Skip to content

Commit eabbc61

Browse files
Jammy2211Jammy2211
authored andcommitted
implement fully tested and complete
1 parent 8af706d commit eabbc61

16 files changed

Lines changed: 362 additions & 277 deletions

File tree

autogalaxy/analysis/model_util.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -178,22 +178,14 @@ def mge_point_model_from(
178178
# and twice the pixel scale, with a floor to avoid taking log10 of
179179
# very small or non-positive values.
180180
min_log10_sigma = -2.0 # corresponds to 0.01 arcsec
181-
max_sigma = max(2.0 * pixel_scales, 10 ** min_log10_sigma)
181+
max_sigma = max(2.0 * pixel_scales, 10**min_log10_sigma)
182182
max_log10_sigma = np.log10(max_sigma)
183183

184-
log10_sigma_list = np.linspace(
185-
min_log10_sigma, max_log10_sigma, total_gaussians
186-
)
187-
centre_0 = af.UniformPrior(
188-
lower_limit=centre[0] - 0.1, upper_limit=centre[0] + 0.1
189-
)
190-
centre_1 = af.UniformPrior(
191-
lower_limit=centre[1] - 0.1, upper_limit=centre[1] + 0.1
192-
)
184+
log10_sigma_list = np.linspace(min_log10_sigma, max_log10_sigma, total_gaussians)
185+
centre_0 = af.UniformPrior(lower_limit=centre[0] - 0.1, upper_limit=centre[0] + 0.1)
186+
centre_1 = af.UniformPrior(lower_limit=centre[1] - 0.1, upper_limit=centre[1] + 0.1)
193187

194-
gaussian_list = af.Collection(
195-
af.Model(Gaussian) for _ in range(total_gaussians)
196-
)
188+
gaussian_list = af.Collection(af.Model(Gaussian) for _ in range(total_gaussians))
197189

198190
for i, gaussian in enumerate(gaussian_list):
199191
gaussian.centre.centre_0 = centre_0

autogalaxy/operate/deflections.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ def from_mass_obj(cls, mass_obj):
102102
return cls(deflections_yx_2d_from=mass_obj.deflections_yx_2d_from)
103103

104104
@classmethod
105-
def from_tracer(cls, tracer, use_multi_plane: bool = True, plane_i: int = 0, plane_j: int = -1):
105+
def from_tracer(
106+
cls, tracer, use_multi_plane: bool = True, plane_i: int = 0, plane_j: int = -1
107+
):
106108
"""
107109
Construct from a PyAutoLens ``Tracer`` object.
108110
@@ -384,9 +386,7 @@ def jacobian_from(self, grid, xp=np) -> List:
384386

385387
return [[a11, a12], [a21, a22]]
386388

387-
def convergence_2d_via_hessian_from(
388-
self, grid, xp=np
389-
) -> aa.ArrayIrregular:
389+
def convergence_2d_via_hessian_from(self, grid, xp=np) -> aa.ArrayIrregular:
390390
"""
391391
Returns the convergence of the lensing object, which is computed from the 2D deflection angle map via the
392392
Hessian using the expression (see equation 56 https://inspirehep.net/literature/419263):
@@ -416,9 +416,7 @@ def convergence_2d_via_hessian_from(
416416

417417
return aa.ArrayIrregular(values=convergence)
418418

419-
def shear_yx_2d_via_hessian_from(
420-
self, grid, xp=np
421-
) -> ShearYX2DIrregular:
419+
def shear_yx_2d_via_hessian_from(self, grid, xp=np) -> ShearYX2DIrregular:
422420
"""
423421
Returns the 2D (y,x) shear vectors of the lensing object, which are computed from the 2D deflection angle map
424422
via the Hessian using the expressions (see equation 57 https://inspirehep.net/literature/419263):
@@ -459,9 +457,7 @@ def shear_yx_2d_via_hessian_from(
459457

460458
return ShearYX2DIrregular(values=shear_yx_2d, grid=grid)
461459

462-
def magnification_2d_via_hessian_from(
463-
self, grid, xp=np
464-
) -> aa.ArrayIrregular:
460+
def magnification_2d_via_hessian_from(self, grid, xp=np) -> aa.ArrayIrregular:
465461
"""
466462
Returns the 2D magnification map of lensing object, which is computed from the 2D deflection angle map
467463
via the Hessian using the expressions (see equation 60 https://inspirehep.net/literature/419263):
@@ -866,4 +862,3 @@ def einstein_mass_angular_from(
866862
)
867863

868864
return einstein_mass_angular_list[0]
869-

autogalaxy/plot/mass_plotter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ def figures_2d(
121121
from autogalaxy.operate.deflections import OperateDeflections
122122

123123
self.mat_plot_2d.plot_array(
124-
array=OperateDeflections.from_mass_obj(self.mass_obj).magnification_2d_from(
125-
grid=self.grid
126-
),
124+
array=OperateDeflections.from_mass_obj(
125+
self.mass_obj
126+
).magnification_2d_from(grid=self.grid),
127127
visuals_2d=self.visuals_2d_with_critical_curves,
128128
auto_labels=aplt.AutoLabels(
129129
title=f"Magnification{title_suffix}",

0 commit comments

Comments
 (0)