Skip to content

Commit

Permalink
image.processing: increased coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
juliotux committed Sep 24, 2023
1 parent 4ed7ecf commit 5dc0662
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions tests/test_image_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,38 @@ def test_flat_with_norm_value(self, inplace):
else:
assert_is_not(res, frame)

@pytest.mark.parametrize('inplace', [True, False])
def test_flat_with_min_value(self, inplace):
expect = np.ones((20, 20))*3

frame = FrameData(np.ones((20, 20))*3, unit=u.adu)
master_flat = FrameData(np.ones((20, 20)))
master_flat.data[0:5, 0:5] = 0.5
# everything in flat will be 1, the minimum value.

res = flat_correct(frame, master_flat, min_value=1, inplace=inplace)

assert_is_instance(res, FrameData)
assert_equal(res.data, expect)
assert_equal(res.header['astropop flat_corrected'], True)
assert_equal(res.flags, np.zeros((20, 20)))
assert_equal(res.unit, u.adu)

if inplace:
assert_is(res, frame)
else:
assert_is_not(res, frame)

@pytest.mark.parametrize('inplace', [True, False])
def test_flat_named(self, inplace):
frame = FrameData(np.ones((20, 20))*3, unit=u.adu)
master_flat = FrameData(np.ones((20, 20)),
origin_filename='test_master_flat.fits')
res = flat_correct(frame, master_flat, inplace=inplace)
assert_equal(res.header['astropop flat_corrected'], True)
assert_equal(res.header['astropop flat_corrected_file'],
'test_master_flat.fits')


class Test_Processing_Bias():
@pytest.mark.parametrize('inplace', [True, False])
Expand All @@ -387,6 +419,23 @@ def test_simple_bias(self, inplace):
else:
assert_is_not(res4.data, frame4bias.data)

@pytest.mark.parametrize('inplace', [True, False])
def test_simple_bias_named(self, inplace):
frame4bias = FrameData(np.ones((20, 20))*3, unit='adu')
master_bias = FrameData(np.ones((20, 20)), unit='adu',
origin_filename='test_master_bias.fits')
res4 = subtract_bias(frame4bias, master_bias, inplace=inplace)

assert_is_instance(res4, FrameData)
assert_equal(res4.header['astropop bias_corrected'], True)
assert_equal(res4.header['astropop bias_corrected_file'],
'test_master_bias.fits')

if inplace:
assert_is(res4.data, frame4bias.data)
else:
assert_is_not(res4.data, frame4bias.data)


class Test_Processing_Dark():
@pytest.mark.parametrize('inplace', [True, False])
Expand Down

0 comments on commit 5dc0662

Please sign in to comment.