Replace per-plane pixel_scale/viewing_angle with z_tolerance; split pointing angle

MeasurementPlane now carries a z_tolerance (uniform tolerance mechanism)
instead of the removed pixel_scale/viewing_angle_deg fields.
ReconstructionResult.pointing_angle_deg becomes horizontal/vertical fields
to match the beam's two independent tilt degrees of freedom.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Martino Ferrari
2026-07-03 11:39:16 +02:00
parent 4f65c2ce4f
commit dffca62f81
4 changed files with 37 additions and 23 deletions
+13 -9
View File
@@ -10,19 +10,15 @@ def test_measurement_plane_stores_fields():
assert plane.z == 0.3
assert np.array_equal(plane.flux, flux)
assert plane.pixel_scale is None
assert plane.viewing_angle_deg is None
assert plane.z_tolerance == 0.0
assert plane.label is None
def test_measurement_plane_stores_optional_fields():
flux = np.ones((4, 4))
plane = MeasurementPlane(
flux=flux, z=0.4, pixel_scale=0.1, viewing_angle_deg=5.0, label="plane_40cm"
)
plane = MeasurementPlane(flux=flux, z=0.4, z_tolerance=0.01, label="plane_40cm")
assert plane.pixel_scale == 0.1
assert plane.viewing_angle_deg == 5.0
assert plane.z_tolerance == 0.01
assert plane.label == "plane_40cm"
@@ -39,6 +35,11 @@ def test_measurement_plane_rejects_non_positive_z():
MeasurementPlane(flux=np.ones((4, 4)), z=-0.1)
def test_measurement_plane_rejects_negative_z_tolerance():
with pytest.raises(ValueError, match="z_tolerance"):
MeasurementPlane(flux=np.ones((4, 4)), z=0.3, z_tolerance=-0.01)
def test_validate_planes_rejects_fewer_than_three():
planes = [
MeasurementPlane(flux=np.ones((4, 4)), z=0.3),
@@ -82,12 +83,15 @@ def test_reconstruction_result_stores_fields():
purity={(0, 0): (1.0, 0.0)},
reconstructed_field=np.ones((4, 4), dtype=complex),
centers=[(0.0, 0.0)],
pointing_angle_deg=0.0,
geometry={"pixel_scale": 0.1, "viewing_angle_deg": 2.0},
pointing_angle_horizontal_deg=0.1,
pointing_angle_vertical_deg=-0.2,
geometry={"focal_length_px": 2000.0},
residuals=[np.zeros((4, 4))],
coefficient_uncertainty={(0, 0): 0.01},
used_phase_retrieval=False,
)
assert result.purity[(0, 0)] == (1.0, 0.0)
assert result.pointing_angle_horizontal_deg == 0.1
assert result.pointing_angle_vertical_deg == -0.2
assert result.used_phase_retrieval is False