Skip to content

Commit d19c18c

Browse files
authored
Modified SensorData.from_fits() to simplify the shape of the serial_number field if possible. (#17)
1 parent bf6e836 commit d19c18c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

msfc_ccd/_images/_sensor_images.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,11 @@ def from_fits(
305305
t.format = "isot"
306306
time.ndarray = t
307307

308+
for axis in serial_number.shape:
309+
sn0 = serial_number[{axis: 0}]
310+
if np.all(sn0 == serial_number):
311+
serial_number = sn0
312+
308313
return cls(
309314
inputs=ImageHeader(
310315
pixel=pixel,

msfc_ccd/_images/_tests/test_sensor_images.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ def test_taps(self, a: msfc_ccd.abc.AbstractSensorData):
2828
msfc_ccd.samples.path_dark_esis3,
2929
]
3030
),
31+
axes="channel",
32+
),
33+
sensor=msfc_ccd.TeledyneCCD230(),
34+
),
35+
msfc_ccd.SensorData.from_fits(
36+
path=na.ScalarArray(
37+
ndarray=np.array(
38+
[
39+
msfc_ccd.samples.path_dark_esis1,
40+
msfc_ccd.samples.path_fe55_esis1,
41+
]
42+
),
3143
axes="time",
3244
),
3345
sensor=msfc_ccd.TeledyneCCD230(),
@@ -52,8 +64,10 @@ def test_unbiased(
5264
a: msfc_ccd.SensorData,
5365
):
5466
result = a.unbiased
67+
taps = result.taps()
5568
assert isinstance(result, msfc_ccd.SensorData)
56-
assert np.abs(result.outputs.mean()) < 1
69+
assert np.abs(taps.outputs[taps.where_blank()].mean()) < 1
70+
assert np.abs(taps.outputs[taps.where_overscan()].mean()) < 1
5771
assert np.abs(result.outputs.mean()) > 0
5872

5973
def test_active(

0 commit comments

Comments
 (0)