Skip to content

Commit

Permalink
Fixes two tests not propagating file and filepath changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Onoddil committed Jan 12, 2024
1 parent 3148425 commit f3320aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
14 changes: 4 additions & 10 deletions tests/macauff/test_fit_astrometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions tests/macauff/test_full_match_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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')

0 comments on commit f3320aa

Please sign in to comment.