Skip to content

Commit fef9fab

Browse files
committed
add unit test for square pixels geometries, testing with SCTCam
1 parent 3b3dd93 commit fef9fab

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

dl1_data_handler/tests/test_image_mapper.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,24 @@ def test_hexagonal_mapper_instantiation(self, lstcam_geometry, mapper_class):
124124
assert mapper is not None
125125
assert mapper.mapping_table is not None
126126

127-
def test_square_mapper_requires_square_pixels(self, lstcam_geometry):
128-
"""Test that SquareMapper raises error for non-square pixel cameras."""
129-
# LSTCam has hexagonal pixels, should raise ValueError
130-
with pytest.raises(ValueError, match="only available for square pixel cameras"):
131-
SquareMapper(geometry=lstcam_geometry)
127+
def test_square_mapper_instantiation(self):
128+
"""Test that SquareMapper can be instantiated with square pixel camera."""
129+
# SCTCam has square pixels
130+
square_geometry = CameraGeometry.from_name("SCTCam")
131+
mapper = SquareMapper(geometry=square_geometry)
132+
assert mapper is not None
133+
assert mapper.mapping_table is not None
134+
135+
# Test output shape
136+
sample_square_image = np.random.rand(square_geometry.n_pixels, 1).astype(np.float32)
137+
mapped_image = mapper.map_image(sample_square_image)
138+
139+
# Output should be square image with 1 channel
140+
assert len(mapped_image.shape) == 3
141+
assert mapped_image.shape[0] == mapped_image.shape[1]
142+
assert mapped_image.shape[2] == 1
143+
assert mapped_image.shape[0] == mapper.image_shape
144+
132145

133146
@pytest.mark.parametrize(
134147
"mapper_class",

0 commit comments

Comments
 (0)