Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions autogalaxy/profiles/light/linear/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,13 @@ def operated_mapping_matrix_override(self) -> Optional[np.ndarray]:
performed in the linear equation solvers.
"""

if self.psf is None:
# Interferometer fits construct this object with `psf=None`: the override below is
# image-space and PSF-based, whereas an interferometer override must be in visibility
# space, so `None` keeps the standard mapping_matrix -> transformer inversion path
# (which is correct for both ordinary and operated light profiles).
return None

if isinstance(self.light_profile_list[0], LightProfileOperated):
return self.mapping_matrix

Expand Down
22 changes: 22 additions & 0 deletions test_autogalaxy/profiles/light/linear/test_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,28 @@ def test__operated_mapping_matrix__columns_match_individual_blurred_images(
] == pytest.approx(lp_1_blurred_image.array, 1.0e-4)


def test__operated_mapping_matrix_override__psf_none_returns_none(
grid_2d_7x7, blurring_grid_2d_7x7
):
lp_linear_obj_func_list = LightProfileLinearObjFuncList(
grid=grid_2d_7x7,
blurring_grid=blurring_grid_2d_7x7,
psf=None,
light_profile_list=[ag.lp_linear.Sersic(effective_radius=1.0)],
)

assert lp_linear_obj_func_list.operated_mapping_matrix_override is None

lp_linear_obj_func_list_operated = LightProfileLinearObjFuncList(
grid=grid_2d_7x7,
blurring_grid=blurring_grid_2d_7x7,
psf=None,
light_profile_list=[ag.lp_linear_operated.Gaussian()],
)

assert lp_linear_obj_func_list_operated.operated_mapping_matrix_override is None


def test__lp_instance_from__returns_non_linear_instance_with_correct_type_and_centre():
lp_linear = ag.lp_linear.Sersic(centre=(1.0, 2.0))

Expand Down
Loading