Skip to content

Commit

Permalink
add tests: optimum_secions, mask_data
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHancock committed Aug 23, 2017
1 parent f5a9998 commit 289b6d0
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
__date__ = '23/08/2017'


###
# BANE.py
###

def test_sigmaclip():
# normal usage case
data = np.random.random(100)
Expand All @@ -23,6 +27,25 @@ def test_sigmaclip():
assert len(BANE.sigmaclip([], 0, 3)) == 0


def test_optimum_sections():
# typical case
assert BANE.optimum_sections(8, (64, 64)) == (2, 4)
# redundant case
assert BANE.optimum_sections(1, (134, 1200)) == (1, 1)


def test_mask_data():
data = np.ones((10, 10), dtype=np.float32)
mask = data.copy()
mask[3:5, 0:2] = np.nan
BANE.mask_img(data, mask)
# check that the nan regions overlap
assert np.all(np.isnan(data) == np.isnan(mask))

###
# fits_interp.py
###

def test_fits_interp_compress_then_expand():
# test compression and expansion
fits_interp.compress("Test/Images/1904-66_AIT.fits", factor=7, outfile='test.fits')
Expand All @@ -32,5 +55,8 @@ def test_fits_interp_compress_then_expand():
os.remove('test2.fits')





if __name__ == "__main__":
test_sigmaclip()

0 comments on commit 289b6d0

Please sign in to comment.