Skip to content

Commit e2a166d

Browse files
authored
Convert to signed float before chopnodcombine (#687)
2 parents 7ced900 + 403391b commit e2a166d

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

scopesim/effects/obs_strategies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def chop_nod_image(img, chop_offsets, nod_offsets=None):
9595
if nod_offsets is None:
9696
nod_offsets = tuple(-np.array(chop_offsets))
9797

98-
im_aa = np.copy(img)
98+
im_aa = img.copy().astype(np.float32) # in case img is uint
9999
im_ab = np.roll(im_aa, chop_offsets, (1, 0))
100100
im_ba = np.roll(im_aa, nod_offsets, (1, 0))
101101
im_bb = np.roll(im_ba, chop_offsets, (1, 0))

scopesim/tests/tests_effects/test_obs_strategies.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def test_creates_image_for_parallel_chop(self, basic_detector):
4343
plt.show()
4444

4545
outimg = basic_detector.hdu.data
46+
assert outimg.dtype == np.float32
4647
assert outimg.sum() == 0
4748
assert ((outimg == 0.).sum() / outimg.size) > .8 # most elements zero
4849

@@ -56,5 +57,6 @@ def test_creates_image_for_perpendicular_chop(self, basic_detector):
5657
plt.show()
5758

5859
outimg = basic_detector.hdu.data
60+
assert outimg.dtype == np.float32
5961
assert outimg.sum() == 0
6062
assert ((outimg == 0.).sum() / outimg.size) > .8 # most elements zero

0 commit comments

Comments
 (0)