From f3320aadd4e0fbfd0249472d875d0a926c802107 Mon Sep 17 00:00:00 2001 From: "Tom J. Wilson" Date: Fri, 12 Jan 2024 15:41:54 +0000 Subject: [PATCH] Fixes two tests not propagating file and filepath changes. --- tests/macauff/test_fit_astrometry.py | 14 ++++---------- tests/macauff/test_full_match_process.py | 3 +++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/macauff/test_fit_astrometry.py b/tests/macauff/test_fit_astrometry.py index 1a9a1b2..91c5d55 100644 --- a/tests/macauff/test_fit_astrometry.py +++ b/tests/macauff/test_fit_astrometry.py @@ -368,13 +368,10 @@ def test_fit_astrometry(self, npy_or_csv, coord_or_chunk, coord_system, pregener narray = np.load('ac_save_folder/npy/n_sigs_array.npy') assert_allclose([marray[0], narray[0]], [2, 0], rtol=0.1, atol=0.01) - if not return_nm: - ax1_mids = np.load('ac_save_folder/npy/ax1_mids.npy') - ax2_mids = np.load('ac_save_folder/npy/ax2_mids.npy') - assert_allclose([ax1_mids[0], ax2_mids[0]], [105, 0], atol=0.001) - if not return_nm: abc_array = np.load('ac_save_folder/npy/snr_mag_params.npy') + assert_allclose([abc_array[0, 0, 3], abc_array[0, 0, 4]], [105, 0], atol=0.001) + assert_allclose(abc_array[0, 0, 0], 1.2e-2, rtol=0.05, atol=0.001) assert_allclose(abc_array[0, 0, 1], 8e-17, rtol=0.05, atol=5e-19) @@ -536,13 +533,10 @@ def test_snr_mag_relation_fit(self, npy_or_csv, coord_or_chunk, coord_system, re else: assert os.path.isfile('ac_save_folder/pdf/s_vs_snr_2017.pdf') - if not return_nm: - ax1_mids = np.load('ac_save_folder/npy/ax1_mids.npy') - ax2_mids = np.load('ac_save_folder/npy/ax2_mids.npy') - assert_allclose([ax1_mids[0], ax2_mids[0]], [105, 0], atol=0.001) - if not return_nm: abc_array = np.load('ac_save_folder/npy/snr_mag_params.npy') + assert_allclose([abc_array[0, 0, 3], abc_array[0, 0, 4]], [105, 0], atol=0.001) + assert_allclose(abc_array[0, 0, 0], 1.2e-2, rtol=0.05, atol=0.001) assert_allclose(abc_array[0, 0, 1], 8e-17, rtol=0.05, atol=5e-19) diff --git a/tests/macauff/test_full_match_process.py b/tests/macauff/test_full_match_process.py index 4a44127..a7962d8 100644 --- a/tests/macauff/test_full_match_process.py +++ b/tests/macauff/test_full_match_process.py @@ -81,6 +81,7 @@ def test_naive_bayes_match(x, y): idx = np.where([ol in line for line in f])[0][0] _replace_line(os.path.join(os.path.dirname(__file__), f'data/chunk0/{cat}_.txt'), idx, nl) + os.makedirs('new_test_path', exist_ok=True) cm = CrossMatch(os.path.join(os.path.dirname(__file__), 'data')) cm() @@ -97,3 +98,5 @@ def test_naive_bayes_match(x, y): assert b_right_inds[i] in bc q = np.where(a_right_inds[i] == ac)[0][0] assert np.all([a_right_inds[i], b_right_inds[i]] == [ac[q], bc[q]]) + + os.system('rm -r new_test_path')