Fix final-review findings: pixel-scale size guard, DRY camera field names
effective_pixel_scale now raises a clear ValueError for image shapes too small for its finite-difference indexing, instead of an IndexError. ModalFitter.fit()'s geometry dict now reuses CAMERA_FIELD_NAMES from geometry.py instead of a duplicated hardcoded tuple. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -149,3 +149,12 @@ def test_effective_pixel_scale_matches_on_axis_focal_length():
|
||||
scale = calib.effective_pixel_scale((41, 41), z)
|
||||
expected = (z - camera_z) / focal_length_px
|
||||
assert scale == pytest.approx(expected, rel=1e-6)
|
||||
|
||||
|
||||
def test_effective_pixel_scale_raises_for_image_too_small():
|
||||
camera = make_on_axis_camera()
|
||||
calib = GeometryCalibration(camera)
|
||||
z = 0.5
|
||||
|
||||
with pytest.raises(ValueError, match="image_shape must be at least 2x2"):
|
||||
calib.effective_pixel_scale((1, 1), z)
|
||||
|
||||
Reference in New Issue
Block a user