Skip to content

Commit

Permalink
Adapted automatic detection tests to reflect new expected output
Browse files Browse the repository at this point in the history
  • Loading branch information
VChristiaens committed Nov 25, 2022
1 parent 80fbf17 commit ba749e0
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/test_metrics_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,44 +36,44 @@ def get_frame_snrmap(example_dataset_adi):

def test_detection_log(get_frame_snrmap):
res_frame, coord, fwhm = get_frame_snrmap
table = detection(res_frame, fwhm, psf=None, mode='log', plot=False)
y, x = detection(res_frame, fwhm, psf=None, mode='log', plot=False)
check = False
for i in range(len(table.y)):
if np.allclose(table.y[i], coord[0], atol=2) and \
np.allclose(table.x[i], coord[1], atol=2):
for i in range(len(y)):
if np.allclose(y[i], coord[0], atol=2) and \
np.allclose(x[i], coord[1], atol=2):
check = True
assert check


def test_detection_dog(get_frame_snrmap):
res_frame, coord, fwhm = get_frame_snrmap
table = detection(res_frame, fwhm, psf=None, mode='dog', plot=False)
y, x = detection(res_frame, fwhm, psf=None, mode='dog', plot=False)
check = False
for i in range(len(table.y)):
if np.allclose(table.y[i], coord[0], atol=2) and \
np.allclose(table.x[i], coord[1], atol=2):
for i in range(len(y)):
if np.allclose(y[i], coord[0], atol=2) and \
np.allclose(x[i], coord[1], atol=2):
check = True
assert check


def test_detection_lpeaks(get_frame_snrmap):
res_frame, coord, fwhm = get_frame_snrmap
table = detection(res_frame, fwhm, psf=None, mode='lpeaks', plot=False)
y, x = detection(res_frame, fwhm, psf=None, mode='lpeaks', plot=False)
check = False
for i in range(len(table.y)):
if np.allclose(table.y[i], coord[0], atol=2) and \
np.allclose(table.x[i], coord[1], atol=2):
for i in range(len(y)):
if np.allclose(y[i], coord[0], atol=2) and \
np.allclose(x[i], coord[1], atol=2):
check = True
assert check


def test_detection_snrmap(get_frame_snrmap):
res_frame, coord, fwhm = get_frame_snrmap
table = detection(res_frame, fwhm, psf=None, mode='snrmapf',
y, x = detection(res_frame, fwhm, psf=None, mode='snrmapf',
plot=False, snr_thresh=5, nproc=2)
check = False
for i in range(len(table.y)):
if np.allclose(table.y[i], coord[0], atol=2) and \
np.allclose(table.x[i], coord[1], atol=2):
for i in range(len(y)):
if np.allclose(y[i], coord[0], atol=2) and \
np.allclose(x[i], coord[1], atol=2):
check = True
assert check

0 comments on commit ba749e0

Please sign in to comment.