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
4 changes: 3 additions & 1 deletion autogalaxy/abstract_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ def linear_light_profile_intensity_dict(
reconstruction = self.inversion.reconstruction_dict[linear_obj_func]

for i, light_profile in enumerate(linear_obj_func.light_profile_list):
linear_light_profile_intensity_dict[light_profile] = float(reconstruction[i])
linear_light_profile_intensity_dict[light_profile] = float(
reconstruction[i]
)

return linear_light_profile_intensity_dict

Expand Down
1 change: 0 additions & 1 deletion autogalaxy/analysis/chaining_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,6 @@ def mass_light_dark_basis_from(
lmp_model.centre = light_profile.centre
lmp_model.ell_comps = light_profile.ell_comps


print(light_profile.intensity)
print(type(light_profile.intensity))

Comment on lines 503 to 505
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The print(...) statements will emit output during normal library usage and can be very noisy in pipeline runs. Please remove these debug prints or replace them with optional logging behind a logger / verbosity flag.

Suggested change
print(light_profile.intensity)
print(type(light_profile.intensity))

Copilot uses AI. Check for mistakes.
Expand Down
2 changes: 2 additions & 0 deletions autogalaxy/galaxy/to_inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ def cls_light_profile_func_list_galaxy_dict_from(
psf=self.dataset.psf,
light_profile_list=light_profile_list,
regularization=light_profile.regularization,
settings=self.settings_inversion,
xp=self._xp,
)

Expand Down Expand Up @@ -486,6 +487,7 @@ def mapper_from(
return mapper_from(
mapper_grids=mapper_grids,
regularization=regularization,
settings=self.settings_inversion,
preloads=self.preloads,
xp=self._xp,
)
Comment on lines 487 to 493
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The factory call mapper_from(..., settings=self.settings_inversion, ...) introduces a new keyword argument. With autoarray unpinned, this can break for users on versions where mapper_from doesn’t accept settings. Please align this change with an explicit autoarray minimum version (or guard the kwarg for backwards compatibility).

Copilot uses AI. Check for mistakes.
Expand Down
5 changes: 4 additions & 1 deletion autogalaxy/profiles/basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ def deflections_yx_2d_from(
"""
if len(self.mass_profile_list) > 0:
return sum(
[mass.deflections_yx_2d_from(grid=grid, xp=xp) for mass in self.profile_list]
[
mass.deflections_yx_2d_from(grid=grid, xp=xp)
for mass in self.profile_list
]
)
return xp.zeros((grid.shape[0], 2))

Expand Down
10 changes: 8 additions & 2 deletions autogalaxy/profiles/light/linear/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def __init__(
psf: Optional[aa.Kernel2D],
light_profile_list: List[LightProfileLinear],
regularization=Optional[aa.reg.Regularization],
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regularization=Optional[aa.reg.Regularization] sets the default value to the typing.Optional[...] object rather than None, which can lead to unexpected truthiness / attribute errors if callers rely on the default. This should be a type annotation (e.g. regularization: Optional[...] = None) instead of an assigned default.

Suggested change
regularization=Optional[aa.reg.Regularization],
regularization: Optional[aa.reg.Regularization] = None,

Copilot uses AI. Check for mistakes.
settings=aa.SettingsInversion(),
xp=np,
):
"""
Expand Down Expand Up @@ -202,7 +203,9 @@ def __init__(
"""
)

super().__init__(grid=grid, regularization=regularization, xp=xp)
super().__init__(
grid=grid, regularization=regularization, settings=settings, xp=xp
)

self.blurring_grid = blurring_grid
self.psf = psf
Expand Down Expand Up @@ -303,7 +306,10 @@ def operated_mapping_matrix_override(self) -> Optional[np.ndarray]:
)

blurred_image_2d = self.psf.convolved_image_from(
image=image_2d, blurring_image=blurring_image_2d, xp=self._xp
image=image_2d,
blurring_image=blurring_image_2d,
use_mixed_precision=self.settings.use_mixed_precision,
xp=self._xp,
)
Comment on lines 308 to 313
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kernel2D.convolved_image_from(...) is now called with use_mixed_precision=.... Because autoarray is an unpinned dependency, this will raise TypeError: got an unexpected keyword argument in environments using an older autoarray that doesn’t support this kwarg. Consider (1) pinning/bumping the minimum autoarray version that introduces this parameter, or (2) adding a backward-compatible call path (e.g. only passing the kwarg when supported).

Copilot uses AI. Check for mistakes.
Comment on lines 308 to 313
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mixed-precision behavior isn’t covered by tests: existing LightProfileLinearObjFuncList tests construct the class without settings, so they don’t validate that settings.use_mixed_precision is forwarded into the PSF convolution. Add a unit test that sets SettingsInversion(use_mixed_precision=True) (or equivalent) and asserts the mixed-precision path is exercised (e.g. via a spy/mocked convolved_image_from).

Copilot uses AI. Check for mistakes.

blurred_image_2d_list.append(blurred_image_2d.array)
Expand Down
42 changes: 28 additions & 14 deletions autogalaxy/profiles/mass/stellar/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,18 @@ def zeta_from(self, grid: aa.type.Grid2DLike, xp=np):

ind_pos_y = y >= 0

scale = q / (xp.asarray(self.sigma, dtype=xp.float64)
* xp.sqrt(xp.asarray(2.0, dtype=xp.float64) * (1.0 - q2)))
scale = q / (
xp.asarray(self.sigma, dtype=xp.float64)
* xp.sqrt(xp.asarray(2.0, dtype=xp.float64) * (1.0 - q2))
)

xs = x * scale
ys = xp.abs(y) * scale

z1 = xs + 1j * ys
z2 = q * xs + 1j * ys / q

exp_term = xp.exp(
-(xs * xs) * (1.0 - q2)
- (ys * ys) * (1.0 / q2 - 1.0)
)
exp_term = xp.exp(-(xs * xs) * (1.0 - q2) - (ys * ys) * (1.0 / q2 - 1.0))

core = -1j * (self.wofz(z1, xp=xp) - exp_term * self.wofz(z2, xp=xp))

Expand Down Expand Up @@ -243,10 +242,13 @@ def wofz(self, z, xp=np):
w_large = 1j * inv_sqrt_pi / t

# ---------- Region 5 ----------
U5 = xp.asarray([1.320522, 35.7668, 219.031,
1540.787, 3321.990, 36183.31], dtype=xp.float64)
V5 = xp.asarray([1.841439, 61.57037, 364.2191,
2186.181, 9022.228, 24322.84, 32066.6], dtype=xp.float64)
U5 = xp.asarray(
[1.320522, 35.7668, 219.031, 1540.787, 3321.990, 36183.31], dtype=xp.float64
)
V5 = xp.asarray(
[1.841439, 61.57037, 364.2191, 2186.181, 9022.228, 24322.84, 32066.6],
dtype=xp.float64,
)

t = inv_sqrt_pi
for u in U5:
Expand All @@ -259,10 +261,22 @@ def wofz(self, z, xp=np):
w5 = xp.exp(-z2) + 1j * z * t / s

# ---------- Region 6 ----------
U6 = xp.asarray([5.9126262, 30.180142, 93.15558,
181.92853, 214.38239, 122.60793], dtype=xp.float64)
V6 = xp.asarray([10.479857, 53.992907, 170.35400,
348.70392, 457.33448, 352.73063, 122.60793], dtype=xp.float64)
U6 = xp.asarray(
[5.9126262, 30.180142, 93.15558, 181.92853, 214.38239, 122.60793],
dtype=xp.float64,
)
V6 = xp.asarray(
[
10.479857,
53.992907,
170.35400,
348.70392,
457.33448,
352.73063,
122.60793,
],
dtype=xp.float64,
)

t = inv_sqrt_pi
for u in U6:
Expand Down
Loading