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
41 changes: 1 addition & 40 deletions autogalaxy/profiles/light/linear/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,44 +269,6 @@ def mapping_matrix(self) -> np.ndarray:

return mapping_matrix

# @cached_property
# def operated_mapping_matrix_override(self) -> Optional[np.ndarray]:
# """
# The inversion object takes the `mapping_matrix` of each linear object and combines it with the `Convolver`
# operator to perform a 2D convolution and compute the `operated_mapping_matrix`.
#
# If this property is overwritten this operation is not performed, with the `operated_mapping_matrix` output this
# property automatically used instead.
#
# This is used for a linear light profile because the in-built mapping matrix convolution does not account for
# how light profile images have flux outside the masked region which is blurred into the masked region. This
# flux is outside the region that defines the `mapping_matrix` and thus this override is required to properly
# incorporate it.
#
# Returns
# -------
# A blurred mapping matrix of dimensions (total_mask_pixels, 1) which overrides the mapping matrix calculations
# performed in the linear equation solvers.
# """
#
# if isinstance(self.light_profile_list[0], LightProfileOperated):
# return self.mapping_matrix
#
# operated_mapping_matrix = np.zeros(shape=(self.pixels_in_mask, self.params))
#
# for pixel, light_profile in enumerate(self.light_profile_list):
# image_2d = light_profile.image_2d_from(grid=self.grid)
#
# blurring_image_2d = light_profile.image_2d_from(grid=self.blurring_grid)
#
# blurred_image_2d = self.convolver.convolve_image(
# image=image_2d, blurring_image=blurring_image_2d
# )
#
# operated_mapping_matrix[:, pixel] = blurred_image_2d
#
# return operated_mapping_matrix

@cached_property
def operated_mapping_matrix_override(self) -> Optional[np.ndarray]:
"""
Expand Down Expand Up @@ -343,5 +305,4 @@ def operated_mapping_matrix_override(self) -> Optional[np.ndarray]:

blurred_image_2d_list.append(blurred_image_2d.array)

# return jnp.stack(blurred_image_2d_list, axis=1)
return np.stack(blurred_image_2d_list, axis=1)
return jnp.stack(blurred_image_2d_list, axis=1)
12 changes: 6 additions & 6 deletions test_autogalaxy/imaging/test_fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ def test__galaxy_model_image_dict(masked_imaging_7x7):
)
assert (fit.galaxy_model_image_dict[g3] == np.zeros(9)).all()

assert fit.model_data.native == pytest.approx(
fit.galaxy_model_image_dict[g0_linear].native, 1.0e-4
assert fit.model_data.native.array == pytest.approx(
fit.galaxy_model_image_dict[g0_linear].native.array, 1.0e-4
)

# Pixelization + Regularizaiton only
Expand Down Expand Up @@ -357,7 +357,7 @@ def test__galaxy_model_image_dict(masked_imaging_7x7):
)

assert mapped_reconstructed_image == pytest.approx(
fit.inversion.mapped_reconstructed_image, 1.0e-4
fit.inversion.mapped_reconstructed_image.array, 1.0e-4
)

assert fit.model_data == pytest.approx(
Expand Down Expand Up @@ -385,11 +385,11 @@ def test__model_images_of_galaxies_list(masked_imaging_7x7):
assert fit.model_images_of_galaxies_list[0] == pytest.approx(
fit.galaxy_model_image_dict[galaxy_light].array, 1.0e-4
)
assert fit.model_images_of_galaxies_list[1] == pytest.approx(
fit.galaxy_model_image_dict[galaxy_linear], 1.0e-4
assert fit.model_images_of_galaxies_list[1].array == pytest.approx(
fit.galaxy_model_image_dict[galaxy_linear].array, 1.0e-4
)
assert fit.model_images_of_galaxies_list[2] == pytest.approx(
fit.galaxy_model_image_dict[galaxy_pix], 1.0e-4
fit.galaxy_model_image_dict[galaxy_pix].array, 1.0e-4
)


Expand Down
8 changes: 4 additions & 4 deletions test_autogalaxy/interferometer/test_fit_interferometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ def test___galaxy_model_image_dict(interferometer_7):

assert (fit.galaxy_model_image_dict[g0].native == 0.0 + 0.0j * np.zeros((7,))).all()

assert fit.galaxy_model_image_dict[galaxy_pix_0] == pytest.approx(
inversion.mapped_reconstructed_image.slim, 1.0e-4
assert fit.galaxy_model_image_dict[galaxy_pix_0].array == pytest.approx(
inversion.mapped_reconstructed_image.slim.array, 1.0e-4
)

# Linear Light PRofiles + Pixelization + Regularizaiton
Expand Down Expand Up @@ -223,8 +223,8 @@ def test___galaxy_model_image_dict(interferometer_7):
+ fit.galaxy_model_image_dict[galaxy_pix_1]
)

assert mapped_reconstructed_image == pytest.approx(
fit.inversion.mapped_reconstructed_image, 1.0e-4
assert mapped_reconstructed_image.array == pytest.approx(
fit.inversion.mapped_reconstructed_image.array, 1.0e-4
)


Expand Down
Binary file modified test_autogalaxy/quantity/files/array/output_test/noise_map.fits
Binary file not shown.
Loading