diff --git a/autogalaxy/profiles/light/standard/shapelets/exponential.py b/autogalaxy/profiles/light/standard/shapelets/exponential.py index 02d1cf0f..fa80a4b2 100644 --- a/autogalaxy/profiles/light/standard/shapelets/exponential.py +++ b/autogalaxy/profiles/light/standard/shapelets/exponential.py @@ -87,7 +87,12 @@ def image_2d_from( The image of the Exponential Shapelet evaluated at every (y,x) coordinate on the transformed grid. """ from scipy.special import genlaguerre - from jax.scipy.special import factorial + + # factorial backend switch + if xp is np: + from scipy.special import factorial + else: + from jax.scipy.special import factorial radial = (grid.array[:, 0] ** 2 + grid.array[:, 1] ** 2) / self.beta theta = xp.arctan(grid.array[:, 1] / grid.array[:, 0])