From 0db02d17531bf90b491e20a27b08e3d8f93e3198 Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:18:52 -0400 Subject: [PATCH] Fix a few tests that were failing locally --- data/tests/DES_data/DES_SN848233.DAT | 164 +++++++++++++++++++++++++++ tests/resspect/conftest.py | 11 +- tests/resspect/test_bump.py | 4 +- 3 files changed, 174 insertions(+), 5 deletions(-) create mode 100644 data/tests/DES_data/DES_SN848233.DAT diff --git a/data/tests/DES_data/DES_SN848233.DAT b/data/tests/DES_data/DES_SN848233.DAT new file mode 100644 index 000000000..28669958d --- /dev/null +++ b/data/tests/DES_data/DES_SN848233.DAT @@ -0,0 +1,164 @@ +SURVEY: DES +SNID: 848233 +IAUC: UNKNOWN +PHOTOMETRY_VERSION: DES +SNTYPE: 22 +FILTERS: griz +RA: 36.750000 deg +DECL: -4.500000 deg +MAGTYPE: LOG10 +MAGREF: AB +FAKE: 2 (=> simulated LC with snlc_sim.exe) +MWEBV: 0.0283 MW E(B-V) +REDSHIFT_HELIO: 0.50369 +- 0.00500 (Helio, z_best) +REDSHIFT_FINAL: 0.50369 +- 0.00500 (CMB) +REDSHIFT_SPEC: 0.50369 +- 0.00500 +REDSHIFT_STATUS: OK + +HOST_GALAXY_GALID: 17173 +HOST_GALAXY_PHOTO-Z: 0.4873 +- 0.0318 + + + +SIM_MODEL: NONIA 10 (name index) +SIM_NON1a: 30 (non1a index) +SIM_COMMENT: SN Type = II , MODEL = SDSS-017564 +SIM_LIBID: 2 +SIM_REDSHIFT: 0.5029 +SIM_HOSTLIB_TRUEZ: 0.5000 (actual Z of hostlib) +SIM_HOSTLIB_GALID: 17173 +SIM_DLMU: 42.276020 mag [ -5*log10(10pc/dL) ] +SIM_RA: 36.750000 deg +SIM_DECL: -4.500000 deg +SIM_MWEBV: 0.0256 (MilkyWay E(B-V)) +SIM_PEAKMAG: 22.48 22.87 22.70 22.82 (griz obs) +SIM_EXPOSURE: 1.0 1.0 1.0 1.0 (griz obs) +SIM_PEAKMJD: 56251.609375 days +SIM_SALT2x0: 1.229e-17 +SIM_MAGDIM: 0.000 +SIM_SEARCHEFF_MASK: 3 (bits 1,2=> found by software,humans) +SIM_SEARCHEFF: 1.0000 (spectro-search efficiency (ignores pipelines)) +SIM_TRESTMIN: -38.24 days +SIM_TRESTMAX: 64.80 days +SIM_RISETIME_SHIFT: 0.0 days +SIM_FALLTIME_SHIFT: 0.0 days + +SEARCH_PEAKMJD: 56250.734 + + +# ============================================ +# TERSE LIGHT CURVE OUTPUT: +# +NOBS: 108 +NVAR: 9 +VARLIST: MJD FLT FIELD FLUXCAL FLUXCALERR SNR MAG MAGERR SIM_MAG +OBS: 56194.145 g NULL 7.600e+00 4.680e+00 1.62 99.000 5.000 98.926 +OBS: 56194.156 r NULL 3.875e+00 2.752e+00 1.41 99.000 5.000 98.953 +OBS: 56194.172 i NULL 3.585e+00 4.628e+00 0.77 99.000 5.000 99.033 +OBS: 56194.188 z NULL -2.203e+00 4.463e+00 -0.49 99.000 5.000 98.983 +OBS: 56207.188 g NULL -7.008e+00 4.367e+00 -1.60 99.000 5.000 98.926 +OBS: 56207.195 r NULL -1.189e+00 3.459e+00 -0.34 99.000 5.000 98.953 +OBS: 56207.203 i NULL 8.799e+00 6.249e+00 1.41 99.000 5.000 99.033 +OBS: 56207.219 z NULL 8.907e+00 5.954e+00 1.50 99.000 5.000 98.983 +OBS: 56215.195 g NULL 2.477e+00 2.683e+00 0.92 26.515 101.485 28.105 +OBS: 56215.203 r NULL 2.093e+01 2.224e+00 9.41 24.198 0.121 24.412 +OBS: 56215.211 i NULL 1.728e+01 2.668e+00 6.48 24.406 0.183 24.213 +OBS: 56215.227 z NULL 1.672e+01 3.444e+00 4.85 24.442 0.250 24.433 +OBS: 56221.090 g NULL 2.618e+00 6.271e+00 0.42 26.455 101.545 26.984 +OBS: 56221.105 r NULL 2.780e+01 5.128e+00 5.42 23.890 0.222 23.673 +OBS: 56221.113 i NULL 2.369e+01 5.606e+00 4.23 24.064 0.294 23.897 +OBS: 56221.117 z NULL 2.000e+01 7.717e+00 2.59 24.247 0.529 24.157 +OBS: 56222.270 g NULL 1.652e+00 7.735e+00 0.21 26.955 101.045 26.693 +OBS: 56222.273 r NULL 3.610e+01 5.763e+00 6.26 23.606 0.189 23.565 +OBS: 56222.281 i NULL 3.322e+01 1.701e+01 1.95 23.697 0.779 23.847 +OBS: 56222.289 z NULL 2.531e+01 8.083e+00 3.13 23.992 0.418 24.107 +DETECTION: 6 MJDs satisfy g+r+i+z +OBS: 56228.234 g NULL 7.506e+00 1.236e+01 0.61 25.311 102.689 24.750 +OBS: 56228.242 r NULL 4.281e+01 5.649e+00 7.58 23.421 0.154 23.345 +OBS: 56228.258 i NULL 6.225e+01 1.209e+01 5.15 23.015 0.234 23.580 +OBS: 56228.270 z NULL 1.815e+01 6.662e+00 2.72 24.353 0.498 23.766 +OBS: 56229.258 g NULL 1.074e+01 1.722e+01 0.62 24.923 103.077 24.375 +OBS: 56229.270 r NULL 5.237e+01 8.140e+00 6.43 23.202 0.183 23.331 +OBS: 56229.285 i NULL 6.093e+01 1.511e+01 4.03 23.038 0.309 23.530 +OBS: 56229.297 z NULL 2.760e+01 8.919e+00 3.09 23.898 0.424 23.713 +OBS: 56230.273 g NULL 2.344e+01 1.385e+01 1.69 24.075 0.971 24.034 +OBS: 56230.277 r NULL 4.896e+01 6.488e+00 7.55 23.275 0.154 23.321 +OBS: 56230.285 i NULL 5.784e+01 1.126e+01 5.14 23.095 0.234 23.482 +OBS: 56230.293 z NULL 3.383e+01 6.194e+00 5.46 23.677 0.220 23.663 +OBS: 56231.242 g NULL 1.214e+01 9.813e+00 1.24 24.790 1.803 23.736 +OBS: 56231.258 r NULL 5.247e+01 5.063e+00 10.36 23.200 0.110 23.315 +OBS: 56231.273 i NULL 2.886e+01 9.681e+00 2.98 23.849 0.445 23.435 +OBS: 56231.277 z NULL 3.487e+01 5.350e+00 6.52 23.644 0.181 23.617 +OBS: 56235.242 g NULL 8.641e+01 7.163e+00 12.06 22.659 0.093 22.778 +OBS: 56235.258 r NULL 4.436e+01 4.026e+00 11.02 23.383 0.104 23.274 +OBS: 56235.270 i NULL 4.233e+01 7.306e+00 5.79 23.433 0.206 23.247 +OBS: 56235.277 z NULL 3.310e+01 7.013e+00 4.72 23.700 0.259 23.442 +OBS: 56236.258 g NULL 8.079e+01 6.834e+00 11.82 22.732 0.096 22.661 +OBS: 56236.270 r NULL 5.043e+01 4.384e+00 11.50 23.243 0.099 23.258 +OBS: 56236.277 i NULL 4.281e+01 6.066e+00 7.06 23.421 0.167 23.202 +OBS: 56236.285 z NULL 3.997e+01 7.845e+00 5.09 23.496 0.237 23.400 +OBS: 56237.289 g NULL 1.019e+02 2.698e+01 3.78 22.480 0.334 22.580 +OBS: 56237.297 r NULL 2.088e-01 4.071e+01 0.01 29.201 98.799 23.238 +OBS: 56237.301 i NULL 1.399e+02 4.393e+01 3.18 22.135 0.408 23.158 +OBS: 56237.316 z NULL 3.802e+01 2.568e+01 1.48 23.550 1.222 23.357 +OBS: 56238.301 g NULL 5.216e+01 4.154e+01 1.26 23.207 1.731 22.539 +OBS: 56238.316 r NULL 5.517e+01 1.376e+01 4.01 23.146 0.311 23.215 +OBS: 56238.328 i NULL 6.165e+01 8.037e+00 7.67 23.025 0.151 23.115 +OBS: 56243.027 z NULL 5.965e+01 7.906e+00 7.54 23.061 0.154 23.127 +OBS: 56243.309 g NULL 9.837e+01 5.065e+00 19.42 22.518 0.058 22.456 +OBS: 56244.027 r NULL 5.680e+01 4.274e+00 13.29 23.114 0.085 23.054 +OBS: 56244.031 i NULL 5.803e+01 6.725e+00 8.63 23.091 0.134 22.905 +OBS: 56244.273 g NULL 1.094e+02 4.771e+00 22.94 22.402 0.048 22.453 +OBS: 56244.277 z NULL 6.480e+01 6.181e+00 10.48 22.971 0.108 23.079 +OBS: 56245.293 g NULL 1.299e+02 1.434e+01 9.06 22.216 0.126 22.451 +OBS: 56245.309 r NULL 5.752e+01 1.022e+01 5.63 23.100 0.213 23.017 +OBS: 56246.027 i NULL 6.990e+01 3.956e+00 17.67 22.889 0.064 22.842 +OBS: 56246.035 z NULL 5.526e+01 4.427e+00 12.48 23.144 0.091 23.013 +OBS: 56247.207 g NULL 1.047e+02 3.844e+00 27.24 22.450 0.041 22.454 +OBS: 56247.215 r NULL 6.365e+01 2.634e+00 24.16 22.990 0.046 22.965 +OBS: 56254.160 i NULL 8.656e+01 5.210e+00 16.61 22.657 0.068 22.641 +OBS: 56254.172 z NULL 8.319e+01 4.320e+00 19.26 22.700 0.058 22.740 +OBS: 56258.125 g NULL 9.369e+01 1.085e+01 8.63 22.571 0.134 22.547 +OBS: 56258.141 r NULL 8.644e+01 5.341e+00 16.19 22.658 0.069 22.766 +OBS: 56261.035 i NULL 9.440e+01 6.370e+00 14.82 22.563 0.076 22.530 +OBS: 56261.043 z NULL 9.209e+01 4.941e+00 18.64 22.590 0.060 22.557 +OBS: 56261.242 g NULL 1.027e+02 8.076e+00 12.72 22.471 0.088 22.588 +OBS: 56261.258 r NULL 8.220e+01 4.254e+00 19.33 22.713 0.058 22.733 +OBS: 56274.188 g NULL 8.236e+01 4.091e+00 20.13 22.711 0.055 22.805 +OBS: 56274.195 r NULL 8.228e+01 3.201e+00 25.71 22.712 0.044 22.663 +OBS: 56274.203 i NULL 1.124e+02 4.797e+00 23.43 22.373 0.047 22.437 +OBS: 56274.219 z NULL 1.097e+02 5.433e+00 20.19 22.400 0.056 22.334 +OBS: 56282.203 g NULL 7.973e+01 6.624e+00 12.04 22.746 0.093 22.937 +OBS: 56283.156 r NULL 9.012e+01 3.611e+00 24.95 22.613 0.044 22.677 +OBS: 56283.168 i NULL 1.184e+02 5.538e+00 21.38 22.317 0.051 22.437 +OBS: 56283.184 z NULL 1.208e+02 4.704e+00 25.68 22.295 0.043 22.269 +OBS: 56288.191 g NULL 6.658e+01 1.265e+01 5.26 22.942 0.229 23.030 +OBS: 56289.066 r NULL 8.984e+01 5.342e+00 16.82 22.616 0.066 22.706 +OBS: 56289.078 i NULL 9.971e+01 8.946e+00 11.15 22.503 0.102 22.453 +OBS: 56289.086 z NULL 1.280e+02 6.124e+00 20.90 22.232 0.053 22.258 +OBS: 56292.090 g NULL 6.464e+01 1.160e+01 5.57 22.974 0.215 23.086 +OBS: 56298.039 r NULL 7.745e+01 2.882e+00 26.88 22.777 0.041 22.767 +OBS: 56298.047 i NULL 1.095e+02 4.149e+00 26.39 22.402 0.041 22.496 +OBS: 56298.055 z NULL 1.189e+02 4.563e+00 26.07 22.312 0.043 22.275 +OBS: 56304.043 g NULL 4.894e+01 2.890e+00 16.94 23.276 0.066 23.255 +OBS: 56306.102 r NULL 6.965e+01 3.514e+00 19.82 22.893 0.057 22.826 +OBS: 56306.113 i NULL 9.360e+01 4.688e+00 19.97 22.572 0.056 22.547 +OBS: 56306.121 z NULL 1.131e+02 5.804e+00 19.48 22.367 0.058 22.314 +OBS: 56312.047 g NULL 4.120e+01 9.682e+00 4.26 23.463 0.291 23.372 +OBS: 56318.066 r NULL 6.878e+01 4.770e+00 14.42 22.906 0.078 22.908 +OBS: 56318.078 i NULL 8.988e+01 8.160e+00 11.01 22.616 0.103 22.633 +OBS: 56318.086 z NULL 1.212e+02 6.769e+00 17.90 22.292 0.062 22.401 +OBS: 56320.035 g NULL 4.723e+01 1.152e+01 4.10 23.314 0.303 23.492 +OBS: 56327.039 r NULL 6.204e+01 3.080e+00 20.14 23.018 0.055 22.991 +OBS: 56327.047 i NULL 8.227e+01 4.487e+00 18.34 22.712 0.061 22.694 +OBS: 56327.055 z NULL 1.057e+02 5.161e+00 20.48 22.440 0.054 22.478 +OBS: 56328.039 g NULL 3.885e+01 3.869e+00 10.04 23.526 0.114 23.608 +OBS: 56336.043 r NULL 6.260e+01 3.337e+00 18.76 23.009 0.059 23.073 +OBS: 56336.055 i NULL 7.939e+01 5.254e+00 15.11 22.751 0.074 22.763 +OBS: 56337.043 z NULL 1.029e+02 4.489e+00 22.93 22.469 0.048 22.566 +OBS: 56338.043 g NULL 2.791e+01 3.672e+00 7.60 23.886 0.154 23.767 +OBS: 56347.996 r NULL 5.477e+01 2.741e+00 19.98 23.154 0.056 23.122 +OBS: 56348.004 i NULL 7.389e+01 5.092e+00 14.51 22.828 0.077 22.889 +OBS: 56348.008 z NULL 7.069e+01 6.706e+00 10.54 22.877 0.109 22.655 +OBS: 56348.996 g NULL 2.600e+01 5.581e+00 4.66 23.963 0.262 23.945 +END: diff --git a/tests/resspect/conftest.py b/tests/resspect/conftest.py index 650dfeced..b16712ee3 100644 --- a/tests/resspect/conftest.py +++ b/tests/resspect/conftest.py @@ -4,7 +4,6 @@ """ import os import pytest -from contextlib import contextmanager from pathlib import Path @@ -12,9 +11,15 @@ def test_data_path(): return Path(__file__).parent.parent.parent / "data" / "tests" + +@pytest.fixture +def test_des_data_path(test_data_path): + return test_data_path / "DES_data" + + @pytest.fixture -def test_des_data_path(): - return Path(__file__).parent.parent.parent / "data" / "tests" / "DES_data" +def test_des_lc_file(test_des_data_path): + return test_des_data_path / "DES_SN848233.DAT" @pytest.fixture(scope="session") diff --git a/tests/resspect/test_bump.py b/tests/resspect/test_bump.py index 98a6e9da9..408c68bbc 100644 --- a/tests/resspect/test_bump.py +++ b/tests/resspect/test_bump.py @@ -3,7 +3,7 @@ """ import numpy as np -import os +import pandas as pd from resspect.bump import bump, fit_bump, protected_exponent, protected_sig @@ -54,7 +54,7 @@ def test_fit_bump(test_data_path): Test fit to Bump parametrization. """ fname = test_data_path / 'lc_mjd_flux.csv' - data = read_csv(fname) + data = pd.read_csv(fname) time = data['mjd'].values flux = data['flux'].values