diff --git a/autogalaxy/profiles/light/linear/abstract.py b/autogalaxy/profiles/light/linear/abstract.py index 403cc9829..e74726d2e 100644 --- a/autogalaxy/profiles/light/linear/abstract.py +++ b/autogalaxy/profiles/light/linear/abstract.py @@ -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]: """ @@ -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) diff --git a/test_autogalaxy/imaging/test_fit_imaging.py b/test_autogalaxy/imaging/test_fit_imaging.py index 461f8323c..a85dda675 100644 --- a/test_autogalaxy/imaging/test_fit_imaging.py +++ b/test_autogalaxy/imaging/test_fit_imaging.py @@ -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 @@ -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( @@ -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 ) diff --git a/test_autogalaxy/interferometer/test_fit_interferometer.py b/test_autogalaxy/interferometer/test_fit_interferometer.py index 6de6afc67..a7ead0b7c 100644 --- a/test_autogalaxy/interferometer/test_fit_interferometer.py +++ b/test_autogalaxy/interferometer/test_fit_interferometer.py @@ -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 @@ -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 ) diff --git a/test_autogalaxy/quantity/files/array/output_test/noise_map.fits b/test_autogalaxy/quantity/files/array/output_test/noise_map.fits index 3c732e540..9a8e8e0cb 100644 Binary files a/test_autogalaxy/quantity/files/array/output_test/noise_map.fits and b/test_autogalaxy/quantity/files/array/output_test/noise_map.fits differ