From 0ea7ae6f6e4b00ab5af745a91b851baf62d35765 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Sat, 7 Feb 2026 11:27:50 +0000 Subject: [PATCH] change geometry profile sin cos calculation to try mitigate JAX tracing --- autogalaxy/profiles/geometry_profiles.py | 6 +++--- autogalaxy/profiles/mass/total/isothermal.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/autogalaxy/profiles/geometry_profiles.py b/autogalaxy/profiles/geometry_profiles.py index 21516ab64..1df8ccec1 100644 --- a/autogalaxy/profiles/geometry_profiles.py +++ b/autogalaxy/profiles/geometry_profiles.py @@ -105,9 +105,9 @@ def _cartesian_grid_via_radial_from( The circular radius of each coordinate from the profile center. """ grid_angles = xp.arctan2(grid.array[:, 0], grid.array[:, 1]) - cos_theta, sin_theta = self.angle_to_profile_grid_from( - grid_angles=grid_angles, xp=xp - ) + + cos_theta = xp.cos(grid_angles) + sin_theta = xp.sin(grid_angles) return xp.multiply(radius[:, None], xp.vstack((sin_theta, cos_theta)).T) diff --git a/autogalaxy/profiles/mass/total/isothermal.py b/autogalaxy/profiles/mass/total/isothermal.py index ba26bf671..c0dc85ecd 100644 --- a/autogalaxy/profiles/mass/total/isothermal.py +++ b/autogalaxy/profiles/mass/total/isothermal.py @@ -202,7 +202,7 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, xp=np, **kwargs): """ return self._cartesian_grid_via_radial_from( grid=grid, - radius=xp.full(grid.shape[0], 2.0 * self.einstein_radius_rescaled(xp)), xp=xp, + radius=xp.full(grid.shape[0], 2.0 * self.einstein_radius_rescaled(xp)), **kwargs, )