diff --git a/autogalaxy/operate/image.py b/autogalaxy/operate/image.py index 6a3fe668b..38d4fbbc4 100644 --- a/autogalaxy/operate/image.py +++ b/autogalaxy/operate/image.py @@ -192,7 +192,6 @@ def visibilities_from( from autogalaxy.profiles.light.abstract import LightProfile if self.has(cls=LightProfile) or isinstance(self, LightProfile): - image_2d = self.image_2d_from(grid=grid, xp=xp) return transformer.visibilities_from(image=image_2d, xp=xp) diff --git a/autogalaxy/profiles/light/linear/abstract.py b/autogalaxy/profiles/light/linear/abstract.py index 43a0946de..a8b9f97f0 100644 --- a/autogalaxy/profiles/light/linear/abstract.py +++ b/autogalaxy/profiles/light/linear/abstract.py @@ -270,68 +270,6 @@ def mapping_matrix(self) -> np.ndarray: return self._xp.stack(image_2d_list, axis=1) - @cached_property - def operated_mapping_matrix_overrideg(self) -> Optional[np.ndarray]: - """ - The inversion object takes the `mapping_matrix` of each linear object and combines it with the PSF - 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 - - # number of source pixels = number of light profiles - n_src = len(self.light_profile_list) - - # allocate slim-form arrays for mapping matrices - mapping_matrix = self._xp.zeros((self.grid.shape_slim, n_src)) - blurring_mapping_matrix = self._xp.zeros((self.blurring_grid.shape_slim, n_src)) - - # build each column - for pixel, light_profile in enumerate(self.light_profile_list): - if self._xp.__name__.startswith("jax"): - # main grid mapping for this light profile - mapping_matrix = mapping_matrix.at[:, pixel].set( - light_profile.image_2d_from(grid=self.grid, xp=self._xp).array - ) - - # blurring grid mapping for this light profile - blurring_mapping_matrix = blurring_mapping_matrix.at[:, pixel].set( - light_profile.image_2d_from( - grid=self.blurring_grid, xp=self._xp - ).array - ) - - else: - - mapping_matrix[:, pixel] = light_profile.image_2d_from( - grid=self.grid, xp=self._xp - ).array - blurring_mapping_matrix[:, pixel] = light_profile.image_2d_from( - grid=self.blurring_grid, xp=self._xp - ).array - - return self.psf.convolved_mapping_matrix_from( - mapping_matrix=mapping_matrix, - mask=self.grid.mask, - blurring_mapping_matrix=blurring_mapping_matrix, - blurring_mask=self.blurring_grid.mask, - xp=self._xp, - ) - @cached_property def operated_mapping_matrix_override(self) -> Optional[np.ndarray]: """ diff --git a/autogalaxy/profiles/mass/total/power_law.py b/autogalaxy/profiles/mass/total/power_law.py index e739a7aab..ac2cfeefa 100644 --- a/autogalaxy/profiles/mass/total/power_law.py +++ b/autogalaxy/profiles/mass/total/power_law.py @@ -103,12 +103,12 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, xp=np, **kwargs): from scipy import special complex_angle = ( - 2.0 - * b - / (1.0 + self.axis_ratio(xp)) - * (b / R) ** (slope - 1.0) - * z - * special.hyp2f1(1.0, 0.5 * slope, 2.0 - 0.5 * slope, -factor * z ** 2) + 2.0 + * b + / (1.0 + self.axis_ratio(xp)) + * (b / R) ** (slope - 1.0) + * z + * special.hyp2f1(1.0, 0.5 * slope, 2.0 - 0.5 * slope, -factor * z**2) ) deflection_y = complex_angle.imag