From ba4b4b5589684f0d69969e086fdd9a9697ba3bc5 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Mon, 29 Apr 2024 19:40:52 +0100 Subject: [PATCH 01/26] jax wrapper --- autogalaxy/profiles/light/standard/sersic.py | 1 + 1 file changed, 1 insertion(+) diff --git a/autogalaxy/profiles/light/standard/sersic.py b/autogalaxy/profiles/light/standard/sersic.py index 675d052b8..77b2baf26 100644 --- a/autogalaxy/profiles/light/standard/sersic.py +++ b/autogalaxy/profiles/light/standard/sersic.py @@ -127,6 +127,7 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray, **kwargs) -> np.ndarra grid_radii The radial distances from the centre of the profile, for each coordinate on the grid. """ + np.seterr(all="ignore") return np.multiply( self._intensity, From 75bbca6074365ff6b2b0e8c53e0d8ce09a8d8c04 Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 10 Jun 2024 15:19:22 +0100 Subject: [PATCH 02/26] fix test (once conf merged) --- test_autogalaxy/profiles/test_dict.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test_autogalaxy/profiles/test_dict.py b/test_autogalaxy/profiles/test_dict.py index 73d5f8426..4f8c35e41 100644 --- a/test_autogalaxy/profiles/test_dict.py +++ b/test_autogalaxy/profiles/test_dict.py @@ -16,12 +16,12 @@ def make_ell_sersic_dict(): "type": "instance", "class_path": "autogalaxy.profiles.mass.stellar.sersic.Sersic", "arguments": { - "centre": (0.0, 0.0), - "ell_comps": (0.0, 0.0), + "mass_to_light_ratio": 1.0, + "ell_comps": {"type": "tuple", "values": [0.0, 0.0]}, + "sersic_index": 0.6, "intensity": 0.1, "effective_radius": 0.6, - "sersic_index": 0.6, - "mass_to_light_ratio": 1.0, + "centre": {"type": "tuple", "values": [0.0, 0.0]}, }, } From d93a5cca97b5af141cf9554f33486764fcebe475 Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 10 Jun 2024 16:15:18 +0100 Subject: [PATCH 03/26] hack-around to get jax script running --- autogalaxy/profiles/light/standard/sersic.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autogalaxy/profiles/light/standard/sersic.py b/autogalaxy/profiles/light/standard/sersic.py index 77b2baf26..097d8c6e6 100644 --- a/autogalaxy/profiles/light/standard/sersic.py +++ b/autogalaxy/profiles/light/standard/sersic.py @@ -1,4 +1,5 @@ -import numpy as np +from autofit.jax_wrapper import numpy as np +from numpy import seterr from typing import Optional, Tuple import autoarray as aa @@ -127,8 +128,7 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray, **kwargs) -> np.ndarra grid_radii The radial distances from the centre of the profile, for each coordinate on the grid. """ - - np.seterr(all="ignore") + seterr(all="ignore") return np.multiply( self._intensity, np.exp( @@ -136,7 +136,7 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray, **kwargs) -> np.ndarra -self.sersic_constant, np.add( np.power( - np.divide(grid_radii, self.effective_radius), + np.divide(grid_radii._array, self.effective_radius), 1.0 / self.sersic_index, ), -1, From 252ecfdbe16307bda653524a5f83ece14a2dec10 Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 10 Jun 2024 16:57:55 +0100 Subject: [PATCH 04/26] revert array casting change --- autogalaxy/profiles/light/standard/sersic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogalaxy/profiles/light/standard/sersic.py b/autogalaxy/profiles/light/standard/sersic.py index 097d8c6e6..7ac96daed 100644 --- a/autogalaxy/profiles/light/standard/sersic.py +++ b/autogalaxy/profiles/light/standard/sersic.py @@ -136,7 +136,7 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray, **kwargs) -> np.ndarra -self.sersic_constant, np.add( np.power( - np.divide(grid_radii._array, self.effective_radius), + np.divide(np.array(grid_radii), self.effective_radius), 1.0 / self.sersic_index, ), -1, From 044febb5dfe06a4b08b8cbd02c77de59d6f5218e Mon Sep 17 00:00:00 2001 From: CKrawczyk Date: Fri, 28 Jun 2024 10:25:26 +0100 Subject: [PATCH 05/26] When using JAX don't import Numpy Switches out `numpy` for `jax.numpy`. --- autogalaxy/profiles/geometry_profiles.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autogalaxy/profiles/geometry_profiles.py b/autogalaxy/profiles/geometry_profiles.py index c75b8cdbf..d036b8cea 100644 --- a/autogalaxy/profiles/geometry_profiles.py +++ b/autogalaxy/profiles/geometry_profiles.py @@ -1,6 +1,11 @@ +import os + from typing import Optional, Tuple, Type -import numpy as np +if os.environ.get("USE_JAX", "0") == "1": + import jax.numpy as np +else: + import numpy as np import autoarray as aa From ad84a98a081abf1d64af7bdf2ab45b88125b3b23 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Fri, 19 Jul 2024 14:42:37 +0100 Subject: [PATCH 06/26] merge main --- docs/api/pixelization.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/pixelization.rst b/docs/api/pixelization.rst index 54d8adad7..39b924651 100644 --- a/docs/api/pixelization.rst +++ b/docs/api/pixelization.rst @@ -52,7 +52,7 @@ Mesh [ag.mesh] Rectangular Delaunay Voronoi - VoronoiNN + Voronoi Regularization [ag.reg] ----------------------- From 9444b1e7f9edf240dd6f2829b608c00d095ddce5 Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 12 Aug 2024 16:28:46 +0100 Subject: [PATCH 07/26] numpy to jax wrapper conversion --- autogalaxy/convert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogalaxy/convert.py b/autogalaxy/convert.py index 3364b1812..8ff432d7b 100644 --- a/autogalaxy/convert.py +++ b/autogalaxy/convert.py @@ -1,5 +1,5 @@ from astropy import units -import numpy as np +from autofit.jax_wrapper import numpy as np from typing import Tuple From 5e30644294561b37867d21ca9697160568f03ece Mon Sep 17 00:00:00 2001 From: CKrawczyk Date: Wed, 18 Sep 2024 10:02:48 +0100 Subject: [PATCH 08/26] Jax version of MGE Sersic profile This adds the MGE code needed for the Sersic profile. --- autogalaxy/profiles/geometry_profiles.py | 8 +- .../profiles/mass/abstract/jax_utils.py | 119 ++++++++ autogalaxy/profiles/mass/abstract/mge.py | 288 +----------------- autogalaxy/profiles/mass/abstract/mge_jax.py | 156 ++++++++++ .../profiles/mass/abstract/mge_numpy.py | 280 +++++++++++++++++ autogalaxy/profiles/mass/stellar/sersic.py | 10 +- 6 files changed, 576 insertions(+), 285 deletions(-) create mode 100644 autogalaxy/profiles/mass/abstract/jax_utils.py create mode 100644 autogalaxy/profiles/mass/abstract/mge_jax.py create mode 100644 autogalaxy/profiles/mass/abstract/mge_numpy.py diff --git a/autogalaxy/profiles/geometry_profiles.py b/autogalaxy/profiles/geometry_profiles.py index d036b8cea..725a10499 100644 --- a/autogalaxy/profiles/geometry_profiles.py +++ b/autogalaxy/profiles/geometry_profiles.py @@ -91,7 +91,7 @@ def __init__(self, centre: Tuple[float, float] = (0.0, 0.0)): def radial_grid_from(self, grid: aa.type.Grid2DLike, **kwargs) -> np.ndarray: """ Convert a grid of (y, x) coordinates, to their radial distances from the profile - centre (e.g. :math: r = x**2 + y**2). + centre (e.g. :math: r = sqrt(x**2 + y**2)). Parameters ---------- @@ -311,7 +311,7 @@ def elliptical_radii_grid_from( """ return np.sqrt( np.add( - np.square(grid[:, 1]), np.square(np.divide(grid[:, 0], self.axis_ratio)) + np.square(grid.array[:, 1]), np.square(np.divide(grid.array[:, 0], self.axis_ratio)) ) ) @@ -334,9 +334,9 @@ def eccentric_radii_grid_from( The (y, x) coordinates in the reference frame of the elliptical profile. """ - grid_radii = self.elliptical_radii_grid_from(grid=grid, **kwargs) + grid_radii = self.elliptical_radii_grid_from(grid=grid, **kwargs).array - return np.multiply(np.sqrt(self.axis_ratio), grid_radii).view(np.ndarray) + return np.multiply(np.sqrt(self.axis_ratio), grid_radii)#.view(np.ndarray) @aa.grid_dec.to_grid def transformed_to_reference_frame_grid_from( diff --git a/autogalaxy/profiles/mass/abstract/jax_utils.py b/autogalaxy/profiles/mass/abstract/jax_utils.py new file mode 100644 index 000000000..19e9d8caf --- /dev/null +++ b/autogalaxy/profiles/mass/abstract/jax_utils.py @@ -0,0 +1,119 @@ +import jax +import jax.numpy as jnp +import numpy as np + +from jax import custom_jvp +from jax.scipy.special import gammaln + + +def reg1(z, _, i_sqrt_pi): + return i_sqrt_pi / z + + +def reg2(z, _, i_sqrt_pi): + z2 = z**2 + return i_sqrt_pi * z / (z2 - 0.5) + + +def reg3(z, _, i_sqrt_pi): + z2 = z**2 + return (i_sqrt_pi / z) * (1 + 0.5 / (z2 - 1.5)) + + +def reg4(z, _, i_sqrt_pi): + z2 = z**2 + return (i_sqrt_pi * z) * (z2 - 2.5) / (z2 * (z2 - 3.0) + 0.75) + + +def reg5(z, sqrt_pi, _): + mz2 = -z**2 + f1 = sqrt_pi + f2 = 1.0 + s1 = [1.320522, 35.7668, 219.031, 1540.787, 3321.99, 36183.31] + s2 = [1.841439, 61.57037, 364.2191, 2186.181, 9022.228, 24322.84, 32066.6] + + for s in s1: + f1 = s - f1 * mz2 + for s in s2: + f2 = s - f2 * mz2 + + return jnp.exp(mz2) + 1j * z * f1 / f2 + + +def reg6(z, sqrt_pi, _): + miz = -1j * z + f1 = sqrt_pi + f2 = 1 + s1 = [5.9126262, 30.180142, 93.15558, 181.92853, 214.38239, 122.60793] + s2 = [10.479857, 53.992907, 170.35400, 348.70392, 457.33448, 352.73063, 122.60793] + + for s in s1: + f1 = s + f1 * miz + for s in s2: + f2 = s + f2 * miz + + return f1 / f2 + + +@custom_jvp +def w_f_approx(z): + """Compute the Faddeeva function :math:`w_{\\mathrm F}(z)` using the + approximation given in Zaghloul (2017). + + :param z: complex number + :type z: ``complex`` or ``numpy.array(dtype=complex)`` + :return: :math:`w_\\mathrm{F}(z)` + :rtype: ``complex`` + + # This function is a JAX conversion of + # "https://github.com/sibirrer/lenstronomy/tree/master/lenstronomy/LensModel/Profiles" + # original function written by Anowar J. Shajib (see 1906.08263) + # JAX conversion written by Coleman M. Krawczyk + """ + sqrt_pi = 1 / jnp.sqrt(jnp.pi) + i_sqrt_pi = 1j * sqrt_pi + + z_imag2 = z.imag**2 + abs_z2 = z.real**2 + z_imag2 + + r1 = abs_z2 >= 38000.0 + r2 = (abs_z2 >= 256.0) & (abs_z2 < 38000.0) + r3 = (abs_z2 >= 62.0) & (abs_z2 < 256.0) + r4 = (abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 >= 1e-13) + # region bounds for 5 taken directly from Zaghloul (2017) + # https://dl.acm.org/doi/pdf/10.1145/3119904 + r5_1 = (abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 < 1e-13) + r5_2 = (abs_z2 >= 2.5) & (abs_z2 < 30.0) & (z_imag2 < 0.072) + r5 = r5_1 | r5_2 + r6 = (abs_z2 < 30.0) & jnp.logical_not(r5) + + args = (z, sqrt_pi, i_sqrt_pi) + wz = jnp.empty_like(z) + wz = jnp.where(r1, reg1(*args), wz) + wz = jnp.where(r2, reg2(*args), wz) + wz = jnp.where(r3, reg3(*args), wz) + wz = jnp.where(r4, reg4(*args), wz) + wz = jnp.where(r5, reg5(*args), wz) + wz = jnp.where(r6, reg6(*args), wz) + return wz + + +@w_f_approx.defjvp +def w_f_approx_jvp(primals, tangents): + # define a custom jvp to avoid the issue using `jnp.where` with `jax.grad` + # also the derivative is defined analytically for this function so bypass + # auto diffing over the complex functions above. + z, = primals + z_dot, = tangents + primal_out = w_f_approx(z) + i_sqrt_pi = 1j / jnp.sqrt(jnp.pi) + tangent_out = z_dot * 2 * (i_sqrt_pi - z * primal_out) + return primal_out, tangent_out + + +def comb(x: int, y: int) -> int: + # use the gamma function definition as that is the only + # JAX friendly way to do this (internally the factorial function + # uses this method as well). Round to closest int at the end of the + # calculation as we only use this for int inputs anyways. + return jnp.exp(gammaln(x + 1) - gammaln(y + 1) - gammaln(x - y + 1)).round(1) diff --git a/autogalaxy/profiles/mass/abstract/mge.py b/autogalaxy/profiles/mass/abstract/mge.py index 2b3f97152..1958eb3ef 100644 --- a/autogalaxy/profiles/mass/abstract/mge.py +++ b/autogalaxy/profiles/mass/abstract/mge.py @@ -1,280 +1,8 @@ -import numpy as np -from scipy.special import comb - - -def w_f_approx(z): - """ - Compute the Faddeeva function :math:`w_{\mathrm F}(z)` using the - approximation given in Zaghloul (2017). - :param z: complex number - :type z: ``complex`` or ``numpy.array(dtype=complex)`` - :return: :math:`w_\mathrm{F}(z)` - :rtype: ``complex`` - - # This function is copied from - # "https://github.com/sibirrer/lenstronomy/tree/master/lenstronomy/LensModel/Profiles" - # written by Anowar J. Shajib (see 1906.08263) - """ - - reg_minus_imag = z.imag < 0.0 - z[reg_minus_imag] = np.conj(z[reg_minus_imag]) - - sqrt_pi = 1 / np.sqrt(np.pi) - i_sqrt_pi = 1j * sqrt_pi - - wz = np.empty_like(z) - - z_imag2 = z.imag**2 - abs_z2 = z.real**2 + z_imag2 - - reg1 = abs_z2 >= 38000.0 - if np.any(reg1): - wz[reg1] = i_sqrt_pi / z[reg1] - - reg2 = (256.0 <= abs_z2) & (abs_z2 < 38000.0) - if np.any(reg2): - t = z[reg2] - wz[reg2] = i_sqrt_pi * t / (t * t - 0.5) - - reg3 = (62.0 <= abs_z2) & (abs_z2 < 256.0) - if np.any(reg3): - t = z[reg3] - wz[reg3] = (i_sqrt_pi / t) * (1 + 0.5 / (t * t - 1.5)) - - reg4 = (30.0 <= abs_z2) & (abs_z2 < 62.0) & (z_imag2 >= 1e-13) - if np.any(reg4): - t = z[reg4] - tt = t * t - wz[reg4] = (i_sqrt_pi * t) * (tt - 2.5) / (tt * (tt - 3.0) + 0.75) - - reg5 = (62.0 > abs_z2) & np.logical_not(reg4) & (abs_z2 > 2.5) & (z_imag2 < 0.072) - if np.any(reg5): - t = z[reg5] - u = -t * t - f1 = sqrt_pi - f2 = 1 - s1 = [1.320522, 35.7668, 219.031, 1540.787, 3321.99, 36183.31] - s2 = [1.841439, 61.57037, 364.2191, 2186.181, 9022.228, 24322.84, 32066.6] - - for s in s1: - f1 = s - f1 * u - for s in s2: - f2 = s - f2 * u - - wz[reg5] = np.exp(u) + 1j * t * f1 / f2 - - reg6 = (30.0 > abs_z2) & np.logical_not(reg5) - if np.any(reg6): - t3 = -1j * z[reg6] - - f1 = sqrt_pi - f2 = 1 - s1 = [5.9126262, 30.180142, 93.15558, 181.92853, 214.38239, 122.60793] - s2 = [ - 10.479857, - 53.992907, - 170.35400, - 348.70392, - 457.33448, - 352.73063, - 122.60793, - ] - - for s in s1: - f1 = f1 * t3 + s - for s in s2: - f2 = f2 * t3 + s - - wz[reg6] = f1 / f2 - - # wz[reg_minus_imag] = np.conj(wz[reg_minus_imag]) - - return wz - - -class MassProfileMGE: - """ - This class speeds up deflection angle calculations of certain mass profiles by decompositing them into many - Gaussians. - - This follows the method of Shajib 2019 - https://academic.oup.com/mnras/article/488/1/1387/5526256 - """ - - def __init__(self): - self.count = 0 - self.sigma_calc = 0 - self.z = 0 - self.zq = 0 - self.expv = 0 - - @staticmethod - # @aa.util.numba.jit() - def zeta_from(grid, amps, sigmas, axis_ratio): - """ - The key part to compute the deflection angle of each Gaussian. - Because of my optimization, there are blocks looking weird and indirect. What I'm doing here - is trying to avoid big matrix operation to save time. - I think there are still spaces we can optimize. - - It seems when using w_f_approx, it gives some errors if y < 0. So when computing for places - where y < 0, we first compute the value at - y, and then change its sign. - """ - - output_grid_final = np.zeros(grid.shape[0], dtype="complex128") - - q2 = axis_ratio**2.0 - - scale_factor = axis_ratio / (sigmas[0] * np.sqrt(2.0 * (1.0 - q2))) - - xs = np.array((grid[:, 1] * scale_factor).copy()) - ys = np.array((grid[:, 0] * scale_factor).copy()) - - ys_minus = ys < 0.0 - ys[ys_minus] *= -1 - z = xs + 1j * ys - zq = axis_ratio * xs + 1j * ys / axis_ratio - - expv = -(xs**2.0) * (1.0 - q2) - ys**2.0 * (1.0 / q2 - 1.0) - - for i in range(len(sigmas)): - if i > 0: - z /= sigmas[i] / sigmas[i - 1] - zq /= sigmas[i] / sigmas[i - 1] - expv /= (sigmas[i] / sigmas[i - 1]) ** 2.0 - - output_grid = -1j * (w_f_approx(z) - np.exp(expv) * w_f_approx(zq)) - - output_grid[ys_minus] = np.conj(output_grid[ys_minus]) - - output_grid_final += (amps[i] * sigmas[i]) * output_grid - - return output_grid_final - - @staticmethod - def kesi(p): - """ - see Eq.(6) of 1906.08263 - """ - n_list = np.arange(0, 2 * p + 1, 1) - return (2.0 * p * np.log(10) / 3.0 + 2.0 * np.pi * n_list * 1j) ** (0.5) - - @staticmethod - def eta(p): - """ - see Eq.(6) of 1906.00263 - """ - eta_list = np.zeros(int(2 * p + 1)) - kesi_list = np.zeros(int(2 * p + 1)) - kesi_list[0] = 0.5 - kesi_list[1 : p + 1] = 1.0 - kesi_list[int(2 * p)] = 1.0 / 2.0**p - - for i in np.arange(1, p, 1): - kesi_list[2 * p - i] = kesi_list[2 * p - i + 1] + 2 ** (-p) * comb(p, i) - - for i in np.arange(0, 2 * p + 1, 1): - eta_list[i] = ( - (-1) ** i * 2.0 * np.sqrt(2.0 * np.pi) * 10 ** (p / 3.0) * kesi_list[i] - ) - - return eta_list - - def decompose_convergence_via_mge(self): - raise NotImplementedError() - - def _decompose_convergence_via_mge( - self, func, radii_min, radii_max, func_terms=28, func_gaussians=20 - ): - """ - - Parameters - ---------- - func : func - The function representing the profile that is decomposed into Gaussians. - normalization - A normalization factor tyh - func_terms - The number of terms used to approximate the input func. - func_gaussians - The number of Gaussians used to represent the input func. - - Returns - ------- - """ - - kesis = self.kesi(func_terms) # kesi in Eq.(6) of 1906.08263 - etas = self.eta(func_terms) # eta in Eqr.(6) of 1906.08263 - - def f(sigma): - """Eq.(5) of 1906.08263""" - return np.sum(etas * np.real(target_function(sigma * kesis))) - - # sigma is sampled from logspace between these radii. - - log_sigmas = np.linspace(np.log(radii_min), np.log(radii_max), func_gaussians) - d_log_sigma = log_sigmas[1] - log_sigmas[0] - sigma_list = np.exp(log_sigmas) - - amplitude_list = np.zeros(func_gaussians) - - for i in range(func_gaussians): - f_sigma = np.sum(etas * np.real(func(sigma_list[i] * kesis))) - if (i == -1) or (i == (func_gaussians - 1)): - amplitude_list[i] = 0.5 * f_sigma * d_log_sigma / np.sqrt(2.0 * np.pi) - else: - amplitude_list[i] = f_sigma * d_log_sigma / np.sqrt(2.0 * np.pi) - - return amplitude_list, sigma_list - - def convergence_2d_via_mge_from(self, grid_radii): - raise NotImplementedError() - - def _convergence_2d_via_mge_from(self, grid_radii): - """Calculate the projected convergence at a given set of arc-second gridded coordinates. - - Parameters - ---------- - grid - The grid of (y,x) arc-second coordinates the convergence is computed on. - - """ - - self.count = 0 - self.sigma_calc = 0 - self.z = 0 - self.zq = 0 - self.expv = 0 - - amps, sigmas = self.decompose_convergence_via_mge() - - convergence = 0.0 - - for i in range(len(sigmas)): - convergence += self.convergence_func_gaussian( - grid_radii=grid_radii, sigma=sigmas[i], intensity=amps[i] - ) - return convergence - - def convergence_func_gaussian(self, grid_radii, sigma, intensity): - return np.multiply( - intensity, np.exp(-0.5 * np.square(np.divide(grid_radii, sigma))) - ) - - def _deflections_2d_via_mge_from(self, grid, sigmas_factor=1.0): - axis_ratio = self.axis_ratio - - if axis_ratio > 0.9999: - axis_ratio = 0.9999 - - amps, sigmas = self.decompose_convergence_via_mge() - sigmas *= sigmas_factor - - angle = self.zeta_from( - grid=grid, amps=amps, sigmas=sigmas, axis_ratio=axis_ratio - ) - - angle *= np.sqrt((2.0 * np.pi) / (1.0 - axis_ratio**2.0)) - - return self.rotated_grid_from_reference_frame_from( - np.vstack((-angle.imag, angle.real)).T - ) +import os + +if os.environ.get("USE_JAX", "0") == "1": + USING_JAX = True + from .mge_jax import MassProfileMGE +else: + USING_JAX = False + from .mge_numpy import MassProfileMGE diff --git a/autogalaxy/profiles/mass/abstract/mge_jax.py b/autogalaxy/profiles/mass/abstract/mge_jax.py new file mode 100644 index 000000000..e24facbd3 --- /dev/null +++ b/autogalaxy/profiles/mass/abstract/mge_jax.py @@ -0,0 +1,156 @@ +import jax.numpy as np +import jax + +from .jax_utils import w_f_approx, comb + + +class MassProfileMGE: + """ + This class speeds up deflection angle calculations of certain mass profiles by decompositing them into many + Gaussians. + + This follows the method of Shajib 2019 - https://academic.oup.com/mnras/article/488/1/1387/5526256 + """ + + def __init__(self): + pass + + @staticmethod + def zeta_from(grid, amps, sigmas, axis_ratio): + """ + The key part to compute the deflection angle of each Gaussian. + """ + q2 = axis_ratio**2.0 + + scale_factor = axis_ratio / np.sqrt(2.0 * (1.0 - q2)) + + xs = np.array((grid.array[:, 1] * scale_factor).copy()) + ys = np.array((grid.array[:, 0] * scale_factor).copy()) + + y_sign = np.sign(ys) + ys = ys * y_sign + + z = xs + 1j * ys + zq = axis_ratio * xs + 1j * ys / axis_ratio + expv = -(xs**2.0) * (1.0 - q2) - ys**2.0 * (1.0 / q2 - 1.0) + sigma_ = sigmas.reshape((-1,) + (1,) * xs.ndim) + inv_sigma_ = 1 / sigma_ + amps_ = amps.reshape((-1,) + (1,) * xs.ndim) + + # process as one big vectorized calculation + # could try `jax.lax.scan` instead if this is too much memory + w = w_f_approx(inv_sigma_ * z) + wq = w_f_approx(inv_sigma_ * zq) + exp_factor = np.exp(inv_sigma_**2 * expv) + + sigma_func_real = w.imag - exp_factor * wq.imag + sigma_func_imag = (-w.real + exp_factor * wq.real) * y_sign + + output_grid = sigma_ * amps_ * (sigma_func_real + 1j * sigma_func_imag) + return output_grid.sum(axis=0) + + @staticmethod + def kesi(p): + """ + see Eq.(6) of 1906.08263 + """ + n_list = np.arange(0, 2 * p + 1, 1) + return (2.0 * p * np.log(10) / 3.0 + 2.0 * np.pi * n_list * 1j) ** (0.5) + + @staticmethod + def eta(p): + """ + see Eq.(6) of 1906.00263 + """ + + def body_kesi(carry, i): + carry = carry + 2**-p * comb(p, i) + return carry, carry + + kesi_last = 1/2**p + _, k = jax.lax.scan(body_kesi, kesi_last, np.arange(1, p, 1)) + kesi_list = np.hstack([ + np.array([0.5]), + np.ones(p), + k[::-1], + np.array([kesi_last]) + ]) + coef = (-1)**np.arange(0, 2 * p + 1, 1) + eta_list = coef * 2.0 * np.sqrt(2.0 * np.pi) * 10 ** (p / 3.0) * kesi_list + return eta_list + + def decompose_convergence_via_mge(self): + raise NotImplementedError() + + def _decompose_convergence_via_mge( + self, func, radii_min, radii_max, func_terms=28, func_gaussians=20 + ): + """ + + Parameters + ---------- + func : func + The function representing the profile that is decomposed into Gaussians. + normalization + A normalization factor tyh + func_terms + The number of terms used to approximate the input func. + func_gaussians + The number of Gaussians used to represent the input func. + + Returns + ------- + """ + + kesis = self.kesi(func_terms) # kesi in Eq.(6) of 1906.08263 + etas = self.eta(func_terms) # eta in Eqr.(6) of 1906.08263 + + # sigma is sampled from logspace between these radii. + + log_sigmas = np.linspace(np.log(radii_min), np.log(radii_max), func_gaussians) + d_log_sigma = log_sigmas[1] - log_sigmas[0] + sigma_list = np.exp(log_sigmas) + + amplitude_list = np.zeros(func_gaussians) + f_sigma = np.sum(etas * np.real(func(sigma_list.reshape(-1, 1) * kesis)), axis=1) + amplitude_list = f_sigma * d_log_sigma / np.sqrt(2.0 * np.pi) + amplitude_list = amplitude_list.at[0].multiply(0.5) + amplitude_list = amplitude_list.at[-1].multiply(0.5) + return amplitude_list, sigma_list + + def convergence_2d_via_mge_from(self, grid_radii): + raise NotImplementedError() + + def _convergence_2d_via_mge_from(self, grid_radii): + """Calculate the projected convergence at a given set of arc-second gridded coordinates. + + Parameters + ---------- + grid + The grid of (y,x) arc-second coordinates the convergence is computed on. + + """ + amps, sigmas = self.decompose_convergence_via_mge() + + convergence = 0.0 + + inv_sigma_ = 1 / sigmas.reshape((-1,) + (1,) * grid_radii.array.ndim) + amps_ = amps.reshape((-1,) + (1,) * grid_radii.array.ndim) + convergence = amps_ * np.exp(-0.5 * (grid_radii.array * inv_sigma_)**2) + return convergence.sum(axis=0) + + def _deflections_2d_via_mge_from(self, grid, sigmas_factor=1.0): + axis_ratio = np.min(np.array([self.axis_ratio, 0.9999])) + + amps, sigmas = self.decompose_convergence_via_mge() + sigmas *= sigmas_factor + + angle = self.zeta_from( + grid=grid, amps=amps, sigmas=sigmas, axis_ratio=axis_ratio + ) + + angle *= np.sqrt((2.0 * np.pi) / (1.0 - axis_ratio**2.0)) + + return self.rotated_grid_from_reference_frame_from( + np.vstack((-angle.imag, angle.real)).T + ) diff --git a/autogalaxy/profiles/mass/abstract/mge_numpy.py b/autogalaxy/profiles/mass/abstract/mge_numpy.py new file mode 100644 index 000000000..24fb218ad --- /dev/null +++ b/autogalaxy/profiles/mass/abstract/mge_numpy.py @@ -0,0 +1,280 @@ +import numpy as np +from scipy.special import comb + + +def w_f_approx(z): + """ + Compute the Faddeeva function :math:`w_{\mathrm F}(z)` using the + approximation given in Zaghloul (2017). + :param z: complex number + :type z: ``complex`` or ``numpy.array(dtype=complex)`` + :return: :math:`w_\mathrm{F}(z)` + :rtype: ``complex`` + + # This function is copied from + # "https://github.com/sibirrer/lenstronomy/tree/master/lenstronomy/LensModel/Profiles" + # written by Anowar J. Shajib (see 1906.08263) + """ + + reg_minus_imag = z.imag < 0.0 + z[reg_minus_imag] = np.conj(z[reg_minus_imag]) + + sqrt_pi = 1 / np.sqrt(np.pi) + i_sqrt_pi = 1j * sqrt_pi + + wz = np.empty_like(z) + + z_imag2 = z.imag**2 + abs_z2 = z.real**2 + z_imag2 + + reg1 = abs_z2 >= 38000.0 + if np.any(reg1): + wz[reg1] = i_sqrt_pi / z[reg1] + + reg2 = (256.0 <= abs_z2) & (abs_z2 < 38000.0) + if np.any(reg2): + t = z[reg2] + wz[reg2] = i_sqrt_pi * t / (t * t - 0.5) + + reg3 = (62.0 <= abs_z2) & (abs_z2 < 256.0) + if np.any(reg3): + t = z[reg3] + wz[reg3] = (i_sqrt_pi / t) * (1 + 0.5 / (t * t - 1.5)) + + reg4 = (30.0 <= abs_z2) & (abs_z2 < 62.0) & (z_imag2 >= 1e-13) + if np.any(reg4): + t = z[reg4] + tt = t * t + wz[reg4] = (i_sqrt_pi * t) * (tt - 2.5) / (tt * (tt - 3.0) + 0.75) + + reg5 = (62.0 > abs_z2) & np.logical_not(reg4) & (abs_z2 > 2.5) & (z_imag2 < 0.072) + if np.any(reg5): + t = z[reg5] + u = -t * t + f1 = sqrt_pi + f2 = 1 + s1 = [1.320522, 35.7668, 219.031, 1540.787, 3321.99, 36183.31] + s2 = [1.841439, 61.57037, 364.2191, 2186.181, 9022.228, 24322.84, 32066.6] + + for s in s1: + f1 = s - f1 * u + for s in s2: + f2 = s - f2 * u + + wz[reg5] = np.exp(u) + 1j * t * f1 / f2 + + reg6 = (30.0 > abs_z2) & np.logical_not(reg5) + if np.any(reg6): + t3 = -1j * z[reg6] + + f1 = sqrt_pi + f2 = 1 + s1 = [5.9126262, 30.180142, 93.15558, 181.92853, 214.38239, 122.60793] + s2 = [ + 10.479857, + 53.992907, + 170.35400, + 348.70392, + 457.33448, + 352.73063, + 122.60793, + ] + + for s in s1: + f1 = f1 * t3 + s + for s in s2: + f2 = f2 * t3 + s + + wz[reg6] = f1 / f2 + + # wz[reg_minus_imag] = np.conj(wz[reg_minus_imag]) + + return wz + + +class MassProfileMGE: + """ + This class speeds up deflection angle calculations of certain mass profiles by decompositing them into many + Gaussians. + + This follows the method of Shajib 2019 - https://academic.oup.com/mnras/article/488/1/1387/5526256 + """ + + def __init__(self): + self.count = 0 + self.sigma_calc = 0 + self.z = 0 + self.zq = 0 + self.expv = 0 + + @staticmethod + # @aa.util.numba.jit() + def zeta_from(grid, amps, sigmas, axis_ratio): + """ + The key part to compute the deflection angle of each Gaussian. + Because of my optimization, there are blocks looking weird and indirect. What I'm doing here + is trying to avoid big matrix operation to save time. + I think there are still spaces we can optimize. + + It seems when using w_f_approx, it gives some errors if y < 0. So when computing for places + where y < 0, we first compute the value at - y, and then change its sign. + """ + + output_grid_final = np.zeros(grid.shape[0], dtype="complex128") + + q2 = axis_ratio**2.0 + + scale_factor = axis_ratio / (sigmas[0] * np.sqrt(2.0 * (1.0 - q2))) + + xs = np.array((grid[:, 1] * scale_factor).copy()) + ys = np.array((grid[:, 0] * scale_factor).copy()) + + ys_minus = ys < 0.0 + ys[ys_minus] *= -1 + z = xs + 1j * ys + zq = axis_ratio * xs + 1j * ys / axis_ratio + + expv = -(xs**2.0) * (1.0 - q2) - ys**2.0 * (1.0 / q2 - 1.0) + + for i in range(len(sigmas)): + if i > 0: + z /= sigmas[i] / sigmas[i - 1] + zq /= sigmas[i] / sigmas[i - 1] + expv /= (sigmas[i] / sigmas[i - 1]) ** 2.0 + + output_grid = -1j * (w_f_approx(z) - np.exp(expv) * w_f_approx(zq)) + + output_grid[ys_minus] = np.conj(output_grid[ys_minus]) + + output_grid_final += (amps[i] * sigmas[i]) * output_grid + + return output_grid_final + + @staticmethod + def kesi(p): + """ + see Eq.(6) of 1906.08263 + """ + n_list = np.arange(0, 2 * p + 1, 1) + return (2.0 * p * np.log(10) / 3.0 + 2.0 * np.pi * n_list * 1j) ** (0.5) + + @staticmethod + def eta(p): + """ + see Eq.(6) of 1906.00263 + """ + eta_list = np.zeros(int(2 * p + 1)) + kesi_list = np.zeros(int(2 * p + 1)) + kesi_list[0] = 0.5 + kesi_list[1 : p + 1] = 1.0 + kesi_list[int(2 * p)] = 1.0 / 2.0**p + + for i in np.arange(1, p, 1): + kesi_list[2 * p - i] = kesi_list[2 * p - i + 1] + 2 ** (-p) * comb(p, i) + + for i in np.arange(0, 2 * p + 1, 1): + eta_list[i] = ( + (-1) ** i * 2.0 * np.sqrt(2.0 * np.pi) * 10 ** (p / 3.0) * kesi_list[i] + ) + + return eta_list + + def decompose_convergence_via_mge(self): + raise NotImplementedError() + + def _decompose_convergence_via_mge( + self, func, radii_min, radii_max, func_terms=28, func_gaussians=20 + ): + """ + + Parameters + ---------- + func : func + The function representing the profile that is decomposed into Gaussians. + normalization + A normalization factor tyh + func_terms + The number of terms used to approximate the input func. + func_gaussians + The number of Gaussians used to represent the input func. + + Returns + ------- + """ + + kesis = self.kesi(func_terms) # kesi in Eq.(6) of 1906.08263 + etas = self.eta(func_terms) # eta in Eqr.(6) of 1906.08263 + + def f(sigma): + """Eq.(5) of 1906.08263""" + return np.sum(etas * np.real(target_function(sigma * kesis))) + + # sigma is sampled from logspace between these radii. + + log_sigmas = np.linspace(np.log(radii_min), np.log(radii_max), func_gaussians) + d_log_sigma = log_sigmas[1] - log_sigmas[0] + sigma_list = np.exp(log_sigmas) + + amplitude_list = np.zeros(func_gaussians) + + for i in range(func_gaussians): + f_sigma = np.sum(etas * np.real(func(sigma_list[i] * kesis))) + if (i == 0) or (i == (func_gaussians - 1)): + amplitude_list[i] = 0.5 * f_sigma * d_log_sigma / np.sqrt(2.0 * np.pi) + else: + amplitude_list[i] = f_sigma * d_log_sigma / np.sqrt(2.0 * np.pi) + + return amplitude_list, sigma_list + + def convergence_2d_via_mge_from(self, grid_radii): + raise NotImplementedError() + + def _convergence_2d_via_mge_from(self, grid_radii): + """Calculate the projected convergence at a given set of arc-second gridded coordinates. + + Parameters + ---------- + grid + The grid of (y,x) arc-second coordinates the convergence is computed on. + + """ + + self.count = 0 + self.sigma_calc = 0 + self.z = 0 + self.zq = 0 + self.expv = 0 + + amps, sigmas = self.decompose_convergence_via_mge() + + convergence = 0.0 + + for i in range(len(sigmas)): + convergence += self.convergence_func_gaussian( + grid_radii=grid_radii, sigma=sigmas[i], intensity=amps[i] + ) + return convergence + + def convergence_func_gaussian(self, grid_radii, sigma, intensity): + return np.multiply( + intensity, np.exp(-0.5 * np.square(np.divide(grid_radii, sigma))) + ) + + def _deflections_2d_via_mge_from(self, grid, sigmas_factor=1.0): + axis_ratio = self.axis_ratio + + if axis_ratio > 0.9999: + axis_ratio = 0.9999 + + amps, sigmas = self.decompose_convergence_via_mge() + sigmas *= sigmas_factor + + angle = self.zeta_from( + grid=grid, amps=amps, sigmas=sigmas, axis_ratio=axis_ratio + ) + + angle *= np.sqrt((2.0 * np.pi) / (1.0 - axis_ratio**2.0)) + + return self.rotated_grid_from_reference_frame_from( + np.vstack((-angle.imag, angle.real)).T + ) diff --git a/autogalaxy/profiles/mass/stellar/sersic.py b/autogalaxy/profiles/mass/stellar/sersic.py index 0d0b8ec97..0366d6cdc 100644 --- a/autogalaxy/profiles/mass/stellar/sersic.py +++ b/autogalaxy/profiles/mass/stellar/sersic.py @@ -1,5 +1,13 @@ +import os + +if os.environ.get("USE_JAX", "0") == "1": + USING_JAX = True + import jax.numpy as np +else: + USING_JAX = False + import numpy as np + import copy -import numpy as np from scipy.integrate import quad from typing import List, Tuple From 3210f4f54a366b15ce1d81542fa7c78133780998 Mon Sep 17 00:00:00 2001 From: CKrawczyk Date: Wed, 18 Sep 2024 10:06:34 +0100 Subject: [PATCH 09/26] Update isothermal and power law profiles to play nice at (0, 0) Add small radial offset to these two profiles to remove the `nan` values at the center. For the power law profile use the expansion of the `hyp2f1` function given by Tessore and Metcalf 2015 (eqn 29). --- autogalaxy/profiles/mass/total/isothermal.py | 29 ++++++++---- autogalaxy/profiles/mass/total/jax_utils.py | 47 ++++++++++++++++++++ autogalaxy/profiles/mass/total/power_law.py | 29 +++++++++--- 3 files changed, 91 insertions(+), 14 deletions(-) create mode 100644 autogalaxy/profiles/mass/total/jax_utils.py diff --git a/autogalaxy/profiles/mass/total/isothermal.py b/autogalaxy/profiles/mass/total/isothermal.py index e9a9ce41e..734330ebf 100644 --- a/autogalaxy/profiles/mass/total/isothermal.py +++ b/autogalaxy/profiles/mass/total/isothermal.py @@ -1,4 +1,12 @@ -import numpy as np +import os + +if os.environ.get("USE_JAX", "0") == "1": + USING_JAX = True + import jax.numpy as np +else: + USING_JAX = False + import numpy as np + from typing import Tuple import autoarray as aa @@ -30,14 +38,19 @@ def psi_from(grid, axis_ratio, core_radius): The value of the Psi term. """ - return np.sqrt( - np.add( - np.multiply( - axis_ratio**2.0, np.add(np.square(grid[:, 1]), core_radius**2.0) - ), - np.square(grid[:, 0]), + if USING_JAX: + return np.sqrt( + (axis_ratio**2.0 * (grid[:, 1]**2.0 + core_radius**2.0)) + grid[:, 0]**2.0 + 1e-16 + ) + else: + return np.sqrt( + np.add( + np.multiply( + axis_ratio**2.0, np.add(np.square(grid[:, 1]), core_radius**2.0) + ), + np.square(grid[:, 0]), + ) ) - ) class Isothermal(PowerLaw): diff --git a/autogalaxy/profiles/mass/total/jax_utils.py b/autogalaxy/profiles/mass/total/jax_utils.py new file mode 100644 index 000000000..42fa0026c --- /dev/null +++ b/autogalaxy/profiles/mass/total/jax_utils.py @@ -0,0 +1,47 @@ +import jax +import jax.numpy as jnp +from jax.tree_util import Partial as partial + + +# A version of scan that will *not* re-compile partial functions when variables change +# taken from https://github.com/google/jax/issues/14743#issuecomment-1456900634 +scan = jax.jit(jax.lax.scan, static_argnames=('length', 'reverse', 'unroll')) + + +def body_fun(carry, n, factor, ei2phi, slope): + omega_nm1, partial_sum = carry + two_n = 2 * n + two_minus_slope = 2 - slope + ratio = (two_n - two_minus_slope) / (two_n + two_minus_slope) + omega_n = -factor * ratio * ei2phi * omega_nm1 + partial_sum = partial_sum + omega_n + return (omega_n, partial_sum), None + + +def omega(eiphi, slope, factor, n_terms=20): + '''JAX implementation of the numerical evaluation of the angular component of + the complex deflection angle for the elliptical power law profile as given as + given by Tessore and Metcalf 2015. Based on equation 29, and gives + omega (e.g. can be used as a drop in replacement for the exp(i * phi) * special.hyp2f1 + term in equation 13). + + Parameters + ---------- + eiphi: + `exp(i * phi)` where `phi` is the elliptical angle of the profile + slope: + The density slope of the power-law (lower value -> shallower profile, higher value + -> steeper profile). + factor: + The second flattening of and ellipse with axis ration q give by `f = (1 - q) / (1 + q)` + n_terms: + The number of terms to calculate for the series expansion, defaults to 20 (this should + be sufficient most of the time) + ''' + # use modified scan with a partial'ed function to avoid re-compile + (_, partial_sum), _ = scan( + partial(body_fun, factor=factor, ei2phi=eiphi**2, slope=slope), + (eiphi, eiphi), + jnp.arange(1, n_terms) + ) + return partial_sum diff --git a/autogalaxy/profiles/mass/total/power_law.py b/autogalaxy/profiles/mass/total/power_law.py index 9fc619e15..99404cfaf 100644 --- a/autogalaxy/profiles/mass/total/power_law.py +++ b/autogalaxy/profiles/mass/total/power_law.py @@ -1,4 +1,13 @@ -import numpy as np +import os + +if os.environ.get("USE_JAX", "0") == "1": + USING_JAX = True + import jax.numpy as np + from .jax_utils import omega +else: + USING_JAX = False + import numpy as np + from scipy import special from typing import Tuple @@ -79,20 +88,28 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): angle = np.arctan2( grid[:, 0], np.multiply(self.axis_ratio, grid[:, 1]) ) # Note, this angle is not the position angle - R = np.sqrt( - np.add(np.multiply(self.axis_ratio**2, grid[:, 1] ** 2), grid[:, 0] ** 2) - ) z = np.add( np.multiply(np.cos(angle), 1 + 0j), np.multiply(np.sin(angle), 0 + 1j) ) + + if USING_JAX: + # offset radius so calculation is finite at (0, 0) + R = np.sqrt( + (self.axis_ratio * grid[:, 1])**2 + grid[:, 0]**2 + 1e-16 + ) + zh = omega(z, slope, factor, n_terms=20) + else: + R = np.sqrt( + np.add(np.multiply(self.axis_ratio**2, grid[:, 1] ** 2), grid[:, 0] ** 2) + ) + zh = z * special.hyp2f1(1.0, 0.5 * slope, 2.0 - 0.5 * slope, -factor * z**2) complex_angle = ( 2.0 * b / (1.0 + self.axis_ratio) * (b / R) ** (slope - 1.0) - * z - * special.hyp2f1(1.0, 0.5 * slope, 2.0 - 0.5 * slope, -factor * z**2) + * zh ) deflection_y = complex_angle.imag From 32e491c97cdcc4498bbc97b03105d1b2f81bb304 Mon Sep 17 00:00:00 2001 From: CKrawczyk Date: Thu, 3 Oct 2024 10:33:13 +0100 Subject: [PATCH 10/26] Small fixes --- .../profiles/mass/abstract/jax_utils.py | 12 +++++------ autogalaxy/profiles/mass/abstract/mge_jax.py | 19 +++++++++--------- autogalaxy/profiles/mass/stellar/sersic.py | 20 +++++++++---------- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/autogalaxy/profiles/mass/abstract/jax_utils.py b/autogalaxy/profiles/mass/abstract/jax_utils.py index 19e9d8caf..735342efc 100644 --- a/autogalaxy/profiles/mass/abstract/jax_utils.py +++ b/autogalaxy/profiles/mass/abstract/jax_utils.py @@ -3,7 +3,7 @@ import numpy as np from jax import custom_jvp -from jax.scipy.special import gammaln +from functools import partial def reg1(z, _, i_sqrt_pi): @@ -111,9 +111,7 @@ def w_f_approx_jvp(primals, tangents): return primal_out, tangent_out -def comb(x: int, y: int) -> int: - # use the gamma function definition as that is the only - # JAX friendly way to do this (internally the factorial function - # uses this method as well). Round to closest int at the end of the - # calculation as we only use this for int inputs anyways. - return jnp.exp(gammaln(x + 1) - gammaln(y + 1) - gammaln(x - y + 1)).round(1) +@partial(jax.jit, static_argnums=(0,)) +def all_comb(n): + i = jnp.arange(1, n, 1) + return jnp.cumprod((n + 1 - i) / i) diff --git a/autogalaxy/profiles/mass/abstract/mge_jax.py b/autogalaxy/profiles/mass/abstract/mge_jax.py index e24facbd3..a98452582 100644 --- a/autogalaxy/profiles/mass/abstract/mge_jax.py +++ b/autogalaxy/profiles/mass/abstract/mge_jax.py @@ -1,7 +1,8 @@ import jax.numpy as np import jax +import numpy as base_np -from .jax_utils import w_f_approx, comb +from .jax_utils import w_f_approx, all_comb class MassProfileMGE: @@ -63,12 +64,10 @@ def eta(p): see Eq.(6) of 1906.00263 """ - def body_kesi(carry, i): - carry = carry + 2**-p * comb(p, i) - return carry, carry - + i = np.arange(1, p, 1) kesi_last = 1/2**p - _, k = jax.lax.scan(body_kesi, kesi_last, np.arange(1, p, 1)) + k = kesi_last + np.cumsum(np.cumprod((p + 1 - i) / i) * kesi_last) + kesi_list = np.hstack([ np.array([0.5]), np.ones(p), @@ -121,7 +120,7 @@ def _decompose_convergence_via_mge( def convergence_2d_via_mge_from(self, grid_radii): raise NotImplementedError() - def _convergence_2d_via_mge_from(self, grid_radii): + def _convergence_2d_via_mge_from(self, grid_radii, func_terms=28, func_gaussians=20): """Calculate the projected convergence at a given set of arc-second gridded coordinates. Parameters @@ -130,7 +129,7 @@ def _convergence_2d_via_mge_from(self, grid_radii): The grid of (y,x) arc-second coordinates the convergence is computed on. """ - amps, sigmas = self.decompose_convergence_via_mge() + amps, sigmas = self.decompose_convergence_via_mge(func_terms=func_terms, func_gaussians=func_gaussians) convergence = 0.0 @@ -139,10 +138,10 @@ def _convergence_2d_via_mge_from(self, grid_radii): convergence = amps_ * np.exp(-0.5 * (grid_radii.array * inv_sigma_)**2) return convergence.sum(axis=0) - def _deflections_2d_via_mge_from(self, grid, sigmas_factor=1.0): + def _deflections_2d_via_mge_from(self, grid, sigmas_factor=1.0, func_terms=28, func_gaussians=20): axis_ratio = np.min(np.array([self.axis_ratio, 0.9999])) - amps, sigmas = self.decompose_convergence_via_mge() + amps, sigmas = self.decompose_convergence_via_mge(func_terms=func_terms, func_gaussians=func_gaussians) sigmas *= sigmas_factor angle = self.zeta_from( diff --git a/autogalaxy/profiles/mass/stellar/sersic.py b/autogalaxy/profiles/mass/stellar/sersic.py index 0366d6cdc..548a5166c 100644 --- a/autogalaxy/profiles/mass/stellar/sersic.py +++ b/autogalaxy/profiles/mass/stellar/sersic.py @@ -138,7 +138,7 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform @aa.grid_dec.relocate_to_radial_minimum - def deflections_2d_via_mge_from(self, grid: aa.type.Grid2DLike, **kwargs): + def deflections_2d_via_mge_from(self, grid: aa.type.Grid2DLike, func_terms=28, func_gaussians=20, **kwargs): """ Calculate the projected 2D deflection angles from a grid of (y,x) arc second coordinates, by computing and summing the convergence of each individual cse used to decompose the mass profile. @@ -153,7 +153,7 @@ def deflections_2d_via_mge_from(self, grid: aa.type.Grid2DLike, **kwargs): The grid of (y,x) arc-second coordinates the convergence is computed on. """ return self._deflections_2d_via_mge_from( - grid=grid, sigmas_factor=np.sqrt(self.axis_ratio) + grid=grid, sigmas_factor=np.sqrt(self.axis_ratio), func_terms=func_terms, func_gaussians=func_gaussians, ) @aa.grid_dec.to_vector_yx @@ -196,7 +196,7 @@ def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_array @aa.grid_dec.transform @aa.grid_dec.relocate_to_radial_minimum - def convergence_2d_via_mge_from(self, grid: aa.type.Grid2DLike, **kwargs): + def convergence_2d_via_mge_from(self, grid: aa.type.Grid2DLike, func_terms=28, func_gaussians=20, **kwargs): """ Calculate the projected convergence at a given set of arc-second gridded coordinates. @@ -209,7 +209,7 @@ def convergence_2d_via_mge_from(self, grid: aa.type.Grid2DLike, **kwargs): eccentric_radii = self.eccentric_radii_grid_from(grid=grid, **kwargs) - return self._convergence_2d_via_mge_from(grid_radii=eccentric_radii) + return self._convergence_2d_via_mge_from(grid_radii=eccentric_radii, func_terms=func_terms, func_gaussians=func_gaussians) @aa.over_sample @aa.grid_dec.to_array @@ -255,7 +255,7 @@ def image_2d_via_radii_from(self, radius: np.ndarray): * (((radius / self.effective_radius) ** (1.0 / self.sersic_index)) - 1) ) - def decompose_convergence_via_mge(self) -> Tuple[List, List]: + def decompose_convergence_via_mge(self, func_terms=28, func_gaussians=20) -> Tuple[List, List]: radii_min = self.effective_radius / 100.0 radii_max = self.effective_radius * 20.0 @@ -270,7 +270,7 @@ def sersic_2d(r): ) return self._decompose_convergence_via_mge( - func=sersic_2d, radii_min=radii_min, radii_max=radii_max + func=sersic_2d, radii_min=radii_min, radii_max=radii_max, func_terms=func_terms, func_gaussians=func_gaussians ) def decompose_convergence_via_cse( @@ -382,10 +382,10 @@ def deflections_2d_via_integral_from(self, grid: aa.type.Grid2DLike, **kwargs): def calculate_deflection_component(npow, index): sersic_constant = self.sersic_constant - deflection_grid = self.axis_ratio * grid[:, index] + deflection_grid = self.axis_ratio * grid.array[:, index] for i in range(grid.shape[0]): - deflection_grid[i] *= ( + deflection_grid = deflection_grid.at[i].multiply( self.intensity * self.mass_to_light_ratio * quad( @@ -393,8 +393,8 @@ def calculate_deflection_component(npow, index): a=0.0, b=1.0, args=( - grid[i, 0], - grid[i, 1], + grid.array[i, 0], + grid.array[i, 1], npow, self.axis_ratio, self.sersic_index, From 68d3371df290904e0a390b41e84189d67e3f99d3 Mon Sep 17 00:00:00 2001 From: Coleman Krawczyk Date: Thu, 3 Oct 2024 10:55:53 +0100 Subject: [PATCH 11/26] Update mge_numpy.py Update doc (merge from jax_wrapper branch) --- autogalaxy/profiles/mass/abstract/mge_numpy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogalaxy/profiles/mass/abstract/mge_numpy.py b/autogalaxy/profiles/mass/abstract/mge_numpy.py index 24fb218ad..08fd0c50d 100644 --- a/autogalaxy/profiles/mass/abstract/mge_numpy.py +++ b/autogalaxy/profiles/mass/abstract/mge_numpy.py @@ -12,7 +12,7 @@ def w_f_approx(z): :rtype: ``complex`` # This function is copied from - # "https://github.com/sibirrer/lenstronomy/tree/master/lenstronomy/LensModel/Profiles" + # "https://github.com/sibirrer/lenstronomy/tree/main/lenstronomy/LensModel/Profiles" # written by Anowar J. Shajib (see 1906.08263) """ From f7600b3ed9513d67190850504d6994197ed53c4b Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Thu, 3 Oct 2024 13:20:00 +0100 Subject: [PATCH 12/26] removed preloads --- autogalaxy/__init__.py | 2 - autogalaxy/aggregator/agg_util.py | 98 -------- autogalaxy/aggregator/imaging/fit_imaging.py | 28 +-- .../interferometer/fit_interferometer.py | 28 +-- autogalaxy/analysis/analysis/analysis.py | 2 +- autogalaxy/analysis/analysis/dataset.py | 75 ------ autogalaxy/analysis/maker.py | 128 ----------- autogalaxy/analysis/preloads.py | 213 ------------------ autogalaxy/config/general.yaml | 6 +- autogalaxy/ellipse/model/analysis.py | 2 +- autogalaxy/galaxy/to_inversion.py | 11 - autogalaxy/imaging/fit_imaging.py | 48 ---- autogalaxy/imaging/model/analysis.py | 53 +---- .../interferometer/fit_interferometer.py | 49 ---- autogalaxy/interferometer/model/analysis.py | 54 +---- test_autogalaxy/analysis/test_preloads.py | 130 ----------- test_autogalaxy/config/general.yaml | 5 +- test_autogalaxy/config/visualize.yaml | 2 +- 18 files changed, 9 insertions(+), 925 deletions(-) delete mode 100644 autogalaxy/analysis/maker.py delete mode 100644 autogalaxy/analysis/preloads.py delete mode 100644 test_autogalaxy/analysis/test_preloads.py diff --git a/autogalaxy/__init__.py b/autogalaxy/__init__.py index 79d364721..26df5df98 100644 --- a/autogalaxy/__init__.py +++ b/autogalaxy/__init__.py @@ -52,8 +52,6 @@ from .analysis.adapt_images.adapt_images import AdaptImages from .analysis.adapt_images.adapt_image_maker import AdaptImageMaker -from .analysis.maker import FitMaker -from .analysis.preloads import Preloads from . import aggregator as agg from . import exc from . import plot diff --git a/autogalaxy/aggregator/agg_util.py b/autogalaxy/aggregator/agg_util.py index 58b818d3e..7aa79f708 100644 --- a/autogalaxy/aggregator/agg_util.py +++ b/autogalaxy/aggregator/agg_util.py @@ -69,101 +69,3 @@ def adapt_images_from( return adapt_images_list - -def mesh_grids_of_planes_list_from( - fit: af.Fit, total_fits: int, use_preloaded_grid: bool -) -> List[Optional[aa.Grid2D]]: - """ - Returns the image-plane pixelization grid(s) used by the fit. - - A subset of image-mesh objects (e.g. `Hilbert`, `KMeans`) create the grid of points that act as the mesh - centres (e.g. the centers of Voronoi cells) in the image-plane. For lensing calculations this may then be - traced to the source-plane to form the pixelization. - - This calculation can depend on the library used to determine the image-plane grid and may have a random element - associated with it. This means that performing an analysis on a super computer and then downloading the results - for inspection on your laptop may produce different image-plane grids, changing the result and quantities like - the `log_likelihood`. - - By storing this grid as a result in the `files` folder and loading it via the database before creating a fit - this possible mismatch is removed, ensuring results on a local computer are identical to those computer elsewhere. - - Parameters - ---------- - fit - A `PyAutoFit` `Fit` object which contains the results of a model-fit as an entry in a sqlite database. - total_fits - The total number of `Analysis` objects summed to create the fit. - use_preloaded_grid - Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This grid - may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is used - as the fit. - - Returns - ------- - The list of image-plane mesh centres used when creating the overall fit. - """ - - if use_preloaded_grid: - if not fit.children: - return [fit.value(name="preload_mesh_grids_of_planes")] - else: - try: - return fit.child_values(name="preload_mesh_grids_of_planes") - except AttributeError: - return [None] * total_fits - else: - return [None] * total_fits - - -def preloads_from( - preloads_cls, - use_preloaded_grid: bool, - mesh_grids_of_planes: List, - use_w_tilde: Optional[bool] = False, -) -> aa.Preloads: - """ - Returns a `Preloads` object associated with a fit loaded via the database. - - When loading results via the database, the preloads class may have certain attributes associated with it - in order to perform the fit. The main purpose is to use the same image-plane mesh centres for pixelization where - the mesh is computed in the image-plane (see `agg_util.mesh_grids_of_planes_list_from`). - - The preloads may also switch off `w_tilde` so fits are computed faster locally as they do not need to recompute - w_tilde. - - Parameters - ---------- - preloads_cls - The `Preloads` object used to create the preloads (this varies across - projects like `autogalaxy` and `autolens`). - use_preloaded_grid - Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This grid - may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is used - as the fit. - mesh_grids_of_planes - The list of image-plane mesh centres used when creating the overall fit which are associated with the - preloads. - use_w_tilde - Whether to use the w-tilde formalism when recomputing fits. - - Returns - ------- - The preloads object associated with the fit loaded via the database. - """ - preloads = preloads_cls() - - if use_preloaded_grid: - if mesh_grids_of_planes is not None: - preloads = preloads_cls( - image_plane_mesh_grid_pg_list=mesh_grids_of_planes, - use_w_tilde=use_w_tilde, - ) - - if len(preloads.image_plane_mesh_grid_pg_list) == 2: - if type(preloads.image_plane_mesh_grid_pg_list[1]) != list: - preloads.image_plane_mesh_grid_pg_list[1] = [ - preloads.image_plane_mesh_grid_pg_list[1] - ] - - return preloads diff --git a/autogalaxy/aggregator/imaging/fit_imaging.py b/autogalaxy/aggregator/imaging/fit_imaging.py index e805df1ee..8ba62ae73 100644 --- a/autogalaxy/aggregator/imaging/fit_imaging.py +++ b/autogalaxy/aggregator/imaging/fit_imaging.py @@ -7,8 +7,6 @@ import autofit as af import autoarray as aa -from autogalaxy.analysis.preloads import Preloads - from autogalaxy.aggregator.imaging.imaging import _imaging_from from autogalaxy.aggregator.galaxies import _galaxies_from from autogalaxy.aggregator.dataset_model import _dataset_model_from @@ -19,7 +17,6 @@ def _fit_imaging_from( fit: af.Fit, instance: Optional[af.ModelInstance] = None, settings_inversion: aa.SettingsInversion = None, - use_preloaded_grid: bool = True, ) -> List[FitImaging]: """ Returns a list of `FitImaging` objects from a `PyAutoFit` sqlite database `Fit` object. @@ -51,10 +48,6 @@ def _fit_imaging_from( randomly from the PDF). settings_inversion Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit. - use_preloaded_grid - Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This grid - may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is used - as the fit. """ from autogalaxy.imaging.fit_imaging import FitImaging @@ -69,25 +62,14 @@ def _fit_imaging_from( settings_inversion = settings_inversion or fit.value(name="settings_inversion") - mesh_grids_of_planes_list = agg_util.mesh_grids_of_planes_list_from( - fit=fit, total_fits=len(dataset_list), use_preloaded_grid=use_preloaded_grid - ) - fit_dataset_list = [] - for dataset, galaxies, dataset_model, adapt_images, mesh_grids_of_planes in zip( + for dataset, galaxies, dataset_model, adapt_images in zip( dataset_list, galaxies_list, dataset_model_list, adapt_images_list, - mesh_grids_of_planes_list, ): - preloads = agg_util.preloads_from( - preloads_cls=Preloads, - use_preloaded_grid=use_preloaded_grid, - mesh_grids_of_planes=mesh_grids_of_planes, - use_w_tilde=False, - ) fit_dataset_list.append( FitImaging( @@ -96,7 +78,6 @@ def _fit_imaging_from( dataset_model=dataset_model, adapt_images=adapt_images, settings_inversion=settings_inversion, - preloads=preloads, ) ) @@ -108,7 +89,6 @@ def __init__( self, aggregator: af.Aggregator, settings_inversion: Optional[aa.SettingsInversion] = None, - use_preloaded_grid: bool = True, ): """ Interfaces with an `PyAutoFit` aggregator object to create instances of `FitImaging` objects from the results @@ -142,15 +122,10 @@ def __init__( A `PyAutoFit` aggregator object which can load the results of model-fits. settings_inversion Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit. - use_preloaded_grid - Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This - grid may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is - used as the fit. """ super().__init__(aggregator=aggregator) self.settings_inversion = settings_inversion - self.use_preloaded_grid = use_preloaded_grid def object_via_gen_from( self, fit, instance: Optional[af.ModelInstance] = None @@ -172,5 +147,4 @@ def object_via_gen_from( fit=fit, instance=instance, settings_inversion=self.settings_inversion, - use_preloaded_grid=self.use_preloaded_grid, ) diff --git a/autogalaxy/aggregator/interferometer/fit_interferometer.py b/autogalaxy/aggregator/interferometer/fit_interferometer.py index 316e3aac4..5e395927b 100644 --- a/autogalaxy/aggregator/interferometer/fit_interferometer.py +++ b/autogalaxy/aggregator/interferometer/fit_interferometer.py @@ -7,8 +7,6 @@ import autofit as af import autoarray as aa -from autogalaxy.analysis.preloads import Preloads - from autogalaxy.aggregator import agg_util from autogalaxy.aggregator.interferometer.interferometer import _interferometer_from from autogalaxy.aggregator.dataset_model import _dataset_model_from @@ -20,7 +18,6 @@ def _fit_interferometer_from( instance: Optional[af.ModelInstance] = None, real_space_mask: Optional[aa.Mask2D] = None, settings_inversion: aa.SettingsInversion = None, - use_preloaded_grid: bool = True, ) -> List[FitInterferometer]: """ Returns a list of `FitInterferometer` objects from a `PyAutoFit` sqlite database `Fit` object. @@ -53,10 +50,6 @@ def _fit_interferometer_from( randomly from the PDF). settings_inversion Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit. - use_preloaded_grid - Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This grid - may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is used - as the fit. """ from autogalaxy.interferometer.fit_interferometer import FitInterferometer @@ -73,25 +66,14 @@ def _fit_interferometer_from( settings_inversion = settings_inversion or fit.value(name="settings_inversion") - mesh_grids_of_planes_list = agg_util.mesh_grids_of_planes_list_from( - fit=fit, total_fits=len(dataset_list), use_preloaded_grid=use_preloaded_grid - ) - fit_dataset_list = [] - for dataset, galaxies, dataset_model, adapt_images, mesh_grids_of_planes in zip( + for dataset, galaxies, dataset_model, adapt_images in zip( dataset_list, galaxies_list, dataset_model_list, adapt_images_list, - mesh_grids_of_planes_list, ): - preloads = agg_util.preloads_from( - preloads_cls=Preloads, - use_preloaded_grid=use_preloaded_grid, - mesh_grids_of_planes=mesh_grids_of_planes, - use_w_tilde=False, - ) fit_dataset_list.append( FitInterferometer( @@ -100,7 +82,6 @@ def _fit_interferometer_from( dataset_model=dataset_model, adapt_images=adapt_images, settings_inversion=settings_inversion, - preloads=preloads, ) ) @@ -112,7 +93,6 @@ def __init__( self, aggregator: af.Aggregator, settings_inversion: Optional[aa.SettingsInversion] = None, - use_preloaded_grid: bool = True, real_space_mask: Optional[aa.Mask2D] = None, ): """ @@ -147,15 +127,10 @@ def __init__( A `PyAutoFit` aggregator object which can load the results of model-fits. settings_inversion Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit. - use_preloaded_grid - Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This - grid may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is - used as the fit. """ super().__init__(aggregator=aggregator) self.settings_inversion = settings_inversion - self.use_preloaded_grid = use_preloaded_grid self.real_space_mask = real_space_mask def object_via_gen_from( @@ -178,5 +153,4 @@ def object_via_gen_from( fit=fit, instance=instance, settings_inversion=self.settings_inversion, - use_preloaded_grid=self.use_preloaded_grid, ) diff --git a/autogalaxy/analysis/analysis/analysis.py b/autogalaxy/analysis/analysis/analysis.py index f084d1f13..8449494eb 100644 --- a/autogalaxy/analysis/analysis/analysis.py +++ b/autogalaxy/analysis/analysis/analysis.py @@ -138,7 +138,7 @@ def profile_log_likelihood_function( An `info_dict` is also created which stores information on aspects of the model and dataset that dictate run times, so the profiled times can be interpreted with this context. - The results of this profiling are then output to hard-disk in the `preloads` folder of the model-fit results, + The results of this profiling are then output to hard-disk in the `prefiling` folder of the model-fit results, which they can be inspected to ensure run-times are as expected. Parameters diff --git a/autogalaxy/analysis/analysis/dataset.py b/autogalaxy/analysis/analysis/dataset.py index da8a35714..ac5e957e0 100644 --- a/autogalaxy/analysis/analysis/dataset.py +++ b/autogalaxy/analysis/analysis/dataset.py @@ -1,17 +1,13 @@ import copy import logging from typing import Optional, Union -import os -from autoconf import conf from autoconf.dictable import to_dict, output_to_json import autofit as af import autoarray as aa from autogalaxy.analysis.adapt_images.adapt_image_maker import AdaptImageMaker from autogalaxy.analysis.adapt_images.adapt_images import AdaptImages -from autogalaxy.analysis.maker import FitMaker -from autogalaxy.analysis.preloads import Preloads from autogalaxy.cosmology.lensing import LensingCosmology from autogalaxy.cosmology.wrap import Planck15 from autogalaxy.analysis.analysis.analysis import Analysis @@ -62,18 +58,8 @@ def __init__( self.settings_inversion = settings_inversion or aa.SettingsInversion() - self.preloads = self.preloads_cls() - self.title_prefix = title_prefix - @property - def preloads_cls(self): - return Preloads - - @property - def fit_maker_cls(self): - return FitMaker - @property def adapt_images(self): if self._adapt_images is not None: @@ -82,67 +68,6 @@ def adapt_images(self): if self.adapt_image_maker is not None: return self.adapt_image_maker.adapt_images - def set_preloads(self, paths: af.DirectoryPaths, model: af.Collection): - """ - It is common for the model to have components whose parameters are all fixed, and thus the way that component - fits the data does not change. For example, if all parameter associated with the light profiles of galaxies - in the model are fixed, the image generated from these galaxies will not change irrespective of the model - parameters chosen by the non-linear search. - - Preloading exploits this to speed up the log likelihood function, by inspecting the model and storing in memory - quantities that do not change. For the example above, the image of all galaxies would be stored in memory and - to perform every fit in the `log_likelihood_funtion`. - - This function sets up all preload quantities, which are described fully in the `preloads` modules. This - occurs directly before the non-linear search begins, to ensure the model parameterization is fixed. - - Parameters - ---------- - paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, - visualization and the pickled objects used by the aggregator output by this function. - model - The PyAutoFit model object, which includes model components representing the galaxies that are fitted to - the imaging data. - """ - - logger.info( - "PRELOADS - Setting up preloads, may take a few minutes for fits using an inversion." - ) - - self.preloads = self.preloads_cls() - - settings_inversion_original = copy.copy(self.settings_inversion) - - self.settings_inversion.image_mesh_min_mesh_pixels_per_pixel = None - self.settings_inversion.image_mesh_adapt_background_percent_threshold = None - - fit_maker = self.fit_maker_cls(model=model, fit_from=self.fit_from) - - fit_0 = fit_maker.fit_via_model_from(unit_value=0.45) - fit_1 = fit_maker.fit_via_model_from(unit_value=0.55) - - if fit_0 is None or fit_1 is None: - self.preloads = self.preloads_cls(failed=True) - - self.settings_inversion = settings_inversion_original - - else: - self.preloads = self.preloads_cls.setup_all_via_fits( - fit_0=fit_0, fit_1=fit_1 - ) - - if conf.instance["general"]["test"]["check_preloads"]: - self.preloads.check_via_fit(fit=fit_0) - - self.settings_inversion = settings_inversion_original - - if isinstance(paths, af.DatabasePaths): - return - - os.makedirs(paths.profile_path, exist_ok=True) - self.preloads.output_info_to_summary(file_path=paths.profile_path) - def save_attributes(self, paths: af.DirectoryPaths): """ Before the model-fit via the non-linear search begins, this routine saves attributes of the `Analysis` object diff --git a/autogalaxy/analysis/maker.py b/autogalaxy/analysis/maker.py deleted file mode 100644 index 154042ee9..000000000 --- a/autogalaxy/analysis/maker.py +++ /dev/null @@ -1,128 +0,0 @@ -import logging -from typing import Callable, Union - -import autoarray as aa -import autofit as af -from autoconf import conf -from autofit.exc import PriorLimitException -from autogalaxy.analysis.preloads import Preloads - -logger = logging.getLogger(__name__) - -logger.setLevel(level="INFO") - - -class FitMaker: - def __init__(self, model: af.Collection, fit_from: Callable): - """ - Makes fits using an input PyAutoFit `model`, where the parameters of the model are drawn from its prior. This - uses an input `fit_from`, which given an `instance` of the model creates the fit object. - - This is used for implicit preloading in the `Analysis` classes, whereby the created fits are compared against - one another to determine whether certain components of the analysis can be preloaded. - - This includes functionality for creating the fit via the model in different ways, so that if certain - models are ill-defined another is used instead. - - Parameters - ---------- - model - A **PyAutoFit** model object which via its parameters and their priors can created instances of the model. - fit_from - A function which given the instance of the model creates a `Fit` object. - """ - - self.model = model - self.fit_from = fit_from - - @property - def preloads_cls(self): - return Preloads - - def fit_via_model_from( - self, unit_value: float - ) -> Union[aa.FitImaging, aa.FitInterferometer]: - """ - Create a fit via the model. - - This first tries to compute the fit from the input `unit_value`, where the `unit_value` defines unit hyper - cube values of each parameter's prior in the model, used to map each value to physical values for the fit. - - If this model fit produces an `Exception` because the parameter combination does not fit the data accurately, - a sequence of random fits are instead used into an exception is not returned. However, if the number - of `preload_attempts` defined in the configuration files is exceeded a None is returned. - - Parameters - ---------- - unit_value - The unit hyper cube values of each parameter's prior in the model, used to map each value to physical - values for the fit. - - Returns - ------- - fit - A fit object where an instance of the model has been fitted to the data. - """ - try: - try: - return self.fit_unit_instance_from(unit_value=unit_value) - except IndexError as e: - raise Exception from e - except (Exception, PriorLimitException): - return self.fit_random_instance_from() - - def fit_unit_instance_from( - self, unit_value: float - ) -> Union[aa.FitImaging, aa.FitInterferometer]: - """ - Create a fit via the model using an input `unit_value`, where the `unit_value` defines unit hyper - cube values of each parameter's prior in the model, used to map each value to physical values for the fit. - - Parameters - ---------- - unit_value - The unit hyper cube values of each parameter's prior in the model, used to map each value to physical - values for the fit. - - Returns - ------- - fit - A fit object where an instance of the model has been fitted to the data. - """ - instance = self.model.instance_from_unit_vector( - unit_vector=[unit_value] * self.model.prior_count, ignore_prior_limits=True - ) - - fit = self.fit_from( - instance=instance, - ) - fit.figure_of_merit - return fit - - def fit_random_instance_from(self) -> Union[aa.FitImaging, aa.FitInterferometer]: - """ - Create a fit via the model by guessing a sequence of random fits until an exception is not returned. If - the number of `preload_attempts` defined in the configuration files is exceeded a None is returned. - - Returns - ------- - fit - A fit object where an instance of the model has been fitted to the data. - """ - - preload_attempts = conf.instance["general"]["analysis"]["preload_attempts"] - - for i in range(preload_attempts): - try: - instance = self.model.random_instance(ignore_prior_limits=True) - - fit = self.fit_from( - instance=instance, - ) - - fit.figure_of_merit - - return fit - - except Exception as e: - continue diff --git a/autogalaxy/analysis/preloads.py b/autogalaxy/analysis/preloads.py deleted file mode 100644 index b1d513e86..000000000 --- a/autogalaxy/analysis/preloads.py +++ /dev/null @@ -1,213 +0,0 @@ -import logging -import numpy as np -from os import path -from typing import Dict, Optional, List - -import autofit as af -import autoarray as aa - -logger = logging.getLogger(__name__) - -logger.setLevel(level="INFO") - - -class Preloads(aa.Preloads): - def __init__( - self, - w_tilde: Optional[aa.WTildeImaging] = None, - use_w_tilde: Optional[bool] = None, - blurred_image: Optional[aa.Array2D] = None, - image_plane_mesh_grid_pg_list: Optional[List[List[aa.Grid2D]]] = None, - relocated_grid: Optional[aa.Grid2D] = None, - mapper_list: Optional[aa.AbstractMapper] = None, - mapper_galaxy_dict: Optional[Dict[aa.AbstractMapper, "Galaxy"]] = None, - linear_func_operated_mapping_matrix_dict=None, - data_linear_func_matrix_dict=None, - mapper_operated_mapping_matrix_dict=None, - operated_mapping_matrix: Optional[np.ndarray] = None, - curvature_matrix: Optional[np.ndarray] = None, - regularization_matrix: Optional[np.ndarray] = None, - log_det_regularization_matrix_term: Optional[float] = None, - traced_mesh_grids_list_of_planes=None, - image_plane_mesh_grid_list=None, - failed=False, - ): - """ - Class which offers a concise API for settings up the preloads, which before a model-fit are set up via - a comparison of two fits using two different models. If a quantity in these two fits is identical, it does - not change thoughout the model-fit and can therefore be preloaded to avoid computation, speeding up - the analysis. - - For example, the image-plane source-plane pixelization grid (which may be computationally expensive to compute - via a KMeans algorithm) does not change for the majority of model-fits, because the associated model parameters - are fixed. Preloading avoids rerruning the KMeans algorithm for every model fitted, by preloading it in memory - and using this preload in every fit. - - Parameters - ---------- - blurred_image - The preloaded array of values containing the blurred image of a model fit (e.g. that light profile of - every galaxy in the model). This can be preloaded when no light profiles in the model vary. - w_tilde - A class containing values that enable an inversion's linear algebra to use the w-tilde formalism. This can - be preloaded when no component of the model changes the noise map (e.g. galaxies are fixed). - use_w_tilde - Whether to use the w tilde formalism, which superseeds the value in `SettingsInversions` such that w tilde - will be disabled for model-fits it is not applicable (e.g. because the noise-map changes). - traced_grids_of_planes_for_inversion - The two dimensional grids corresponding to the traced grids in a lens fit. This can be preloaded when no - mass profiles in the model vary. - image_plane_mesh_grid_pg_list - The two dimensional grids corresponding to the sparse image plane grids in a lens fit, that is ray-traced to - the source plane to form the source pixelization. This can be preloaded when no pixelizations in the model - vary. - relocated_grid - The two dimensional grids corresponding to the grid that has had its border pixels relocated for a - pixelization in a lens fit. This can be preloaded when no mass profiles in the model vary. - mapper_list - The mapper of a fit, which preloading avoids recalculation of the mapping matrix and image to source - pixel mappings. This can be preloaded when no pixelizations in the model vary. - operated_mapping_matrix - A matrix containing the mappings between PSF blurred image pixels and source pixels used in the linear - algebra of an inversion. This can be preloaded when no mass profiles and pixelizations in the model vary. - - Returns - ------- - The preloads object used to skip certain calculations in the log likelihood function. - """ - super().__init__( - w_tilde=w_tilde, - use_w_tilde=use_w_tilde, - relocated_grid=relocated_grid, - image_plane_mesh_grid_pg_list=image_plane_mesh_grid_pg_list, - mapper_list=mapper_list, - linear_func_operated_mapping_matrix_dict=linear_func_operated_mapping_matrix_dict, - data_linear_func_matrix_dict=data_linear_func_matrix_dict, - mapper_operated_mapping_matrix_dict=mapper_operated_mapping_matrix_dict, - operated_mapping_matrix=operated_mapping_matrix, - curvature_matrix=curvature_matrix, - regularization_matrix=regularization_matrix, - log_det_regularization_matrix_term=log_det_regularization_matrix_term, - traced_mesh_grids_list_of_planes=traced_mesh_grids_list_of_planes, - image_plane_mesh_grid_list=image_plane_mesh_grid_list, - ) - - self.mapper_galaxy_dict = mapper_galaxy_dict - self.blurred_image = blurred_image - self.failed = failed - - @classmethod - def setup_all_via_fits(cls, fit_0, fit_1) -> "Preloads": - """ - Setup the Preloads from two fits which use two different lens model of a model-fit. - - Parameters - ---------- - fit_0 - The first fit corresponding to a model with a specific set of unit-values. - fit_1 - The second fit corresponding to a model with a different set of unit-values. - - Returns - ------- - Preloads - Preloads which are set up based on the fit's passed in specific to a lens model. - - """ - - preloads = cls() - - if isinstance(fit_0, aa.FitImaging): - preloads.set_w_tilde_imaging(fit_0=fit_0, fit_1=fit_1) - preloads.set_blurred_image(fit_0=fit_0, fit_1=fit_1) - - preloads.set_mapper_list(fit_0=fit_0, fit_1=fit_1) - - if preloads.mapper_list is not None: - preloads.mapper_galaxy_dict = fit_0.galaxies_to_inversion.mapper_galaxy_dict - - preloads.set_operated_mapping_matrix_with_preloads(fit_0=fit_0, fit_1=fit_1) - preloads.set_linear_func_inversion_dicts(fit_0=fit_0, fit_1=fit_1) - preloads.set_curvature_matrix(fit_0=fit_0, fit_1=fit_1) - preloads.set_regularization_matrix_and_term(fit_0=fit_0, fit_1=fit_1) - - return preloads - - def set_blurred_image(self, fit_0, fit_1): - """ - If the `LightProfile`'s in a model are all fixed parameters their corresponding image and therefore PSF blurred - image do not change during the model fit and can therefore be preloaded. - - This function compares the blurred image of two fit's corresponding to two model instances, and preloads - the blurred image if the blurred image of both fits are the same. - - The preload is typically used though out search chaining pipelines, as it is common to fix the lens light for - the majority of model-fits. - - Parameters - ---------- - fit_0 - The first fit corresponding to a model with a specific set of unit-values. - fit_1 - The second fit corresponding to a model with a different set of unit-values. - """ - self.blurred_image = None - - precision = 1e-8 - - if (np.max(abs(fit_0.blurred_image - fit_1.blurred_image)) < precision) and ( - np.sum(fit_0.blurred_image) > precision - ): - self.blurred_image = fit_0.blurred_image - - logger.info( - "PRELOADS - Blurred image (e.g. the image of all light profiles) is preloaded for this model-fit." - ) - - def output_info_to_summary(self, file_path): - file_preloads = path.join(file_path, "preloads.summary") - - if self.failed: - logger.info( - "PRELOADS - Preloading failed as models gave too many exceptions, preloading therefore " - "not used." - ) - - af.formatter.output_list_of_strings_to_file( - file=file_preloads, list_of_strings=["FAILED"] - ) - - else: - af.formatter.output_list_of_strings_to_file( - file=file_preloads, list_of_strings=self.info - ) - - @property - def info(self) -> List[str]: - """ - The information on what has or has not been preloaded, which is written to the file `preloads.summary`. - - Returns - ------- - A list of strings containing True and False values as to whether a quantity has been preloaded. - """ - line = [f"W Tilde = {self.w_tilde is not None}\n"] - line += [f"Use W Tilde = {self.use_w_tilde}\n\n"] - line += [f"Blurred Image = {np.count_nonzero(self.blurred_image) != 0}\n"] - line += [f"Mapper = {self.mapper_list is not None}\n"] - line += [ - f"Blurred Mapping Matrix = {self.operated_mapping_matrix is not None}\n" - ] - line += [ - f"Inversion Linear Func (Linear Light Profile) Dicts = {self.linear_func_operated_mapping_matrix_dict is not None}\n" - ] - line += [f"Curvature Matrix = {self.curvature_matrix is not None}\n"] - line += [ - f"Curvature Matrix Mapper Diag = {self.curvature_matrix_mapper_diag is not None}\n" - ] - line += [f"Regularization Matrix = {self.regularization_matrix is not None}\n"] - line += [ - f"Log Det Regularization Matrix Term = {self.log_det_regularization_matrix_term is not None}\n" - ] - - return line diff --git a/autogalaxy/config/general.yaml b/autogalaxy/config/general.yaml index 61f8b09a0..361abe732 100644 --- a/autogalaxy/config/general.yaml +++ b/autogalaxy/config/general.yaml @@ -1,5 +1,3 @@ -analysis: - preload_attempts: 250 fits: flip_for_ds9: true grid: @@ -11,6 +9,4 @@ inversion: use_border_relocator: true # If True, by default a pixelization's border is used to relocate all pixels outside its border to the border. test: check_likelihood_function: true # if True, when a search is resumed the likelihood of a previous sample is recalculated to ensure it is consistent with the previous run. - check_preloads: false - exception_override: false - preloads_check_threshold: 1.0 # If the figure of merit of a fit with and without preloads is greater than this threshold, the check preload test fails and an exception raised for a model-fit. + exception_override: false \ No newline at end of file diff --git a/autogalaxy/ellipse/model/analysis.py b/autogalaxy/ellipse/model/analysis.py index cd51e9a55..07f92f41c 100644 --- a/autogalaxy/ellipse/model/analysis.py +++ b/autogalaxy/ellipse/model/analysis.py @@ -217,7 +217,7 @@ def profile_log_likelihood_function( An `info_dict` is also created which stores information on aspects of the model and dataset that dictate run times, so the profiled times can be interpreted with this context. - The results of this profiling are then output to hard-disk in the `preloads` folder of the model-fit results, + The results of this profiling are then output to hard-disk in the `profiling` folder of the model-fit results, which they can be inspected to ensure run-times are as expected. Parameters diff --git a/autogalaxy/galaxy/to_inversion.py b/autogalaxy/galaxy/to_inversion.py index 669d62f9d..76d233ed7 100644 --- a/autogalaxy/galaxy/to_inversion.py +++ b/autogalaxy/galaxy/to_inversion.py @@ -15,7 +15,6 @@ from autogalaxy.profiles.light.linear import LightProfileLinear from autogalaxy.galaxy.galaxy import Galaxy from autogalaxy.galaxy.galaxies import Galaxies -from autogalaxy.analysis.preloads import Preloads class AbstractToInversion: @@ -24,7 +23,6 @@ def __init__( dataset: Optional[Union[aa.Imaging, aa.Interferometer, aa.DatasetInterface]], adapt_images: Optional[AdaptImages] = None, settings_inversion: aa.SettingsInversion = aa.SettingsInversion(), - preloads=Preloads(), run_time_dict: Optional[Dict] = None, ): """ @@ -59,8 +57,6 @@ def __init__( the pixelization's pixels to the brightest regions of the image. settings_inversion The settings of the inversion, which controls how the linear algebra calculation is performed. - preloads - Preloads of the inversion, which are used to speed up the linear algebra calculation. run_time_dict A dictionary of run-time values used to compute the inversion, for example the noise-map normalization. """ @@ -82,7 +78,6 @@ def __init__( self.settings_inversion = settings_inversion - self.preloads = preloads self.run_time_dict = run_time_dict @property @@ -198,7 +193,6 @@ def __init__( galaxies: List[Galaxy], adapt_images: Optional[AdaptImages] = None, settings_inversion: aa.SettingsInversion = aa.SettingsInversion(), - preloads=aa.Preloads(), run_time_dict: Optional[Dict] = None, ): """ @@ -234,8 +228,6 @@ def __init__( the pixelization's pixels to the brightest regions of the image. settings_inversion The settings of the inversion, which controls how the linear algebra calculation is performed. - preloads - Preloads of the inversion, which are used to speed up the linear algebra calculation. run_time_dict A dictionary of run-time values used to compute the inversion, for example the noise-map normalization. """ @@ -245,7 +237,6 @@ def __init__( dataset=dataset, adapt_images=adapt_images, settings_inversion=settings_inversion, - preloads=preloads, run_time_dict=run_time_dict, ) @@ -500,7 +491,6 @@ def mapper_from( source_plane_mesh_grid=source_plane_mesh_grid, image_plane_mesh_grid=image_plane_mesh_grid, adapt_data=adapt_galaxy_image, - preloads=self.preloads, run_time_dict=self.run_time_dict, ) @@ -592,7 +582,6 @@ def inversion(self) -> aa.AbstractInversion: dataset=self.dataset, linear_obj_list=self.linear_obj_list, settings=self.settings_inversion, - preloads=self.preloads, run_time_dict=self.run_time_dict, ) diff --git a/autogalaxy/imaging/fit_imaging.py b/autogalaxy/imaging/fit_imaging.py index ff72fe5e4..d3acac4e5 100644 --- a/autogalaxy/imaging/fit_imaging.py +++ b/autogalaxy/imaging/fit_imaging.py @@ -7,7 +7,6 @@ from autogalaxy.abstract_fit import AbstractFitInversion from autogalaxy.analysis.adapt_images.adapt_images import AdaptImages -from autogalaxy.analysis.preloads import Preloads from autogalaxy.galaxy.galaxy import Galaxy from autogalaxy.galaxy.galaxies import Galaxies from autogalaxy.galaxy.to_inversion import GalaxiesToInversion @@ -26,7 +25,6 @@ def __init__( dataset_model: Optional[aa.DatasetModel] = None, adapt_images: Optional[AdaptImages] = None, settings_inversion: aa.SettingsInversion = aa.SettingsInversion(), - preloads: aa.Preloads = Preloads(), run_time_dict: Optional[Dict] = None, ): """ @@ -66,16 +64,12 @@ def __init__( reconstructed galaxy's morphology. settings_inversion Settings controlling how an inversion is fitted for example which linear algebra formalism is used. - preloads - Contains preloaded calculations (e.g. linear algebra matrices) which can skip certain calculations in - the fit. run_time_dict A dictionary which if passed to the fit records how long fucntion calls which have the `profile_func` decorator take to run. """ self.galaxies = Galaxies(galaxies=galaxies, run_time_dict=run_time_dict) - self.preloads = preloads super().__init__( dataset=dataset, @@ -135,7 +129,6 @@ def galaxies_to_inversion(self) -> GalaxiesToInversion: galaxies=self.galaxies, adapt_images=self.adapt_images, settings_inversion=self.settings_inversion, - preloads=self.preloads, run_time_dict=self.run_time_dict, ) @@ -285,44 +278,3 @@ def galaxies_linear_light_profiles_to_light_profiles(self) -> List[Galaxy]: or `GalaxyPlotter` objects. """ return self.model_obj_linear_light_profiles_to_light_profiles - - def refit_with_new_preloads( - self, - preloads: Preloads, - settings_inversion: Optional[aa.SettingsInversion] = None, - ) -> "FitImaging": - """ - Returns a new fit which uses the dataset, galaxies and other objects of this fit, but uses a different set of - preloads input into this function. - - This is used when setting up the preloads objects, to concisely test how using different preloads objects - changes the attributes of the fit. - - Parameters - ---------- - preloads - The new preloads which are used to refit the data using the - settings_inversion - Settings controlling how an inversion is fitted for example which linear algebra formalism is used. - - Returns - ------- - A new fit which has used new preloads input into this function but the same dataset, galaxies and other settings. - """ - run_time_dict = {} if self.run_time_dict is not None else None - - settings_inversion = ( - self.settings_inversion - if settings_inversion is None - else settings_inversion - ) - - return FitImaging( - dataset=self.dataset, - galaxies=self.galaxies, - dataset_model=self.dataset_model, - adapt_images=self.adapt_images, - settings_inversion=settings_inversion, - preloads=preloads, - run_time_dict=run_time_dict, - ) diff --git a/autogalaxy/imaging/model/analysis.py b/autogalaxy/imaging/model/analysis.py index 82f34282e..b9fe3a2ae 100644 --- a/autogalaxy/imaging/model/analysis.py +++ b/autogalaxy/imaging/model/analysis.py @@ -9,7 +9,6 @@ from autogalaxy.analysis.adapt_images.adapt_image_maker import AdaptImageMaker from autogalaxy.analysis.analysis.dataset import AnalysisDataset -from autogalaxy.analysis.preloads import Preloads from autogalaxy.cosmology.lensing import LensingCosmology from autogalaxy.cosmology.wrap import Planck15 from autogalaxy.imaging.model.result import ResultImaging @@ -94,9 +93,6 @@ def modify_before_fit(self, paths: af.DirectoryPaths, model: af.Collection): super().modify_before_fit(paths=paths, model=model) - if not paths.is_complete: - self.set_preloads(paths=paths, model=model) - return self def log_likelihood_function(self, instance: af.ModelInstance) -> float: @@ -150,53 +146,6 @@ def log_likelihood_function(self, instance: af.ModelInstance) -> float: ) as e: raise exc.FitException from e - def fit_from( - self, - instance: af.ModelInstance, - preload_overwrite: Optional[Preloads] = None, - run_time_dict: Optional[Dict] = None, - ) -> FitImaging: - """ - Given a model instance create a `FitImaging` object. - - This function is used in the `log_likelihood_function` to fit the model to the imaging data and compute the - log likelihood. - - Parameters - ---------- - instance - An instance of the model that is being fitted to the data by this analysis (whose parameters have been set - via a non-linear search). - preload_overwrite - If a `Preload` object is input this is used instead of the preloads stored as an attribute in the analysis. - run_time_dict - A dictionary which times functions called to fit the model to data, for profiling. - - Returns - ------- - FitImaging - The fit of the galaxies to the imaging dataset, which includes the log likelihood. - """ - - galaxies = self.galaxies_via_instance_from( - instance=instance, run_time_dict=run_time_dict - ) - - dataset_model = self.dataset_model_via_instance_from(instance=instance) - - adapt_images = self.adapt_images_via_instance_from(instance=instance) - - preloads = self.preloads if preload_overwrite is None else preload_overwrite - - return FitImaging( - dataset=self.dataset, - galaxies=galaxies, - dataset_model=dataset_model, - adapt_images=adapt_images, - settings_inversion=self.settings_inversion, - preloads=preloads, - run_time_dict=run_time_dict, - ) def save_attributes(self, paths: af.DirectoryPaths): """ @@ -253,7 +202,7 @@ def profile_log_likelihood_function( An `info_dict` is also created which stores information on aspects of the model and dataset that dictate run times, so the profiled times can be interpreted with this context. - The results of this profiling are then output to hard-disk in the `preloads` folder of the model-fit results, + The results of this profiling are then output to hard-disk in the `profiling` folder of the model-fit results, which they can be inspected to ensure run-times are as expected. Parameters diff --git a/autogalaxy/interferometer/fit_interferometer.py b/autogalaxy/interferometer/fit_interferometer.py index 7f7f6fe6b..7095ced45 100644 --- a/autogalaxy/interferometer/fit_interferometer.py +++ b/autogalaxy/interferometer/fit_interferometer.py @@ -7,7 +7,6 @@ from autogalaxy.abstract_fit import AbstractFitInversion from autogalaxy.analysis.adapt_images.adapt_images import AdaptImages -from autogalaxy.analysis.preloads import Preloads from autogalaxy.galaxy.galaxy import Galaxy from autogalaxy.galaxy.galaxies import Galaxies from autogalaxy.galaxy.to_inversion import GalaxiesToInversion @@ -21,7 +20,6 @@ def __init__( dataset_model: Optional[aa.DatasetModel] = None, adapt_images: Optional[AdaptImages] = None, settings_inversion: aa.SettingsInversion = aa.SettingsInversion(), - preloads: aa.Preloads = Preloads(), run_time_dict: Optional[Dict] = None, ): """ @@ -62,9 +60,6 @@ def __init__( reconstructed galaxy's morphology. settings_inversion Settings controlling how an inversion is fitted for example which linear algebra formalism is used. - preloads - Contains preloaded calculations (e.g. linear algebra matrices) which can skip certain calculations in - the fit. run_time_dict A dictionary which if passed to the fit records how long fucntion calls which have the `profile_func` decorator take to run. @@ -92,8 +87,6 @@ def __init__( self.adapt_images = adapt_images self.settings_inversion = settings_inversion - self.preloads = preloads - @property def profile_visibilities(self) -> aa.Visibilities: """ @@ -126,7 +119,6 @@ def galaxies_to_inversion(self) -> GalaxiesToInversion: galaxies=self.galaxies, adapt_images=self.adapt_images, settings_inversion=self.settings_inversion, - preloads=self.preloads, run_time_dict=self.run_time_dict, ) @@ -223,44 +215,3 @@ def galaxies_linear_light_profiles_to_light_profiles(self) -> List[Galaxy]: or `GalaxyPlotter` objects. """ return self.model_obj_linear_light_profiles_to_light_profiles - - def refit_with_new_preloads( - self, - preloads: Preloads, - settings_inversion: Optional[aa.SettingsInversion] = None, - ) -> "FitInterferometer": - """ - Returns a new fit which uses the dataset, galaxies and other objects of this fit, but uses a different set of - preloads input into this function. - - This is used when setting up the preloads objects, to concisely test how using different preloads objects - changes the attributes of the fit. - - Parameters - ---------- - preloads - The new preloads which are used to refit the data using the - settings_inversion - Settings controlling how an inversion is fitted for example which linear algebra formalism is used. - - Returns - ------- - A new fit which has used new preloads input into this function but the same dataset, galaxies and other settings. - """ - if self.run_time_dict is not None: - run_time_dict = {} - else: - run_time_dict = None - - if settings_inversion is None: - settings_inversion = self.settings_inversion - - return FitInterferometer( - dataset=self.dataset, - galaxies=self.galaxies, - dataset_model=self.dataset_model, - adapt_images=self.adapt_images, - settings_inversion=settings_inversion, - preloads=preloads, - run_time_dict=run_time_dict, - ) diff --git a/autogalaxy/interferometer/model/analysis.py b/autogalaxy/interferometer/model/analysis.py index c152e4e4c..06ca11ad4 100644 --- a/autogalaxy/interferometer/model/analysis.py +++ b/autogalaxy/interferometer/model/analysis.py @@ -11,7 +11,6 @@ from autogalaxy.analysis.adapt_images.adapt_image_maker import AdaptImageMaker from autogalaxy.analysis.analysis.dataset import AnalysisDataset -from autogalaxy.analysis.preloads import Preloads from autogalaxy.cosmology.lensing import LensingCosmology from autogalaxy.cosmology.wrap import Planck15 from autogalaxy.interferometer.model.result import ResultInterferometer @@ -99,13 +98,6 @@ def modify_before_fit(self, paths: af.DirectoryPaths, model: af.Collection): super().modify_before_fit(paths=paths, model=model) - if not paths.is_complete: - logger.info( - "PRELOADS - Setting up preloads, may take a few minutes for fits using an inversion." - ) - - self.set_preloads(paths=paths, model=model) - return self def log_likelihood_function(self, instance: af.ModelInstance) -> float: @@ -158,50 +150,6 @@ def log_likelihood_function(self, instance: af.ModelInstance) -> float: ) as e: raise exc.FitException from e - def fit_from( - self, - instance: af.ModelInstance, - preload_overwrite: Optional[Preloads] = None, - run_time_dict: Optional[Dict] = None, - ) -> FitInterferometer: - """ - Given a model instance create a `FitInterferometer` object. - - This function is used in the `log_likelihood_function` to fit the model to the interferometer data and compute - the log likelihood. - - Parameters - ---------- - instance - An instance of the model that is being fitted to the data by this analysis (whose parameters have been set - via a non-linear search). - preload_overwrite - If a `Preload` object is input this is used instead of the preloads stored as an attribute in the analysis. - run_time_dict - A dictionary which times functions called to fit the model to data, for profiling. - - Returns - ------- - FitInterferometer - The fit of the galaxies to the interferometer dataset, which includes the log likelihood. - """ - galaxies = self.galaxies_via_instance_from( - instance=instance, run_time_dict=run_time_dict - ) - - adapt_images = self.adapt_images_via_instance_from(instance=instance) - - preloads = self.preloads if preload_overwrite is None else preload_overwrite - - return FitInterferometer( - dataset=self.dataset, - galaxies=galaxies, - adapt_images=adapt_images, - settings_inversion=self.settings_inversion, - preloads=preloads, - run_time_dict=run_time_dict, - ) - def save_attributes(self, paths: af.DirectoryPaths): """ Before the model-fit begins, this routine saves attributes of the `Analysis` object to the `files` folder @@ -259,7 +207,7 @@ def profile_log_likelihood_function( An `info_dict` is also created which stores information on aspects of the model and dataset that dictate run times, so the profiled times can be interpreted with this context. - The results of this profiling are then output to hard-disk in the `preloads` folder of the model-fit results, + The results of this profiling are then output to hard-disk in the `profiling` folder of the model-fit results, which they can be inspected to ensure run-times are as expected. Parameters diff --git a/test_autogalaxy/analysis/test_preloads.py b/test_autogalaxy/analysis/test_preloads.py deleted file mode 100644 index 284962428..000000000 --- a/test_autogalaxy/analysis/test_preloads.py +++ /dev/null @@ -1,130 +0,0 @@ -import numpy as np -from os import path - -import autofit as af - -import autogalaxy as ag - - -def test__set_blurred_image(): - # Blurred image is all zeros so preloads as zeros - - fit_0 = ag.m.MockFitImaging(blurred_image=np.zeros(2)) - fit_1 = ag.m.MockFitImaging(blurred_image=np.zeros(2)) - - preloads = ag.Preloads(blurred_image=1) - preloads.set_blurred_image(fit_0=fit_0, fit_1=fit_1) - - assert preloads.blurred_image is None - - # Blurred image are different, indicating the model parameters change the grid, so no preloading. - - fit_0 = ag.m.MockFitImaging(blurred_image=np.array([1.0])) - fit_1 = ag.m.MockFitImaging(blurred_image=np.array([2.0])) - - preloads = ag.Preloads(blurred_image=1) - preloads.set_blurred_image(fit_0=fit_0, fit_1=fit_1) - - assert preloads.blurred_image is None - - # Blurred images are the same meaning they are fixed in the model, so do preload. - - fit_0 = ag.m.MockFitImaging(blurred_image=np.array([1.0])) - fit_1 = ag.m.MockFitImaging(blurred_image=np.array([1.0])) - - preloads = ag.Preloads(blurred_image=1) - preloads.set_blurred_image(fit_0=fit_0, fit_1=fit_1) - - assert (preloads.blurred_image == np.array([1.0])).all() - - -def test__info(): - file_path = path.join("{}".format(path.dirname(path.realpath(__file__))), "files") - - file_preloads = path.join(file_path, "preloads.summary") - - preloads = ag.Preloads( - blurred_image=np.zeros(3), - w_tilde=None, - use_w_tilde=False, - image_plane_mesh_grid_pg_list=None, - relocated_grid=None, - mapper_list=None, - operated_mapping_matrix=None, - ) - - af.formatter.output_list_of_strings_to_file( - file=file_preloads, list_of_strings=preloads.info - ) - - results = open(file_preloads) - lines = results.readlines() - - i = 0 - - assert lines[i] == f"W Tilde = False\n" - i += 1 - assert lines[i] == f"Use W Tilde = False\n" - i += 1 - assert lines[i] == f"\n" - i += 1 - assert lines[i] == f"Blurred Image = False\n" - i += 1 - assert lines[i] == f"Mapper = False\n" - i += 1 - assert lines[i] == f"Blurred Mapping Matrix = False\n" - i += 1 - assert lines[i] == f"Inversion Linear Func (Linear Light Profile) Dicts = False\n" - i += 1 - assert lines[i] == f"Curvature Matrix = False\n" - i += 1 - assert lines[i] == f"Curvature Matrix Mapper Diag = False\n" - i += 1 - assert lines[i] == f"Regularization Matrix = False\n" - i += 1 - assert lines[i] == f"Log Det Regularization Matrix Term = False\n" - i += 1 - - preloads = ag.Preloads( - blurred_image=1, - w_tilde=1, - use_w_tilde=True, - image_plane_mesh_grid_pg_list=1, - mapper_list=1, - operated_mapping_matrix=1, - curvature_matrix=1, - regularization_matrix=1, - log_det_regularization_matrix_term=1, - ) - - af.formatter.output_list_of_strings_to_file( - file=file_preloads, list_of_strings=preloads.info - ) - - results = open(file_preloads) - lines = results.readlines() - - i = 0 - - assert lines[i] == f"W Tilde = True\n" - i += 1 - assert lines[i] == f"Use W Tilde = True\n" - i += 1 - assert lines[i] == f"\n" - i += 1 - assert lines[i] == f"Blurred Image = True\n" - i += 1 - assert lines[i] == f"Mapper = True\n" - i += 1 - assert lines[i] == f"Blurred Mapping Matrix = True\n" - i += 1 - assert lines[i] == f"Inversion Linear Func (Linear Light Profile) Dicts = False\n" - i += 1 - assert lines[i] == f"Curvature Matrix = True\n" - i += 1 - assert lines[i] == f"Curvature Matrix Mapper Diag = False\n" - i += 1 - assert lines[i] == f"Regularization Matrix = True\n" - i += 1 - assert lines[i] == f"Log Det Regularization Matrix Term = True\n" - i += 1 diff --git a/test_autogalaxy/config/general.yaml b/test_autogalaxy/config/general.yaml index 2acec5ada..26e205c6b 100644 --- a/test_autogalaxy/config/general.yaml +++ b/test_autogalaxy/config/general.yaml @@ -1,6 +1,5 @@ analysis: n_cores: 1 - preload_attempts: 250 fits: flip_for_ds9: true grid: @@ -39,6 +38,4 @@ structures: native_binned_only: false # If True, data structures are only stored in their native and binned format. This is used to reduce memory usage in autocti. test: check_likelihood_function: false # if True, when a search is resumed the likelihood of a previous sample is recalculated to ensure it is consistent with the previous run. - check_preloads: false - exception_override: true - preloads_check_threshold: 1.0 # If the figure of merit of a fit with and without preloads is greater than this threshold, the check preload test fails and an exception raised for a model-fit. + exception_override: true \ No newline at end of file diff --git a/test_autogalaxy/config/visualize.yaml b/test_autogalaxy/config/visualize.yaml index 50c40f0cb..2b170d7c2 100644 --- a/test_autogalaxy/config/visualize.yaml +++ b/test_autogalaxy/config/visualize.yaml @@ -8,7 +8,7 @@ include: einstein_radius: true half_light_radius: true include_2d: - border: true + border: false tangential_caustics: false radial_caustics: false tangential_critical_curves: false From 9cd4e70e46e5fb157c625daf4cefb896ccfb98e8 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Thu, 3 Oct 2024 13:22:02 +0100 Subject: [PATCH 13/26] black --- autogalaxy/aggregator/agg_util.py | 1 - autogalaxy/analysis/analysis/analysis.py | 30 +++++++-------- autogalaxy/imaging/fit_imaging.py | 6 +-- autogalaxy/imaging/model/analysis.py | 1 - autogalaxy/operate/deflections.py | 4 +- autogalaxy/profiles/basis.py | 8 ++-- autogalaxy/profiles/geometry_profiles.py | 5 ++- .../profiles/mass/abstract/jax_utils.py | 8 ++-- autogalaxy/profiles/mass/abstract/mge_jax.py | 37 +++++++++++-------- .../mass/dark/gnfw_virial_mass_conc.py | 4 +- .../profiles/mass/dark/nfw_hk24_util.py | 30 +++------------ autogalaxy/profiles/mass/stellar/sersic.py | 29 ++++++++++++--- autogalaxy/profiles/mass/total/isothermal.py | 6 ++- autogalaxy/profiles/mass/total/jax_utils.py | 8 ++-- autogalaxy/profiles/mass/total/power_law.py | 16 +++----- autogalaxy/util/shear_field.py | 1 - 16 files changed, 97 insertions(+), 97 deletions(-) diff --git a/autogalaxy/aggregator/agg_util.py b/autogalaxy/aggregator/agg_util.py index 7aa79f708..205944d4b 100644 --- a/autogalaxy/aggregator/agg_util.py +++ b/autogalaxy/aggregator/agg_util.py @@ -68,4 +68,3 @@ def adapt_images_from( adapt_images_list.append(adapt_images) return adapt_images_list - diff --git a/autogalaxy/analysis/analysis/analysis.py b/autogalaxy/analysis/analysis/analysis.py index 8449494eb..15645c66b 100644 --- a/autogalaxy/analysis/analysis/analysis.py +++ b/autogalaxy/analysis/analysis/analysis.py @@ -191,33 +191,33 @@ def profile_log_likelihood_function( try: info_dict["image_pixels"] = self.dataset.grids.uniform.shape_slim - info_dict[ - "sub_total_light_profiles" - ] = self.dataset.grids.uniform.over_sampler.sub_total + info_dict["sub_total_light_profiles"] = ( + self.dataset.grids.uniform.over_sampler.sub_total + ) except AttributeError: pass if fit.model_obj.has(cls=aa.Pixelization): info_dict["use_w_tilde"] = fit.inversion.settings.use_w_tilde try: - info_dict[ - "sub_total_pixelization" - ] = self.dataset.grids.pixelization.over_sampler.sub_total + info_dict["sub_total_pixelization"] = ( + self.dataset.grids.pixelization.over_sampler.sub_total + ) except AttributeError: pass - info_dict[ - "use_positive_only_solver" - ] = fit.inversion.settings.use_positive_only_solver - info_dict[ - "force_edge_pixels_to_zeros" - ] = fit.inversion.settings.force_edge_pixels_to_zeros + info_dict["use_positive_only_solver"] = ( + fit.inversion.settings.use_positive_only_solver + ) + info_dict["force_edge_pixels_to_zeros"] = ( + fit.inversion.settings.force_edge_pixels_to_zeros + ) info_dict["use_w_tilde_numpy"] = fit.inversion.settings.use_w_tilde_numpy info_dict["source_pixels"] = len(fit.inversion.reconstruction) if hasattr(fit.inversion, "w_tilde"): - info_dict[ - "w_tilde_curvature_preload_size" - ] = fit.inversion.w_tilde.curvature_preload.shape[0] + info_dict["w_tilde_curvature_preload_size"] = ( + fit.inversion.w_tilde.curvature_preload.shape[0] + ) self.output_profiling_info( paths=paths, run_time_dict=run_time_dict, info_dict=info_dict diff --git a/autogalaxy/imaging/fit_imaging.py b/autogalaxy/imaging/fit_imaging.py index d3acac4e5..06f331691 100644 --- a/autogalaxy/imaging/fit_imaging.py +++ b/autogalaxy/imaging/fit_imaging.py @@ -213,9 +213,9 @@ def subtracted_images_of_galaxies_dict(self) -> Dict[Galaxy, aa.Array2D]: subtracted_image = self.data - sum(other_galaxies_model_images) - subtracted_images_of_galaxies_dict[ - self.galaxies[galaxy_index] - ] = subtracted_image + subtracted_images_of_galaxies_dict[self.galaxies[galaxy_index]] = ( + subtracted_image + ) return subtracted_images_of_galaxies_dict diff --git a/autogalaxy/imaging/model/analysis.py b/autogalaxy/imaging/model/analysis.py index b9fe3a2ae..58b188c45 100644 --- a/autogalaxy/imaging/model/analysis.py +++ b/autogalaxy/imaging/model/analysis.py @@ -146,7 +146,6 @@ def log_likelihood_function(self, instance: af.ModelInstance) -> float: ) as e: raise exc.FitException from e - def save_attributes(self, paths: af.DirectoryPaths): """ Before the non-linear search begins, this routine saves attributes of the `Analysis` object to the `files` diff --git a/autogalaxy/operate/deflections.py b/autogalaxy/operate/deflections.py index 28f01958c..57af22765 100644 --- a/autogalaxy/operate/deflections.py +++ b/autogalaxy/operate/deflections.py @@ -662,9 +662,7 @@ def einstein_mass_angular_list_from( einstein_radius_list = self.einstein_radius_list_from( grid=grid, pixel_scale=pixel_scale ) - return [ - np.pi * einstein_radius**2 for einstein_radius in einstein_radius_list - ] + return [np.pi * einstein_radius**2 for einstein_radius in einstein_radius_list] @evaluation_grid def einstein_mass_angular_from( diff --git a/autogalaxy/profiles/basis.py b/autogalaxy/profiles/basis.py index 63747b22c..f71777a00 100644 --- a/autogalaxy/profiles/basis.py +++ b/autogalaxy/profiles/basis.py @@ -125,9 +125,11 @@ def image_2d_list_from( The image of the light profiles in the basis summed together. """ return [ - light_profile.image_2d_from(grid=grid, operated_only=operated_only) - if not isinstance(light_profile, lp_linear.LightProfileLinear) - else np.zeros((grid.shape[0],)) + ( + light_profile.image_2d_from(grid=grid, operated_only=operated_only) + if not isinstance(light_profile, lp_linear.LightProfileLinear) + else np.zeros((grid.shape[0],)) + ) for light_profile in self.light_profile_list ] diff --git a/autogalaxy/profiles/geometry_profiles.py b/autogalaxy/profiles/geometry_profiles.py index 725a10499..64fb0c453 100644 --- a/autogalaxy/profiles/geometry_profiles.py +++ b/autogalaxy/profiles/geometry_profiles.py @@ -311,7 +311,8 @@ def elliptical_radii_grid_from( """ return np.sqrt( np.add( - np.square(grid.array[:, 1]), np.square(np.divide(grid.array[:, 0], self.axis_ratio)) + np.square(grid.array[:, 1]), + np.square(np.divide(grid.array[:, 0], self.axis_ratio)), ) ) @@ -336,7 +337,7 @@ def eccentric_radii_grid_from( grid_radii = self.elliptical_radii_grid_from(grid=grid, **kwargs).array - return np.multiply(np.sqrt(self.axis_ratio), grid_radii)#.view(np.ndarray) + return np.multiply(np.sqrt(self.axis_ratio), grid_radii) # .view(np.ndarray) @aa.grid_dec.to_grid def transformed_to_reference_frame_grid_from( diff --git a/autogalaxy/profiles/mass/abstract/jax_utils.py b/autogalaxy/profiles/mass/abstract/jax_utils.py index 735342efc..dd31478cd 100644 --- a/autogalaxy/profiles/mass/abstract/jax_utils.py +++ b/autogalaxy/profiles/mass/abstract/jax_utils.py @@ -26,7 +26,7 @@ def reg4(z, _, i_sqrt_pi): def reg5(z, sqrt_pi, _): - mz2 = -z**2 + mz2 = -(z**2) f1 = sqrt_pi f2 = 1.0 s1 = [1.320522, 35.7668, 219.031, 1540.787, 3321.99, 36183.31] @@ -80,7 +80,7 @@ def w_f_approx(z): r2 = (abs_z2 >= 256.0) & (abs_z2 < 38000.0) r3 = (abs_z2 >= 62.0) & (abs_z2 < 256.0) r4 = (abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 >= 1e-13) - # region bounds for 5 taken directly from Zaghloul (2017) + # region bounds for 5 taken directly from Zaghloul (2017) # https://dl.acm.org/doi/pdf/10.1145/3119904 r5_1 = (abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 < 1e-13) r5_2 = (abs_z2 >= 2.5) & (abs_z2 < 30.0) & (z_imag2 < 0.072) @@ -103,8 +103,8 @@ def w_f_approx_jvp(primals, tangents): # define a custom jvp to avoid the issue using `jnp.where` with `jax.grad` # also the derivative is defined analytically for this function so bypass # auto diffing over the complex functions above. - z, = primals - z_dot, = tangents + (z,) = primals + (z_dot,) = tangents primal_out = w_f_approx(z) i_sqrt_pi = 1j / jnp.sqrt(jnp.pi) tangent_out = z_dot * 2 * (i_sqrt_pi - z * primal_out) diff --git a/autogalaxy/profiles/mass/abstract/mge_jax.py b/autogalaxy/profiles/mass/abstract/mge_jax.py index a98452582..2fbfd5ed7 100644 --- a/autogalaxy/profiles/mass/abstract/mge_jax.py +++ b/autogalaxy/profiles/mass/abstract/mge_jax.py @@ -65,16 +65,13 @@ def eta(p): """ i = np.arange(1, p, 1) - kesi_last = 1/2**p + kesi_last = 1 / 2**p k = kesi_last + np.cumsum(np.cumprod((p + 1 - i) / i) * kesi_last) - - kesi_list = np.hstack([ - np.array([0.5]), - np.ones(p), - k[::-1], - np.array([kesi_last]) - ]) - coef = (-1)**np.arange(0, 2 * p + 1, 1) + + kesi_list = np.hstack( + [np.array([0.5]), np.ones(p), k[::-1], np.array([kesi_last])] + ) + coef = (-1) ** np.arange(0, 2 * p + 1, 1) eta_list = coef * 2.0 * np.sqrt(2.0 * np.pi) * 10 ** (p / 3.0) * kesi_list return eta_list @@ -111,7 +108,9 @@ def _decompose_convergence_via_mge( sigma_list = np.exp(log_sigmas) amplitude_list = np.zeros(func_gaussians) - f_sigma = np.sum(etas * np.real(func(sigma_list.reshape(-1, 1) * kesis)), axis=1) + f_sigma = np.sum( + etas * np.real(func(sigma_list.reshape(-1, 1) * kesis)), axis=1 + ) amplitude_list = f_sigma * d_log_sigma / np.sqrt(2.0 * np.pi) amplitude_list = amplitude_list.at[0].multiply(0.5) amplitude_list = amplitude_list.at[-1].multiply(0.5) @@ -120,7 +119,9 @@ def _decompose_convergence_via_mge( def convergence_2d_via_mge_from(self, grid_radii): raise NotImplementedError() - def _convergence_2d_via_mge_from(self, grid_radii, func_terms=28, func_gaussians=20): + def _convergence_2d_via_mge_from( + self, grid_radii, func_terms=28, func_gaussians=20 + ): """Calculate the projected convergence at a given set of arc-second gridded coordinates. Parameters @@ -129,19 +130,25 @@ def _convergence_2d_via_mge_from(self, grid_radii, func_terms=28, func_gaussians The grid of (y,x) arc-second coordinates the convergence is computed on. """ - amps, sigmas = self.decompose_convergence_via_mge(func_terms=func_terms, func_gaussians=func_gaussians) + amps, sigmas = self.decompose_convergence_via_mge( + func_terms=func_terms, func_gaussians=func_gaussians + ) convergence = 0.0 inv_sigma_ = 1 / sigmas.reshape((-1,) + (1,) * grid_radii.array.ndim) amps_ = amps.reshape((-1,) + (1,) * grid_radii.array.ndim) - convergence = amps_ * np.exp(-0.5 * (grid_radii.array * inv_sigma_)**2) + convergence = amps_ * np.exp(-0.5 * (grid_radii.array * inv_sigma_) ** 2) return convergence.sum(axis=0) - def _deflections_2d_via_mge_from(self, grid, sigmas_factor=1.0, func_terms=28, func_gaussians=20): + def _deflections_2d_via_mge_from( + self, grid, sigmas_factor=1.0, func_terms=28, func_gaussians=20 + ): axis_ratio = np.min(np.array([self.axis_ratio, 0.9999])) - amps, sigmas = self.decompose_convergence_via_mge(func_terms=func_terms, func_gaussians=func_gaussians) + amps, sigmas = self.decompose_convergence_via_mge( + func_terms=func_terms, func_gaussians=func_gaussians + ) sigmas *= sigmas_factor angle = self.zeta_from( diff --git a/autogalaxy/profiles/mass/dark/gnfw_virial_mass_conc.py b/autogalaxy/profiles/mass/dark/gnfw_virial_mass_conc.py index 9247c9c9d..838b67453 100644 --- a/autogalaxy/profiles/mass/dark/gnfw_virial_mass_conc.py +++ b/autogalaxy/profiles/mass/dark/gnfw_virial_mass_conc.py @@ -43,9 +43,7 @@ def kappa_s_and_scale_radius( ############################## def integrand(r): - return (r**2 / r**inner_slope) * (1 + r / scale_radius_kpc) ** ( - inner_slope - 3 - ) + return (r**2 / r**inner_slope) * (1 + r / scale_radius_kpc) ** (inner_slope - 3) de_c = ( (overdens / 3.0) diff --git a/autogalaxy/profiles/mass/dark/nfw_hk24_util.py b/autogalaxy/profiles/mass/dark/nfw_hk24_util.py index 0c46b4cfa..71bdce62c 100644 --- a/autogalaxy/profiles/mass/dark/nfw_hk24_util.py +++ b/autogalaxy/profiles/mass/dark/nfw_hk24_util.py @@ -3,6 +3,7 @@ @author: felixvecchi """ + import numpy as np from astropy.cosmology import Planck15 @@ -206,16 +207,11 @@ def g1_g2_from(x1, x2, e, k_s): # Prefactors for g1 pre_f0_g1 = ( - ((x1 - e) ** 2 + x2**2) - * ((x1 + e) ** 2 + x2**2) - * (x1**2 - x2**2 - e**2) + ((x1 - e) ** 2 + x2**2) * ((x1 + e) ** 2 + x2**2) * (x1**2 - x2**2 - e**2) ) pre_f1_g1 = ( - 2 - * e**2 - * (x1**2 - 1) - * ((x1**2 - x2**2 - e**2) ** 2 - 4 * x1**2 * x2**2) + 2 * e**2 * (x1**2 - 1) * ((x1**2 - x2**2 - e**2) ** 2 - 4 * x1**2 * x2**2) - (x1**2 - x2**2 - e**2) ** 3 * (3 + e**2) / 2 + 6 * x1**2 * x2**2 * (e**2 - 1) * (x1**2 - x2**2 - e**2) ) @@ -225,12 +221,7 @@ def g1_g2_from(x1, x2, e, k_s): - 8 * e**2 * x1**2 * x2**2 ) - pre_f3_g1 = ( - 2 - * x1 - * x2 - * ((x1**2 + x2**2 + e**2) ** 2 - 4 * e**2 * (x2**2 + e**2)) - ) + pre_f3_g1 = 2 * x1 * x2 * ((x1**2 + x2**2 + e**2) ** 2 - 4 * e**2 * (x2**2 + e**2)) # First component shear g1 = full_pre_factor * ( @@ -245,21 +236,12 @@ def g1_g2_from(x1, x2, e, k_s): * x2 * ( (x1**2 + x2**2 + e**2) - * ( - (5 * e**2 - 3) * x1**2 - - 3 * (1 + e**2) * x2**2 - + (5 - 3 * e**2) * e**2 - ) + * ((5 * e**2 - 3) * x1**2 - 3 * (1 + e**2) * x2**2 + (5 - 3 * e**2) * e**2) - 4 * e**2 * x1**2 * (1 + e**2) ) ) - pre_f2_g2 = ( - -2 - * x1 - * x2 - * ((x1**2 + x2**2 + e**2) ** 2 - 4 * e**2 * (x2**2 + e**2)) - ) + pre_f2_g2 = -2 * x1 * x2 * ((x1**2 + x2**2 + e**2) ** 2 - 4 * e**2 * (x2**2 + e**2)) pre_f3_g2 = -( (x1**2 - x2**2 - e**2) * ((x1**2 + x2**2) ** 2 - e**4) diff --git a/autogalaxy/profiles/mass/stellar/sersic.py b/autogalaxy/profiles/mass/stellar/sersic.py index 548a5166c..a7608c903 100644 --- a/autogalaxy/profiles/mass/stellar/sersic.py +++ b/autogalaxy/profiles/mass/stellar/sersic.py @@ -138,7 +138,9 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform @aa.grid_dec.relocate_to_radial_minimum - def deflections_2d_via_mge_from(self, grid: aa.type.Grid2DLike, func_terms=28, func_gaussians=20, **kwargs): + def deflections_2d_via_mge_from( + self, grid: aa.type.Grid2DLike, func_terms=28, func_gaussians=20, **kwargs + ): """ Calculate the projected 2D deflection angles from a grid of (y,x) arc second coordinates, by computing and summing the convergence of each individual cse used to decompose the mass profile. @@ -153,7 +155,10 @@ def deflections_2d_via_mge_from(self, grid: aa.type.Grid2DLike, func_terms=28, f The grid of (y,x) arc-second coordinates the convergence is computed on. """ return self._deflections_2d_via_mge_from( - grid=grid, sigmas_factor=np.sqrt(self.axis_ratio), func_terms=func_terms, func_gaussians=func_gaussians, + grid=grid, + sigmas_factor=np.sqrt(self.axis_ratio), + func_terms=func_terms, + func_gaussians=func_gaussians, ) @aa.grid_dec.to_vector_yx @@ -196,7 +201,9 @@ def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_array @aa.grid_dec.transform @aa.grid_dec.relocate_to_radial_minimum - def convergence_2d_via_mge_from(self, grid: aa.type.Grid2DLike, func_terms=28, func_gaussians=20, **kwargs): + def convergence_2d_via_mge_from( + self, grid: aa.type.Grid2DLike, func_terms=28, func_gaussians=20, **kwargs + ): """ Calculate the projected convergence at a given set of arc-second gridded coordinates. @@ -209,7 +216,11 @@ def convergence_2d_via_mge_from(self, grid: aa.type.Grid2DLike, func_terms=28, f eccentric_radii = self.eccentric_radii_grid_from(grid=grid, **kwargs) - return self._convergence_2d_via_mge_from(grid_radii=eccentric_radii, func_terms=func_terms, func_gaussians=func_gaussians) + return self._convergence_2d_via_mge_from( + grid_radii=eccentric_radii, + func_terms=func_terms, + func_gaussians=func_gaussians, + ) @aa.over_sample @aa.grid_dec.to_array @@ -255,7 +266,9 @@ def image_2d_via_radii_from(self, radius: np.ndarray): * (((radius / self.effective_radius) ** (1.0 / self.sersic_index)) - 1) ) - def decompose_convergence_via_mge(self, func_terms=28, func_gaussians=20) -> Tuple[List, List]: + def decompose_convergence_via_mge( + self, func_terms=28, func_gaussians=20 + ) -> Tuple[List, List]: radii_min = self.effective_radius / 100.0 radii_max = self.effective_radius * 20.0 @@ -270,7 +283,11 @@ def sersic_2d(r): ) return self._decompose_convergence_via_mge( - func=sersic_2d, radii_min=radii_min, radii_max=radii_max, func_terms=func_terms, func_gaussians=func_gaussians + func=sersic_2d, + radii_min=radii_min, + radii_max=radii_max, + func_terms=func_terms, + func_gaussians=func_gaussians, ) def decompose_convergence_via_cse( diff --git a/autogalaxy/profiles/mass/total/isothermal.py b/autogalaxy/profiles/mass/total/isothermal.py index 734330ebf..79f378930 100644 --- a/autogalaxy/profiles/mass/total/isothermal.py +++ b/autogalaxy/profiles/mass/total/isothermal.py @@ -40,10 +40,12 @@ def psi_from(grid, axis_ratio, core_radius): """ if USING_JAX: return np.sqrt( - (axis_ratio**2.0 * (grid[:, 1]**2.0 + core_radius**2.0)) + grid[:, 0]**2.0 + 1e-16 + (axis_ratio**2.0 * (grid[:, 1] ** 2.0 + core_radius**2.0)) + + grid[:, 0] ** 2.0 + + 1e-16 ) else: - return np.sqrt( + return np.sqrt( np.add( np.multiply( axis_ratio**2.0, np.add(np.square(grid[:, 1]), core_radius**2.0) diff --git a/autogalaxy/profiles/mass/total/jax_utils.py b/autogalaxy/profiles/mass/total/jax_utils.py index 42fa0026c..5bed36c6c 100644 --- a/autogalaxy/profiles/mass/total/jax_utils.py +++ b/autogalaxy/profiles/mass/total/jax_utils.py @@ -5,7 +5,7 @@ # A version of scan that will *not* re-compile partial functions when variables change # taken from https://github.com/google/jax/issues/14743#issuecomment-1456900634 -scan = jax.jit(jax.lax.scan, static_argnames=('length', 'reverse', 'unroll')) +scan = jax.jit(jax.lax.scan, static_argnames=("length", "reverse", "unroll")) def body_fun(carry, n, factor, ei2phi, slope): @@ -19,7 +19,7 @@ def body_fun(carry, n, factor, ei2phi, slope): def omega(eiphi, slope, factor, n_terms=20): - '''JAX implementation of the numerical evaluation of the angular component of + """JAX implementation of the numerical evaluation of the angular component of the complex deflection angle for the elliptical power law profile as given as given by Tessore and Metcalf 2015. Based on equation 29, and gives omega (e.g. can be used as a drop in replacement for the exp(i * phi) * special.hyp2f1 @@ -37,11 +37,11 @@ def omega(eiphi, slope, factor, n_terms=20): n_terms: The number of terms to calculate for the series expansion, defaults to 20 (this should be sufficient most of the time) - ''' + """ # use modified scan with a partial'ed function to avoid re-compile (_, partial_sum), _ = scan( partial(body_fun, factor=factor, ei2phi=eiphi**2, slope=slope), (eiphi, eiphi), - jnp.arange(1, n_terms) + jnp.arange(1, n_terms), ) return partial_sum diff --git a/autogalaxy/profiles/mass/total/power_law.py b/autogalaxy/profiles/mass/total/power_law.py index 99404cfaf..cdab5afe3 100644 --- a/autogalaxy/profiles/mass/total/power_law.py +++ b/autogalaxy/profiles/mass/total/power_law.py @@ -91,25 +91,21 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): z = np.add( np.multiply(np.cos(angle), 1 + 0j), np.multiply(np.sin(angle), 0 + 1j) ) - + if USING_JAX: # offset radius so calculation is finite at (0, 0) - R = np.sqrt( - (self.axis_ratio * grid[:, 1])**2 + grid[:, 0]**2 + 1e-16 - ) + R = np.sqrt((self.axis_ratio * grid[:, 1]) ** 2 + grid[:, 0] ** 2 + 1e-16) zh = omega(z, slope, factor, n_terms=20) else: R = np.sqrt( - np.add(np.multiply(self.axis_ratio**2, grid[:, 1] ** 2), grid[:, 0] ** 2) + np.add( + np.multiply(self.axis_ratio**2, grid[:, 1] ** 2), grid[:, 0] ** 2 + ) ) zh = z * special.hyp2f1(1.0, 0.5 * slope, 2.0 - 0.5 * slope, -factor * z**2) complex_angle = ( - 2.0 - * b - / (1.0 + self.axis_ratio) - * (b / R) ** (slope - 1.0) - * zh + 2.0 * b / (1.0 + self.axis_ratio) * (b / R) ** (slope - 1.0) * zh ) deflection_y = complex_angle.imag diff --git a/autogalaxy/util/shear_field.py b/autogalaxy/util/shear_field.py index b0f5f02d2..179e8f09a 100644 --- a/autogalaxy/util/shear_field.py +++ b/autogalaxy/util/shear_field.py @@ -94,7 +94,6 @@ class ShearYX2D(aa.VectorYX2D, AbstractShearField): class ShearYX2DIrregular(aa.VectorYX2DIrregular, AbstractShearField): - """ An irregular shear field, which is collection of (y,x) vectors which are located on an irregular grid of (y,x) coordinates. From c32250718f9c24a1e311cb05525c4fd301c99211 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Thu, 3 Oct 2024 13:25:04 +0100 Subject: [PATCH 14/26] restore fit_from --- autogalaxy/imaging/model/analysis.py | 44 +++++++++++++++++++++ autogalaxy/interferometer/model/analysis.py | 40 +++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/autogalaxy/imaging/model/analysis.py b/autogalaxy/imaging/model/analysis.py index 58b188c45..ad2bc643f 100644 --- a/autogalaxy/imaging/model/analysis.py +++ b/autogalaxy/imaging/model/analysis.py @@ -146,6 +146,50 @@ def log_likelihood_function(self, instance: af.ModelInstance) -> float: ) as e: raise exc.FitException from e + def fit_from( + self, + instance: af.ModelInstance, + run_time_dict: Optional[Dict] = None, + ) -> FitImaging: + """ + Given a model instance create a `FitImaging` object. + + This function is used in the `log_likelihood_function` to fit the model to the imaging data and compute the + log likelihood. + + Parameters + ---------- + instance + An instance of the model that is being fitted to the data by this analysis (whose parameters have been set + via a non-linear search). + preload_overwrite + If a `Preload` object is input this is used instead of the preloads stored as an attribute in the analysis. + run_time_dict + A dictionary which times functions called to fit the model to data, for profiling. + + Returns + ------- + FitImaging + The fit of the galaxies to the imaging dataset, which includes the log likelihood. + """ + + galaxies = self.galaxies_via_instance_from( + instance=instance, run_time_dict=run_time_dict + ) + + dataset_model = self.dataset_model_via_instance_from(instance=instance) + + adapt_images = self.adapt_images_via_instance_from(instance=instance) + + return FitImaging( + dataset=self.dataset, + galaxies=galaxies, + dataset_model=dataset_model, + adapt_images=adapt_images, + settings_inversion=self.settings_inversion, + run_time_dict=run_time_dict, + ) + def save_attributes(self, paths: af.DirectoryPaths): """ Before the non-linear search begins, this routine saves attributes of the `Analysis` object to the `files` diff --git a/autogalaxy/interferometer/model/analysis.py b/autogalaxy/interferometer/model/analysis.py index 06ca11ad4..7ee73d1f8 100644 --- a/autogalaxy/interferometer/model/analysis.py +++ b/autogalaxy/interferometer/model/analysis.py @@ -150,6 +150,46 @@ def log_likelihood_function(self, instance: af.ModelInstance) -> float: ) as e: raise exc.FitException from e + def fit_from( + self, + instance: af.ModelInstance, + run_time_dict: Optional[Dict] = None, + ) -> FitInterferometer: + """ + Given a model instance create a `FitInterferometer` object. + + This function is used in the `log_likelihood_function` to fit the model to the interferometer data and compute + the log likelihood. + + Parameters + ---------- + instance + An instance of the model that is being fitted to the data by this analysis (whose parameters have been set + via a non-linear search). + preload_overwrite + If a `Preload` object is input this is used instead of the preloads stored as an attribute in the analysis. + run_time_dict + A dictionary which times functions called to fit the model to data, for profiling. + + Returns + ------- + FitInterferometer + The fit of the galaxies to the interferometer dataset, which includes the log likelihood. + """ + galaxies = self.galaxies_via_instance_from( + instance=instance, run_time_dict=run_time_dict + ) + + adapt_images = self.adapt_images_via_instance_from(instance=instance) + + return FitInterferometer( + dataset=self.dataset, + galaxies=galaxies, + adapt_images=adapt_images, + settings_inversion=self.settings_inversion, + run_time_dict=run_time_dict, + ) + def save_attributes(self, paths: af.DirectoryPaths): """ Before the model-fit begins, this routine saves attributes of the `Analysis` object to the `files` folder From 033fc094b966b89c66d61e003054d1d891daec14 Mon Sep 17 00:00:00 2001 From: CKrawczyk Date: Fri, 25 Oct 2024 10:04:39 +0100 Subject: [PATCH 15/26] Update Faddeeva function This change makes the MGE profile work better for near-circular mass profiles. This is done by using more terms of the continued fraction for large values of `|z|^2`. This makes the auto grad more accurate and not evaluate to `0` when it should not. --- .../profiles/mass/abstract/jax_utils.py | 88 ++++++++----------- autogalaxy/profiles/mass/abstract/mge_jax.py | 18 ++-- 2 files changed, 46 insertions(+), 60 deletions(-) diff --git a/autogalaxy/profiles/mass/abstract/jax_utils.py b/autogalaxy/profiles/mass/abstract/jax_utils.py index 735342efc..0b2eba439 100644 --- a/autogalaxy/profiles/mass/abstract/jax_utils.py +++ b/autogalaxy/profiles/mass/abstract/jax_utils.py @@ -1,55 +1,45 @@ -import jax import jax.numpy as jnp -import numpy as np from jax import custom_jvp -from functools import partial -def reg1(z, _, i_sqrt_pi): - return i_sqrt_pi / z +r1_s1 = [2.5, 2, 1.5, 1, 0.5] -def reg2(z, _, i_sqrt_pi): - z2 = z**2 - return i_sqrt_pi * z / (z2 - 0.5) +def reg1(z, _ , i_sqrt_pi): + v = z + for coef in r1_s1: + v = z - coef / v + return i_sqrt_pi / v -def reg3(z, _, i_sqrt_pi): - z2 = z**2 - return (i_sqrt_pi / z) * (1 + 0.5 / (z2 - 1.5)) +r2_s1 = [1.320522, 35.7668, 219.031, 1540.787, 3321.99, 36183.31] +r2_s2 = [1.841439, 61.57037, 364.2191, 2186.181, 9022.228, 24322.84, 32066.6] -def reg4(z, _, i_sqrt_pi): - z2 = z**2 - return (i_sqrt_pi * z) * (z2 - 2.5) / (z2 * (z2 - 3.0) + 0.75) - - -def reg5(z, sqrt_pi, _): +def reg2(z, sqrt_pi, _): mz2 = -z**2 f1 = sqrt_pi f2 = 1.0 - s1 = [1.320522, 35.7668, 219.031, 1540.787, 3321.99, 36183.31] - s2 = [1.841439, 61.57037, 364.2191, 2186.181, 9022.228, 24322.84, 32066.6] - - for s in s1: + for s in r2_s1: f1 = s - f1 * mz2 - for s in s2: + for s in r2_s2: f2 = s - f2 * mz2 return jnp.exp(mz2) + 1j * z * f1 / f2 -def reg6(z, sqrt_pi, _): +r3_s1 = [5.9126262, 30.180142, 93.15558, 181.92853, 214.38239, 122.60793] +r3_s2 = [10.479857, 53.992907, 170.35400, 348.70392, 457.33448, 352.73063, 122.60793] + + +def reg3(z, sqrt_pi, _): miz = -1j * z f1 = sqrt_pi f2 = 1 - s1 = [5.9126262, 30.180142, 93.15558, 181.92853, 214.38239, 122.60793] - s2 = [10.479857, 53.992907, 170.35400, 348.70392, 457.33448, 352.73063, 122.60793] - - for s in s1: + for s in r3_s1: f1 = s + f1 * miz - for s in s2: + for s in r3_s2: f2 = s + f2 * miz return f1 / f2 @@ -64,11 +54,6 @@ def w_f_approx(z): :type z: ``complex`` or ``numpy.array(dtype=complex)`` :return: :math:`w_\\mathrm{F}(z)` :rtype: ``complex`` - - # This function is a JAX conversion of - # "https://github.com/sibirrer/lenstronomy/tree/master/lenstronomy/LensModel/Profiles" - # original function written by Anowar J. Shajib (see 1906.08263) - # JAX conversion written by Coleman M. Krawczyk """ sqrt_pi = 1 / jnp.sqrt(jnp.pi) i_sqrt_pi = 1j * sqrt_pi @@ -76,42 +61,39 @@ def w_f_approx(z): z_imag2 = z.imag**2 abs_z2 = z.real**2 + z_imag2 - r1 = abs_z2 >= 38000.0 - r2 = (abs_z2 >= 256.0) & (abs_z2 < 38000.0) - r3 = (abs_z2 >= 62.0) & (abs_z2 < 256.0) - r4 = (abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 >= 1e-13) + # use a single partial fraction approx for all large abs(z)**2 + # to have better approx of the auto-derivatives + r1 = (abs_z2 >= 62.0) | ((abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 >= 1e-13)) # region bounds for 5 taken directly from Zaghloul (2017) # https://dl.acm.org/doi/pdf/10.1145/3119904 - r5_1 = (abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 < 1e-13) - r5_2 = (abs_z2 >= 2.5) & (abs_z2 < 30.0) & (z_imag2 < 0.072) - r5 = r5_1 | r5_2 - r6 = (abs_z2 < 30.0) & jnp.logical_not(r5) + r2_1 = (abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 < 1e-13) + r2_2 = (abs_z2 >= 2.5) & (abs_z2 < 30.0) & (z_imag2 < 0.072) + r2 = r2_1 | r2_2 + r3 = jnp.logical_not(r1) & jnp.logical_not(r2) + + # exploit symmetry to avoid overflow in some regions + r_flip = z.imag < 0 + z_adjust = jnp.where(r_flip, -z, z) + two_exp_zz = 2 * jnp.exp(-z_adjust**2) - args = (z, sqrt_pi, i_sqrt_pi) + args = (z_adjust, sqrt_pi, i_sqrt_pi) wz = jnp.empty_like(z) wz = jnp.where(r1, reg1(*args), wz) wz = jnp.where(r2, reg2(*args), wz) wz = jnp.where(r3, reg3(*args), wz) - wz = jnp.where(r4, reg4(*args), wz) - wz = jnp.where(r5, reg5(*args), wz) - wz = jnp.where(r6, reg6(*args), wz) + + # exploit symmetry to avoid overflow in some regions + wz = jnp.where(r_flip, two_exp_zz - wz, wz) + return wz @w_f_approx.defjvp def w_f_approx_jvp(primals, tangents): # define a custom jvp to avoid the issue using `jnp.where` with `jax.grad` - # also the derivative is defined analytically for this function so bypass - # auto diffing over the complex functions above. z, = primals z_dot, = tangents primal_out = w_f_approx(z) i_sqrt_pi = 1j / jnp.sqrt(jnp.pi) tangent_out = z_dot * 2 * (i_sqrt_pi - z * primal_out) return primal_out, tangent_out - - -@partial(jax.jit, static_argnums=(0,)) -def all_comb(n): - i = jnp.arange(1, n, 1) - return jnp.cumprod((n + 1 - i) / i) diff --git a/autogalaxy/profiles/mass/abstract/mge_jax.py b/autogalaxy/profiles/mass/abstract/mge_jax.py index a98452582..649cb8170 100644 --- a/autogalaxy/profiles/mass/abstract/mge_jax.py +++ b/autogalaxy/profiles/mass/abstract/mge_jax.py @@ -1,8 +1,6 @@ import jax.numpy as np -import jax -import numpy as base_np -from .jax_utils import w_f_approx, all_comb +from .jax_utils import w_f_approx class MassProfileMGE: @@ -75,8 +73,9 @@ def eta(p): np.array([kesi_last]) ]) coef = (-1)**np.arange(0, 2 * p + 1, 1) - eta_list = coef * 2.0 * np.sqrt(2.0 * np.pi) * 10 ** (p / 3.0) * kesi_list - return eta_list + eta_const = 2.0 * np.sqrt(2.0 * np.pi) * 10 ** (p / 3.0) + eta_list = coef * kesi_list + return eta_const, eta_list def decompose_convergence_via_mge(self): raise NotImplementedError() @@ -102,7 +101,7 @@ def _decompose_convergence_via_mge( """ kesis = self.kesi(func_terms) # kesi in Eq.(6) of 1906.08263 - etas = self.eta(func_terms) # eta in Eqr.(6) of 1906.08263 + eta_constant, eta_n = self.eta(func_terms) # eta in Eqr.(6) of 1906.08263 # sigma is sampled from logspace between these radii. @@ -111,7 +110,12 @@ def _decompose_convergence_via_mge( sigma_list = np.exp(log_sigmas) amplitude_list = np.zeros(func_gaussians) - f_sigma = np.sum(etas * np.real(func(sigma_list.reshape(-1, 1) * kesis)), axis=1) + f_sigma = eta_constant * np.sum( + eta_n * np.real(func( + sigma_list.reshape(-1, 1) * kesis + )), + axis=1 + ) amplitude_list = f_sigma * d_log_sigma / np.sqrt(2.0 * np.pi) amplitude_list = amplitude_list.at[0].multiply(0.5) amplitude_list = amplitude_list.at[-1].multiply(0.5) From b6d157c6e28398cfdf1431be853e49b0924970d0 Mon Sep 17 00:00:00 2001 From: CKrawczyk Date: Fri, 25 Oct 2024 13:15:37 +0100 Subject: [PATCH 16/26] Update functions for Tracer to be jax safe Needed to make the `autolens.Tracer` example work. --- autogalaxy/convert.py | 24 ++++++++++++++++---- autogalaxy/profiles/mass/total/isothermal.py | 3 +++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/autogalaxy/convert.py b/autogalaxy/convert.py index 8ff432d7b..4c1ae9299 100644 --- a/autogalaxy/convert.py +++ b/autogalaxy/convert.py @@ -1,7 +1,10 @@ from astropy import units -from autofit.jax_wrapper import numpy as np +from autofit.jax_wrapper import numpy as np, use_jax from typing import Tuple +if use_jax: + import jax + def ell_comps_from(axis_ratio: float, angle: float) -> Tuple[float, float]: """ @@ -62,12 +65,23 @@ def axis_ratio_and_angle_from(ell_comps: Tuple[float, float]) -> Tuple[float, fl angle = np.arctan2(ell_comps[0], ell_comps[1]) / 2 angle *= 180.0 / np.pi - if abs(angle) > 45 and angle < 0: - angle += 180 + if use_jax: + angle = jax.lax.select( + angle < -45, + angle + 180, + angle + ) + else: + if abs(angle) > 45 and angle < 0: + angle += 180 fac = np.sqrt(ell_comps[1] ** 2 + ell_comps[0] ** 2) - if fac > 0.999: - fac = 0.999 # avoid unphysical solution + if use_jax: + fac = jax.lax.min(fac, 0.999) + else: + fac = min(fac, 0.999) + # if fac > 0.999: + # fac = 0.999 # avoid unphysical solution # if fac > 1: print('unphysical e1,e2') axis_ratio = (1 - fac) / (1 + fac) return axis_ratio, angle diff --git a/autogalaxy/profiles/mass/total/isothermal.py b/autogalaxy/profiles/mass/total/isothermal.py index 79f378930..f5073bd23 100644 --- a/autogalaxy/profiles/mass/total/isothermal.py +++ b/autogalaxy/profiles/mass/total/isothermal.py @@ -3,6 +3,7 @@ if os.environ.get("USE_JAX", "0") == "1": USING_JAX = True import jax.numpy as np + from jax.lax import min else: USING_JAX = False import numpy as np @@ -110,6 +111,8 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): * self.axis_ratio / np.sqrt(1 - self.axis_ratio**2) ) + if USING_JAX: + grid = grid.array psi = psi_from(grid=grid, axis_ratio=self.axis_ratio, core_radius=0.0) From 686ddad1e75cd0c0e3e96c172e223422513996ea Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Fri, 25 Oct 2024 14:14:06 +0100 Subject: [PATCH 17/26] Revert "Main to JAX" --- autogalaxy/__init__.py | 3 +- autogalaxy/aggregator/ellipse/fit_ellipse.py | 1 + autogalaxy/aggregator/galaxies.py | 8 +- autogalaxy/analysis/analysis/analysis.py | 19 +- autogalaxy/analysis/analysis/dataset.py | 4 +- autogalaxy/analysis/chaining_util.py | 81 +++---- autogalaxy/analysis/clump_model.py | 204 ++++++++++++++++++ autogalaxy/analysis/plotter_interface.py | 2 +- autogalaxy/ellipse/model/analysis.py | 4 +- autogalaxy/ellipse/model/plotter_interface.py | 2 +- autogalaxy/ellipse/model/visualizer.py | 6 +- autogalaxy/gui/scribbler.py | 14 +- autogalaxy/imaging/model/analysis.py | 8 +- autogalaxy/imaging/model/plotter_interface.py | 147 +------------ autogalaxy/imaging/model/visualizer.py | 85 +------- autogalaxy/interferometer/model/analysis.py | 8 +- .../interferometer/model/plotter_interface.py | 2 +- autogalaxy/interferometer/model/visualizer.py | 6 +- autogalaxy/quantity/model/analysis.py | 2 +- autogalaxy/quantity/model/visualizer.py | 2 +- docs/howtogalaxy/chapter_1_introduction.rst | 17 +- docs/howtogalaxy/chapter_2_modeling.rst | 32 +-- docs/overview/overview_1_start_here.rst | 8 +- .../analysis/analysis/test_analysis.py | 5 +- test_autogalaxy/analysis/test_clump_model.py | 99 +++++++++ .../model/test_plotter_interface_imaging.py | 28 --- 26 files changed, 424 insertions(+), 373 deletions(-) create mode 100644 autogalaxy/analysis/clump_model.py create mode 100644 test_autogalaxy/analysis/test_clump_model.py diff --git a/autogalaxy/__init__.py b/autogalaxy/__init__.py index c7c42cca7..26df5df98 100644 --- a/autogalaxy/__init__.py +++ b/autogalaxy/__init__.py @@ -4,7 +4,6 @@ from autoarray.dataset.interferometer.dataset import Interferometer # noqa from autoarray.dataset.dataset_model import DatasetModel from autoarray.dataset.over_sampling import OverSamplingDataset -from autoarray.inversion.inversion.mapper_valued import MapperValued from autoarray.inversion.pixelization import mesh # noqa from autoarray.inversion import regularization as reg # noqa from autoarray.inversion.pixelization import image_mesh @@ -109,6 +108,8 @@ from .gui.clicker import Clicker from .gui.scribbler import Scribbler +from .analysis.clump_model import ClumpModel + from autoconf import conf conf.instance.register(__file__) diff --git a/autogalaxy/aggregator/ellipse/fit_ellipse.py b/autogalaxy/aggregator/ellipse/fit_ellipse.py index 0fe101295..031a7c24a 100644 --- a/autogalaxy/aggregator/ellipse/fit_ellipse.py +++ b/autogalaxy/aggregator/ellipse/fit_ellipse.py @@ -60,6 +60,7 @@ def _fit_ellipse_from( for dataset, ellipse_list, multipole_lists in zip( dataset_list, ellipse_list_list, multipole_list_list ): + for ellipse, multipole_list in zip(ellipse_list, multipole_lists): fit_dataset_list.append( FitEllipse( diff --git a/autogalaxy/aggregator/galaxies.py b/autogalaxy/aggregator/galaxies.py index ed1c3224e..a6711ac54 100644 --- a/autogalaxy/aggregator/galaxies.py +++ b/autogalaxy/aggregator/galaxies.py @@ -41,14 +41,14 @@ def _galaxies_from(fit: af.Fit, instance: af.ModelInstance) -> List[Galaxy]: if instance is not None: galaxies = instance.galaxies - if hasattr(instance, "extra_galaxies"): - galaxies = galaxies + fit.instance.extra_galaxies + if hasattr(instance, "clumps"): + galaxies = galaxies + fit.instance.clumps else: galaxies = fit.instance.galaxies - if hasattr(fit.instance, "extra_galaxies"): - galaxies = galaxies + fit.instance.extra_galaxies + if hasattr(fit.instance, "clumps"): + galaxies = galaxies + fit.instance.clumps if fit.children is not None: if len(fit.children) > 0: diff --git a/autogalaxy/analysis/analysis/analysis.py b/autogalaxy/analysis/analysis/analysis.py index 0c25b68ef..15645c66b 100644 --- a/autogalaxy/analysis/analysis/analysis.py +++ b/autogalaxy/analysis/analysis/analysis.py @@ -42,8 +42,8 @@ def galaxies_via_instance_from( """ Create a list of galaxies from a model instance, which is used to fit the dataset. - The instance may only contain galaxies, in which case this function is redundant. However, if extra galaxies - are included, the instance will contain both galaxies and extra galaxies, and they should be added to create + The instance may only contain galaxies, in which case this function is redundant. However, if the clumns + API is being used, the instance will contain both galaxies and clumps, and they should be added to create the single list of galaxies used to fit the dataset. Parameters @@ -56,12 +56,11 @@ def galaxies_via_instance_from( ------- A list of galaxies that is used to then fit the dataset. """ - if hasattr(instance, "extra_galaxies"): - if getattr(instance, "extra_galaxies", None) is not None: - return Galaxies( - galaxies=instance.galaxies + instance.extra_galaxies, - run_time_dict=run_time_dict - ) + if hasattr(instance, "clumps"): + return Galaxies( + galaxies=instance.galaxies + instance.clumps, + run_time_dict=run_time_dict, + ) return Galaxies(galaxies=instance.galaxies, run_time_dict=run_time_dict) @@ -148,7 +147,7 @@ def profile_log_likelihood_function( An instance of the model that is being fitted to the data by this analysis (whose parameters have been set via a non-linear search). paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. Returns @@ -239,7 +238,7 @@ def output_profiling_info( Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. run_time_dict A dictionary containing the profiling times of the functions called by the `log_likelihood_function`. diff --git a/autogalaxy/analysis/analysis/dataset.py b/autogalaxy/analysis/analysis/dataset.py index 4dd25bca4..ac5e957e0 100644 --- a/autogalaxy/analysis/analysis/dataset.py +++ b/autogalaxy/analysis/analysis/dataset.py @@ -90,7 +90,7 @@ def save_attributes(self, paths: af.DirectoryPaths): Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. """ paths.save_fits( @@ -145,7 +145,7 @@ def save_results(self, paths: af.DirectoryPaths, result: ResultDataset): Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. result The result of a model fit, including the non-linear search, samples and maximum likelihood tracer. diff --git a/autogalaxy/analysis/chaining_util.py b/autogalaxy/analysis/chaining_util.py index 5affa0bc6..52353670d 100644 --- a/autogalaxy/analysis/chaining_util.py +++ b/autogalaxy/analysis/chaining_util.py @@ -166,19 +166,19 @@ def source_from( return source_custom_model_from(result=result, source_is_model=True) -def extra_galaxies_from( +def clumps_from( result: Result, light_as_model: bool = False, mass_as_model: bool = False, free_centre: bool = False, ) -> af.Collection: """ - The extra galaxies API models the light and / or mass of additional galaxies surrouding the main galaxy or - strong lens system. + The clump API models the light and / or mass of additional galaxies surrouding the main galaxy or strong lens + system. - This function performs model composition of extra galaxies for fits using the search chaining API. It makes it - possible to pass the extra galaxy parameters from a previous search to a new search, such that the new extra - galaxies are either treated as an instance or model component. + This function performs model composition of clumps for fits using the search chaining API. It makes it possible to + pass the clump parameters from a previous search to a new search, such that the new clumps are either treated + as an instance or model component. This function currently requires that mass profiles are `IsothermalSph` objects and that light profiles are `Sersic` objects. This will be generalised in the future. @@ -186,70 +186,57 @@ def extra_galaxies_from( Parameters ---------- result - The result, which includes extra galaxies, of the previous search, which via prior passing are used to create - the new extra galaxy model. + The result, which includes clumps, of the previous search, which via prior passing are used to create the new + clump model. light_as_model - If `True`, the extra_galaxy light is passed as a model component, else it is a fixed instance. + If `True`, the clump light is passed as a model component, else it is a fixed instance. mass_as_model - If `True`, the extra_galaxy mass is passed as a model component, else it is a fixed instance. + If `True`, the clump mass is passed as a model component, else it is a fixed instance. free_centre If `True`, the requested mass and/or light model centres are passed as a model, else they are fixed. Returns ------- af.Collection - A collection of extra galaxy `Galaxy` objects, where each is either an instance or model component. + A collection of clump `Galaxy` objects, where each clump is either an instance or model component. """ # ideal API: - # extra_galaxies = result.instance.extra_galaxies.as_model((LightProfile, mp.MassProfile,), fixed="centre", prior_pass=True) - - if result.instance.extra_galaxies is None: - return None + # clumps = result.instance.clumps.as_model((LightProfile, mp.MassProfile,), fixed="centre", prior_pass=True) if mass_as_model: - extra_galaxies = result.instance.extra_galaxies.as_model((MassProfile,)) - - for extra_galaxy_index in range(len(result.instance.extra_galaxies)): - if hasattr(result.instance.extra_galaxies[extra_galaxy_index], "mass"): - extra_galaxies[ - extra_galaxy_index - ].mass.centre = result.instance.extra_galaxies[ - extra_galaxy_index + clumps = result.instance.clumps.as_model((MassProfile,)) + + for clump_index in range(len(result.instance.clumps)): + if hasattr(result.instance.clumps[clump_index], "mass"): + clumps[clump_index].mass.centre = result.instance.clumps[ + clump_index ].mass.centre - extra_galaxies[ - extra_galaxy_index - ].mass.einstein_radius = result.model.extra_galaxies[ - extra_galaxy_index + clumps[clump_index].mass.einstein_radius = result.model.clumps[ + clump_index ].mass.einstein_radius if free_centre: - extra_galaxies[ - extra_galaxy_index - ].mass.centre = result.model.extra_galaxies[ - extra_galaxy_index + clumps[clump_index].mass.centre = result.model.clumps[ + clump_index ].mass.centre elif light_as_model: - extra_galaxies = result.instance.extra_galaxies.as_model((LightProfile,)) - - for extra_galaxy_index in range(len(result.instance.extra_galaxies)): - if extra_galaxies[extra_galaxy_index].bulge is not None: - extra_galaxies[ - extra_galaxy_index - ].bulge.centre = result.instance.extra_galaxies[ - extra_galaxy_index - ].bulge.centre + clumps = result.instance.clumps.as_model((LightProfile,)) + + for clump_index in range(len(result.instance.clumps)): + if clumps[clump_index].light is not None: + clumps[clump_index].light.centre = result.instance.clumps[ + clump_index + ].light.centre if free_centre: - extra_galaxies[ - extra_galaxy_index - ].bulge.centre = result.model.extra_galaxies[ - extra_galaxy_index - ].bulge.centre + clumps[clump_index].light.centre = result.model.clumps[ + clump_index + ].light.centre else: - extra_galaxies = result.instance.extra_galaxies.as_model(()) + clumps = result.instance.clumps.as_model(()) - return extra_galaxies + return clumps def lp_chain_tracer_from(light_result, settings_search): diff --git a/autogalaxy/analysis/clump_model.py b/autogalaxy/analysis/clump_model.py new file mode 100644 index 000000000..509c40f83 --- /dev/null +++ b/autogalaxy/analysis/clump_model.py @@ -0,0 +1,204 @@ +from typing import List, Optional, Type + +import autofit as af +import autoarray as aa + +from autogalaxy.galaxy.galaxy import Galaxy +from autogalaxy.profiles.light.abstract import LightProfile +from autogalaxy.profiles.mass.abstract.abstract import MassProfile + + +class ClumpModel: + def __init__( + self, + redshift: float, + centres: aa.Grid2DIrregular, + light_cls: Optional[Type[LightProfile]] = None, + mass_cls: Optional[Type[MassProfile]] = None, + einstein_radius_upper_limit: Optional[float] = None, + unfix_centres: bool = False, + ): + """ + The clump API allows creates model components which model the light and mass of galaxies that are nearby the + main galaxy(s) of interest. + + The `ClumpModel` object handles the creation of these model components to streamline model composition with + multiple clumps. + + Every galaxy which is modeled as a clump has its centre input into this object which is fixed to this value + for model-fitting. All clumps are created as model `Galaxy` objects with a shard input redshift. + + The light and mass profiles of the clumps are input via the `light_cls` and `mass_cls` inputs. If either is + omitted the clumps are not assigned a light or mass model. + + Parameters + ---------- + redshift + The redshift value of all clumps, which is likely the same as the main galaxy redshift. + centres + The centre of every clump in the model, whose light and mass profile centres are fixed to this value + throughout the model-fit. + light_cls + The light profile given to all clumps; if omitted all clumps have no light profile. + mass_cls + The mass profile given to all clumps; if omitted all clumps have no mass profile. + einstein_radius_upper_limit + The upper limit given to any mass model's `einstein_radius` parameter (e.g. if `IsothermalSph` profiles + are used to model clumps). + unfix_centres + If required, change the mass and light centres from fixed values to Uniform Prior Models +/- 0.1 around + the input centres. + """ + self.redshift = redshift + self.centres = centres + + self.light_cls = light_cls + self.mass_cls = mass_cls + + self.einstein_radius_upper_limit = einstein_radius_upper_limit + self.unfix_centres = unfix_centres + + self.centre_prior_half_width = 0.1 + + @property + def total_clumps(self) -> int: + return len(self.centres.in_list) + + def unfix_centre(obj, centre): + obj.centre.centre_0 = af.UniformPrior( + lower_limit=new_centre[0] - centre_prior_half_width, + upper_limit=new_centre[0] + centre_prior_half_width, + ) + obj.centre.centre_1 = af.UniformPrior( + lower_limit=new_centre[1] - centre_prior_half_width, + upper_limit=new_centre[1] + centre_prior_half_width, + ) + return obj + + @property + def light_list(self) -> Optional[List[af.Model]]: + """ + Returns a list of every clump's light model, where the centre of that light model is fixed to its corresponding + input clump's centre, unless specified to be free. + """ + if self.light_cls is None: + return None + + light_list = [] + + for centre in self.centres.in_list: + if self.unfix_centres: + light_list.append(unfix_centre(af.Model(self.light_cls), centre)) + else: + light_list.append(af.Model(self.light_cls, centre=centre)) + + return light_list + + @property + def mass_list(self) -> Optional[List[af.Model]]: + """ + Returns a list of every clump's mass model, where the centre of that mass model is fixed to its corresponding + input clump's centre, unless specified to be free. + """ + if self.mass_cls is None: + return None + + mass_list = [] + + for centre in self.centres.in_list: + if self.unfix_centres: + mass = unfix_centres(af.Model(self.mass_cls), centre) + else: + mass = af.Model(self.mass_cls, centre=centre) + + if ( + hasattr(mass, "einstein_radius") + and self.einstein_radius_upper_limit is not None + ): + mass.einstein_radius = af.UniformPrior( + lower_limit=0.0, upper_limit=self.einstein_radius_upper_limit + ) + mass_list.append(mass) + + return mass_list + + @property + def clumps_light_only(self) -> af.Collection: + """ + Returns all clumps as a `Collection` model object, which can be easily added to an overall model `Collection` + of galaxies (see the `clumps` property below for more details). + + All clumps only contain their model mass profiles, which is important for certain pipelines which omit + the clump mass profiles. + """ + clumps_light_only = {} + + for i in range(self.total_clumps): + light = self.light_list[i] if self.light_cls is not None else None + + clumps_light_only[f"clump_{i}"] = af.Model( + Galaxy, redshift=self.redshift, light=light + ) + + return af.Collection(**clumps_light_only) + + @property + def clumps_mass_only(self) -> af.Collection: + """ + Returns all clumps as a `Collection` model object, which can be easily added to an overall model `Collection` + of galaxies (see the `clumps` property below for more details). + + All clumps only contain their model mass profiles, which is important for certain pipelines which omit + the clump light profiles. + """ + clumps_mass_only = {} + + for i in range(self.total_clumps): + mass = self.mass_list[i] if self.mass_cls is not None else None + + clumps_mass_only[f"clump_{i}"] = af.Model( + Galaxy, redshift=self.redshift, mass=mass + ) + + return af.Collection(**clumps_mass_only) + + @property + def clumps(self) -> af.Collection: + """ + Returns all clumps as a `Collection` model object, which can be easily added to an overall model `Collection` + of galaxies. + + To make this `Collection` every clump centre and the input `light_cls` / `mass_cls` are used to create a + dictionary of model `Galaxy` objects with fixed light and mass profile centres. Their redshifts use the + input redshift. + + The keys of this dictionary are numerically ordered as `clump_0`, `clump_2` etc. + """ + clumps = {} + + for i in range(self.total_clumps): + light = self.light_list[i] if self.light_cls is not None else None + mass = self.mass_list[i] if self.mass_cls is not None else None + + clumps[f"clump_{i}"] = af.Model( + Galaxy, redshift=self.redshift, light=light, mass=mass + ) + + return af.Collection(**clumps) + + +class ClumpModelDisabled: + def __init__(self): + pass + + @property + def clumps_light_only(self): + return af.Collection() + + @property + def clumps_mass_only(self): + return af.Collection() + + @property + def clumps(self): + return af.Collection() diff --git a/autogalaxy/analysis/plotter_interface.py b/autogalaxy/analysis/plotter_interface.py index bc5646635..df0da17d5 100644 --- a/autogalaxy/analysis/plotter_interface.py +++ b/autogalaxy/analysis/plotter_interface.py @@ -379,7 +379,7 @@ def adapt_images( Visualizes the adapt images used by a model-fit for adaptive pixelization mesh's and regularization. Images are output to the `image` folder of the `image_path` in a subfolder called `adapt`. When - used with a non-linear search the `image_path` is the output folder of the non-linear search. + used with a non-linear search the `image_path` points to the search's results folder. Visualization includes an image of the overall adapt model image and a subplot of all galaxy images on the same figure. diff --git a/autogalaxy/ellipse/model/analysis.py b/autogalaxy/ellipse/model/analysis.py index 7e228ece3..07f92f41c 100644 --- a/autogalaxy/ellipse/model/analysis.py +++ b/autogalaxy/ellipse/model/analysis.py @@ -181,7 +181,7 @@ def save_attributes(self, paths: af.DirectoryPaths): Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. """ paths.save_fits( @@ -226,7 +226,7 @@ def profile_log_likelihood_function( An instance of the model that is being fitted to the data by this analysis (whose parameters have been set via a non-linear search). paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. Returns diff --git a/autogalaxy/ellipse/model/plotter_interface.py b/autogalaxy/ellipse/model/plotter_interface.py index bce0ecdf6..cbbf52fc6 100644 --- a/autogalaxy/ellipse/model/plotter_interface.py +++ b/autogalaxy/ellipse/model/plotter_interface.py @@ -17,7 +17,7 @@ def imaging(self, dataset: aa.Imaging): Visualizes an `Imaging` dataset object. Images are output to the `image` folder of the `image_path` in a subfolder called `imaging`. When used with - a non-linear search the `image_path` is the output folder of the non-linear search. + a non-linear search the `image_path` points to the search's results folder. `. Visualization includes individual images of attributes of the dataset (e.g. the image, noise map, PSF) and a subplot of all these attributes on the same figure. diff --git a/autogalaxy/ellipse/model/visualizer.py b/autogalaxy/ellipse/model/visualizer.py index 42862f101..781bf6213 100644 --- a/autogalaxy/ellipse/model/visualizer.py +++ b/autogalaxy/ellipse/model/visualizer.py @@ -20,10 +20,10 @@ def visualize_before_fit( Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. model - The model object, which includes model components representing the galaxies that are fitted to + The PyAutoFit model object, which includes model components representing the galaxies that are fitted to the imaging data. """ @@ -55,7 +55,7 @@ def visualize( Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. instance An instance of the model that is being fitted to the data by this analysis (whose parameters have been set diff --git a/autogalaxy/gui/scribbler.py b/autogalaxy/gui/scribbler.py index d8183f504..505562cc8 100644 --- a/autogalaxy/gui/scribbler.py +++ b/autogalaxy/gui/scribbler.py @@ -166,13 +166,13 @@ def show_mask(self): junk_mask = masks["1"] feature_mask = masks["2"] plt.ioff() - # plt.figure() - # plt.subplot(121) - # plt.imshow(junk_mask.astype("int"), cmap="gray") - # plt.title("Junk mask") - # plt.subplot(122) - # plt.imshow(feature_mask.astype("int"), cmap="gray") - # plt.title("Feature mask") + plt.figure() + plt.subplot(121) + plt.imshow(junk_mask.astype("int"), cmap="gray") + plt.title("Junk mask") + plt.subplot(122) + plt.imshow(feature_mask.astype("int"), cmap="gray") + plt.title("Feature mask") # plt.show() return junk_mask diff --git a/autogalaxy/imaging/model/analysis.py b/autogalaxy/imaging/model/analysis.py index 5e6a8844f..ad2bc643f 100644 --- a/autogalaxy/imaging/model/analysis.py +++ b/autogalaxy/imaging/model/analysis.py @@ -84,10 +84,10 @@ def modify_before_fit(self, paths: af.DirectoryPaths, model: af.Collection): Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. model - The model object, which includes model components representing the galaxies that are fitted to + The PyAutoFit model object, which includes model components representing the galaxies that are fitted to the imaging data. """ @@ -217,7 +217,7 @@ def save_attributes(self, paths: af.DirectoryPaths): Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. """ super().save_attributes(paths=paths) @@ -254,7 +254,7 @@ def profile_log_likelihood_function( An instance of the model that is being fitted to the data by this analysis (whose parameters have been set via a non-linear search). paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. Returns diff --git a/autogalaxy/imaging/model/plotter_interface.py b/autogalaxy/imaging/model/plotter_interface.py index 2352e4e1a..564369c82 100644 --- a/autogalaxy/imaging/model/plotter_interface.py +++ b/autogalaxy/imaging/model/plotter_interface.py @@ -1,5 +1,4 @@ from os import path -from typing import List import autoarray as aa import autoarray.plot as aplt @@ -14,21 +13,21 @@ class PlotterInterfaceImaging(PlotterInterface): def imaging(self, dataset: aa.Imaging): """ - Output visualization of an `Imaging` dataset, typically before a model-fit is performed. + Visualizes an `Imaging` dataset object. - Images are output to the `image` folder of the `image_path` in a subfolder called `dataset`. When used with - a non-linear search the `image_path` is the output folder of the non-linear search. + Images are output to the `image` folder of the `image_path` in a subfolder called `imaging`. When used with + a non-linear search the `image_path` points to the search's results folder. `. Visualization includes individual images of attributes of the dataset (e.g. the image, noise map, PSF) and a subplot of all these attributes on the same figure. - The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under - the `dataset` header. + The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under the + [dataset] header. Parameters ---------- dataset - The imaging dataset which is visualized. + The imaging dataset whose attributes are visualized. """ def should_plot(name): @@ -158,137 +157,3 @@ def should_plot(name): subtracted_image=True, model_image=True, ) - - def imaging_combined(self, dataset_list: List[aa.Imaging]): - """ - Output visualization of all `Imaging` datasets in a summed combined analysis, typically before a model-fit - is performed. - - Images are output to the `image` folder of the `image_path` in a subfolder called `dataset_combined`. When - used with a non-linear search the `image_path` is the output folder of the non-linear search. - `. - Visualization includes individual images of attributes of each dataset (e.g. the image, noise map, PSF) on - a single subplot, such that the full suite of multiple datasets can be viewed on the same figure. - - The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under - the `dataset` header. - - Parameters - ---------- - dataset - The list of imaging datasets which are visualized. - """ - - def should_plot(name): - return plot_setting(section=["dataset", "imaging"], name=name) - - mat_plot_2d = self.mat_plot_2d_from(subfolders="combined") - - dataset_plotter_list = [ - aplt.ImagingPlotter( - dataset=dataset, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d - ) - for dataset in dataset_list - ] - - subplot_shape = (len(dataset_list), 4) - - multi_plotter = aplt.MultiFigurePlotter( - plotter_list=dataset_plotter_list, subplot_shape=subplot_shape - ) - - if should_plot("subplot_dataset"): - multi_plotter.subplot_of_figures_multi( - func_name_list=["figures_2d"] * 4, - figure_name_list=["data", "noise_map", "signal_to_noise_map", "psf"], - filename_suffix="dataset", - ) - - for plotter in multi_plotter.plotter_list: - plotter.mat_plot_2d.use_log10 = True - - multi_plotter.subplot_of_figures_multi( - func_name_list=["figures_2d"] * 4, - figure_name_list=["data", "noise_map", "signal_to_noise_map", "psf"], - filename_suffix="dataset_log10", - ) - - def fit_imaging_combined(self, fit_list: List[FitImaging]): - """ - Output visualization of all `FitImaging` objects in a summed combined analysis, typically during or after a - model-fit is performed. - - Images are output to the `image` folder of the `image_path` in a subfolder called `combined`. When used - with a non-linear search the `image_path` is the output folder of the non-linear search. - `. - Visualization includes individual images of attributes of each fit (e.g. data, normalized residual-map) on - a single subplot, such that the full suite of multiple datasets can be viewed on the same figure. - - The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under - the `fit` header. - - Parameters - ---------- - fit - The list of imaging fits which are visualized. - """ - - def should_plot(name): - return plot_setting(section=["fit", "fit_imaging"], name=name) - - mat_plot_2d = self.mat_plot_2d_from(subfolders="combined") - - fit_plotter_list = [ - FitImagingPlotter( - fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d - ) - for fit in fit_list - ] - - subplot_shape = (len(fit_list), 5) - - multi_plotter = aplt.MultiFigurePlotter( - plotter_list=fit_plotter_list, subplot_shape=subplot_shape - ) - - if should_plot("subplot_fit"): - - def make_subplot_fit(filename_suffix): - multi_plotter.subplot_of_figures_multi( - func_name_list=["figures_2d"] * 4, - figure_name_list=[ - "data", - "signal_to_noise_map", - "model_image", - "normalized_residual_map", - ], - filename_suffix=filename_suffix, - number_subplots=len(fit_list) * 5, - close_subplot=False, - ) - - for plotter in multi_plotter.plotter_list: - plotter.mat_plot_2d.cmap.kwargs["vmin"] = -1.0 - plotter.mat_plot_2d.cmap.kwargs["vmax"] = 1.0 - - multi_plotter.subplot_of_figures_multi( - func_name_list=["figures_2d"], - figure_name_list=[ - "normalized_residual_map", - ], - filename_suffix=filename_suffix, - number_subplots=len(fit_list) * 5, - subplot_index_offset=4, - open_subplot=False, - ) - - for plotter in multi_plotter.plotter_list: - plotter.mat_plot_2d.cmap.kwargs["vmin"] = None - plotter.mat_plot_2d.cmap.kwargs["vmax"] = None - - make_subplot_fit(filename_suffix="fit") - - for plotter in multi_plotter.plotter_list: - plotter.mat_plot_2d.use_log10 = True - - make_subplot_fit(filename_suffix="fit_log10") diff --git a/autogalaxy/imaging/model/visualizer.py b/autogalaxy/imaging/model/visualizer.py index 201c72d48..fa169c0ab 100644 --- a/autogalaxy/imaging/model/visualizer.py +++ b/autogalaxy/imaging/model/visualizer.py @@ -20,10 +20,10 @@ def visualize_before_fit( Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. model - The model object, which includes model components representing the galaxies that are fitted to + The PyAutoFit model object, which includes model components representing the galaxies that are fitted to the imaging data. """ @@ -63,7 +63,7 @@ def visualize( Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. instance An instance of the model that is being fitted to the data by this analysis (whose parameters have been set @@ -94,82 +94,3 @@ def visualize( ) if fit.inversion is not None: plotter.inversion(inversion=fit.inversion, during_analysis=during_analysis) - - @staticmethod - def visualize_before_fit_combined( - analyses, - paths: af.AbstractPaths, - model: af.AbstractPriorModel, - ): - """ - Performs visualization before the non-linear search begins of information which shared across all analyses - on a single matplotlib figure. - - This function outputs visuals of all information which does not vary during the fit, for example the dataset - being fitted. - - Parameters - ---------- - analyses - The list of all analysis objects used for fitting via yhe non-linear search. - paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, - visualization and the pickled objects used by the aggregator output by this function. - model - The model object, which includes model components representing the galaxies that are fitted to - the imaging data. - """ - - if analyses is None: - return - - plotter = PlotterInterfaceImaging( - image_path=paths.image_path, title_prefix=analyses[0].title_prefix - ) - - dataset_list = [analysis.dataset for analysis in analyses] - - plotter.imaging_combined( - dataset_list=dataset_list, - ) - - @staticmethod - def visualize_combined( - analyses, - paths: af.AbstractPaths, - instance: af.ModelInstance, - during_analysis: bool, - ): - """ - Performs visualization during the non-linear search of information which is shared across all analyses on a - single matplotlib figure. - - This function outputs visuals of all information which varies during the fit, for example the model-fit to - the dataset being fitted. - - Parameters - ---------- - analyses - The list of all analysis objects used for fitting via yhe non-linear search. - paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, - visualization and the pickled objects used by the aggregator output by this function. - model - The model object, which includes model components representing the galaxies that are fitted to - the imaging data. - """ - if analyses is None: - return - - plotter = PlotterInterfaceImaging( - image_path=paths.image_path, title_prefix=analyses[0].title_prefix - ) - - fit_list = [ - analysis.fit_from(instance=single_instance) - for analysis, single_instance in zip(analyses, instance) - ] - - plotter.fit_imaging_combined( - fit_list=fit_list, - ) diff --git a/autogalaxy/interferometer/model/analysis.py b/autogalaxy/interferometer/model/analysis.py index 126561f76..7ee73d1f8 100644 --- a/autogalaxy/interferometer/model/analysis.py +++ b/autogalaxy/interferometer/model/analysis.py @@ -89,10 +89,10 @@ def modify_before_fit(self, paths: af.DirectoryPaths, model: af.Collection): Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. model - The model object, which includes model components representing the galaxies that are fitted to + The PyAutoFit model object, which includes model components representing the galaxies that are fitted to the imaging data. """ @@ -217,7 +217,7 @@ def save_attributes(self, paths: af.DirectoryPaths): Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. """ super().save_attributes(paths=paths) @@ -256,7 +256,7 @@ def profile_log_likelihood_function( An instance of the model that is being fitted to the data by this analysis (whose parameters have been set via a non-linear search). paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. Returns diff --git a/autogalaxy/interferometer/model/plotter_interface.py b/autogalaxy/interferometer/model/plotter_interface.py index 335dbe25a..5686415ac 100644 --- a/autogalaxy/interferometer/model/plotter_interface.py +++ b/autogalaxy/interferometer/model/plotter_interface.py @@ -18,7 +18,7 @@ def interferometer(self, dataset: aa.Interferometer): Visualizes an `Interferometer` dataset object. Images are output to the `image` folder of the `image_path` in a subfolder called `interferometer`. When - used with a non-linear search the `image_path` is the output folder of the non-linear search. + used with a non-linear search the `image_path` points to the search's results folder. Visualization includes individual images of attributes of the dataset (e.g. the visibilities, noise map, uv-wavelengths) and a subplot of all these attributes on the same figure. diff --git a/autogalaxy/interferometer/model/visualizer.py b/autogalaxy/interferometer/model/visualizer.py index 03e5d4655..ca3b5bc1d 100644 --- a/autogalaxy/interferometer/model/visualizer.py +++ b/autogalaxy/interferometer/model/visualizer.py @@ -21,10 +21,10 @@ def visualize_before_fit( Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. model - The model object, which includes model components representing the galaxies that are fitted to + The PyAutoFit model object, which includes model components representing the galaxies that are fitted to the imaging data. """ @@ -67,7 +67,7 @@ def visualize( Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. instance An instance of the model that is being fitted to the data by this analysis (whose parameters have been set diff --git a/autogalaxy/quantity/model/analysis.py b/autogalaxy/quantity/model/analysis.py index 78ebb372f..aaf9e5f27 100644 --- a/autogalaxy/quantity/model/analysis.py +++ b/autogalaxy/quantity/model/analysis.py @@ -147,7 +147,7 @@ def save_attributes(self, paths: af.DirectoryPaths): Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. """ paths.save_fits( diff --git a/autogalaxy/quantity/model/visualizer.py b/autogalaxy/quantity/model/visualizer.py index 2b2af686a..48b30e16a 100644 --- a/autogalaxy/quantity/model/visualizer.py +++ b/autogalaxy/quantity/model/visualizer.py @@ -30,7 +30,7 @@ def visualize( Parameters ---------- paths - The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. instance An instance of the model that is being fitted to the data by this analysis (whose parameters have been set diff --git a/docs/howtogalaxy/chapter_1_introduction.rst b/docs/howtogalaxy/chapter_1_introduction.rst index 538cd4da1..5d8cb0767 100644 --- a/docs/howtogalaxy/chapter_1_introduction.rst +++ b/docs/howtogalaxy/chapter_1_introduction.rst @@ -10,17 +10,14 @@ The chapter contains the following tutorials: `Tutorial 0: Visualization `_ - Setting up **PyAutoGalaxy**'s visualization library. -`Tutorial 1: Grids And Galaxies `_ -- Using grids of (y,x) coordinates with galaxies made up of light profiles. +`Tutorial 1: Grids `_ +- Uniform grids of (y,x) coordinates used for ray-tracing. -`Tutorial 2: Data `_ -- Simulating and inspecting telescope imaging data of a galaxy. +`Tutorial 2: Light Profiles `_ +- Analytic profiles representing light distributions. -`Tutorial 3: Fitting `_ -- Fitting data with a galaxy model. +`Tutorial 3: Galaxies `_ +- Making galaxy objects out of light and mass profile. -`Tutorial 4: Methods `_ -- An overview of the different methods used to fit galaxies with. - -`Tutorial 5: Summary `_ +`Tutorial 6: Summary `_ - A summary of the chapter. \ No newline at end of file diff --git a/docs/howtogalaxy/chapter_2_modeling.rst b/docs/howtogalaxy/chapter_2_modeling.rst index 66c2432b2..d912944d6 100644 --- a/docs/howtogalaxy/chapter_2_modeling.rst +++ b/docs/howtogalaxy/chapter_2_modeling.rst @@ -5,27 +5,33 @@ In chapter 2, we'll take you through how to model galaxies using a non-linear se The chapter contains the following tutorials: -`Tutorial 1: Non-linear Search `_ -- How a non-linear search is used to fit a lens model. +`Tutorial 1: Data `_ +- Loading and inspecting telescope imaging data of a galaxy. -`Tutorial 2: Parameter Space And Priors `_ +`Tutorial 2: Fitting `_ +- Fitting data with a galaxy model. + +`Tutorial 3: Non-linear Search `_ +- How a non-linear search is used to fit a model. + +`Tutorial 4: Parameter Space And Priors `_ - The Concepts of a parameter space and priors. -`Tutorial 3: Realism and Complexity `_ -- Finding a balance between realism and complexity when composing and fitting a lens model. +`Tutorial 5: Realism and Complexity `_ +- Finding a balance between realism and complexity when composing and fitting a model. -`Tutorial 4: Dealing with Failure `_ -- What to do when PyAutoLens finds an inaccurate lens model. +`Tutorial 6: Dealing with Failure `_ +- What to do when PyAutoGalaxy finds an inaccurate model. -`Tutorial 5: Linear Profiles `_ +`Tutorial 7: Linear Profiles `_ - Light profiles which capture complex morphologies in a reduced number of non-linear parameters. -`Tutorial 6: Masking and Positions `_ -- How to mask and mark positions on your data to improve the lens model. +`Tutorial 8: Masking `_ +- How to mask your data to improve the model. -`Tutorial 7: Results `_ -- Overview of the results available after successfully fitting a lens model. +`Tutorial 9: Results `_ +- Overview of the results available after successfully fitting a model. -`Tutorial 8: Need for Speed `_ +`Tutorial 10: Need for Speed `_ - How to fit complex models whilst balancing efficiency and run-time. diff --git a/docs/overview/overview_1_start_here.rst b/docs/overview/overview_1_start_here.rst index ce3046d85..5d7a399da 100644 --- a/docs/overview/overview_1_start_here.rst +++ b/docs/overview/overview_1_start_here.rst @@ -219,10 +219,10 @@ To further illustrate this, we create a merging galaxy system with 4 star formin intensity=0.1, effective_radius=1.6, ), - extra_galaxy_0=ag.lp.SersicSph(centre=(1.0, 1.0), intensity=0.5, effective_radius=0.2), - extra_galaxy_1=ag.lp.SersicSph(centre=(0.5, 0.8), intensity=0.5, effective_radius=0.2), - extra_galaxy_2=ag.lp.SersicSph(centre=(-1.0, -0.7), intensity=0.5, effective_radius=0.2), - extra_galaxy_3=ag.lp.SersicSph(centre=(-1.0, 0.4), intensity=0.5, effective_radius=0.2), + clump_0=ag.lp.SersicSph(centre=(1.0, 1.0), intensity=0.5, effective_radius=0.2), + clump_1=ag.lp.SersicSph(centre=(0.5, 0.8), intensity=0.5, effective_radius=0.2), + clump_2=ag.lp.SersicSph(centre=(-1.0, -0.7), intensity=0.5, effective_radius=0.2), + clump_3=ag.lp.SersicSph(centre=(-1.0, 0.4), intensity=0.5, effective_radius=0.2), ) galaxy_1 = ag.Galaxy( diff --git a/test_autogalaxy/analysis/analysis/test_analysis.py b/test_autogalaxy/analysis/analysis/test_analysis.py index 387e50c8f..2e7be98d5 100644 --- a/test_autogalaxy/analysis/analysis/test_analysis.py +++ b/test_autogalaxy/analysis/analysis/test_analysis.py @@ -11,11 +11,10 @@ def test__galaxies_via_instance(masked_imaging_7x7): galaxy = ag.Galaxy(redshift=0.5, light=ag.lp.Sersic(intensity=0.1)) - extra_galaxy = ag.Galaxy(redshift=0.5, light=ag.lp.Sersic(intensity=0.2)) + clump = ag.Galaxy(redshift=0.5, light=ag.lp.Sersic(intensity=0.2)) model = af.Collection( - galaxies=af.Collection(galaxy=galaxy), - extra_galaxies=af.Collection(extra_galaxy_0=extra_galaxy), + galaxies=af.Collection(galaxy=galaxy), clumps=af.Collection(clump_0=clump) ) analysis = ag.AnalysisImaging(dataset=masked_imaging_7x7) diff --git a/test_autogalaxy/analysis/test_clump_model.py b/test_autogalaxy/analysis/test_clump_model.py new file mode 100644 index 000000000..12d4230ae --- /dev/null +++ b/test_autogalaxy/analysis/test_clump_model.py @@ -0,0 +1,99 @@ +import autofit as af +import autogalaxy as ag + + +def test__clumps(): + centres = ag.Grid2DIrregular(values=[(1.0, 1.0)]) + + clump_model = ag.ClumpModel( + redshift=0.5, centres=centres, light_cls=ag.lp.SersicSph + ) + + clumps = clump_model.clumps + + assert clumps["clump_0"].redshift == 0.5 + assert clumps["clump_0"].light.centre == (1.0, 1.0) + assert isinstance(clumps["clump_0"].light.intensity, af.LogUniformPrior) + assert clumps["clump_0"].mass == None + + clump_model = ag.ClumpModel( + redshift=0.5, centres=centres, mass_cls=ag.mp.IsothermalSph + ) + + clumps = clump_model.clumps + + assert clumps["clump_0"].redshift == 0.5 + assert clumps["clump_0"].mass.centre == (1.0, 1.0) + assert isinstance(clumps["clump_0"].mass.einstein_radius, af.UniformPrior) + assert clumps["clump_0"].light == None + + clump_model = ag.ClumpModel( + redshift=0.5, + centres=centres, + light_cls=ag.lp.SersicSph, + mass_cls=ag.mp.IsothermalSph, + ) + + clumps = clump_model.clumps + + assert clumps["clump_0"].redshift == 0.5 + assert clumps["clump_0"].light.centre == (1.0, 1.0) + assert clumps["clump_0"].mass.centre == (1.0, 1.0) + assert isinstance(clumps["clump_0"].light.intensity, af.LogUniformPrior) + assert isinstance(clumps["clump_0"].mass.einstein_radius, af.UniformPrior) + + +def test__clumps_light_only(): + centres = ag.Grid2DIrregular(values=[(1.0, 1.0)]) + + clump_model = ag.ClumpModel( + redshift=0.5, + centres=centres, + light_cls=ag.lp.SersicSph, + mass_cls=ag.mp.IsothermalSph, + ) + + clumps_light_only = clump_model.clumps_light_only + + assert clumps_light_only["clump_0"].redshift == 0.5 + assert clumps_light_only["clump_0"].light.centre == (1.0, 1.0) + assert isinstance(clumps_light_only["clump_0"].light.intensity, af.LogUniformPrior) + assert not hasattr(clumps_light_only["clump_0"], "mass") + + +def test__clumps_mass_only(): + centres = ag.Grid2DIrregular(values=[(1.0, 1.0)]) + + clump_model = ag.ClumpModel( + redshift=0.5, + centres=centres, + light_cls=ag.lp.SersicSph, + mass_cls=ag.mp.IsothermalSph, + ) + + clumps_mass_only = clump_model.clumps_mass_only + + assert clumps_mass_only["clump_0"].redshift == 0.5 + assert clumps_mass_only["clump_0"].mass.centre == (1.0, 1.0) + assert isinstance(clumps_mass_only["clump_0"].mass.einstein_radius, af.UniformPrior) + assert not hasattr(clumps_mass_only["clump_0"], "light") + + +def test__einstein_radius_max(): + centres = ag.Grid2DIrregular(values=[(1.0, 1.0)]) + + clump_model = ag.ClumpModel( + redshift=0.5, + centres=centres, + mass_cls=ag.mp.IsothermalSph, + einstein_radius_upper_limit=1.0, + ) + + clumps = clump_model.clumps + + assert isinstance(clumps["clump_0"].mass.einstein_radius, af.UniformPrior) + assert clumps["clump_0"].mass.einstein_radius.upper_limit == 1.0 + + assert clumps["clump_0"].redshift == 0.5 + assert clumps["clump_0"].mass.centre == (1.0, 1.0) + assert clumps["clump_0"].light == None diff --git a/test_autogalaxy/imaging/model/test_plotter_interface_imaging.py b/test_autogalaxy/imaging/model/test_plotter_interface_imaging.py index 0c43849e2..a2fd39420 100644 --- a/test_autogalaxy/imaging/model/test_plotter_interface_imaging.py +++ b/test_autogalaxy/imaging/model/test_plotter_interface_imaging.py @@ -31,19 +31,6 @@ def test__imaging(imaging_7x7, include_2d_all, plot_path, plot_patch): assert path.join(plot_path, "signal_to_noise_map.png") not in plot_patch.paths -def test__imaging_combined(imaging_7x7, plot_path, plot_patch): - if path.exists(plot_path): - shutil.rmtree(plot_path) - - visualizer = PlotterInterfaceImaging(image_path=plot_path) - - visualizer.imaging_combined(dataset_list=[imaging_7x7, imaging_7x7]) - - plot_path = path.join(plot_path, "combined") - - assert path.join(plot_path, "subplot_dataset.png") in plot_patch.paths - - def test__fit_imaging( masked_imaging_7x7, fit_imaging_x2_galaxy_inversion_7x7, @@ -74,18 +61,3 @@ def test__fit_imaging( ) assert image.shape == (7, 7) - - -def test__fit_imaging_combined( - fit_imaging_x2_galaxy_inversion_7x7, plot_path, plot_patch -): - if path.exists(plot_path): - shutil.rmtree(plot_path) - - visualizer = PlotterInterfaceImaging(image_path=plot_path) - - visualizer.fit_imaging_combined(fit_list=2 * [fit_imaging_x2_galaxy_inversion_7x7]) - - plot_path = path.join(plot_path, "combined") - - assert path.join(plot_path, "subplot_fit.png") in plot_patch.paths From 860d142bd617a87c515bf80bfde48b79ea68b83e Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Fri, 25 Oct 2024 15:13:55 +0100 Subject: [PATCH 18/26] Revert "Revert "Main to JAX"" --- autogalaxy/__init__.py | 3 +- autogalaxy/aggregator/ellipse/fit_ellipse.py | 1 - autogalaxy/aggregator/galaxies.py | 8 +- autogalaxy/analysis/analysis/analysis.py | 19 +- autogalaxy/analysis/analysis/dataset.py | 4 +- autogalaxy/analysis/chaining_util.py | 81 ++++--- autogalaxy/analysis/clump_model.py | 204 ------------------ autogalaxy/analysis/plotter_interface.py | 2 +- autogalaxy/ellipse/model/analysis.py | 4 +- autogalaxy/ellipse/model/plotter_interface.py | 2 +- autogalaxy/ellipse/model/visualizer.py | 6 +- autogalaxy/gui/scribbler.py | 14 +- autogalaxy/imaging/model/analysis.py | 8 +- autogalaxy/imaging/model/plotter_interface.py | 147 ++++++++++++- autogalaxy/imaging/model/visualizer.py | 85 +++++++- autogalaxy/interferometer/model/analysis.py | 8 +- .../interferometer/model/plotter_interface.py | 2 +- autogalaxy/interferometer/model/visualizer.py | 6 +- autogalaxy/quantity/model/analysis.py | 2 +- autogalaxy/quantity/model/visualizer.py | 2 +- docs/howtogalaxy/chapter_1_introduction.rst | 17 +- docs/howtogalaxy/chapter_2_modeling.rst | 32 ++- docs/overview/overview_1_start_here.rst | 8 +- .../analysis/analysis/test_analysis.py | 5 +- test_autogalaxy/analysis/test_clump_model.py | 99 --------- .../model/test_plotter_interface_imaging.py | 28 +++ 26 files changed, 373 insertions(+), 424 deletions(-) delete mode 100644 autogalaxy/analysis/clump_model.py delete mode 100644 test_autogalaxy/analysis/test_clump_model.py diff --git a/autogalaxy/__init__.py b/autogalaxy/__init__.py index 26df5df98..c7c42cca7 100644 --- a/autogalaxy/__init__.py +++ b/autogalaxy/__init__.py @@ -4,6 +4,7 @@ from autoarray.dataset.interferometer.dataset import Interferometer # noqa from autoarray.dataset.dataset_model import DatasetModel from autoarray.dataset.over_sampling import OverSamplingDataset +from autoarray.inversion.inversion.mapper_valued import MapperValued from autoarray.inversion.pixelization import mesh # noqa from autoarray.inversion import regularization as reg # noqa from autoarray.inversion.pixelization import image_mesh @@ -108,8 +109,6 @@ from .gui.clicker import Clicker from .gui.scribbler import Scribbler -from .analysis.clump_model import ClumpModel - from autoconf import conf conf.instance.register(__file__) diff --git a/autogalaxy/aggregator/ellipse/fit_ellipse.py b/autogalaxy/aggregator/ellipse/fit_ellipse.py index 031a7c24a..0fe101295 100644 --- a/autogalaxy/aggregator/ellipse/fit_ellipse.py +++ b/autogalaxy/aggregator/ellipse/fit_ellipse.py @@ -60,7 +60,6 @@ def _fit_ellipse_from( for dataset, ellipse_list, multipole_lists in zip( dataset_list, ellipse_list_list, multipole_list_list ): - for ellipse, multipole_list in zip(ellipse_list, multipole_lists): fit_dataset_list.append( FitEllipse( diff --git a/autogalaxy/aggregator/galaxies.py b/autogalaxy/aggregator/galaxies.py index a6711ac54..ed1c3224e 100644 --- a/autogalaxy/aggregator/galaxies.py +++ b/autogalaxy/aggregator/galaxies.py @@ -41,14 +41,14 @@ def _galaxies_from(fit: af.Fit, instance: af.ModelInstance) -> List[Galaxy]: if instance is not None: galaxies = instance.galaxies - if hasattr(instance, "clumps"): - galaxies = galaxies + fit.instance.clumps + if hasattr(instance, "extra_galaxies"): + galaxies = galaxies + fit.instance.extra_galaxies else: galaxies = fit.instance.galaxies - if hasattr(fit.instance, "clumps"): - galaxies = galaxies + fit.instance.clumps + if hasattr(fit.instance, "extra_galaxies"): + galaxies = galaxies + fit.instance.extra_galaxies if fit.children is not None: if len(fit.children) > 0: diff --git a/autogalaxy/analysis/analysis/analysis.py b/autogalaxy/analysis/analysis/analysis.py index 15645c66b..0c25b68ef 100644 --- a/autogalaxy/analysis/analysis/analysis.py +++ b/autogalaxy/analysis/analysis/analysis.py @@ -42,8 +42,8 @@ def galaxies_via_instance_from( """ Create a list of galaxies from a model instance, which is used to fit the dataset. - The instance may only contain galaxies, in which case this function is redundant. However, if the clumns - API is being used, the instance will contain both galaxies and clumps, and they should be added to create + The instance may only contain galaxies, in which case this function is redundant. However, if extra galaxies + are included, the instance will contain both galaxies and extra galaxies, and they should be added to create the single list of galaxies used to fit the dataset. Parameters @@ -56,11 +56,12 @@ def galaxies_via_instance_from( ------- A list of galaxies that is used to then fit the dataset. """ - if hasattr(instance, "clumps"): - return Galaxies( - galaxies=instance.galaxies + instance.clumps, - run_time_dict=run_time_dict, - ) + if hasattr(instance, "extra_galaxies"): + if getattr(instance, "extra_galaxies", None) is not None: + return Galaxies( + galaxies=instance.galaxies + instance.extra_galaxies, + run_time_dict=run_time_dict + ) return Galaxies(galaxies=instance.galaxies, run_time_dict=run_time_dict) @@ -147,7 +148,7 @@ def profile_log_likelihood_function( An instance of the model that is being fitted to the data by this analysis (whose parameters have been set via a non-linear search). paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. Returns @@ -238,7 +239,7 @@ def output_profiling_info( Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. run_time_dict A dictionary containing the profiling times of the functions called by the `log_likelihood_function`. diff --git a/autogalaxy/analysis/analysis/dataset.py b/autogalaxy/analysis/analysis/dataset.py index ac5e957e0..4dd25bca4 100644 --- a/autogalaxy/analysis/analysis/dataset.py +++ b/autogalaxy/analysis/analysis/dataset.py @@ -90,7 +90,7 @@ def save_attributes(self, paths: af.DirectoryPaths): Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. """ paths.save_fits( @@ -145,7 +145,7 @@ def save_results(self, paths: af.DirectoryPaths, result: ResultDataset): Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. result The result of a model fit, including the non-linear search, samples and maximum likelihood tracer. diff --git a/autogalaxy/analysis/chaining_util.py b/autogalaxy/analysis/chaining_util.py index 52353670d..5affa0bc6 100644 --- a/autogalaxy/analysis/chaining_util.py +++ b/autogalaxy/analysis/chaining_util.py @@ -166,19 +166,19 @@ def source_from( return source_custom_model_from(result=result, source_is_model=True) -def clumps_from( +def extra_galaxies_from( result: Result, light_as_model: bool = False, mass_as_model: bool = False, free_centre: bool = False, ) -> af.Collection: """ - The clump API models the light and / or mass of additional galaxies surrouding the main galaxy or strong lens - system. + The extra galaxies API models the light and / or mass of additional galaxies surrouding the main galaxy or + strong lens system. - This function performs model composition of clumps for fits using the search chaining API. It makes it possible to - pass the clump parameters from a previous search to a new search, such that the new clumps are either treated - as an instance or model component. + This function performs model composition of extra galaxies for fits using the search chaining API. It makes it + possible to pass the extra galaxy parameters from a previous search to a new search, such that the new extra + galaxies are either treated as an instance or model component. This function currently requires that mass profiles are `IsothermalSph` objects and that light profiles are `Sersic` objects. This will be generalised in the future. @@ -186,57 +186,70 @@ def clumps_from( Parameters ---------- result - The result, which includes clumps, of the previous search, which via prior passing are used to create the new - clump model. + The result, which includes extra galaxies, of the previous search, which via prior passing are used to create + the new extra galaxy model. light_as_model - If `True`, the clump light is passed as a model component, else it is a fixed instance. + If `True`, the extra_galaxy light is passed as a model component, else it is a fixed instance. mass_as_model - If `True`, the clump mass is passed as a model component, else it is a fixed instance. + If `True`, the extra_galaxy mass is passed as a model component, else it is a fixed instance. free_centre If `True`, the requested mass and/or light model centres are passed as a model, else they are fixed. Returns ------- af.Collection - A collection of clump `Galaxy` objects, where each clump is either an instance or model component. + A collection of extra galaxy `Galaxy` objects, where each is either an instance or model component. """ # ideal API: - # clumps = result.instance.clumps.as_model((LightProfile, mp.MassProfile,), fixed="centre", prior_pass=True) + # extra_galaxies = result.instance.extra_galaxies.as_model((LightProfile, mp.MassProfile,), fixed="centre", prior_pass=True) - if mass_as_model: - clumps = result.instance.clumps.as_model((MassProfile,)) + if result.instance.extra_galaxies is None: + return None - for clump_index in range(len(result.instance.clumps)): - if hasattr(result.instance.clumps[clump_index], "mass"): - clumps[clump_index].mass.centre = result.instance.clumps[ - clump_index + if mass_as_model: + extra_galaxies = result.instance.extra_galaxies.as_model((MassProfile,)) + + for extra_galaxy_index in range(len(result.instance.extra_galaxies)): + if hasattr(result.instance.extra_galaxies[extra_galaxy_index], "mass"): + extra_galaxies[ + extra_galaxy_index + ].mass.centre = result.instance.extra_galaxies[ + extra_galaxy_index ].mass.centre - clumps[clump_index].mass.einstein_radius = result.model.clumps[ - clump_index + extra_galaxies[ + extra_galaxy_index + ].mass.einstein_radius = result.model.extra_galaxies[ + extra_galaxy_index ].mass.einstein_radius if free_centre: - clumps[clump_index].mass.centre = result.model.clumps[ - clump_index + extra_galaxies[ + extra_galaxy_index + ].mass.centre = result.model.extra_galaxies[ + extra_galaxy_index ].mass.centre elif light_as_model: - clumps = result.instance.clumps.as_model((LightProfile,)) - - for clump_index in range(len(result.instance.clumps)): - if clumps[clump_index].light is not None: - clumps[clump_index].light.centre = result.instance.clumps[ - clump_index - ].light.centre + extra_galaxies = result.instance.extra_galaxies.as_model((LightProfile,)) + + for extra_galaxy_index in range(len(result.instance.extra_galaxies)): + if extra_galaxies[extra_galaxy_index].bulge is not None: + extra_galaxies[ + extra_galaxy_index + ].bulge.centre = result.instance.extra_galaxies[ + extra_galaxy_index + ].bulge.centre if free_centre: - clumps[clump_index].light.centre = result.model.clumps[ - clump_index - ].light.centre + extra_galaxies[ + extra_galaxy_index + ].bulge.centre = result.model.extra_galaxies[ + extra_galaxy_index + ].bulge.centre else: - clumps = result.instance.clumps.as_model(()) + extra_galaxies = result.instance.extra_galaxies.as_model(()) - return clumps + return extra_galaxies def lp_chain_tracer_from(light_result, settings_search): diff --git a/autogalaxy/analysis/clump_model.py b/autogalaxy/analysis/clump_model.py deleted file mode 100644 index 509c40f83..000000000 --- a/autogalaxy/analysis/clump_model.py +++ /dev/null @@ -1,204 +0,0 @@ -from typing import List, Optional, Type - -import autofit as af -import autoarray as aa - -from autogalaxy.galaxy.galaxy import Galaxy -from autogalaxy.profiles.light.abstract import LightProfile -from autogalaxy.profiles.mass.abstract.abstract import MassProfile - - -class ClumpModel: - def __init__( - self, - redshift: float, - centres: aa.Grid2DIrregular, - light_cls: Optional[Type[LightProfile]] = None, - mass_cls: Optional[Type[MassProfile]] = None, - einstein_radius_upper_limit: Optional[float] = None, - unfix_centres: bool = False, - ): - """ - The clump API allows creates model components which model the light and mass of galaxies that are nearby the - main galaxy(s) of interest. - - The `ClumpModel` object handles the creation of these model components to streamline model composition with - multiple clumps. - - Every galaxy which is modeled as a clump has its centre input into this object which is fixed to this value - for model-fitting. All clumps are created as model `Galaxy` objects with a shard input redshift. - - The light and mass profiles of the clumps are input via the `light_cls` and `mass_cls` inputs. If either is - omitted the clumps are not assigned a light or mass model. - - Parameters - ---------- - redshift - The redshift value of all clumps, which is likely the same as the main galaxy redshift. - centres - The centre of every clump in the model, whose light and mass profile centres are fixed to this value - throughout the model-fit. - light_cls - The light profile given to all clumps; if omitted all clumps have no light profile. - mass_cls - The mass profile given to all clumps; if omitted all clumps have no mass profile. - einstein_radius_upper_limit - The upper limit given to any mass model's `einstein_radius` parameter (e.g. if `IsothermalSph` profiles - are used to model clumps). - unfix_centres - If required, change the mass and light centres from fixed values to Uniform Prior Models +/- 0.1 around - the input centres. - """ - self.redshift = redshift - self.centres = centres - - self.light_cls = light_cls - self.mass_cls = mass_cls - - self.einstein_radius_upper_limit = einstein_radius_upper_limit - self.unfix_centres = unfix_centres - - self.centre_prior_half_width = 0.1 - - @property - def total_clumps(self) -> int: - return len(self.centres.in_list) - - def unfix_centre(obj, centre): - obj.centre.centre_0 = af.UniformPrior( - lower_limit=new_centre[0] - centre_prior_half_width, - upper_limit=new_centre[0] + centre_prior_half_width, - ) - obj.centre.centre_1 = af.UniformPrior( - lower_limit=new_centre[1] - centre_prior_half_width, - upper_limit=new_centre[1] + centre_prior_half_width, - ) - return obj - - @property - def light_list(self) -> Optional[List[af.Model]]: - """ - Returns a list of every clump's light model, where the centre of that light model is fixed to its corresponding - input clump's centre, unless specified to be free. - """ - if self.light_cls is None: - return None - - light_list = [] - - for centre in self.centres.in_list: - if self.unfix_centres: - light_list.append(unfix_centre(af.Model(self.light_cls), centre)) - else: - light_list.append(af.Model(self.light_cls, centre=centre)) - - return light_list - - @property - def mass_list(self) -> Optional[List[af.Model]]: - """ - Returns a list of every clump's mass model, where the centre of that mass model is fixed to its corresponding - input clump's centre, unless specified to be free. - """ - if self.mass_cls is None: - return None - - mass_list = [] - - for centre in self.centres.in_list: - if self.unfix_centres: - mass = unfix_centres(af.Model(self.mass_cls), centre) - else: - mass = af.Model(self.mass_cls, centre=centre) - - if ( - hasattr(mass, "einstein_radius") - and self.einstein_radius_upper_limit is not None - ): - mass.einstein_radius = af.UniformPrior( - lower_limit=0.0, upper_limit=self.einstein_radius_upper_limit - ) - mass_list.append(mass) - - return mass_list - - @property - def clumps_light_only(self) -> af.Collection: - """ - Returns all clumps as a `Collection` model object, which can be easily added to an overall model `Collection` - of galaxies (see the `clumps` property below for more details). - - All clumps only contain their model mass profiles, which is important for certain pipelines which omit - the clump mass profiles. - """ - clumps_light_only = {} - - for i in range(self.total_clumps): - light = self.light_list[i] if self.light_cls is not None else None - - clumps_light_only[f"clump_{i}"] = af.Model( - Galaxy, redshift=self.redshift, light=light - ) - - return af.Collection(**clumps_light_only) - - @property - def clumps_mass_only(self) -> af.Collection: - """ - Returns all clumps as a `Collection` model object, which can be easily added to an overall model `Collection` - of galaxies (see the `clumps` property below for more details). - - All clumps only contain their model mass profiles, which is important for certain pipelines which omit - the clump light profiles. - """ - clumps_mass_only = {} - - for i in range(self.total_clumps): - mass = self.mass_list[i] if self.mass_cls is not None else None - - clumps_mass_only[f"clump_{i}"] = af.Model( - Galaxy, redshift=self.redshift, mass=mass - ) - - return af.Collection(**clumps_mass_only) - - @property - def clumps(self) -> af.Collection: - """ - Returns all clumps as a `Collection` model object, which can be easily added to an overall model `Collection` - of galaxies. - - To make this `Collection` every clump centre and the input `light_cls` / `mass_cls` are used to create a - dictionary of model `Galaxy` objects with fixed light and mass profile centres. Their redshifts use the - input redshift. - - The keys of this dictionary are numerically ordered as `clump_0`, `clump_2` etc. - """ - clumps = {} - - for i in range(self.total_clumps): - light = self.light_list[i] if self.light_cls is not None else None - mass = self.mass_list[i] if self.mass_cls is not None else None - - clumps[f"clump_{i}"] = af.Model( - Galaxy, redshift=self.redshift, light=light, mass=mass - ) - - return af.Collection(**clumps) - - -class ClumpModelDisabled: - def __init__(self): - pass - - @property - def clumps_light_only(self): - return af.Collection() - - @property - def clumps_mass_only(self): - return af.Collection() - - @property - def clumps(self): - return af.Collection() diff --git a/autogalaxy/analysis/plotter_interface.py b/autogalaxy/analysis/plotter_interface.py index df0da17d5..bc5646635 100644 --- a/autogalaxy/analysis/plotter_interface.py +++ b/autogalaxy/analysis/plotter_interface.py @@ -379,7 +379,7 @@ def adapt_images( Visualizes the adapt images used by a model-fit for adaptive pixelization mesh's and regularization. Images are output to the `image` folder of the `image_path` in a subfolder called `adapt`. When - used with a non-linear search the `image_path` points to the search's results folder. + used with a non-linear search the `image_path` is the output folder of the non-linear search. Visualization includes an image of the overall adapt model image and a subplot of all galaxy images on the same figure. diff --git a/autogalaxy/ellipse/model/analysis.py b/autogalaxy/ellipse/model/analysis.py index 07f92f41c..7e228ece3 100644 --- a/autogalaxy/ellipse/model/analysis.py +++ b/autogalaxy/ellipse/model/analysis.py @@ -181,7 +181,7 @@ def save_attributes(self, paths: af.DirectoryPaths): Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. """ paths.save_fits( @@ -226,7 +226,7 @@ def profile_log_likelihood_function( An instance of the model that is being fitted to the data by this analysis (whose parameters have been set via a non-linear search). paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. Returns diff --git a/autogalaxy/ellipse/model/plotter_interface.py b/autogalaxy/ellipse/model/plotter_interface.py index cbbf52fc6..bce0ecdf6 100644 --- a/autogalaxy/ellipse/model/plotter_interface.py +++ b/autogalaxy/ellipse/model/plotter_interface.py @@ -17,7 +17,7 @@ def imaging(self, dataset: aa.Imaging): Visualizes an `Imaging` dataset object. Images are output to the `image` folder of the `image_path` in a subfolder called `imaging`. When used with - a non-linear search the `image_path` points to the search's results folder. + a non-linear search the `image_path` is the output folder of the non-linear search. `. Visualization includes individual images of attributes of the dataset (e.g. the image, noise map, PSF) and a subplot of all these attributes on the same figure. diff --git a/autogalaxy/ellipse/model/visualizer.py b/autogalaxy/ellipse/model/visualizer.py index 781bf6213..42862f101 100644 --- a/autogalaxy/ellipse/model/visualizer.py +++ b/autogalaxy/ellipse/model/visualizer.py @@ -20,10 +20,10 @@ def visualize_before_fit( Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. model - The PyAutoFit model object, which includes model components representing the galaxies that are fitted to + The model object, which includes model components representing the galaxies that are fitted to the imaging data. """ @@ -55,7 +55,7 @@ def visualize( Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. instance An instance of the model that is being fitted to the data by this analysis (whose parameters have been set diff --git a/autogalaxy/gui/scribbler.py b/autogalaxy/gui/scribbler.py index 505562cc8..d8183f504 100644 --- a/autogalaxy/gui/scribbler.py +++ b/autogalaxy/gui/scribbler.py @@ -166,13 +166,13 @@ def show_mask(self): junk_mask = masks["1"] feature_mask = masks["2"] plt.ioff() - plt.figure() - plt.subplot(121) - plt.imshow(junk_mask.astype("int"), cmap="gray") - plt.title("Junk mask") - plt.subplot(122) - plt.imshow(feature_mask.astype("int"), cmap="gray") - plt.title("Feature mask") + # plt.figure() + # plt.subplot(121) + # plt.imshow(junk_mask.astype("int"), cmap="gray") + # plt.title("Junk mask") + # plt.subplot(122) + # plt.imshow(feature_mask.astype("int"), cmap="gray") + # plt.title("Feature mask") # plt.show() return junk_mask diff --git a/autogalaxy/imaging/model/analysis.py b/autogalaxy/imaging/model/analysis.py index ad2bc643f..5e6a8844f 100644 --- a/autogalaxy/imaging/model/analysis.py +++ b/autogalaxy/imaging/model/analysis.py @@ -84,10 +84,10 @@ def modify_before_fit(self, paths: af.DirectoryPaths, model: af.Collection): Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. model - The PyAutoFit model object, which includes model components representing the galaxies that are fitted to + The model object, which includes model components representing the galaxies that are fitted to the imaging data. """ @@ -217,7 +217,7 @@ def save_attributes(self, paths: af.DirectoryPaths): Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. """ super().save_attributes(paths=paths) @@ -254,7 +254,7 @@ def profile_log_likelihood_function( An instance of the model that is being fitted to the data by this analysis (whose parameters have been set via a non-linear search). paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. Returns diff --git a/autogalaxy/imaging/model/plotter_interface.py b/autogalaxy/imaging/model/plotter_interface.py index 564369c82..2352e4e1a 100644 --- a/autogalaxy/imaging/model/plotter_interface.py +++ b/autogalaxy/imaging/model/plotter_interface.py @@ -1,4 +1,5 @@ from os import path +from typing import List import autoarray as aa import autoarray.plot as aplt @@ -13,21 +14,21 @@ class PlotterInterfaceImaging(PlotterInterface): def imaging(self, dataset: aa.Imaging): """ - Visualizes an `Imaging` dataset object. + Output visualization of an `Imaging` dataset, typically before a model-fit is performed. - Images are output to the `image` folder of the `image_path` in a subfolder called `imaging`. When used with - a non-linear search the `image_path` points to the search's results folder. + Images are output to the `image` folder of the `image_path` in a subfolder called `dataset`. When used with + a non-linear search the `image_path` is the output folder of the non-linear search. `. Visualization includes individual images of attributes of the dataset (e.g. the image, noise map, PSF) and a subplot of all these attributes on the same figure. - The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under the - [dataset] header. + The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under + the `dataset` header. Parameters ---------- dataset - The imaging dataset whose attributes are visualized. + The imaging dataset which is visualized. """ def should_plot(name): @@ -157,3 +158,137 @@ def should_plot(name): subtracted_image=True, model_image=True, ) + + def imaging_combined(self, dataset_list: List[aa.Imaging]): + """ + Output visualization of all `Imaging` datasets in a summed combined analysis, typically before a model-fit + is performed. + + Images are output to the `image` folder of the `image_path` in a subfolder called `dataset_combined`. When + used with a non-linear search the `image_path` is the output folder of the non-linear search. + `. + Visualization includes individual images of attributes of each dataset (e.g. the image, noise map, PSF) on + a single subplot, such that the full suite of multiple datasets can be viewed on the same figure. + + The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under + the `dataset` header. + + Parameters + ---------- + dataset + The list of imaging datasets which are visualized. + """ + + def should_plot(name): + return plot_setting(section=["dataset", "imaging"], name=name) + + mat_plot_2d = self.mat_plot_2d_from(subfolders="combined") + + dataset_plotter_list = [ + aplt.ImagingPlotter( + dataset=dataset, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d + ) + for dataset in dataset_list + ] + + subplot_shape = (len(dataset_list), 4) + + multi_plotter = aplt.MultiFigurePlotter( + plotter_list=dataset_plotter_list, subplot_shape=subplot_shape + ) + + if should_plot("subplot_dataset"): + multi_plotter.subplot_of_figures_multi( + func_name_list=["figures_2d"] * 4, + figure_name_list=["data", "noise_map", "signal_to_noise_map", "psf"], + filename_suffix="dataset", + ) + + for plotter in multi_plotter.plotter_list: + plotter.mat_plot_2d.use_log10 = True + + multi_plotter.subplot_of_figures_multi( + func_name_list=["figures_2d"] * 4, + figure_name_list=["data", "noise_map", "signal_to_noise_map", "psf"], + filename_suffix="dataset_log10", + ) + + def fit_imaging_combined(self, fit_list: List[FitImaging]): + """ + Output visualization of all `FitImaging` objects in a summed combined analysis, typically during or after a + model-fit is performed. + + Images are output to the `image` folder of the `image_path` in a subfolder called `combined`. When used + with a non-linear search the `image_path` is the output folder of the non-linear search. + `. + Visualization includes individual images of attributes of each fit (e.g. data, normalized residual-map) on + a single subplot, such that the full suite of multiple datasets can be viewed on the same figure. + + The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under + the `fit` header. + + Parameters + ---------- + fit + The list of imaging fits which are visualized. + """ + + def should_plot(name): + return plot_setting(section=["fit", "fit_imaging"], name=name) + + mat_plot_2d = self.mat_plot_2d_from(subfolders="combined") + + fit_plotter_list = [ + FitImagingPlotter( + fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d + ) + for fit in fit_list + ] + + subplot_shape = (len(fit_list), 5) + + multi_plotter = aplt.MultiFigurePlotter( + plotter_list=fit_plotter_list, subplot_shape=subplot_shape + ) + + if should_plot("subplot_fit"): + + def make_subplot_fit(filename_suffix): + multi_plotter.subplot_of_figures_multi( + func_name_list=["figures_2d"] * 4, + figure_name_list=[ + "data", + "signal_to_noise_map", + "model_image", + "normalized_residual_map", + ], + filename_suffix=filename_suffix, + number_subplots=len(fit_list) * 5, + close_subplot=False, + ) + + for plotter in multi_plotter.plotter_list: + plotter.mat_plot_2d.cmap.kwargs["vmin"] = -1.0 + plotter.mat_plot_2d.cmap.kwargs["vmax"] = 1.0 + + multi_plotter.subplot_of_figures_multi( + func_name_list=["figures_2d"], + figure_name_list=[ + "normalized_residual_map", + ], + filename_suffix=filename_suffix, + number_subplots=len(fit_list) * 5, + subplot_index_offset=4, + open_subplot=False, + ) + + for plotter in multi_plotter.plotter_list: + plotter.mat_plot_2d.cmap.kwargs["vmin"] = None + plotter.mat_plot_2d.cmap.kwargs["vmax"] = None + + make_subplot_fit(filename_suffix="fit") + + for plotter in multi_plotter.plotter_list: + plotter.mat_plot_2d.use_log10 = True + + make_subplot_fit(filename_suffix="fit_log10") diff --git a/autogalaxy/imaging/model/visualizer.py b/autogalaxy/imaging/model/visualizer.py index fa169c0ab..201c72d48 100644 --- a/autogalaxy/imaging/model/visualizer.py +++ b/autogalaxy/imaging/model/visualizer.py @@ -20,10 +20,10 @@ def visualize_before_fit( Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. model - The PyAutoFit model object, which includes model components representing the galaxies that are fitted to + The model object, which includes model components representing the galaxies that are fitted to the imaging data. """ @@ -63,7 +63,7 @@ def visualize( Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. instance An instance of the model that is being fitted to the data by this analysis (whose parameters have been set @@ -94,3 +94,82 @@ def visualize( ) if fit.inversion is not None: plotter.inversion(inversion=fit.inversion, during_analysis=during_analysis) + + @staticmethod + def visualize_before_fit_combined( + analyses, + paths: af.AbstractPaths, + model: af.AbstractPriorModel, + ): + """ + Performs visualization before the non-linear search begins of information which shared across all analyses + on a single matplotlib figure. + + This function outputs visuals of all information which does not vary during the fit, for example the dataset + being fitted. + + Parameters + ---------- + analyses + The list of all analysis objects used for fitting via yhe non-linear search. + paths + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + visualization and the pickled objects used by the aggregator output by this function. + model + The model object, which includes model components representing the galaxies that are fitted to + the imaging data. + """ + + if analyses is None: + return + + plotter = PlotterInterfaceImaging( + image_path=paths.image_path, title_prefix=analyses[0].title_prefix + ) + + dataset_list = [analysis.dataset for analysis in analyses] + + plotter.imaging_combined( + dataset_list=dataset_list, + ) + + @staticmethod + def visualize_combined( + analyses, + paths: af.AbstractPaths, + instance: af.ModelInstance, + during_analysis: bool, + ): + """ + Performs visualization during the non-linear search of information which is shared across all analyses on a + single matplotlib figure. + + This function outputs visuals of all information which varies during the fit, for example the model-fit to + the dataset being fitted. + + Parameters + ---------- + analyses + The list of all analysis objects used for fitting via yhe non-linear search. + paths + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, + visualization and the pickled objects used by the aggregator output by this function. + model + The model object, which includes model components representing the galaxies that are fitted to + the imaging data. + """ + if analyses is None: + return + + plotter = PlotterInterfaceImaging( + image_path=paths.image_path, title_prefix=analyses[0].title_prefix + ) + + fit_list = [ + analysis.fit_from(instance=single_instance) + for analysis, single_instance in zip(analyses, instance) + ] + + plotter.fit_imaging_combined( + fit_list=fit_list, + ) diff --git a/autogalaxy/interferometer/model/analysis.py b/autogalaxy/interferometer/model/analysis.py index 7ee73d1f8..126561f76 100644 --- a/autogalaxy/interferometer/model/analysis.py +++ b/autogalaxy/interferometer/model/analysis.py @@ -89,10 +89,10 @@ def modify_before_fit(self, paths: af.DirectoryPaths, model: af.Collection): Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. model - The PyAutoFit model object, which includes model components representing the galaxies that are fitted to + The model object, which includes model components representing the galaxies that are fitted to the imaging data. """ @@ -217,7 +217,7 @@ def save_attributes(self, paths: af.DirectoryPaths): Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. """ super().save_attributes(paths=paths) @@ -256,7 +256,7 @@ def profile_log_likelihood_function( An instance of the model that is being fitted to the data by this analysis (whose parameters have been set via a non-linear search). paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. Returns diff --git a/autogalaxy/interferometer/model/plotter_interface.py b/autogalaxy/interferometer/model/plotter_interface.py index 5686415ac..335dbe25a 100644 --- a/autogalaxy/interferometer/model/plotter_interface.py +++ b/autogalaxy/interferometer/model/plotter_interface.py @@ -18,7 +18,7 @@ def interferometer(self, dataset: aa.Interferometer): Visualizes an `Interferometer` dataset object. Images are output to the `image` folder of the `image_path` in a subfolder called `interferometer`. When - used with a non-linear search the `image_path` points to the search's results folder. + used with a non-linear search the `image_path` is the output folder of the non-linear search. Visualization includes individual images of attributes of the dataset (e.g. the visibilities, noise map, uv-wavelengths) and a subplot of all these attributes on the same figure. diff --git a/autogalaxy/interferometer/model/visualizer.py b/autogalaxy/interferometer/model/visualizer.py index ca3b5bc1d..03e5d4655 100644 --- a/autogalaxy/interferometer/model/visualizer.py +++ b/autogalaxy/interferometer/model/visualizer.py @@ -21,10 +21,10 @@ def visualize_before_fit( Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization and the pickled objects used by the aggregator output by this function. model - The PyAutoFit model object, which includes model components representing the galaxies that are fitted to + The model object, which includes model components representing the galaxies that are fitted to the imaging data. """ @@ -67,7 +67,7 @@ def visualize( Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. instance An instance of the model that is being fitted to the data by this analysis (whose parameters have been set diff --git a/autogalaxy/quantity/model/analysis.py b/autogalaxy/quantity/model/analysis.py index aaf9e5f27..78ebb372f 100644 --- a/autogalaxy/quantity/model/analysis.py +++ b/autogalaxy/quantity/model/analysis.py @@ -147,7 +147,7 @@ def save_attributes(self, paths: af.DirectoryPaths): Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. """ paths.save_fits( diff --git a/autogalaxy/quantity/model/visualizer.py b/autogalaxy/quantity/model/visualizer.py index 48b30e16a..2b2af686a 100644 --- a/autogalaxy/quantity/model/visualizer.py +++ b/autogalaxy/quantity/model/visualizer.py @@ -30,7 +30,7 @@ def visualize( Parameters ---------- paths - The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored, + The paths object which manages all paths, e.g. where the non-linear search outputs are stored, visualization, and the pickled objects used by the aggregator output by this function. instance An instance of the model that is being fitted to the data by this analysis (whose parameters have been set diff --git a/docs/howtogalaxy/chapter_1_introduction.rst b/docs/howtogalaxy/chapter_1_introduction.rst index 5d8cb0767..538cd4da1 100644 --- a/docs/howtogalaxy/chapter_1_introduction.rst +++ b/docs/howtogalaxy/chapter_1_introduction.rst @@ -10,14 +10,17 @@ The chapter contains the following tutorials: `Tutorial 0: Visualization `_ - Setting up **PyAutoGalaxy**'s visualization library. -`Tutorial 1: Grids `_ -- Uniform grids of (y,x) coordinates used for ray-tracing. +`Tutorial 1: Grids And Galaxies `_ +- Using grids of (y,x) coordinates with galaxies made up of light profiles. -`Tutorial 2: Light Profiles `_ -- Analytic profiles representing light distributions. +`Tutorial 2: Data `_ +- Simulating and inspecting telescope imaging data of a galaxy. -`Tutorial 3: Galaxies `_ -- Making galaxy objects out of light and mass profile. +`Tutorial 3: Fitting `_ +- Fitting data with a galaxy model. -`Tutorial 6: Summary `_ +`Tutorial 4: Methods `_ +- An overview of the different methods used to fit galaxies with. + +`Tutorial 5: Summary `_ - A summary of the chapter. \ No newline at end of file diff --git a/docs/howtogalaxy/chapter_2_modeling.rst b/docs/howtogalaxy/chapter_2_modeling.rst index d912944d6..66c2432b2 100644 --- a/docs/howtogalaxy/chapter_2_modeling.rst +++ b/docs/howtogalaxy/chapter_2_modeling.rst @@ -5,33 +5,27 @@ In chapter 2, we'll take you through how to model galaxies using a non-linear se The chapter contains the following tutorials: -`Tutorial 1: Data `_ -- Loading and inspecting telescope imaging data of a galaxy. +`Tutorial 1: Non-linear Search `_ +- How a non-linear search is used to fit a lens model. -`Tutorial 2: Fitting `_ -- Fitting data with a galaxy model. - -`Tutorial 3: Non-linear Search `_ -- How a non-linear search is used to fit a model. - -`Tutorial 4: Parameter Space And Priors `_ +`Tutorial 2: Parameter Space And Priors `_ - The Concepts of a parameter space and priors. -`Tutorial 5: Realism and Complexity `_ -- Finding a balance between realism and complexity when composing and fitting a model. +`Tutorial 3: Realism and Complexity `_ +- Finding a balance between realism and complexity when composing and fitting a lens model. -`Tutorial 6: Dealing with Failure `_ -- What to do when PyAutoGalaxy finds an inaccurate model. +`Tutorial 4: Dealing with Failure `_ +- What to do when PyAutoLens finds an inaccurate lens model. -`Tutorial 7: Linear Profiles `_ +`Tutorial 5: Linear Profiles `_ - Light profiles which capture complex morphologies in a reduced number of non-linear parameters. -`Tutorial 8: Masking `_ -- How to mask your data to improve the model. +`Tutorial 6: Masking and Positions `_ +- How to mask and mark positions on your data to improve the lens model. -`Tutorial 9: Results `_ -- Overview of the results available after successfully fitting a model. +`Tutorial 7: Results `_ +- Overview of the results available after successfully fitting a lens model. -`Tutorial 10: Need for Speed `_ +`Tutorial 8: Need for Speed `_ - How to fit complex models whilst balancing efficiency and run-time. diff --git a/docs/overview/overview_1_start_here.rst b/docs/overview/overview_1_start_here.rst index 5d7a399da..ce3046d85 100644 --- a/docs/overview/overview_1_start_here.rst +++ b/docs/overview/overview_1_start_here.rst @@ -219,10 +219,10 @@ To further illustrate this, we create a merging galaxy system with 4 star formin intensity=0.1, effective_radius=1.6, ), - clump_0=ag.lp.SersicSph(centre=(1.0, 1.0), intensity=0.5, effective_radius=0.2), - clump_1=ag.lp.SersicSph(centre=(0.5, 0.8), intensity=0.5, effective_radius=0.2), - clump_2=ag.lp.SersicSph(centre=(-1.0, -0.7), intensity=0.5, effective_radius=0.2), - clump_3=ag.lp.SersicSph(centre=(-1.0, 0.4), intensity=0.5, effective_radius=0.2), + extra_galaxy_0=ag.lp.SersicSph(centre=(1.0, 1.0), intensity=0.5, effective_radius=0.2), + extra_galaxy_1=ag.lp.SersicSph(centre=(0.5, 0.8), intensity=0.5, effective_radius=0.2), + extra_galaxy_2=ag.lp.SersicSph(centre=(-1.0, -0.7), intensity=0.5, effective_radius=0.2), + extra_galaxy_3=ag.lp.SersicSph(centre=(-1.0, 0.4), intensity=0.5, effective_radius=0.2), ) galaxy_1 = ag.Galaxy( diff --git a/test_autogalaxy/analysis/analysis/test_analysis.py b/test_autogalaxy/analysis/analysis/test_analysis.py index 2e7be98d5..387e50c8f 100644 --- a/test_autogalaxy/analysis/analysis/test_analysis.py +++ b/test_autogalaxy/analysis/analysis/test_analysis.py @@ -11,10 +11,11 @@ def test__galaxies_via_instance(masked_imaging_7x7): galaxy = ag.Galaxy(redshift=0.5, light=ag.lp.Sersic(intensity=0.1)) - clump = ag.Galaxy(redshift=0.5, light=ag.lp.Sersic(intensity=0.2)) + extra_galaxy = ag.Galaxy(redshift=0.5, light=ag.lp.Sersic(intensity=0.2)) model = af.Collection( - galaxies=af.Collection(galaxy=galaxy), clumps=af.Collection(clump_0=clump) + galaxies=af.Collection(galaxy=galaxy), + extra_galaxies=af.Collection(extra_galaxy_0=extra_galaxy), ) analysis = ag.AnalysisImaging(dataset=masked_imaging_7x7) diff --git a/test_autogalaxy/analysis/test_clump_model.py b/test_autogalaxy/analysis/test_clump_model.py deleted file mode 100644 index 12d4230ae..000000000 --- a/test_autogalaxy/analysis/test_clump_model.py +++ /dev/null @@ -1,99 +0,0 @@ -import autofit as af -import autogalaxy as ag - - -def test__clumps(): - centres = ag.Grid2DIrregular(values=[(1.0, 1.0)]) - - clump_model = ag.ClumpModel( - redshift=0.5, centres=centres, light_cls=ag.lp.SersicSph - ) - - clumps = clump_model.clumps - - assert clumps["clump_0"].redshift == 0.5 - assert clumps["clump_0"].light.centre == (1.0, 1.0) - assert isinstance(clumps["clump_0"].light.intensity, af.LogUniformPrior) - assert clumps["clump_0"].mass == None - - clump_model = ag.ClumpModel( - redshift=0.5, centres=centres, mass_cls=ag.mp.IsothermalSph - ) - - clumps = clump_model.clumps - - assert clumps["clump_0"].redshift == 0.5 - assert clumps["clump_0"].mass.centre == (1.0, 1.0) - assert isinstance(clumps["clump_0"].mass.einstein_radius, af.UniformPrior) - assert clumps["clump_0"].light == None - - clump_model = ag.ClumpModel( - redshift=0.5, - centres=centres, - light_cls=ag.lp.SersicSph, - mass_cls=ag.mp.IsothermalSph, - ) - - clumps = clump_model.clumps - - assert clumps["clump_0"].redshift == 0.5 - assert clumps["clump_0"].light.centre == (1.0, 1.0) - assert clumps["clump_0"].mass.centre == (1.0, 1.0) - assert isinstance(clumps["clump_0"].light.intensity, af.LogUniformPrior) - assert isinstance(clumps["clump_0"].mass.einstein_radius, af.UniformPrior) - - -def test__clumps_light_only(): - centres = ag.Grid2DIrregular(values=[(1.0, 1.0)]) - - clump_model = ag.ClumpModel( - redshift=0.5, - centres=centres, - light_cls=ag.lp.SersicSph, - mass_cls=ag.mp.IsothermalSph, - ) - - clumps_light_only = clump_model.clumps_light_only - - assert clumps_light_only["clump_0"].redshift == 0.5 - assert clumps_light_only["clump_0"].light.centre == (1.0, 1.0) - assert isinstance(clumps_light_only["clump_0"].light.intensity, af.LogUniformPrior) - assert not hasattr(clumps_light_only["clump_0"], "mass") - - -def test__clumps_mass_only(): - centres = ag.Grid2DIrregular(values=[(1.0, 1.0)]) - - clump_model = ag.ClumpModel( - redshift=0.5, - centres=centres, - light_cls=ag.lp.SersicSph, - mass_cls=ag.mp.IsothermalSph, - ) - - clumps_mass_only = clump_model.clumps_mass_only - - assert clumps_mass_only["clump_0"].redshift == 0.5 - assert clumps_mass_only["clump_0"].mass.centre == (1.0, 1.0) - assert isinstance(clumps_mass_only["clump_0"].mass.einstein_radius, af.UniformPrior) - assert not hasattr(clumps_mass_only["clump_0"], "light") - - -def test__einstein_radius_max(): - centres = ag.Grid2DIrregular(values=[(1.0, 1.0)]) - - clump_model = ag.ClumpModel( - redshift=0.5, - centres=centres, - mass_cls=ag.mp.IsothermalSph, - einstein_radius_upper_limit=1.0, - ) - - clumps = clump_model.clumps - - assert isinstance(clumps["clump_0"].mass.einstein_radius, af.UniformPrior) - assert clumps["clump_0"].mass.einstein_radius.upper_limit == 1.0 - - assert clumps["clump_0"].redshift == 0.5 - assert clumps["clump_0"].mass.centre == (1.0, 1.0) - assert clumps["clump_0"].light == None diff --git a/test_autogalaxy/imaging/model/test_plotter_interface_imaging.py b/test_autogalaxy/imaging/model/test_plotter_interface_imaging.py index a2fd39420..0c43849e2 100644 --- a/test_autogalaxy/imaging/model/test_plotter_interface_imaging.py +++ b/test_autogalaxy/imaging/model/test_plotter_interface_imaging.py @@ -31,6 +31,19 @@ def test__imaging(imaging_7x7, include_2d_all, plot_path, plot_patch): assert path.join(plot_path, "signal_to_noise_map.png") not in plot_patch.paths +def test__imaging_combined(imaging_7x7, plot_path, plot_patch): + if path.exists(plot_path): + shutil.rmtree(plot_path) + + visualizer = PlotterInterfaceImaging(image_path=plot_path) + + visualizer.imaging_combined(dataset_list=[imaging_7x7, imaging_7x7]) + + plot_path = path.join(plot_path, "combined") + + assert path.join(plot_path, "subplot_dataset.png") in plot_patch.paths + + def test__fit_imaging( masked_imaging_7x7, fit_imaging_x2_galaxy_inversion_7x7, @@ -61,3 +74,18 @@ def test__fit_imaging( ) assert image.shape == (7, 7) + + +def test__fit_imaging_combined( + fit_imaging_x2_galaxy_inversion_7x7, plot_path, plot_patch +): + if path.exists(plot_path): + shutil.rmtree(plot_path) + + visualizer = PlotterInterfaceImaging(image_path=plot_path) + + visualizer.fit_imaging_combined(fit_list=2 * [fit_imaging_x2_galaxy_inversion_7x7]) + + plot_path = path.join(plot_path, "combined") + + assert path.join(plot_path, "subplot_fit.png") in plot_patch.paths From 8d8239923ba1f5e060280b60e89d80d55a1b3e3c Mon Sep 17 00:00:00 2001 From: CKrawczyk Date: Fri, 25 Oct 2024 16:15:10 +0100 Subject: [PATCH 19/26] Use auto diff to get at jacobian of deflection angles These changes add the ability to use JAX to find the jacobian of deflection angles. To do this it first needs a version of the deflection angle function that takes in two scalars and returns a 2 element vector. From this `jax.jacfwd` is used to get the 2x2 jacobian for a single (y,x) value. This function is vectorized to take in a set of (y,x) values (of arbitrary shape) and return a (*shape, 2, 2) array of jacobian values. The final step is to pass the value from a `grid` object into this function. --- autogalaxy/operate/deflections.py | 98 +++++++++++++++++++++++-------- 1 file changed, 74 insertions(+), 24 deletions(-) diff --git a/autogalaxy/operate/deflections.py b/autogalaxy/operate/deflections.py index 57af22765..cf083d5a5 100644 --- a/autogalaxy/operate/deflections.py +++ b/autogalaxy/operate/deflections.py @@ -1,8 +1,11 @@ from functools import wraps import logging -import numpy as np +from autofit.jax_wrapper import numpy as np, use_jax from typing import List, Tuple, Union +if use_jax: + import jax + from autoconf import conf import autoarray as aa @@ -106,6 +109,20 @@ class OperateDeflections: def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): raise NotImplementedError + + def deflections_yx_scalar(self, y, x, pixel_scales): + if not use_jax: + return + else: + # A version of the deflection function that takes in two scalars + # and outputs a 2D vector. Needed for JAX auto differentiation. + g = aa.Grid2D.from_yx_1d( + y=y.reshape(1), + x=x.reshape(1), + shape_native=(1, 1), + pixel_scales=pixel_scales + ) + return self.deflections_yx_2d_from(g).squeeze() def __eq__(self, other): return self.__dict__ == other.__dict__ and self.__class__ is other.__class__ @@ -709,6 +726,29 @@ def einstein_mass_angular_from( return einstein_mass_angular_list[0] + def jacobian_stack(self, y, x, pixel_scales): + if not use_jax: + return + else: + return np.stack( + jax.jacfwd( + self.deflections_yx_scalar, + argnums=(0, 1) + )(y, x, pixel_scales) + ) + + def jacobian_stack_vector(self, y, x, pixel_scales): + if not use_jax: + return + else: + return np.vectorize( + jax.tree_util.Partial( + self.jacobian_stack, + pixel_scales=pixel_scales + ), + signature='(),()->(i,i)' + )(y, x) + def jacobian_from(self, grid): """ Returns the Jacobian of the lensing object, which is computed by taking the gradient of the 2D deflection @@ -727,35 +767,45 @@ def jacobian_from(self, grid): The 2D grid of (y,x) arc-second coordinates the deflection angles and Jacobian are computed on. """ - deflections = self.deflections_yx_2d_from(grid=grid) + if not use_jax: + deflections = self.deflections_yx_2d_from(grid=grid) - # TODO : Can probably make this work on irregular grid? Is there any point? + # TODO : Can probably make this work on irregular grid? Is there any point? - a11 = aa.Array2D( - values=1.0 - - np.gradient(deflections.native[:, :, 1], grid.native[0, :, 1], axis=1), - mask=grid.mask, - ) + a11 = aa.Array2D( + values=1.0 + - np.gradient(deflections.native[:, :, 1], grid.native[0, :, 1], axis=1), + mask=grid.mask, + ) - a12 = aa.Array2D( - values=-1.0 - * np.gradient(deflections.native[:, :, 1], grid.native[:, 0, 0], axis=0), - mask=grid.mask, - ) + a12 = aa.Array2D( + values=-1.0 + * np.gradient(deflections.native[:, :, 1], grid.native[:, 0, 0], axis=0), + mask=grid.mask, + ) - a21 = aa.Array2D( - values=-1.0 - * np.gradient(deflections.native[:, :, 0], grid.native[0, :, 1], axis=1), - mask=grid.mask, - ) + a21 = aa.Array2D( + values=-1.0 + * np.gradient(deflections.native[:, :, 0], grid.native[0, :, 1], axis=1), + mask=grid.mask, + ) - a22 = aa.Array2D( - values=1 - - np.gradient(deflections.native[:, :, 0], grid.native[:, 0, 0], axis=0), - mask=grid.mask, - ) + a22 = aa.Array2D( + values=1 + - np.gradient(deflections.native[:, :, 0], grid.native[:, 0, 0], axis=0), + mask=grid.mask, + ) - return [[a11, a12], [a21, a22]] + return [[a11, a12], [a21, a22]] + else: + a = self.jacobian_stack_vector( + grid.array[:, 0], + grid.array[:, 1], + grid.pixel_scales + ) + # transpose the result + # use `moveaxis` as grid might not be nx2 + return np.moveaxis(np.moveaxis(a, -1, 0), -1, 0) @precompute_jacobian def convergence_2d_via_jacobian_from(self, grid, jacobian=None) -> aa.Array2D: From f5b24a0f5ef2bb1d3183911ca22efd6542f3f94f Mon Sep 17 00:00:00 2001 From: CKrawczyk Date: Mon, 4 Nov 2024 10:13:35 +0000 Subject: [PATCH 20/26] Calculate critical curves using JAX This overhauls the current critical curve method from a grid search to an application of Newton's method for zero finding. The steps are as follows: 1) Create a set of `n_points` initial points in a circle of radius `init_r` and centred on `init_centre` 2) Apply `n_steps` of Newton's method to these points in the "radial" direction only (i.e. keeping angle fixed). Jax's auto differentiation is used to find the radial derivatives of the eigen value function for this step. 3) Filter the results and only keep point that have their eigen value `threshold` of 0. This step is needed because Newton's method will fail when the radial derivative is equal to zero (i.e. near a max or min of the eigen value). No underlying grid is needed for this method, but the quality of the results are dependent on the initial circle of points. For best results the circle should be drawn around *each* max/min of the eigen value function. This is typically the centre of each mass in the profile. --- autogalaxy/operate/deflections.py | 211 +++++++++++++++++- autogalaxy/profiles/geometry_profiles.py | 12 +- .../profiles/light/standard/gaussian.py | 32 ++- autogalaxy/profiles/mass/stellar/gaussian.py | 12 +- 4 files changed, 247 insertions(+), 20 deletions(-) diff --git a/autogalaxy/operate/deflections.py b/autogalaxy/operate/deflections.py index cf083d5a5..ef60c45fa 100644 --- a/autogalaxy/operate/deflections.py +++ b/autogalaxy/operate/deflections.py @@ -1,6 +1,6 @@ -from functools import wraps +from functools import wraps, partial import logging -from autofit.jax_wrapper import numpy as np, use_jax +from autofit.jax_wrapper import numpy as np, use_jax, jit from typing import List, Tuple, Union if use_jax: @@ -91,6 +91,26 @@ def wrapper( return wrapper +def one_step(r, _, theta, fun, fun_dr): + r = np.abs(r - fun(r, theta) / fun_dr(r, theta)) + return r, None + + +@partial(jit, static_argnums=(4,)) +def step_r(r, theta, fun, fun_dr, N=20): + one_step_partial = jax.tree_util.Partial( + one_step, + theta=theta, + fun=fun, + fun_dr=fun_dr + ) + new_r = jax.lax.scan(one_step_partial, r, xs=np.arange(N))[0] + return np.stack([ + new_r * np.sin(theta), + new_r * np.cos(theta) + ]).T + + class OperateDeflections: """ Packages methods which manipulate the 2D deflection angle map returned from the `deflections_yx_2d_from` function @@ -126,6 +146,9 @@ def deflections_yx_scalar(self, y, x, pixel_scales): def __eq__(self, other): return self.__dict__ == other.__dict__ and self.__class__ is other.__class__ + + def __hash__(self): + return hash(repr(self)) @precompute_jacobian def tangential_eigen_value_from(self, grid, jacobian=None) -> aa.Array2D: @@ -748,6 +771,162 @@ def jacobian_stack_vector(self, y, x, pixel_scales): ), signature='(),()->(i,i)' )(y, x) + + def convergence_mag_shear_yx(self, y, x): + J = self.jacobian_stack_vector(y, x, 0.05) + K = 0.5 * (J[..., 0, 0] + J[..., 1, 1]) + mag_shear = 0.5 * np.sqrt( + (J[..., 0, 1] + J[..., 1, 0])**2 + (J[..., 0, 0] - J[..., 1, 1])**2 + ) + return K, mag_shear + + @partial(jit, static_argnums=(0,)) + def tangential_eigen_value_yx(self, y, x): + K, mag_shear = self.convergence_mag_shear_yx(y, x) + return 1 - K - mag_shear + + @partial(jit, static_argnums=(0, 3)) + def tangential_eigen_value_rt(self, r, theta, centre=(0.0, 0.0)): + y = r * np.sin(theta) + centre[0] + x = r * np.cos(theta) + centre[1] + return self.tangential_eigen_value_yx(y, x) + + @partial(jit, static_argnums=(0, 3)) + def grad_r_tangential_eigen_value(self, r, theta, centre=(0.0, 0.0)): + # ignore `self` with the `argnums` below + tangential_eigen_part = partial( + self.tangential_eigen_value_rt, + centre=centre + ) + return np.vectorize( + jax.jacfwd(tangential_eigen_part, argnums=(0,)), + signature='(),()->()' + )(r, theta)[0] + + @partial(jit, static_argnums=(0,)) + def radial_eigen_value_yx(self, y, x): + K, mag_shear = self.convergence_mag_shear_yx(y, x) + return 1 - K + mag_shear + + @partial(jit, static_argnums=(0, 3)) + def radial_eigen_value_rt(self, r, theta, centre=(0.0, 0.0)): + y = r * np.sin(theta) + centre[0] + x = r * np.cos(theta) + centre[1] + return self.radial_eigen_value_yx(y, x) + + @partial(jit, static_argnums=(0, 3)) + def grad_r_radial_eigen_value(self, r, theta, centre=(0.0, 0.0)): + # ignore `self` with the `argnums` below + radial_eigen_part = partial( + self.radial_eigen_value_rt, + centre=centre + ) + return np.vectorize( + jax.jacfwd(radial_eigen_part, argnums=(0,)), + signature='(),()->()' + )(r, theta)[0] + + def tangential_critical_curve_jax( + self, + init_r=0.1, + init_centre=(0.0, 0.0), + n_points=300, + n_steps=20, + threshold=1e-5 + ): + """ + Returns all tangential critical curves of the lensing system, which are computed as follows: + + 1) Create a set of `n_points` initial points in a circle of radius `init_r` and centred on `init_centre` + 2) Apply `n_steps` of Newton's method to these points in the "radial" direction only (i.e. keeping angle fixed). + Jax's auto differentiation is used to find the radial derivatives of the tangential eigen value function for + this step. + 3) Filter the results and only keep point that have their tangential eigen value `threshold` of 0 + + No underlying grid is needed for the method, but the quality of the results are dependent on the initial + circle of points. + + Parameters + ---------- + init_r : float + Radius of the circle of initial guess points + init_centre : tuple + centre of the circle of initial guess points as `(y, x)` + n_points : Int + Number of initial guess points to create (evenly spaced in angle around `init_centre`) + n_steps : Int + Number of iterations of Newton's method to apply + threshold : float + Only keep points whose tangential eigen value is within this value of zero (inclusive) + """ + r = np.ones(n_points) * init_r + theta = np.linspace(0, 2 * np.pi, n_points + 1)[:-1] + new_yx = step_r( + r, + theta, + jax.tree_util.Partial(self.tangential_eigen_value_rt, centre=init_centre), + jax.tree_util.Partial(self.grad_r_tangential_eigen_value, centre=init_centre), + n_steps + ) + new_yx = new_yx + np.array(init_centre) + # filter out nan values + fdx = np.isfinite(new_yx).all(axis=1) + new_yx = new_yx[fdx] + # filter out failed points + value = np.abs(self.tangential_eigen_value_yx(new_yx[:, 0], new_yx[:, 1])) + gdx = value <= threshold + return aa.structures.grids.irregular_2d.Grid2DIrregular(values=new_yx[gdx]) + + def radial_critical_curve_jax( + self, + init_r=0.01, + init_centre=(0.0, 0.0), + n_points=300, + n_steps=20, + threshold=1e-5 + ): + """ + Returns all radial critical curves of the lensing system, which are computed as follows: + + 1) Create a set of `n_points` initial points in a circle of radius `init_r` and centred on `init_centre` + 2) Apply `n_steps` of Newton's method to these points in the "radial" direction only (i.e. keeping angle fixed). + Jax's auto differentiation is used to find the radial derivatives of the radial eigen value function for + this step. + 3) Filter the results and only keep point that have their radial eigen value `threshold` of 0 + + No underlying grid is needed for the method, but the quality of the results are dependent on the initial + circle of points. + + Parameters + ---------- + init_r : float + Radius of the circle of initial guess points + init_centre : tuple + centre of the circle of initial guess points as `(y, x)` + n_points : Int + Number of initial guess points to create (evenly spaced in angle around `init_centre`) + n_steps : Int + Number of iterations of Newton's method to apply + threshold : float + Only keep points whose radial eigen value is within this value of zero (inclusive) + """ + r = np.ones(n_points) * init_r + theta = np.linspace(0, 2 * np.pi, n_points + 1)[:-1] + new_yx = step_r( + r, + theta, + jax.tree_util.Partial(self.radial_eigen_value_rt, centre=init_centre), + jax.tree_util.Partial(self.grad_r_radial_eigen_value, centre=init_centre), + n_steps + ) + new_yx = new_yx + np.array(init_centre) + # filter out nan values + fdx = np.isfinite(new_yx).all(axis=1) + new_yx = new_yx[fdx] + # filter out failed points + value = np.abs(self.radial_eigen_value_yx(new_yx[:, 0], new_yx[:, 1])) + gdx = value <= threshold + return aa.structures.grids.irregular_2d.Grid2DIrregular(values=new_yx[gdx]) def jacobian_from(self, grid): """ @@ -798,14 +977,26 @@ def jacobian_from(self, grid): return [[a11, a12], [a21, a22]] else: - a = self.jacobian_stack_vector( + A = self.jacobian_stack_vector( grid.array[:, 0], grid.array[:, 1], grid.pixel_scales ) + a = np.eye(2).reshape(1, 2, 2) - A + return [ + [ + aa.Array2D(values=a[..., 1, 1], mask=grid.mask), + aa.Array2D(values=a[..., 1, 0], mask=grid.mask) + ], + [ + aa.Array2D(values=a[..., 0, 1], mask=grid.mask), + aa.Array2D(values=a[..., 0, 0], mask=grid.mask) + ] + ] + # transpose the result # use `moveaxis` as grid might not be nx2 - return np.moveaxis(np.moveaxis(a, -1, 0), -1, 0) + # return np.moveaxis(np.moveaxis(a, -1, 0), -1, 0) @precompute_jacobian def convergence_2d_via_jacobian_from(self, grid, jacobian=None) -> aa.Array2D: @@ -855,9 +1046,15 @@ def shear_yx_2d_via_jacobian_from( A precomputed lensing jacobian, which is passed throughout the `CalcLens` functions for efficiency. """ - shear_yx_2d = np.zeros(shape=(grid.shape_slim, 2)) - shear_yx_2d[:, 0] = -0.5 * (jacobian[0][1] + jacobian[1][0]) - shear_yx_2d[:, 1] = 0.5 * (jacobian[1][1] - jacobian[0][0]) + if not use_jax: + shear_yx_2d = np.zeros(shape=(grid.shape_slim, 2)) + shear_yx_2d[:, 0] = -0.5 * (jacobian[0][1] + jacobian[1][0]) + shear_yx_2d[:, 1] = 0.5 * (jacobian[1][1] - jacobian[0][0]) + + else: + shear_y = -0.5 * (jacobian[0][1] + jacobian[1][0]).array + shear_x = 0.5 * (jacobian[1][1] - jacobian[0][0]).array + shear_yx_2d = np.stack([shear_y, shear_x]).T if isinstance(grid, aa.Grid2DIrregular): return ShearYX2DIrregular(values=shear_yx_2d, grid=grid) diff --git a/autogalaxy/profiles/geometry_profiles.py b/autogalaxy/profiles/geometry_profiles.py index 64fb0c453..8bd7ec6b4 100644 --- a/autogalaxy/profiles/geometry_profiles.py +++ b/autogalaxy/profiles/geometry_profiles.py @@ -4,8 +4,10 @@ if os.environ.get("USE_JAX", "0") == "1": import jax.numpy as np + use_jax = True else: import numpy as np + use_jax = False import autoarray as aa @@ -129,7 +131,10 @@ def _cartesian_grid_via_radial_from( radius The circular radius of each coordinate from the profile center. """ - grid_angles = np.arctan2(grid[:, 0], grid[:, 1]) + if use_jax: + grid_angles = np.arctan2(grid.array[:, 0], grid.array[:, 1]) + else: + grid_angles = np.arctan2(grid[:, 0], grid[:, 1]) cos_theta, sin_theta = self.angle_to_profile_grid_from(grid_angles=grid_angles) return np.multiply(radius[:, None], np.vstack((sin_theta, cos_theta)).T) @@ -145,7 +150,10 @@ def transformed_to_reference_frame_grid_from(self, grid, **kwargs): grid The (y, x) coordinates in the original reference frame of the grid. """ - return np.subtract(grid, self.centre) + if use_jax: + return np.subtract(grid.array, np.array(self.centre)) + else: + return np.subtract(grid, self.centre) @aa.grid_dec.to_grid def transformed_from_reference_frame_grid_from(self, grid, **kwargs): diff --git a/autogalaxy/profiles/light/standard/gaussian.py b/autogalaxy/profiles/light/standard/gaussian.py index 87717ae5f..a297c6bf5 100644 --- a/autogalaxy/profiles/light/standard/gaussian.py +++ b/autogalaxy/profiles/light/standard/gaussian.py @@ -1,4 +1,5 @@ -import numpy as np +# import numpy as np +from autofit.jax_wrapper import numpy as np, use_jax from typing import Optional, Tuple import autoarray as aa @@ -59,15 +60,26 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray) -> np.ndarray: grid_radii The radial distances from the centre of the profile, for each coordinate on the grid. """ - return np.multiply( - self._intensity, - np.exp( - -0.5 - * np.square( - np.divide(grid_radii, self.sigma / np.sqrt(self.axis_ratio)) - ) - ), - ) + if use_jax: + return np.multiply( + self._intensity, + np.exp( + -0.5 + * np.square( + np.divide(grid_radii.array, self.sigma / np.sqrt(self.axis_ratio)) + ) + ), + ) + else: + return np.multiply( + self._intensity, + np.exp( + -0.5 + * np.square( + np.divide(grid_radii, self.sigma / np.sqrt(self.axis_ratio)) + ) + ), + ) @aa.over_sample @aa.grid_dec.to_array diff --git a/autogalaxy/profiles/mass/stellar/gaussian.py b/autogalaxy/profiles/mass/stellar/gaussian.py index 42fa8d540..d0cf66499 100644 --- a/autogalaxy/profiles/mass/stellar/gaussian.py +++ b/autogalaxy/profiles/mass/stellar/gaussian.py @@ -1,5 +1,8 @@ import copy import numpy as np +from autofit.jax_wrapper import use_jax +if use_jax: + import jax from scipy.special import wofz from scipy.integrate import quad from typing import Tuple @@ -188,7 +191,14 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray): @property def axis_ratio(self): axis_ratio = super().axis_ratio - return axis_ratio if axis_ratio < 0.9999 else 0.9999 + if use_jax: + return jax.lax.select( + axis_ratio < 0.9999, + axis_ratio, + 0.9999 + ) + else: + return axis_ratio if axis_ratio < 0.9999 else 0.9999 def zeta_from(self, grid: aa.type.Grid2DLike): q2 = self.axis_ratio**2.0 From 5e8a273b04618c97d9b89d3c72cd3d0dc1ad6eb7 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Wed, 22 Jan 2025 19:35:01 +0000 Subject: [PATCH 21/26] config changes --- .github/workflows/main.yml | 194 ++-- autogalaxy/aggregator/imaging/imaging.py | 240 ++--- autogalaxy/config/general.yaml | 22 +- autogalaxy/config/grids.yaml | 464 ++++----- autogalaxy/config/notation.yaml | 286 +++--- autogalaxy/config/priors/basis.yaml | 2 +- autogalaxy/config/priors/cosmology.yaml | 124 +-- .../config/priors/light/linear/chameleon.yaml | 228 ++--- .../priors/light/linear/dev_vaucouleurs.yaml | 188 ++-- .../config/priors/light/linear/eff.yaml | 228 ++--- .../priors/light/linear/exponential.yaml | 188 ++-- .../priors/light/linear/exponential_core.yaml | 224 ++--- .../config/priors/light/linear/gaussian.yaml | 188 ++-- .../config/priors/light/linear/moffat.yaml | 228 ++--- .../config/priors/light/linear/sersic.yaml | 228 ++--- .../priors/light/linear/sersic_core.yaml | 262 ++--- .../light/linear_operated/gaussian.yaml | 138 +-- .../priors/light/linear_operated/moffat.yaml | 138 +-- .../priors/light/operated/gaussian.yaml | 138 +-- .../config/priors/light/operated/moffat.yaml | 158 ++-- .../config/priors/light/operated/sersic.yaml | 158 ++-- .../priors/light/standard/chameleon.yaml | 268 +++--- .../light/standard/dev_vaucouleurs.yaml | 228 ++--- .../config/priors/light/standard/eff.yaml | 268 +++--- .../priors/light/standard/exponential.yaml | 228 ++--- .../light/standard/exponential_core.yaml | 264 +++--- .../priors/light/standard/gaussian.yaml | 228 ++--- .../config/priors/light/standard/moffat.yaml | 268 +++--- .../config/priors/light/standard/sersic.yaml | 268 +++--- .../priors/light/standard/sersic_core.yaml | 304 +++--- autogalaxy/config/priors/mass/dark/gnfw.yaml | 268 +++--- .../config/priors/mass/dark/gnfw_mcr.yaml | 178 ++-- .../mass/dark/gnfw_virial_mass_conc.yaml | 168 ++-- autogalaxy/config/priors/mass/dark/nfw.yaml | 228 ++--- .../config/priors/mass/dark/nfw_mcr.yaml | 378 ++++---- .../priors/mass/dark/nfw_mcr_scatter.yaml | 134 +-- .../priors/mass/dark/nfw_truncated.yaml | 110 +-- .../priors/mass/dark/nfw_truncated_mcr.yaml | 354 +++---- .../mass/dark/nfw_virial_mass_conc.yaml | 150 +-- .../config/priors/mass/point/point.yaml | 70 +- autogalaxy/config/priors/mass/point/smbh.yaml | 108 +-- .../config/priors/mass/point/smbh_binary.yaml | 168 ++-- .../priors/mass/sheets/external_shear.yaml | 42 +- .../config/priors/mass/sheets/mass_sheet.yaml | 70 +- .../config/priors/mass/stellar/chameleon.yaml | 308 +++--- .../priors/mass/stellar/dev_vaucouleurs.yaml | 268 +++--- .../priors/mass/stellar/exponential.yaml | 268 +++--- .../config/priors/mass/stellar/gaussian.yaml | 158 ++-- .../mass/stellar/gaussian_gradient.yaml | 182 ++-- .../config/priors/mass/stellar/sersic.yaml | 308 +++--- .../priors/mass/stellar/sersic_core.yaml | 344 +++---- .../priors/mass/stellar/sersic_gradient.yaml | 348 +++---- .../config/priors/mass/total/isothermal.yaml | 188 ++-- .../priors/mass/total/isothermal_core.yaml | 228 ++--- .../config/priors/mass/total/power_law.yaml | 228 ++--- .../priors/mass/total/power_law_broken.yaml | 308 +++--- .../priors/mass/total/power_law_core.yaml | 268 +++--- autogalaxy/config/priors/mesh/delaunay.yaml | 2 +- .../config/priors/mesh/rectangular.yaml | 42 +- autogalaxy/config/priors/point_sources.yaml | 170 ++-- .../regularization/adaptive_brightness.yaml | 124 +-- .../priors/regularization/constant.yaml | 22 +- .../priors/regularization/constant_split.yaml | 22 +- .../regularization/constant_zeroth.yaml | 42 +- .../config/priors/regularization/zeroth.yaml | 22 +- autogalaxy/config/visualize/general.yaml | 16 +- autogalaxy/config/visualize/include.yaml | 22 +- autogalaxy/config/visualize/mat_wrap_1d.yaml | 38 +- autogalaxy/config/visualize/mat_wrap_2d.yaml | 126 +-- autogalaxy/config/visualize/plots.yaml | 196 ++-- autogalaxy/profiles/light/decorators.py | 144 +-- autogalaxy/profiles/light/snr/sersic.py | 150 +-- .../profiles/mass/abstract/jax_utils.py | 198 ++-- autogalaxy/profiles/mass/abstract/mge.py | 16 +- .../profiles/mass/dark/nfw_hk24_util.py | 512 +++++----- .../mass/dark/nfw_virial_mass_conc.py | 184 ++-- autogalaxy/profiles/mass/total/jax_utils.py | 94 +- eden.ini | 6 +- optional_requirements.txt | 14 +- test_autogalaxy/config/general.yaml | 80 +- test_autogalaxy/config/grids.yaml | 464 ++++----- test_autogalaxy/config/lensing.yaml | 22 +- test_autogalaxy/config/non_linear.yaml | 214 ++--- test_autogalaxy/config/notation.yaml | 166 ++-- test_autogalaxy/config/output.yaml | 126 +-- test_autogalaxy/config/text.yaml | 22 +- test_autogalaxy/config/visualize.yaml | 894 +++++++++--------- test_autogalaxy/profiles/test_dict.py | 68 +- test_autogalaxy/test_regression.py | 152 +-- 89 files changed, 8274 insertions(+), 8274 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ede250ca5..0eaada122 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,98 +1,98 @@ -name: Tests - -on: [push, pull_request] - -jobs: - unittest: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.9, '3.10', '3.11', '3.12'] - steps: - - name: Checkout PyAutoConf - uses: actions/checkout@v2 - with: - repository: rhayes777/PyAutoConf - path: PyAutoConf - - name: Checkout PyAutoFit - uses: actions/checkout@v2 - with: - repository: rhayes777/PyAutoFit - path: PyAutoFit - - name: Checkout PyAutoArray - uses: actions/checkout@v2 - with: - repository: Jammy2211/PyAutoArray - path: PyAutoArray - - name: Checkout PyAutoGalaxy - uses: actions/checkout@v2 - with: - path: PyAutoGalaxy - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/cache@v2 - id: cache-pip - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Extract branch name - shell: bash - run: | - cd PyAutoGalaxy - echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - name: Change to same branch if exists in deps - shell: bash - run: | - export PACKAGES=("PyAutoConf" "PyAutoFit" "PyAutoArray") - export BRANCH="${{ steps.extract_branch.outputs.branch }}" - for PACKAGE in ${PACKAGES[@]}; do - pushd $PACKAGE - export existed_in_remote=$(git ls-remote --heads origin ${BRANCH}) - if [[ -z ${existed_in_remote} ]]; then - echo "Branch $BRANCH did not exist in $PACKAGE" - else - echo "Branch $BRANCH did exist in $PACKAGE" - git fetch - git checkout $BRANCH - fi - popd - done - - name: Install dependencies - # if: steps.cache-pip.outputs.cache-hit != 'true' - run: | - pip3 install --upgrade pip - pip3 install setuptools - pip3 install wheel - pip3 install pytest coverage pytest-cov - pip3 install -r PyAutoConf/requirements.txt - pip3 install -r PyAutoFit/requirements.txt - pip3 install -r PyAutoArray/requirements.txt - pip3 install -r PyAutoArray/optional_requirements.txt - pip3 install -r PyAutoGalaxy/requirements.txt - pip3 install -r PyAutoGalaxy/optional_requirements.txt - - name: Run tests - run: | - export ROOT_DIR=`pwd` - export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoConf - export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoFit - export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoArray - export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoGalaxy - pushd PyAutoGalaxy - python3 -m pytest --cov autogalaxy --cov-report xml:coverage.xml - - name: Slack send - if: ${{ failure() }} - id: slack - uses: slackapi/slack-github-action@v1.21.0 - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - with: - channel-id: C03S98FEDK2 - payload: | - { - "text": "${{ github.repository }}/${{ github.ref_name }} (Python ${{ matrix.python-version }}) build result: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" +name: Tests + +on: [push, pull_request] + +jobs: + unittest: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.9, '3.10', '3.11', '3.12'] + steps: + - name: Checkout PyAutoConf + uses: actions/checkout@v2 + with: + repository: rhayes777/PyAutoConf + path: PyAutoConf + - name: Checkout PyAutoFit + uses: actions/checkout@v2 + with: + repository: rhayes777/PyAutoFit + path: PyAutoFit + - name: Checkout PyAutoArray + uses: actions/checkout@v2 + with: + repository: Jammy2211/PyAutoArray + path: PyAutoArray + - name: Checkout PyAutoGalaxy + uses: actions/checkout@v2 + with: + path: PyAutoGalaxy + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/cache@v2 + id: cache-pip + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Extract branch name + shell: bash + run: | + cd PyAutoGalaxy + echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + - name: Change to same branch if exists in deps + shell: bash + run: | + export PACKAGES=("PyAutoConf" "PyAutoFit" "PyAutoArray") + export BRANCH="${{ steps.extract_branch.outputs.branch }}" + for PACKAGE in ${PACKAGES[@]}; do + pushd $PACKAGE + export existed_in_remote=$(git ls-remote --heads origin ${BRANCH}) + if [[ -z ${existed_in_remote} ]]; then + echo "Branch $BRANCH did not exist in $PACKAGE" + else + echo "Branch $BRANCH did exist in $PACKAGE" + git fetch + git checkout $BRANCH + fi + popd + done + - name: Install dependencies + # if: steps.cache-pip.outputs.cache-hit != 'true' + run: | + pip3 install --upgrade pip + pip3 install setuptools + pip3 install wheel + pip3 install pytest coverage pytest-cov + pip3 install -r PyAutoConf/requirements.txt + pip3 install -r PyAutoFit/requirements.txt + pip3 install -r PyAutoArray/requirements.txt + pip3 install -r PyAutoArray/optional_requirements.txt + pip3 install -r PyAutoGalaxy/requirements.txt + pip3 install -r PyAutoGalaxy/optional_requirements.txt + - name: Run tests + run: | + export ROOT_DIR=`pwd` + export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoConf + export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoFit + export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoArray + export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoGalaxy + pushd PyAutoGalaxy + python3 -m pytest --cov autogalaxy --cov-report xml:coverage.xml + - name: Slack send + if: ${{ failure() }} + id: slack + uses: slackapi/slack-github-action@v1.21.0 + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + with: + channel-id: C03S98FEDK2 + payload: | + { + "text": "${{ github.repository }}/${{ github.ref_name }} (Python ${{ matrix.python-version }}) build result: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" } \ No newline at end of file diff --git a/autogalaxy/aggregator/imaging/imaging.py b/autogalaxy/aggregator/imaging/imaging.py index 9a30e7852..f1772b7fd 100644 --- a/autogalaxy/aggregator/imaging/imaging.py +++ b/autogalaxy/aggregator/imaging/imaging.py @@ -1,120 +1,120 @@ -from functools import partial -from typing import List - -import autofit as af -import autoarray as aa - - -def _imaging_from( - fit: af.Fit, -) -> List[aa.Imaging]: - """ - Returns a list of `Imaging` objects from a `PyAutoFit` sqlite database `Fit` object. - - The results of a model-fit can be stored in a sqlite database, including the following attributes of the fit: - - - The imaging data as a .fits file (`dataset/data.fits`). - - The noise-map as a .fits file (`dataset/noise_map.fits`). - - The point spread function as a .fits file (`dataset/psf.fits`). - - The settings of the `Imaging` data structure used in the fit (`dataset/settings.json`). - - The mask used to mask the `Imaging` data structure in the fit (`dataset/mask.fits`). - - Each individual attribute can be loaded from the database via the `fit.value()` method. - - This method combines all of these attributes and returns a `Imaging` object, has the mask applied to the - `Imaging` data structure and its settings updated to the values used by the model-fit. - - If multiple `Imaging` objects were fitted simultaneously via analysis summing, the `fit.child_values()` method - is instead used to load lists of the data, noise-map, PSF and mask and combine them into a list of - `Imaging` objects. - - Parameters - ---------- - fit - A `PyAutoFit` `Fit` object which contains the results of a model-fit as an entry in a sqlite database. - """ - - fit_list = [fit] if not fit.children else fit.children - - dataset_list = [] - - for fit in fit_list: - data = aa.Array2D.from_primary_hdu(primary_hdu=fit.value(name="dataset.data")) - noise_map = aa.Array2D.from_primary_hdu( - primary_hdu=fit.value(name="dataset.noise_map") - ) - try: - psf = aa.Kernel2D.from_primary_hdu( - primary_hdu=fit.value(name="dataset.psf") - ) - except AttributeError: - psf = None - - over_sampling = fit.value(name="dataset.over_sampling") - - dataset = aa.Imaging( - data=data, - noise_map=noise_map, - psf=psf, - over_sampling=over_sampling, - check_noise_map=False, - ) - - mask = aa.Mask2D.from_primary_hdu(primary_hdu=fit.value(name="dataset.mask")) - - dataset = dataset.apply_mask(mask=mask) - - dataset_list.append(dataset) - - return dataset_list - - -class ImagingAgg: - def __init__(self, aggregator: af.Aggregator): - """ - Interfaces with an `PyAutoFit` aggregator object to create instances of `Imaging` objects from the results - of a model-fit. - - The results of a model-fit can be stored in a sqlite database, including the following attributes of the fit: - - - The imaging data as a .fits file (`dataset/data.fits`). - - The noise-map as a .fits file (`dataset/noise_map.fits`). - - The point spread function as a .fits file (`dataset/psf.fits`). - - The settings of the `Imaging` data structure used in the fit (`dataset/settings.json`). - - The mask used to mask the `Imaging` data structure in the fit (`dataset/mask.fits`). - - The `aggregator` contains the path to each of these files, and they can be loaded individually. This class - can load them all at once and create an `Imaging` object via the `_imaging_from` method. - - This class's methods returns generators which create the instances of the `Imaging` objects. This ensures - that large sets of results can be efficiently loaded from the hard-disk and do not require storing all - `Imaging` instances in the memory at once. - - For example, if the `aggregator` contains 3 model-fits, this class can be used to create a generator which - creates instances of the corresponding 3 `Imaging` objects. - - If multiple `Imaging` objects were fitted simultaneously via analysis summing, the `fit.child_values()` method - is instead used to load lists of the data, noise-map, PSF and mask and combine them into a list of - `Imaging` objects. - - This can be done manually, but this object provides a more concise API. - - Parameters - ---------- - aggregator - A `PyAutoFit` aggregator object which can load the results of model-fits. - """ - self.aggregator = aggregator - - def dataset_gen_from( - self, - ) -> List[aa.Imaging]: - """ - Returns a generator of `Imaging` objects from an input aggregator. - - See `__init__` for a description of how the `Imaging` objects are created by this method. - """ - - func = partial(_imaging_from) - - return self.aggregator.map(func=func) +from functools import partial +from typing import List + +import autofit as af +import autoarray as aa + + +def _imaging_from( + fit: af.Fit, +) -> List[aa.Imaging]: + """ + Returns a list of `Imaging` objects from a `PyAutoFit` sqlite database `Fit` object. + + The results of a model-fit can be stored in a sqlite database, including the following attributes of the fit: + + - The imaging data as a .fits file (`dataset/data.fits`). + - The noise-map as a .fits file (`dataset/noise_map.fits`). + - The point spread function as a .fits file (`dataset/psf.fits`). + - The settings of the `Imaging` data structure used in the fit (`dataset/settings.json`). + - The mask used to mask the `Imaging` data structure in the fit (`dataset/mask.fits`). + + Each individual attribute can be loaded from the database via the `fit.value()` method. + + This method combines all of these attributes and returns a `Imaging` object, has the mask applied to the + `Imaging` data structure and its settings updated to the values used by the model-fit. + + If multiple `Imaging` objects were fitted simultaneously via analysis summing, the `fit.child_values()` method + is instead used to load lists of the data, noise-map, PSF and mask and combine them into a list of + `Imaging` objects. + + Parameters + ---------- + fit + A `PyAutoFit` `Fit` object which contains the results of a model-fit as an entry in a sqlite database. + """ + + fit_list = [fit] if not fit.children else fit.children + + dataset_list = [] + + for fit in fit_list: + data = aa.Array2D.from_primary_hdu(primary_hdu=fit.value(name="dataset.data")) + noise_map = aa.Array2D.from_primary_hdu( + primary_hdu=fit.value(name="dataset.noise_map") + ) + try: + psf = aa.Kernel2D.from_primary_hdu( + primary_hdu=fit.value(name="dataset.psf") + ) + except AttributeError: + psf = None + + over_sampling = fit.value(name="dataset.over_sampling") + + dataset = aa.Imaging( + data=data, + noise_map=noise_map, + psf=psf, + over_sampling=over_sampling, + check_noise_map=False, + ) + + mask = aa.Mask2D.from_primary_hdu(primary_hdu=fit.value(name="dataset.mask")) + + dataset = dataset.apply_mask(mask=mask) + + dataset_list.append(dataset) + + return dataset_list + + +class ImagingAgg: + def __init__(self, aggregator: af.Aggregator): + """ + Interfaces with an `PyAutoFit` aggregator object to create instances of `Imaging` objects from the results + of a model-fit. + + The results of a model-fit can be stored in a sqlite database, including the following attributes of the fit: + + - The imaging data as a .fits file (`dataset/data.fits`). + - The noise-map as a .fits file (`dataset/noise_map.fits`). + - The point spread function as a .fits file (`dataset/psf.fits`). + - The settings of the `Imaging` data structure used in the fit (`dataset/settings.json`). + - The mask used to mask the `Imaging` data structure in the fit (`dataset/mask.fits`). + + The `aggregator` contains the path to each of these files, and they can be loaded individually. This class + can load them all at once and create an `Imaging` object via the `_imaging_from` method. + + This class's methods returns generators which create the instances of the `Imaging` objects. This ensures + that large sets of results can be efficiently loaded from the hard-disk and do not require storing all + `Imaging` instances in the memory at once. + + For example, if the `aggregator` contains 3 model-fits, this class can be used to create a generator which + creates instances of the corresponding 3 `Imaging` objects. + + If multiple `Imaging` objects were fitted simultaneously via analysis summing, the `fit.child_values()` method + is instead used to load lists of the data, noise-map, PSF and mask and combine them into a list of + `Imaging` objects. + + This can be done manually, but this object provides a more concise API. + + Parameters + ---------- + aggregator + A `PyAutoFit` aggregator object which can load the results of model-fits. + """ + self.aggregator = aggregator + + def dataset_gen_from( + self, + ) -> List[aa.Imaging]: + """ + Returns a generator of `Imaging` objects from an input aggregator. + + See `__init__` for a description of how the `Imaging` objects are created by this method. + """ + + func = partial(_imaging_from) + + return self.aggregator.map(func=func) diff --git a/autogalaxy/config/general.yaml b/autogalaxy/config/general.yaml index 361abe732..09893bfed 100644 --- a/autogalaxy/config/general.yaml +++ b/autogalaxy/config/general.yaml @@ -1,12 +1,12 @@ -fits: - flip_for_ds9: true -grid: - max_evaluation_grid_size: 1000 # An evaluation grid whose shape is adaptive chosen is used to compute quantities like critical curves, this integer is the max size of the grid ensuring faster run times. -adapt: - adapt_minimum_percent: 0.01 - adapt_noise_limit: 100000000.0 -inversion: - use_border_relocator: true # If True, by default a pixelization's border is used to relocate all pixels outside its border to the border. -test: - check_likelihood_function: true # if True, when a search is resumed the likelihood of a previous sample is recalculated to ensure it is consistent with the previous run. +fits: + flip_for_ds9: true +grid: + max_evaluation_grid_size: 1000 # An evaluation grid whose shape is adaptive chosen is used to compute quantities like critical curves, this integer is the max size of the grid ensuring faster run times. +adapt: + adapt_minimum_percent: 0.01 + adapt_noise_limit: 100000000.0 +inversion: + use_border_relocator: true # If True, by default a pixelization's border is used to relocate all pixels outside its border to the border. +test: + check_likelihood_function: true # if True, when a search is resumed the likelihood of a previous sample is recalculated to ensure it is consistent with the previous run. exception_override: false \ No newline at end of file diff --git a/autogalaxy/config/grids.yaml b/autogalaxy/config/grids.yaml index 6891a7f60..636d7af08 100644 --- a/autogalaxy/config/grids.yaml +++ b/autogalaxy/config/grids.yaml @@ -1,233 +1,233 @@ -# Certain light and mass profile calculations become ill defined at (0.0, 0.0) or close to this value. This can lead -# to numerical issues in the calculation of the profile, for example a np.nan may arise, crashing the code. - -# To avoid this, we set a minimum value for the radial coordinate of the profile. If the radial coordinate is below -# this value, it is rounded up to this value. This ensures that the profile cannot receive a radial coordinate of 0.0. - -# For example, if an input grid coordinate has a radial coordinate of 1e-12, for most profiles this will be rounded up -# to radial_minimum=1e-08. This is a small enough value that it should not impact the results of the profile calculation. - -radial_minimum: - radial_minimum: - Chameleon: 1.0e-08 - ChameleonSph: 1.0e-08 - DevVaucouleurs: 1.0e-06 - DevVaucouleursSph: 1.0e-06 - dPIE: 1.0e-08 - dPIESph: 1.0e-08 - ExponentialGradient: 1.0e-06 - ExponentialGradientSph: 1.0e-06 - ElsonFreeFall: 1.0e-08 - ElsonFreeFallSph: 1.0e-08 - Exponential: 1.0e-06 - ExponentialCore: 1.0e-06 - ExponentialCoreSph: 1.0e-06 - ExponentialSph: 1.0e-06 - ExternalShear: 1.0e-08 - Gaussian: 1.0e-08 - GaussianGradient: 1.0e-08 - GaussianSph: 1.0e-08 - gNFW: 1.0e-06 - gNFWMCRLudlow: 1.0e-06 - gNFWVirialMassConcSph: 1.0e-06 - gNFWSph: 1.0e-06 - Isothermal: 1.0e-08 - IsothermalCore: 1.0e-08 - IsothermalCoreSph: 1.0e-08 - IsothermalSph: 1.0e-08 - MassSheet: 1.0e-08 - Moffat: 1.0e-08 - MoffatSph: 1.0e-08 - PowerLawMultipole: 1.0e-08 - NFW: 1.0e-06 - NFWMCRDuffySph: 1.0e-06 - NFWMCRLudlow: 1.0e-06 - NFWMCRLudlowSph: 1.0e-06 - NFWMCRScatterLudlow: 1.0e-06 - NFWMCRScatterLudlowSph: 1.0e-06 - NFWVirialMassConcSph : 1.0e-06 - NFWSph: 1.0e-06 - NFWTruncatedMCRDuffySph: 1.0e-06 - NFWTruncatedMCRLudlowSph: 1.0e-06 - NFWTruncatedMCRScatterLudlowSph: 1.0e-06 - NFWTruncatedSph: 1.0e-06 - PointMass: 1.0e-08 - PowerLaw: 1.0e-08 - PowerLawBroken: 1.0e-08 - PowerLawBrokenSph: 1.0e-08 - PowerLawCore: 1.0e-08 - PowerLawCoreSph: 1.0e-08 - PowerLawSph: 1.0e-08 - Sersic: 1.0e-06 - SersicCore: 1.0e-06 - SersicCoreSph: 1.0e-06 - SersicGradient: 1.0e-06 - SersicSph: 1.0e-06 - SersicGradientSph: 1.0e-06 - ShapeletCartesianSph: 1.0e-8 - ShapeletCartesian: 1.0e-8 - ShapeletPolarSph: 1.0e-8 - ShapeletPolar: 1.0e-8 - ShapeletExponentialSph: 1.0e-8 - ShapeletExponential: 1.0e-8 - SMBH: 1.0e-8 - SMBHBinary: 1.0e-8 - EllProfile: 1.0e-08 - -# Over sampling is an important numerical technique, whereby light profiles images are evaluated on a higher resolution -# grid than the image data to ensure the calculation is accurate. - -# By default, a user does not specify the over sampling factor, and a default over sampling scheme is used for each -# profile. This scheme first goes to the centre of the profile, and computes circles with certain radial values -# (e.g. radii). It then assigns an over sampling `sub_size` to each circle, where the central circles have the highest -# over sampling factor and the outer circles have the lowest. - -# The size of the circles that are appropriate for determining the over sampling factor are dependent on the resolution -# of the grid. For a high resolution grid (e.g. low pixel scale), a smaller circle central circle is necessary to -# over sample the profile accurately. The config file below therefore specifies the "radial factors" used for -# automatically determining the over sampling factors for each profile, which is the factor the pixel scale is multiplied -# by to determine the circle size. - -# The config entry below defines the default over sampling factor for each profile, where: - -# radial_factor_list: The factors that are multiplied by the pixel scale to determine the circle size that is used. -# sub_size_list: The over sampling factor that is used for each circle size. - -# For the default entries below, oversampling of degree 32 x 32 is used within a circle of radius 3.01 x pixel scale, -# 4 x 4 within a circle of radius 10.01 x pixel scale and 2 x 2 for all pixels outside of this radius. - -over_sampling: - radial_factor_list: - Chameleon: [3.01, 10.01] - ChameleonSph: [3.01, 10.01] - DevVaucouleurs: [3.01, 10.01] - DevVaucouleursSph: [3.01, 10.01] - dPIE: [3.01, 10.01] - dPIESph: [3.01, 10.01] - ExponentialRadialGradient: [3.01, 10.01] - ExponentialRadialGradientSph: [3.01, 10.01] - ElsonFreeFall: [3.01, 10.01] - ElsonFreeFallSph: [3.01, 10.01] - Exponential: [3.01, 10.01] - ExponentialCore: [3.01, 10.01] - ExponentialCoreSph: [3.01, 10.01] - ExponentialSph: [3.01, 10.01] - ExternalShear: [3.01, 10.01] - Gaussian: [3.01, 10.01] - GaussianSph: [3.01, 10.01] - GaussianGradient: [3.01, 10.01] - GaussianGradientSph: [3.01, 10.01] - gNFW: [3.01, 10.01] - gNFWMCRLudlow: [3.01, 10.01] - gNFWVirialMassConcSph: [3.01, 10.01] - gNFWSph: [3.01, 10.01] - Isothermal: [3.01, 10.01] - IsothermalCore: [3.01, 10.01] - IsothermalCoreSph: [3.01, 10.01] - IsothermalSph: [3.01, 10.01] - MassSheet: [3.01, 10.01] - Moffat: [3.01, 10.01] - MoffatSph: [3.01, 10.01] - PowerLawMultipole: [3.01, 10.01] - NFW: [3.01, 10.01] - NFWMCRDuffySph: [3.01, 10.01] - NFWMCRLudlow: [3.01, 10.01] - NFWMCRLudlowSph: [3.01, 10.01] - NFWMCRScatterLudlow: [3.01, 10.01] - NFWMCRScatterLudlowSph: [3.01, 10.01] - NFWVirialMassConcSph: [3.01, 10.01] - NFWSph: [3.01, 10.01] - NFWTruncatedMCRDuffySph: [3.01, 10.01] - NFWTruncatedMCRLudlowSph: [3.01, 10.01] - NFWTruncatedMCRScatterLudlowSph: [3.01, 10.01] - NFWTruncatedSph: [3.01, 10.01] - PointMass: [3.01, 10.01] - PowerLaw: [3.01, 10.01] - PowerLawBroken: [3.01, 10.01] - PowerLawBrokenSph: [3.01, 10.01] - PowerLawCore: [3.01, 10.01] - PowerLawCoreSph: [3.01, 10.01] - PowerLawSph: [3.01, 10.01] - Sersic: [3.01, 10.01] - SersicCore: [3.01, 10.01] - SersicCoreSph: [3.01, 10.01] - SersicRadialGradient: [3.01, 10.01] - SersicSph: [3.01, 10.01] - SersicRadialGradientSph: [3.01, 10.01] - ShapeletCartesianSph: [3.01, 10.01] - ShapeletCartesian: [3.01, 10.01] - ShapeletPolarSph: [3.01, 10.01] - ShapeletPolar: [3.01, 10.01] - ShapeletExponentialSph: [3.01, 10.01] - ShapeletExponential: [3.01, 10.01] - SMBH: [3.01, 10.01] - SMBHBinary: [3.01, 10.01] - EllProfile: [3.01, 10.01] - PlotExample: [3.01, 10.01] - sub_size_list: - Chameleon: [32, 4, 2] - ChameleonSph: [32, 4, 2] - DevVaucouleurs: [32, 4, 2] - DevVaucouleursSph: [32, 4, 2] - dPIE: [32, 4, 2] - dPIESph: [32, 4, 2] - ExponentialRadialGradient: [32, 4, 2] - ExponentialRadialGradientSph: [32, 4, 2] - ElsonFreeFall: [32, 4, 2] - ElsonFreeFallSph: [32, 4, 2] - Exponential: [32, 4, 2] - ExponentialCore: [32, 4, 2] - ExponentialCoreSph: [32, 4, 2] - ExponentialSph: [32, 4, 2] - ExternalShear: [32, 4, 2] - Gaussian: [32, 4, 2] - GaussianSph: [32, 4, 2] - GaussianGradient: [32, 4, 2] - GaussianGradientSph: [32, 4, 2] - gNFW: [32, 4, 2] - gNFWMCRLudlow: [32, 4, 2] - gNFWVirialMassConcSph: [32, 4, 2] - gNFWSph: [32, 4, 2] - Isothermal: [32, 4, 2] - IsothermalCore: [32, 4, 2] - IsothermalCoreSph: [32, 4, 2] - IsothermalSph: [32, 4, 2] - MassSheet: [32, 4, 2] - Moffat: [32, 4, 2] - MoffatSph: [32, 4, 2] - PowerLawMultipole: [32, 4, 2] - NFW: [32, 4, 2] - NFWMCRDuffySph: [32, 4, 2] - NFWMCRLudlow: [32, 4, 2] - NFWMCRLudlowSph: [32, 4, 2] - NFWMCRScatterLudlow: [32, 4, 2] - NFWMCRScatterLudlowSph: [32, 4, 2] - NFWVirialMassConcSph : [32, 4, 2] - NFWSph: [32, 4, 2] - NFWTruncatedMCRDuffySph: [32, 4, 2] - NFWTruncatedMCRLudlowSph: [32, 4, 2] - NFWTruncatedMCRScatterLudlowSph: [32, 4, 2] - NFWTruncatedSph: [32, 4, 2] - PointMass: [32, 4, 2] - PowerLaw: [32, 4, 2] - PowerLawBroken: [32, 4, 2] - PowerLawBrokenSph: [32, 4, 2] - PowerLawCore: [32, 4, 2] - PowerLawCoreSph: [32, 4, 2] - PowerLawSph: [32, 4, 2] - Sersic: [32, 4, 2] - SersicCore: [32, 4, 2] - SersicCoreSph: [32, 4, 2] - SersicRadialGradient: [32, 4, 2] - SersicSph: [32, 4, 2] - SersicRadialGradientSph: [32, 4, 2] - ShapeletCartesianSph: [32, 4, 2] - ShapeletCartesian: [32, 4, 2] - ShapeletPolarSph: [32, 4, 2] - ShapeletPolar: [32, 4, 2] - ShapeletExponentialSph: [32, 4, 2] - ShapeletExponential: [32, 4, 2] - SMBH: [32, 4, 2] - SMBHBinary: [32, 4, 2] - EllProfile: [32, 4, 2] +# Certain light and mass profile calculations become ill defined at (0.0, 0.0) or close to this value. This can lead +# to numerical issues in the calculation of the profile, for example a np.nan may arise, crashing the code. + +# To avoid this, we set a minimum value for the radial coordinate of the profile. If the radial coordinate is below +# this value, it is rounded up to this value. This ensures that the profile cannot receive a radial coordinate of 0.0. + +# For example, if an input grid coordinate has a radial coordinate of 1e-12, for most profiles this will be rounded up +# to radial_minimum=1e-08. This is a small enough value that it should not impact the results of the profile calculation. + +radial_minimum: + radial_minimum: + Chameleon: 1.0e-08 + ChameleonSph: 1.0e-08 + DevVaucouleurs: 1.0e-06 + DevVaucouleursSph: 1.0e-06 + dPIE: 1.0e-08 + dPIESph: 1.0e-08 + ExponentialGradient: 1.0e-06 + ExponentialGradientSph: 1.0e-06 + ElsonFreeFall: 1.0e-08 + ElsonFreeFallSph: 1.0e-08 + Exponential: 1.0e-06 + ExponentialCore: 1.0e-06 + ExponentialCoreSph: 1.0e-06 + ExponentialSph: 1.0e-06 + ExternalShear: 1.0e-08 + Gaussian: 1.0e-08 + GaussianGradient: 1.0e-08 + GaussianSph: 1.0e-08 + gNFW: 1.0e-06 + gNFWMCRLudlow: 1.0e-06 + gNFWVirialMassConcSph: 1.0e-06 + gNFWSph: 1.0e-06 + Isothermal: 1.0e-08 + IsothermalCore: 1.0e-08 + IsothermalCoreSph: 1.0e-08 + IsothermalSph: 1.0e-08 + MassSheet: 1.0e-08 + Moffat: 1.0e-08 + MoffatSph: 1.0e-08 + PowerLawMultipole: 1.0e-08 + NFW: 1.0e-06 + NFWMCRDuffySph: 1.0e-06 + NFWMCRLudlow: 1.0e-06 + NFWMCRLudlowSph: 1.0e-06 + NFWMCRScatterLudlow: 1.0e-06 + NFWMCRScatterLudlowSph: 1.0e-06 + NFWVirialMassConcSph : 1.0e-06 + NFWSph: 1.0e-06 + NFWTruncatedMCRDuffySph: 1.0e-06 + NFWTruncatedMCRLudlowSph: 1.0e-06 + NFWTruncatedMCRScatterLudlowSph: 1.0e-06 + NFWTruncatedSph: 1.0e-06 + PointMass: 1.0e-08 + PowerLaw: 1.0e-08 + PowerLawBroken: 1.0e-08 + PowerLawBrokenSph: 1.0e-08 + PowerLawCore: 1.0e-08 + PowerLawCoreSph: 1.0e-08 + PowerLawSph: 1.0e-08 + Sersic: 1.0e-06 + SersicCore: 1.0e-06 + SersicCoreSph: 1.0e-06 + SersicGradient: 1.0e-06 + SersicSph: 1.0e-06 + SersicGradientSph: 1.0e-06 + ShapeletCartesianSph: 1.0e-8 + ShapeletCartesian: 1.0e-8 + ShapeletPolarSph: 1.0e-8 + ShapeletPolar: 1.0e-8 + ShapeletExponentialSph: 1.0e-8 + ShapeletExponential: 1.0e-8 + SMBH: 1.0e-8 + SMBHBinary: 1.0e-8 + EllProfile: 1.0e-08 + +# Over sampling is an important numerical technique, whereby light profiles images are evaluated on a higher resolution +# grid than the image data to ensure the calculation is accurate. + +# By default, a user does not specify the over sampling factor, and a default over sampling scheme is used for each +# profile. This scheme first goes to the centre of the profile, and computes circles with certain radial values +# (e.g. radii). It then assigns an over sampling `sub_size` to each circle, where the central circles have the highest +# over sampling factor and the outer circles have the lowest. + +# The size of the circles that are appropriate for determining the over sampling factor are dependent on the resolution +# of the grid. For a high resolution grid (e.g. low pixel scale), a smaller circle central circle is necessary to +# over sample the profile accurately. The config file below therefore specifies the "radial factors" used for +# automatically determining the over sampling factors for each profile, which is the factor the pixel scale is multiplied +# by to determine the circle size. + +# The config entry below defines the default over sampling factor for each profile, where: + +# radial_factor_list: The factors that are multiplied by the pixel scale to determine the circle size that is used. +# sub_size_list: The over sampling factor that is used for each circle size. + +# For the default entries below, oversampling of degree 32 x 32 is used within a circle of radius 3.01 x pixel scale, +# 4 x 4 within a circle of radius 10.01 x pixel scale and 2 x 2 for all pixels outside of this radius. + +over_sampling: + radial_factor_list: + Chameleon: [3.01, 10.01] + ChameleonSph: [3.01, 10.01] + DevVaucouleurs: [3.01, 10.01] + DevVaucouleursSph: [3.01, 10.01] + dPIE: [3.01, 10.01] + dPIESph: [3.01, 10.01] + ExponentialRadialGradient: [3.01, 10.01] + ExponentialRadialGradientSph: [3.01, 10.01] + ElsonFreeFall: [3.01, 10.01] + ElsonFreeFallSph: [3.01, 10.01] + Exponential: [3.01, 10.01] + ExponentialCore: [3.01, 10.01] + ExponentialCoreSph: [3.01, 10.01] + ExponentialSph: [3.01, 10.01] + ExternalShear: [3.01, 10.01] + Gaussian: [3.01, 10.01] + GaussianSph: [3.01, 10.01] + GaussianGradient: [3.01, 10.01] + GaussianGradientSph: [3.01, 10.01] + gNFW: [3.01, 10.01] + gNFWMCRLudlow: [3.01, 10.01] + gNFWVirialMassConcSph: [3.01, 10.01] + gNFWSph: [3.01, 10.01] + Isothermal: [3.01, 10.01] + IsothermalCore: [3.01, 10.01] + IsothermalCoreSph: [3.01, 10.01] + IsothermalSph: [3.01, 10.01] + MassSheet: [3.01, 10.01] + Moffat: [3.01, 10.01] + MoffatSph: [3.01, 10.01] + PowerLawMultipole: [3.01, 10.01] + NFW: [3.01, 10.01] + NFWMCRDuffySph: [3.01, 10.01] + NFWMCRLudlow: [3.01, 10.01] + NFWMCRLudlowSph: [3.01, 10.01] + NFWMCRScatterLudlow: [3.01, 10.01] + NFWMCRScatterLudlowSph: [3.01, 10.01] + NFWVirialMassConcSph: [3.01, 10.01] + NFWSph: [3.01, 10.01] + NFWTruncatedMCRDuffySph: [3.01, 10.01] + NFWTruncatedMCRLudlowSph: [3.01, 10.01] + NFWTruncatedMCRScatterLudlowSph: [3.01, 10.01] + NFWTruncatedSph: [3.01, 10.01] + PointMass: [3.01, 10.01] + PowerLaw: [3.01, 10.01] + PowerLawBroken: [3.01, 10.01] + PowerLawBrokenSph: [3.01, 10.01] + PowerLawCore: [3.01, 10.01] + PowerLawCoreSph: [3.01, 10.01] + PowerLawSph: [3.01, 10.01] + Sersic: [3.01, 10.01] + SersicCore: [3.01, 10.01] + SersicCoreSph: [3.01, 10.01] + SersicRadialGradient: [3.01, 10.01] + SersicSph: [3.01, 10.01] + SersicRadialGradientSph: [3.01, 10.01] + ShapeletCartesianSph: [3.01, 10.01] + ShapeletCartesian: [3.01, 10.01] + ShapeletPolarSph: [3.01, 10.01] + ShapeletPolar: [3.01, 10.01] + ShapeletExponentialSph: [3.01, 10.01] + ShapeletExponential: [3.01, 10.01] + SMBH: [3.01, 10.01] + SMBHBinary: [3.01, 10.01] + EllProfile: [3.01, 10.01] + PlotExample: [3.01, 10.01] + sub_size_list: + Chameleon: [32, 4, 2] + ChameleonSph: [32, 4, 2] + DevVaucouleurs: [32, 4, 2] + DevVaucouleursSph: [32, 4, 2] + dPIE: [32, 4, 2] + dPIESph: [32, 4, 2] + ExponentialRadialGradient: [32, 4, 2] + ExponentialRadialGradientSph: [32, 4, 2] + ElsonFreeFall: [32, 4, 2] + ElsonFreeFallSph: [32, 4, 2] + Exponential: [32, 4, 2] + ExponentialCore: [32, 4, 2] + ExponentialCoreSph: [32, 4, 2] + ExponentialSph: [32, 4, 2] + ExternalShear: [32, 4, 2] + Gaussian: [32, 4, 2] + GaussianSph: [32, 4, 2] + GaussianGradient: [32, 4, 2] + GaussianGradientSph: [32, 4, 2] + gNFW: [32, 4, 2] + gNFWMCRLudlow: [32, 4, 2] + gNFWVirialMassConcSph: [32, 4, 2] + gNFWSph: [32, 4, 2] + Isothermal: [32, 4, 2] + IsothermalCore: [32, 4, 2] + IsothermalCoreSph: [32, 4, 2] + IsothermalSph: [32, 4, 2] + MassSheet: [32, 4, 2] + Moffat: [32, 4, 2] + MoffatSph: [32, 4, 2] + PowerLawMultipole: [32, 4, 2] + NFW: [32, 4, 2] + NFWMCRDuffySph: [32, 4, 2] + NFWMCRLudlow: [32, 4, 2] + NFWMCRLudlowSph: [32, 4, 2] + NFWMCRScatterLudlow: [32, 4, 2] + NFWMCRScatterLudlowSph: [32, 4, 2] + NFWVirialMassConcSph : [32, 4, 2] + NFWSph: [32, 4, 2] + NFWTruncatedMCRDuffySph: [32, 4, 2] + NFWTruncatedMCRLudlowSph: [32, 4, 2] + NFWTruncatedMCRScatterLudlowSph: [32, 4, 2] + NFWTruncatedSph: [32, 4, 2] + PointMass: [32, 4, 2] + PowerLaw: [32, 4, 2] + PowerLawBroken: [32, 4, 2] + PowerLawBrokenSph: [32, 4, 2] + PowerLawCore: [32, 4, 2] + PowerLawCoreSph: [32, 4, 2] + PowerLawSph: [32, 4, 2] + Sersic: [32, 4, 2] + SersicCore: [32, 4, 2] + SersicCoreSph: [32, 4, 2] + SersicRadialGradient: [32, 4, 2] + SersicSph: [32, 4, 2] + SersicRadialGradientSph: [32, 4, 2] + ShapeletCartesianSph: [32, 4, 2] + ShapeletCartesian: [32, 4, 2] + ShapeletPolarSph: [32, 4, 2] + ShapeletPolar: [32, 4, 2] + ShapeletExponentialSph: [32, 4, 2] + ShapeletExponential: [32, 4, 2] + SMBH: [32, 4, 2] + SMBHBinary: [32, 4, 2] + EllProfile: [32, 4, 2] PlotExample: [32, 4, 2] \ No newline at end of file diff --git a/autogalaxy/config/notation.yaml b/autogalaxy/config/notation.yaml index ba30f9bfd..055dd634b 100644 --- a/autogalaxy/config/notation.yaml +++ b/autogalaxy/config/notation.yaml @@ -1,143 +1,143 @@ -label: - label: - sigma: \sigma - alpha: \alpha - angle_binary: \theta - beta: \beta - break_radius: \theta_{\rm B} - centre_0: y - centre_1: x - coefficient: \lambda - c_2: c_{\rm 2} - concentration: conc - core_radius: C_{\rm r} - core_radius_0: C_{rm r0} - core_radius_1: C_{\rm r1} - effective_radius: R_{\rm eff} - einstein_radius: \theta_{\rm Ein} - ell_comps_0: \epsilon_{\rm 1} - ell_comps_1: \epsilon_{\rm 2} - multipole_comps_0: M_{\rm 1} - multipole_comps_1: M_{\rm 2} - flux: F - gamma: \gamma - gamma_1: \gamma - gamma_2: \gamma - inner_coefficient: \lambda_{\rm 1} - inner_slope: t_{\rm 1} - intensity: I_{\rm b} - kappa: \kappa - kappa_s: \kappa_{\rm s} - log10m_vir: log_{\rm 10}(m_{vir}) - m: m - mass: M - mass_at_200: M_{\rm 200} - mass_ratio: M_{\rm ratio} - mass_to_light_gradient: \Gamma - mass_to_light_ratio: \Psi - mass_to_light_ratio_base: \Psi_{\rm base} - mass_to_light_radius: R_{\rm ref} - noise_factor: \omega_{\rm 1} - noise_power: \omega{\rm 2} - noise_scale: \sigma_{\rm 1} - normalization_scale: n - outer_coefficient: \lambda_{\rm 2} - outer_slope: t_{\rm 2} - overdens: \Delta_{\rm vir} - pixels: N_{\rm pix} - radius_break: R_{\rm b} - redshift: z - redshift_object: z_{\rm obj} - redshift_source: z_{\rm src} - scale_radius: R_{\rm s} - scatter: \sigma - separation: s - sersic_index: n - shape_0: y_{\rm pix} - shape_1: x_{\rm pix} - signal_scale: V - sky_scale: \sigma_{\rm 0} - slope: \gamma - truncation_radius: R_{\rm t} - virial_mass: M_{\rm vir} - virial_overdens: \Delta_{\rm vir} - weight_floor: W_{\rm f} - weight_power: W_{\rm p} - zeroth_coefficient: \lambda_{\rm 0} - zeroth_signal_scale: V - superscript: - ExternalShear: ext - Mesh: mesh - Point: point - SMBH: smbh - Redshift: z - Regularization: reg - InputDeflections: defl -label_format: - format: - sigma: '{:.4f}' - alpha: '{:.4f}' - angle_binary: '{:.4f}' - angular_diameter_distance_to_earth: '{:.4f}' - beta: '{:.4f}' - c_2: '{:.4f}' - centre_0: '{:.4f}' - centre_1: '{:.4f}' - coefficient: '{:.4f}' - concentration: '{:.4f}' - core_radius: '{:.4f}' - core_radius_0: '{:.4f}' - core_radius_1: '{:.4f}' - effective_radius: '{:.4f}' - einstein_mass: '{:.4e}' - einstein_radius: '{:.4f}' - ell_comps_0: '{:.4f}' - ell_comps_1: '{:.4f}' - multipole_comps_0: '{:.4f}' - multipole_comps_1: '{:.4f}' - flux: '{:.4e}' - gamma: '{:.4f}' - inner_coefficient: '{:.4f}' - inner_slope: '{:.4f}' - intensity: '{:.4f}' - kappa: '{:.4f}' - kappa_s: '{:.4f}' - kpc_per_arcsec: '{:.4f}' - log10m_vir: '{:.4f}' - luminosity: '{:.4e}' - m: '{:.1f}' - mass: '{:.4e}' - mass_at_200: '{:.4e}' - mass_at_truncation_radius: '{:.4e}' - mass_ratio: '{:.4f}' - mass_to_light_gradient: '{:.4f}' - mass_to_light_ratio: '{:.4f}' - n_x: '{:.1d}' - n_y: '{:.1d}' - noise_factor: '{:.3f}' - noise_power: '{:.3f}' - noise_scale: '{:.3f}' - normalization_scale: '{:.4f}' - outer_coefficient: '{:.4f}' - outer_slope: '{:.4f}' - overdens: '{:.4f}' - pixels: '{:.4f}' - radius: '{:.4f}' - radius_break: '{:.4f}' - redshift: '{:.4f}' - redshift_object: '{:.4f}' - redshift_source: '{:.4f}' - rho: '{:.4f}' - scale_radius: '{:.4f}' - separation: '{:.4f}' - sersic_index: '{:.4f}' - shape_0: '{:.4f}' - shape_1: '{:.4f}' - signal_scale: '{:.4f}' - sky_scale: '{:.4f}' - slope: '{:.4f}' - truncation_radius: '{:.4f}' - virial_mass: '{:.4f}' - virial_overdens: '{:.4f}' - weight_floor: '{:.4f}' - weight_power: '{:.4f}' +label: + label: + sigma: \sigma + alpha: \alpha + angle_binary: \theta + beta: \beta + break_radius: \theta_{\rm B} + centre_0: y + centre_1: x + coefficient: \lambda + c_2: c_{\rm 2} + concentration: conc + core_radius: C_{\rm r} + core_radius_0: C_{rm r0} + core_radius_1: C_{\rm r1} + effective_radius: R_{\rm eff} + einstein_radius: \theta_{\rm Ein} + ell_comps_0: \epsilon_{\rm 1} + ell_comps_1: \epsilon_{\rm 2} + multipole_comps_0: M_{\rm 1} + multipole_comps_1: M_{\rm 2} + flux: F + gamma: \gamma + gamma_1: \gamma + gamma_2: \gamma + inner_coefficient: \lambda_{\rm 1} + inner_slope: t_{\rm 1} + intensity: I_{\rm b} + kappa: \kappa + kappa_s: \kappa_{\rm s} + log10m_vir: log_{\rm 10}(m_{vir}) + m: m + mass: M + mass_at_200: M_{\rm 200} + mass_ratio: M_{\rm ratio} + mass_to_light_gradient: \Gamma + mass_to_light_ratio: \Psi + mass_to_light_ratio_base: \Psi_{\rm base} + mass_to_light_radius: R_{\rm ref} + noise_factor: \omega_{\rm 1} + noise_power: \omega{\rm 2} + noise_scale: \sigma_{\rm 1} + normalization_scale: n + outer_coefficient: \lambda_{\rm 2} + outer_slope: t_{\rm 2} + overdens: \Delta_{\rm vir} + pixels: N_{\rm pix} + radius_break: R_{\rm b} + redshift: z + redshift_object: z_{\rm obj} + redshift_source: z_{\rm src} + scale_radius: R_{\rm s} + scatter: \sigma + separation: s + sersic_index: n + shape_0: y_{\rm pix} + shape_1: x_{\rm pix} + signal_scale: V + sky_scale: \sigma_{\rm 0} + slope: \gamma + truncation_radius: R_{\rm t} + virial_mass: M_{\rm vir} + virial_overdens: \Delta_{\rm vir} + weight_floor: W_{\rm f} + weight_power: W_{\rm p} + zeroth_coefficient: \lambda_{\rm 0} + zeroth_signal_scale: V + superscript: + ExternalShear: ext + Mesh: mesh + Point: point + SMBH: smbh + Redshift: z + Regularization: reg + InputDeflections: defl +label_format: + format: + sigma: '{:.4f}' + alpha: '{:.4f}' + angle_binary: '{:.4f}' + angular_diameter_distance_to_earth: '{:.4f}' + beta: '{:.4f}' + c_2: '{:.4f}' + centre_0: '{:.4f}' + centre_1: '{:.4f}' + coefficient: '{:.4f}' + concentration: '{:.4f}' + core_radius: '{:.4f}' + core_radius_0: '{:.4f}' + core_radius_1: '{:.4f}' + effective_radius: '{:.4f}' + einstein_mass: '{:.4e}' + einstein_radius: '{:.4f}' + ell_comps_0: '{:.4f}' + ell_comps_1: '{:.4f}' + multipole_comps_0: '{:.4f}' + multipole_comps_1: '{:.4f}' + flux: '{:.4e}' + gamma: '{:.4f}' + inner_coefficient: '{:.4f}' + inner_slope: '{:.4f}' + intensity: '{:.4f}' + kappa: '{:.4f}' + kappa_s: '{:.4f}' + kpc_per_arcsec: '{:.4f}' + log10m_vir: '{:.4f}' + luminosity: '{:.4e}' + m: '{:.1f}' + mass: '{:.4e}' + mass_at_200: '{:.4e}' + mass_at_truncation_radius: '{:.4e}' + mass_ratio: '{:.4f}' + mass_to_light_gradient: '{:.4f}' + mass_to_light_ratio: '{:.4f}' + n_x: '{:.1d}' + n_y: '{:.1d}' + noise_factor: '{:.3f}' + noise_power: '{:.3f}' + noise_scale: '{:.3f}' + normalization_scale: '{:.4f}' + outer_coefficient: '{:.4f}' + outer_slope: '{:.4f}' + overdens: '{:.4f}' + pixels: '{:.4f}' + radius: '{:.4f}' + radius_break: '{:.4f}' + redshift: '{:.4f}' + redshift_object: '{:.4f}' + redshift_source: '{:.4f}' + rho: '{:.4f}' + scale_radius: '{:.4f}' + separation: '{:.4f}' + sersic_index: '{:.4f}' + shape_0: '{:.4f}' + shape_1: '{:.4f}' + signal_scale: '{:.4f}' + sky_scale: '{:.4f}' + slope: '{:.4f}' + truncation_radius: '{:.4f}' + virial_mass: '{:.4f}' + virial_overdens: '{:.4f}' + weight_floor: '{:.4f}' + weight_power: '{:.4f}' diff --git a/autogalaxy/config/priors/basis.yaml b/autogalaxy/config/priors/basis.yaml index d4b4187f1..a208ccb42 100644 --- a/autogalaxy/config/priors/basis.yaml +++ b/autogalaxy/config/priors/basis.yaml @@ -1 +1 @@ -Basis: {} +Basis: {} diff --git a/autogalaxy/config/priors/cosmology.yaml b/autogalaxy/config/priors/cosmology.yaml index 1efc5d637..656941bba 100644 --- a/autogalaxy/config/priors/cosmology.yaml +++ b/autogalaxy/config/priors/cosmology.yaml @@ -1,63 +1,63 @@ -model.LambdaCDMWrap: - H0: - type: Constant - value: 67.66 - Om0: - type: Constant - value: 0.30966 - Ode0: - type: Constant - value: 0.69034 - Tcmb0: - type: Constant - value: 2.7255 - Neff: - type: Constant - value: 3.046 - m_nu: - type: Constant - value: 0.06 - Ob0: - type: Constant - value: 0.04897 -model.FlatLambdaCDMWrap: - H0: - type: Constant - value: 67.66 - Om0: - type: Constant - value: 0.30966 - Tcmb0: - type: Constant - value: 2.7255 - Neff: - type: Constant - value: 3.046 - m_nu: - type: Constant - value: 0.06 - Ob0: - type: Constant - value: 0.04897 -model.FlatwCDMWrap: - H0: - type: Constant - value: 67.66 - Om0: - type: Constant - value: 0.30966 - w0: - type: Constant - value: -1.0 - Tcmb0: - type: Constant - value: 2.7255 - Neff: - type: Constant - value: 3.046 - m_nu: - type: Constant - value: 0.06 - Ob0: - type: Constant +model.LambdaCDMWrap: + H0: + type: Constant + value: 67.66 + Om0: + type: Constant + value: 0.30966 + Ode0: + type: Constant + value: 0.69034 + Tcmb0: + type: Constant + value: 2.7255 + Neff: + type: Constant + value: 3.046 + m_nu: + type: Constant + value: 0.06 + Ob0: + type: Constant + value: 0.04897 +model.FlatLambdaCDMWrap: + H0: + type: Constant + value: 67.66 + Om0: + type: Constant + value: 0.30966 + Tcmb0: + type: Constant + value: 2.7255 + Neff: + type: Constant + value: 3.046 + m_nu: + type: Constant + value: 0.06 + Ob0: + type: Constant + value: 0.04897 +model.FlatwCDMWrap: + H0: + type: Constant + value: 67.66 + Om0: + type: Constant + value: 0.30966 + w0: + type: Constant + value: -1.0 + Tcmb0: + type: Constant + value: 2.7255 + Neff: + type: Constant + value: 3.046 + m_nu: + type: Constant + value: 0.06 + Ob0: + type: Constant value: 0.04897 \ No newline at end of file diff --git a/autogalaxy/config/priors/light/linear/chameleon.yaml b/autogalaxy/config/priors/light/linear/chameleon.yaml index 212701531..c6fc9d5ef 100644 --- a/autogalaxy/config/priors/light/linear/chameleon.yaml +++ b/autogalaxy/config/priors/light/linear/chameleon.yaml @@ -1,114 +1,114 @@ -Chameleon: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - core_radius_0: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - core_radius_1: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 -ChameleonSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - core_radius_0: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - core_radius_1: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf +Chameleon: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + core_radius_0: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + core_radius_1: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 +ChameleonSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + core_radius_0: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + core_radius_1: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/linear/dev_vaucouleurs.yaml b/autogalaxy/config/priors/light/linear/dev_vaucouleurs.yaml index 1c4bd5220..e6b47b4fb 100644 --- a/autogalaxy/config/priors/light/linear/dev_vaucouleurs.yaml +++ b/autogalaxy/config/priors/light/linear/dev_vaucouleurs.yaml @@ -1,94 +1,94 @@ -DevVaucouleurs: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 -DevVaucouleursSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf +DevVaucouleurs: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 +DevVaucouleursSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/linear/eff.yaml b/autogalaxy/config/priors/light/linear/eff.yaml index 548249856..7a2847408 100644 --- a/autogalaxy/config/priors/light/linear/eff.yaml +++ b/autogalaxy/config/priors/light/linear/eff.yaml @@ -1,114 +1,114 @@ -ElsonFreeFall: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - eta: - type: Uniform - lower_limit: 0.5 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.0 - upper: 5.0 -ElsonFreeFallSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - eta: - type: Uniform - lower_limit: 0.5 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.0 - upper: 5.0 +ElsonFreeFall: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + eta: + type: Uniform + lower_limit: 0.5 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.0 + upper: 5.0 +ElsonFreeFallSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + eta: + type: Uniform + lower_limit: 0.5 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.0 + upper: 5.0 diff --git a/autogalaxy/config/priors/light/linear/exponential.yaml b/autogalaxy/config/priors/light/linear/exponential.yaml index 5bc79c66b..1c840c800 100644 --- a/autogalaxy/config/priors/light/linear/exponential.yaml +++ b/autogalaxy/config/priors/light/linear/exponential.yaml @@ -1,94 +1,94 @@ -Exponential: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 -ExponentialSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf +Exponential: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 +ExponentialSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/linear/exponential_core.yaml b/autogalaxy/config/priors/light/linear/exponential_core.yaml index 041d297d3..f0f0845bb 100644 --- a/autogalaxy/config/priors/light/linear/exponential_core.yaml +++ b/autogalaxy/config/priors/light/linear/exponential_core.yaml @@ -1,112 +1,112 @@ -ExponentialCore: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - alpha: - type: Constant - value: 3.0 - gamma: - type: Constant - value: 0.25 - radius_break: - type: Constant - value: 0.025 -ExponentialCoreSph: - alpha: - type: Constant - value: 3.0 - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - gamma: - type: Constant - value: 0.25 - radius_break: - type: Constant - value: 0.025 +ExponentialCore: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + alpha: + type: Constant + value: 3.0 + gamma: + type: Constant + value: 0.25 + radius_break: + type: Constant + value: 0.025 +ExponentialCoreSph: + alpha: + type: Constant + value: 3.0 + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + gamma: + type: Constant + value: 0.25 + radius_break: + type: Constant + value: 0.025 diff --git a/autogalaxy/config/priors/light/linear/gaussian.yaml b/autogalaxy/config/priors/light/linear/gaussian.yaml index 6ded43381..ffe10a146 100644 --- a/autogalaxy/config/priors/light/linear/gaussian.yaml +++ b/autogalaxy/config/priors/light/linear/gaussian.yaml @@ -1,94 +1,94 @@ -Gaussian: - sigma: - type: Uniform - lower_limit: 0.0 - upper_limit: 25.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 -GaussianSph: - sigma: - type: Uniform - lower_limit: 0.0 - upper_limit: 25.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf +Gaussian: + sigma: + type: Uniform + lower_limit: 0.0 + upper_limit: 25.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 +GaussianSph: + sigma: + type: Uniform + lower_limit: 0.0 + upper_limit: 25.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf diff --git a/autogalaxy/config/priors/light/linear/moffat.yaml b/autogalaxy/config/priors/light/linear/moffat.yaml index a8a484a54..35f6e0740 100644 --- a/autogalaxy/config/priors/light/linear/moffat.yaml +++ b/autogalaxy/config/priors/light/linear/moffat.yaml @@ -1,114 +1,114 @@ -Moffat: - alpha: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - beta: - type: Uniform - lower_limit: 1.0 - upper_limit: 5.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 -MoffatSph: - alpha: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - beta: - type: Uniform - lower_limit: 1.0 - upper_limit: 5.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf +Moffat: + alpha: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + beta: + type: Uniform + lower_limit: 1.0 + upper_limit: 5.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 +MoffatSph: + alpha: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + beta: + type: Uniform + lower_limit: 1.0 + upper_limit: 5.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf diff --git a/autogalaxy/config/priors/light/linear/sersic.yaml b/autogalaxy/config/priors/light/linear/sersic.yaml index 277bad262..4ad9e921e 100644 --- a/autogalaxy/config/priors/light/linear/sersic.yaml +++ b/autogalaxy/config/priors/light/linear/sersic.yaml @@ -1,114 +1,114 @@ -Sersic: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 -SersicSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 +Sersic: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 +SersicSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 diff --git a/autogalaxy/config/priors/light/linear/sersic_core.yaml b/autogalaxy/config/priors/light/linear/sersic_core.yaml index 0b36998e7..7d3f4cd84 100644 --- a/autogalaxy/config/priors/light/linear/sersic_core.yaml +++ b/autogalaxy/config/priors/light/linear/sersic_core.yaml @@ -1,132 +1,132 @@ -SersicCore: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 - alpha: - type: Constant - value: 3.0 - gamma: - type: Constant - value: 0.25 - radius_break: - type: Constant - value: 0.025 -SersicCoreSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 - alpha: - type: Constant - value: 3.0 - gamma: - type: Constant - value: 0.25 - radius_break: - type: Constant +SersicCore: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 + alpha: + type: Constant + value: 3.0 + gamma: + type: Constant + value: 0.25 + radius_break: + type: Constant + value: 0.025 +SersicCoreSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 + alpha: + type: Constant + value: 3.0 + gamma: + type: Constant + value: 0.25 + radius_break: + type: Constant value: 0.025 \ No newline at end of file diff --git a/autogalaxy/config/priors/light/linear_operated/gaussian.yaml b/autogalaxy/config/priors/light/linear_operated/gaussian.yaml index 3d6a67991..37db03afa 100644 --- a/autogalaxy/config/priors/light/linear_operated/gaussian.yaml +++ b/autogalaxy/config/priors/light/linear_operated/gaussian.yaml @@ -1,69 +1,69 @@ -Gaussian: - sigma: - type: Uniform - lower_limit: 0.0 - upper_limit: 5.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +Gaussian: + sigma: + type: Uniform + lower_limit: 0.0 + upper_limit: 5.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/linear_operated/moffat.yaml b/autogalaxy/config/priors/light/linear_operated/moffat.yaml index 8d3a97a23..526ea7765 100644 --- a/autogalaxy/config/priors/light/linear_operated/moffat.yaml +++ b/autogalaxy/config/priors/light/linear_operated/moffat.yaml @@ -1,69 +1,69 @@ -Moffat: - alpha: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - beta: - type: Uniform - lower_limit: 1.0 - upper_limit: 5.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 +Moffat: + alpha: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + beta: + type: Uniform + lower_limit: 1.0 + upper_limit: 5.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 diff --git a/autogalaxy/config/priors/light/operated/gaussian.yaml b/autogalaxy/config/priors/light/operated/gaussian.yaml index 3d6a67991..37db03afa 100644 --- a/autogalaxy/config/priors/light/operated/gaussian.yaml +++ b/autogalaxy/config/priors/light/operated/gaussian.yaml @@ -1,69 +1,69 @@ -Gaussian: - sigma: - type: Uniform - lower_limit: 0.0 - upper_limit: 5.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +Gaussian: + sigma: + type: Uniform + lower_limit: 0.0 + upper_limit: 5.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/operated/moffat.yaml b/autogalaxy/config/priors/light/operated/moffat.yaml index 40addc1d9..34d6185fc 100644 --- a/autogalaxy/config/priors/light/operated/moffat.yaml +++ b/autogalaxy/config/priors/light/operated/moffat.yaml @@ -1,79 +1,79 @@ -Moffat: - alpha: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - beta: - type: Uniform - lower_limit: 1.0 - upper_limit: 5.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +Moffat: + alpha: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + beta: + type: Uniform + lower_limit: 1.0 + upper_limit: 5.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/operated/sersic.yaml b/autogalaxy/config/priors/light/operated/sersic.yaml index 4db2ca6b1..d53a170e4 100644 --- a/autogalaxy/config/priors/light/operated/sersic.yaml +++ b/autogalaxy/config/priors/light/operated/sersic.yaml @@ -1,79 +1,79 @@ -ersic: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 +ersic: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 diff --git a/autogalaxy/config/priors/light/standard/chameleon.yaml b/autogalaxy/config/priors/light/standard/chameleon.yaml index 971679724..d5d25af83 100644 --- a/autogalaxy/config/priors/light/standard/chameleon.yaml +++ b/autogalaxy/config/priors/light/standard/chameleon.yaml @@ -1,134 +1,134 @@ -Chameleon: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - core_radius_0: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - core_radius_1: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf -ChameleonSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - core_radius_0: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - core_radius_1: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +Chameleon: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + core_radius_0: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + core_radius_1: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf +ChameleonSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + core_radius_0: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + core_radius_1: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/standard/dev_vaucouleurs.yaml b/autogalaxy/config/priors/light/standard/dev_vaucouleurs.yaml index 02b23e42f..4a8b8e391 100644 --- a/autogalaxy/config/priors/light/standard/dev_vaucouleurs.yaml +++ b/autogalaxy/config/priors/light/standard/dev_vaucouleurs.yaml @@ -1,114 +1,114 @@ -DevVaucouleurs: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf -DevVaucouleursSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +DevVaucouleurs: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf +DevVaucouleursSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/standard/eff.yaml b/autogalaxy/config/priors/light/standard/eff.yaml index 3c36e9b99..9e0819937 100644 --- a/autogalaxy/config/priors/light/standard/eff.yaml +++ b/autogalaxy/config/priors/light/standard/eff.yaml @@ -1,134 +1,134 @@ -ElsonFreeFall: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - eta: - type: Uniform - lower_limit: 0.5 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.0 - upper: 5.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf -ElsonFreeFallSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - eta: - type: Uniform - lower_limit: 0.5 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.0 - upper: 5.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +ElsonFreeFall: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + eta: + type: Uniform + lower_limit: 0.5 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.0 + upper: 5.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf +ElsonFreeFallSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + eta: + type: Uniform + lower_limit: 0.5 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.0 + upper: 5.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/standard/exponential.yaml b/autogalaxy/config/priors/light/standard/exponential.yaml index c34c6e927..820fec183 100644 --- a/autogalaxy/config/priors/light/standard/exponential.yaml +++ b/autogalaxy/config/priors/light/standard/exponential.yaml @@ -1,114 +1,114 @@ -Exponential: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf -ExponentialSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +Exponential: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf +ExponentialSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/standard/exponential_core.yaml b/autogalaxy/config/priors/light/standard/exponential_core.yaml index df091ff31..8d4597f47 100644 --- a/autogalaxy/config/priors/light/standard/exponential_core.yaml +++ b/autogalaxy/config/priors/light/standard/exponential_core.yaml @@ -1,132 +1,132 @@ -ExponentialCore: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-05 - upper_limit: 1000.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - alpha: - type: Constant - value: 3.0 - gamma: - type: Constant - value: 0.25 - radius_break: - type: Constant - value: 0.025 -ExponentialCoreSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-05 - upper_limit: 1000.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - alpha: - type: Constant - value: 3.0 - gamma: - type: Constant - value: 0.25 - radius_break: - type: Constant - value: 0.025 +ExponentialCore: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-05 + upper_limit: 1000.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + alpha: + type: Constant + value: 3.0 + gamma: + type: Constant + value: 0.25 + radius_break: + type: Constant + value: 0.025 +ExponentialCoreSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-05 + upper_limit: 1000.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + alpha: + type: Constant + value: 3.0 + gamma: + type: Constant + value: 0.25 + radius_break: + type: Constant + value: 0.025 diff --git a/autogalaxy/config/priors/light/standard/gaussian.yaml b/autogalaxy/config/priors/light/standard/gaussian.yaml index ac712a116..09cdaf30e 100644 --- a/autogalaxy/config/priors/light/standard/gaussian.yaml +++ b/autogalaxy/config/priors/light/standard/gaussian.yaml @@ -1,114 +1,114 @@ -Gaussian: - sigma: - type: Uniform - lower_limit: 0.0 - upper_limit: 25.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf -GaussianSph: - sigma: - type: Uniform - lower_limit: 0.0 - upper_limit: 25.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +Gaussian: + sigma: + type: Uniform + lower_limit: 0.0 + upper_limit: 25.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf +GaussianSph: + sigma: + type: Uniform + lower_limit: 0.0 + upper_limit: 25.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/standard/moffat.yaml b/autogalaxy/config/priors/light/standard/moffat.yaml index 4894fb419..77dfa3353 100644 --- a/autogalaxy/config/priors/light/standard/moffat.yaml +++ b/autogalaxy/config/priors/light/standard/moffat.yaml @@ -1,134 +1,134 @@ -Moffat: - alpha: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - beta: - type: Uniform - lower_limit: 1.0 - upper_limit: 5.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf -MoffatSph: - alpha: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - beta: - type: Uniform - lower_limit: 1.0 - upper_limit: 5.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +Moffat: + alpha: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + beta: + type: Uniform + lower_limit: 1.0 + upper_limit: 5.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf +MoffatSph: + alpha: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + beta: + type: Uniform + lower_limit: 1.0 + upper_limit: 5.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/light/standard/sersic.yaml b/autogalaxy/config/priors/light/standard/sersic.yaml index 5593b9562..660c3ebfd 100644 --- a/autogalaxy/config/priors/light/standard/sersic.yaml +++ b/autogalaxy/config/priors/light/standard/sersic.yaml @@ -1,134 +1,134 @@ -Sersic: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 -SersicSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 +Sersic: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 +SersicSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 diff --git a/autogalaxy/config/priors/light/standard/sersic_core.yaml b/autogalaxy/config/priors/light/standard/sersic_core.yaml index 19a894c9c..ad0b2f31c 100644 --- a/autogalaxy/config/priors/light/standard/sersic_core.yaml +++ b/autogalaxy/config/priors/light/standard/sersic_core.yaml @@ -1,152 +1,152 @@ -SersicCore: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-05 - upper_limit: 1000.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 - alpha: - type: Constant - value: 3.0 - gamma: - type: Constant - value: 0.25 - radius_break: - type: Constant - value: 0.025 -SersicCoreSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-05 - upper_limit: 1000.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 - alpha: - type: Constant - value: 3.0 - gamma: - type: Constant - value: 0.25 - radius_break: - type: Constant - value: 0.025 +SersicCore: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-05 + upper_limit: 1000.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 + alpha: + type: Constant + value: 3.0 + gamma: + type: Constant + value: 0.25 + radius_break: + type: Constant + value: 0.025 +SersicCoreSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-05 + upper_limit: 1000.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 + alpha: + type: Constant + value: 3.0 + gamma: + type: Constant + value: 0.25 + radius_break: + type: Constant + value: 0.025 diff --git a/autogalaxy/config/priors/mass/dark/gnfw.yaml b/autogalaxy/config/priors/mass/dark/gnfw.yaml index e7438167a..de3949a02 100644 --- a/autogalaxy/config/priors/mass/dark/gnfw.yaml +++ b/autogalaxy/config/priors/mass/dark/gnfw.yaml @@ -1,134 +1,134 @@ -gNFW: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - inner_slope: - type: Uniform - lower_limit: 0.0 - upper_limit: 2.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: -1.0 - upper: 3.0 - kappa_s: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - scale_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf -gNFWSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - inner_slope: - type: Uniform - lower_limit: 0.0 - upper_limit: 2.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: -1.0 - upper: 3.0 - kappa_s: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - scale_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf +gNFW: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + inner_slope: + type: Uniform + lower_limit: 0.0 + upper_limit: 2.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: -1.0 + upper: 3.0 + kappa_s: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + scale_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf +gNFWSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + inner_slope: + type: Uniform + lower_limit: 0.0 + upper_limit: 2.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: -1.0 + upper: 3.0 + kappa_s: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + scale_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/dark/gnfw_mcr.yaml b/autogalaxy/config/priors/mass/dark/gnfw_mcr.yaml index 4e2a7ad3a..976821ec4 100644 --- a/autogalaxy/config/priors/mass/dark/gnfw_mcr.yaml +++ b/autogalaxy/config/priors/mass/dark/gnfw_mcr.yaml @@ -1,89 +1,89 @@ -gNFWMCRLudlow: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - inner_slope: - type: Uniform - lower_limit: 0.0 - upper_limit: 2.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: -1.0 - upper: 3.0 - mass_at_200: - type: LogUniform - lower_limit: 100000000.0 - upper_limit: 1000000000000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +gNFWMCRLudlow: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + inner_slope: + type: Uniform + lower_limit: 0.0 + upper_limit: 2.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: -1.0 + upper: 3.0 + mass_at_200: + type: LogUniform + lower_limit: 100000000.0 + upper_limit: 1000000000000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/dark/gnfw_virial_mass_conc.yaml b/autogalaxy/config/priors/mass/dark/gnfw_virial_mass_conc.yaml index f3f8ba6bf..20956f214 100644 --- a/autogalaxy/config/priors/mass/dark/gnfw_virial_mass_conc.yaml +++ b/autogalaxy/config/priors/mass/dark/gnfw_virial_mass_conc.yaml @@ -1,85 +1,85 @@ -gNFWVirialMassConcSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - log10m_vir: - type: Uniform - lower_limit: 7.0 - upper_limit: 12.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - c_2: - type: LogUniform - lower_limit: 1.0 - upper_limit: 100.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - overdens: - type: Uniform - lower_limit: 100.0 - upper_limit: 250.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - inner_slope: - type: Uniform - lower_limit: 0.0 - upper_limit: 2.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: -1.0 +gNFWVirialMassConcSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + log10m_vir: + type: Uniform + lower_limit: 7.0 + upper_limit: 12.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + c_2: + type: LogUniform + lower_limit: 1.0 + upper_limit: 100.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + overdens: + type: Uniform + lower_limit: 100.0 + upper_limit: 250.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + inner_slope: + type: Uniform + lower_limit: 0.0 + upper_limit: 2.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: -1.0 upper: 3.0 \ No newline at end of file diff --git a/autogalaxy/config/priors/mass/dark/nfw.yaml b/autogalaxy/config/priors/mass/dark/nfw.yaml index 0345d21ab..a6790a099 100644 --- a/autogalaxy/config/priors/mass/dark/nfw.yaml +++ b/autogalaxy/config/priors/mass/dark/nfw.yaml @@ -1,114 +1,114 @@ -NFW: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - kappa_s: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - scale_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf -NFWSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - kappa_s: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - scale_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf +NFW: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + kappa_s: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + scale_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf +NFWSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + kappa_s: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + scale_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/dark/nfw_mcr.yaml b/autogalaxy/config/priors/mass/dark/nfw_mcr.yaml index 305a2285f..bb45526b1 100644 --- a/autogalaxy/config/priors/mass/dark/nfw_mcr.yaml +++ b/autogalaxy/config/priors/mass/dark/nfw_mcr.yaml @@ -1,189 +1,189 @@ -NFWMCRDuffySph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - mass_at_200: - type: LogUniform - lower_limit: 100000000.0 - upper_limit: 1000000000000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf -NFWMCRLudlow: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - mass_at_200: - type: LogUniform - lower_limit: 100000000.0 - upper_limit: 1000000000000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf -NFWMCRLudlowSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - mass_at_200: - type: LogUniform - lower_limit: 100000000.0 - upper_limit: 1000000000000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +NFWMCRDuffySph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + mass_at_200: + type: LogUniform + lower_limit: 100000000.0 + upper_limit: 1000000000000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf +NFWMCRLudlow: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + mass_at_200: + type: LogUniform + lower_limit: 100000000.0 + upper_limit: 1000000000000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf +NFWMCRLudlowSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + mass_at_200: + type: LogUniform + lower_limit: 100000000.0 + upper_limit: 1000000000000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/dark/nfw_mcr_scatter.yaml b/autogalaxy/config/priors/mass/dark/nfw_mcr_scatter.yaml index 660f0802f..b46e2c8f0 100644 --- a/autogalaxy/config/priors/mass/dark/nfw_mcr_scatter.yaml +++ b/autogalaxy/config/priors/mass/dark/nfw_mcr_scatter.yaml @@ -1,67 +1,67 @@ -NFWMCRScatterLudlowSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - mass_at_200: - type: LogUniform - lower_limit: 100000000.0 - upper_limit: 1000000000000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - scatter: - type: Gaussian - mean: 0.0 - sigma: 3.0 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 1.0 - gaussian_limits: - lower: -inf - upper: inf +NFWMCRScatterLudlowSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + mass_at_200: + type: LogUniform + lower_limit: 100000000.0 + upper_limit: 1000000000000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + scatter: + type: Gaussian + mean: 0.0 + sigma: 3.0 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 1.0 + gaussian_limits: + lower: -inf + upper: inf diff --git a/autogalaxy/config/priors/mass/dark/nfw_truncated.yaml b/autogalaxy/config/priors/mass/dark/nfw_truncated.yaml index c6fab741c..95368e812 100644 --- a/autogalaxy/config/priors/mass/dark/nfw_truncated.yaml +++ b/autogalaxy/config/priors/mass/dark/nfw_truncated.yaml @@ -1,55 +1,55 @@ -NFWTruncatedSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - kappa_s: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - scale_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - truncation_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf +NFWTruncatedSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + kappa_s: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + scale_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + truncation_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/dark/nfw_truncated_mcr.yaml b/autogalaxy/config/priors/mass/dark/nfw_truncated_mcr.yaml index 30829067b..825f83cd0 100644 --- a/autogalaxy/config/priors/mass/dark/nfw_truncated_mcr.yaml +++ b/autogalaxy/config/priors/mass/dark/nfw_truncated_mcr.yaml @@ -1,177 +1,177 @@ -NFWTruncatedMCRDuffySph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - mass_at_200: - type: LogUniform - lower_limit: 100000000.0 - upper_limit: 1000000000000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf -NFWTruncatedMCRLudlowSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - mass_at_200: - type: LogUniform - lower_limit: 100000000.0 - upper_limit: 1000000000000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf -NFWTruncatedMCRScatterLudlowSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - mass_at_200: - type: LogUniform - lower_limit: 100000000.0 - upper_limit: 1000000000000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - scatter: - type: Gaussian - mean: 0.0 - sigma: 3.0 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 1.0 - gaussian_limits: - lower: -inf - upper: inf +NFWTruncatedMCRDuffySph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + mass_at_200: + type: LogUniform + lower_limit: 100000000.0 + upper_limit: 1000000000000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf +NFWTruncatedMCRLudlowSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + mass_at_200: + type: LogUniform + lower_limit: 100000000.0 + upper_limit: 1000000000000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf +NFWTruncatedMCRScatterLudlowSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + mass_at_200: + type: LogUniform + lower_limit: 100000000.0 + upper_limit: 1000000000000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + scatter: + type: Gaussian + mean: 0.0 + sigma: 3.0 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 1.0 + gaussian_limits: + lower: -inf + upper: inf diff --git a/autogalaxy/config/priors/mass/dark/nfw_virial_mass_conc.yaml b/autogalaxy/config/priors/mass/dark/nfw_virial_mass_conc.yaml index cfc064a4f..5dfc209ac 100644 --- a/autogalaxy/config/priors/mass/dark/nfw_virial_mass_conc.yaml +++ b/autogalaxy/config/priors/mass/dark/nfw_virial_mass_conc.yaml @@ -1,75 +1,75 @@ -NFWVirialMassConcSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - virial_mass: - type: LogUniform - lower_limit: 100000000.0 - upper_limit: 1000000000000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - concentration: - type: Uniform - lower_limit: 0.0 - upper_limit: 12.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - virial_overdens: - type: Uniform - lower_limit: 100.0 - upper_limit: 250.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +NFWVirialMassConcSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + virial_mass: + type: LogUniform + lower_limit: 100000000.0 + upper_limit: 1000000000000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + concentration: + type: Uniform + lower_limit: 0.0 + upper_limit: 12.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + virial_overdens: + type: Uniform + lower_limit: 100.0 + upper_limit: 250.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/point/point.yaml b/autogalaxy/config/priors/mass/point/point.yaml index cf40f0ac9..ec2710898 100644 --- a/autogalaxy/config/priors/mass/point/point.yaml +++ b/autogalaxy/config/priors/mass/point/point.yaml @@ -1,35 +1,35 @@ -PointMass: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - einstein_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 8.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf +PointMass: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + einstein_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 8.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/point/smbh.yaml b/autogalaxy/config/priors/mass/point/smbh.yaml index 8d871d0eb..74319aa7d 100644 --- a/autogalaxy/config/priors/mass/point/smbh.yaml +++ b/autogalaxy/config/priors/mass/point/smbh.yaml @@ -1,55 +1,55 @@ -SMBH: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - mass: - type: LogUniform - lower_limit: 1000000.0 - upper_limit: 10000000000000.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 +SMBH: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + mass: + type: LogUniform + lower_limit: 1000000.0 + upper_limit: 10000000000000.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 upper: inf \ No newline at end of file diff --git a/autogalaxy/config/priors/mass/point/smbh_binary.yaml b/autogalaxy/config/priors/mass/point/smbh_binary.yaml index 50b95a91f..c87bf0e71 100644 --- a/autogalaxy/config/priors/mass/point/smbh_binary.yaml +++ b/autogalaxy/config/priors/mass/point/smbh_binary.yaml @@ -1,85 +1,85 @@ -SMBHBinary: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 1.0 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 1.0 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - separation: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - angle_binary: - type: Uniform - lower_limit: 0.0 - upper_limit: 360.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - mass: - type: LogUniform - lower_limit: 1000000.0 - upper_limit: 10000000000000.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - mass_ratio: - type: Uniform - lower_limit: 1.0 - upper_limit: 10.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_object: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - redshift_source: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 +SMBHBinary: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 1.0 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 1.0 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + separation: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + angle_binary: + type: Uniform + lower_limit: 0.0 + upper_limit: 360.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + mass: + type: LogUniform + lower_limit: 1000000.0 + upper_limit: 10000000000000.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + mass_ratio: + type: Uniform + lower_limit: 1.0 + upper_limit: 10.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 upper: inf \ No newline at end of file diff --git a/autogalaxy/config/priors/mass/sheets/external_shear.yaml b/autogalaxy/config/priors/mass/sheets/external_shear.yaml index ab46432e7..e55c841d8 100644 --- a/autogalaxy/config/priors/mass/sheets/external_shear.yaml +++ b/autogalaxy/config/priors/mass/sheets/external_shear.yaml @@ -1,21 +1,21 @@ -ExternalShear: - gamma_1: - type: Uniform - lower_limit: -0.2 - upper_limit: 0.2 - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - gamma_2: - type: Uniform - lower_limit: -0.2 - upper_limit: 0.2 - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf +ExternalShear: + gamma_1: + type: Uniform + lower_limit: -0.2 + upper_limit: 0.2 + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + gamma_2: + type: Uniform + lower_limit: -0.2 + upper_limit: 0.2 + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf diff --git a/autogalaxy/config/priors/mass/sheets/mass_sheet.yaml b/autogalaxy/config/priors/mass/sheets/mass_sheet.yaml index 4494af32c..e71a8d435 100644 --- a/autogalaxy/config/priors/mass/sheets/mass_sheet.yaml +++ b/autogalaxy/config/priors/mass/sheets/mass_sheet.yaml @@ -1,35 +1,35 @@ -MassSheet: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - kappa: - type: Uniform - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf +MassSheet: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + kappa: + type: Uniform + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf diff --git a/autogalaxy/config/priors/mass/stellar/chameleon.yaml b/autogalaxy/config/priors/mass/stellar/chameleon.yaml index fe09daafd..11694d7ce 100644 --- a/autogalaxy/config/priors/mass/stellar/chameleon.yaml +++ b/autogalaxy/config/priors/mass/stellar/chameleon.yaml @@ -1,154 +1,154 @@ -Chameleon: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - core_radius_0: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - core_radius_1: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf -ChameleonSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - core_radius_0: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - core_radius_1: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Absolute - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf +Chameleon: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + core_radius_0: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + core_radius_1: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf +ChameleonSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + core_radius_0: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + core_radius_1: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Absolute + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/stellar/dev_vaucouleurs.yaml b/autogalaxy/config/priors/mass/stellar/dev_vaucouleurs.yaml index 692270371..460ac5c23 100644 --- a/autogalaxy/config/priors/mass/stellar/dev_vaucouleurs.yaml +++ b/autogalaxy/config/priors/mass/stellar/dev_vaucouleurs.yaml @@ -1,134 +1,134 @@ -DevVaucouleurs: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 10.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf -DevVaucouleursSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 10.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf +DevVaucouleurs: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 10.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf +DevVaucouleursSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 10.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/stellar/exponential.yaml b/autogalaxy/config/priors/mass/stellar/exponential.yaml index deb9631da..380bc7123 100644 --- a/autogalaxy/config/priors/mass/stellar/exponential.yaml +++ b/autogalaxy/config/priors/mass/stellar/exponential.yaml @@ -1,134 +1,134 @@ -Exponential: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 10.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf -ExponentialSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 10.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf +Exponential: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 10.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf +ExponentialSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 10.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/stellar/gaussian.yaml b/autogalaxy/config/priors/mass/stellar/gaussian.yaml index 1a593535a..591cb9185 100644 --- a/autogalaxy/config/priors/mass/stellar/gaussian.yaml +++ b/autogalaxy/config/priors/mass/stellar/gaussian.yaml @@ -1,79 +1,79 @@ -Gaussian: - sigma: - type: Uniform - lower_limit: 0.0 - upper_limit: 25.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf +Gaussian: + sigma: + type: Uniform + lower_limit: 0.0 + upper_limit: 25.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/stellar/gaussian_gradient.yaml b/autogalaxy/config/priors/mass/stellar/gaussian_gradient.yaml index 8bcb2340d..4d8e5e5a3 100644 --- a/autogalaxy/config/priors/mass/stellar/gaussian_gradient.yaml +++ b/autogalaxy/config/priors/mass/stellar/gaussian_gradient.yaml @@ -1,92 +1,92 @@ -GaussianGradient: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - sigma: - type: Uniform - lower_limit: 0.0 - upper_limit: 25.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_ratio_base: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_gradient: - type: Uniform - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_radius: - type: Constant +GaussianGradient: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + sigma: + type: Uniform + lower_limit: 0.0 + upper_limit: 25.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_ratio_base: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_gradient: + type: Uniform + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_radius: + type: Constant value: 1.0 \ No newline at end of file diff --git a/autogalaxy/config/priors/mass/stellar/sersic.yaml b/autogalaxy/config/priors/mass/stellar/sersic.yaml index 37c18f926..8361ff6a4 100644 --- a/autogalaxy/config/priors/mass/stellar/sersic.yaml +++ b/autogalaxy/config/priors/mass/stellar/sersic.yaml @@ -1,154 +1,154 @@ -Sersic: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 10.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 -SersicSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 10.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 +Sersic: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 10.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 +SersicSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 10.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 diff --git a/autogalaxy/config/priors/mass/stellar/sersic_core.yaml b/autogalaxy/config/priors/mass/stellar/sersic_core.yaml index b05ebecf5..b1fc6f5e0 100644 --- a/autogalaxy/config/priors/mass/stellar/sersic_core.yaml +++ b/autogalaxy/config/priors/mass/stellar/sersic_core.yaml @@ -1,172 +1,172 @@ -SersicCore: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-05 - upper_limit: 1000.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - alpha: - type: Constant - value: 3.0 - gamma: - type: Constant - value: 0.25 - radius_break: - type: Constant - value: 0.025 - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 -SersicCoreSph: - alpha: - type: Constant - value: 3.0 - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - gamma: - type: Constant - value: 0.25 - intensity: - type: LogUniform - lower_limit: 1.0e-05 - upper_limit: 1000.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - radius_break: - type: Constant - value: 0.025 - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 +SersicCore: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-05 + upper_limit: 1000.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + alpha: + type: Constant + value: 3.0 + gamma: + type: Constant + value: 0.25 + radius_break: + type: Constant + value: 0.025 + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 +SersicCoreSph: + alpha: + type: Constant + value: 3.0 + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + gamma: + type: Constant + value: 0.25 + intensity: + type: LogUniform + lower_limit: 1.0e-05 + upper_limit: 1000.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + radius_break: + type: Constant + value: 0.025 + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 diff --git a/autogalaxy/config/priors/mass/stellar/sersic_gradient.yaml b/autogalaxy/config/priors/mass/stellar/sersic_gradient.yaml index 47e0a4a30..32b401797 100644 --- a/autogalaxy/config/priors/mass/stellar/sersic_gradient.yaml +++ b/autogalaxy/config/priors/mass/stellar/sersic_gradient.yaml @@ -1,174 +1,174 @@ -SersicGradient: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 10.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_gradient: - type: Uniform - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -inf - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 -SersicGradientSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - effective_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 30.0 - width_modifier: - type: Relative - value: 1.0 - gaussian_limits: - lower: 0.0 - upper: inf - intensity: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 10.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - mass_to_light_gradient: - type: Uniform - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -inf - upper: inf - mass_to_light_ratio: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.3 - gaussian_limits: - lower: 0.0 - upper: inf - sersic_index: - type: Uniform - lower_limit: 0.8 - upper_limit: 5.0 - width_modifier: - type: Absolute - value: 1.5 - gaussian_limits: - lower: 0.8 - upper: 5.0 +SersicGradient: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 10.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_gradient: + type: Uniform + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -inf + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 +SersicGradientSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + effective_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 30.0 + width_modifier: + type: Relative + value: 1.0 + gaussian_limits: + lower: 0.0 + upper: inf + intensity: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 10.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + mass_to_light_gradient: + type: Uniform + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -inf + upper: inf + mass_to_light_ratio: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.3 + gaussian_limits: + lower: 0.0 + upper: inf + sersic_index: + type: Uniform + lower_limit: 0.8 + upper_limit: 5.0 + width_modifier: + type: Absolute + value: 1.5 + gaussian_limits: + lower: 0.8 + upper: 5.0 diff --git a/autogalaxy/config/priors/mass/total/isothermal.yaml b/autogalaxy/config/priors/mass/total/isothermal.yaml index 2be7aeb3b..bafb6df1d 100644 --- a/autogalaxy/config/priors/mass/total/isothermal.yaml +++ b/autogalaxy/config/priors/mass/total/isothermal.yaml @@ -1,94 +1,94 @@ -Isothermal: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - einstein_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 8.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 -IsothermalSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - einstein_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 8.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf +Isothermal: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + einstein_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 8.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 +IsothermalSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + einstein_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 8.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/total/isothermal_core.yaml b/autogalaxy/config/priors/mass/total/isothermal_core.yaml index c5d7989f1..7f32ff0eb 100644 --- a/autogalaxy/config/priors/mass/total/isothermal_core.yaml +++ b/autogalaxy/config/priors/mass/total/isothermal_core.yaml @@ -1,114 +1,114 @@ -IsothermalCore: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - core_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 0.2 - width_modifier: - type: Absolute - value: 0.1 - gaussian_limits: - lower: 0.0 - upper: inf - einstein_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 8.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 -IsothermalCoreSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - core_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 0.2 - width_modifier: - type: Absolute - value: 0.1 - gaussian_limits: - lower: 0.0 - upper: inf - einstein_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 8.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf +IsothermalCore: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + core_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 0.2 + width_modifier: + type: Absolute + value: 0.1 + gaussian_limits: + lower: 0.0 + upper: inf + einstein_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 8.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 +IsothermalCoreSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + core_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 0.2 + width_modifier: + type: Absolute + value: 0.1 + gaussian_limits: + lower: 0.0 + upper: inf + einstein_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 8.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/mass/total/power_law.yaml b/autogalaxy/config/priors/mass/total/power_law.yaml index 6d902237f..c4cdb210d 100644 --- a/autogalaxy/config/priors/mass/total/power_law.yaml +++ b/autogalaxy/config/priors/mass/total/power_law.yaml @@ -1,114 +1,114 @@ -PowerLaw: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - einstein_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 8.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - slope: - type: Uniform - lower_limit: 1.5 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: 1.0 - upper: 3.0 -PowerLawSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - einstein_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 8.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - slope: - type: Uniform - lower_limit: 1.5 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: 1.0 - upper: 3.0 +PowerLaw: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + einstein_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 8.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + slope: + type: Uniform + lower_limit: 1.5 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: 1.0 + upper: 3.0 +PowerLawSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + einstein_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 8.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + slope: + type: Uniform + lower_limit: 1.5 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: 1.0 + upper: 3.0 diff --git a/autogalaxy/config/priors/mass/total/power_law_broken.yaml b/autogalaxy/config/priors/mass/total/power_law_broken.yaml index d882e8a53..f07a61200 100644 --- a/autogalaxy/config/priors/mass/total/power_law_broken.yaml +++ b/autogalaxy/config/priors/mass/total/power_law_broken.yaml @@ -1,154 +1,154 @@ -PowerLawBroken: - break_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - einstein_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 8.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - inner_slope: - type: Uniform - lower_limit: 0.0 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: 3.0 - outer_slope: - type: Uniform - lower_limit: 0.0 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: 3.0 -PowerLawBrokenSph: - break_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.1 - gaussian_limits: - lower: 0.0 - upper: inf - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - einstein_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 8.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - inner_slope: - type: Uniform - lower_limit: 0.0 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: 3.0 - outer_slope: - type: Uniform - lower_limit: 0.0 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: 3.0 +PowerLawBroken: + break_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + einstein_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 8.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + inner_slope: + type: Uniform + lower_limit: 0.0 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: 3.0 + outer_slope: + type: Uniform + lower_limit: 0.0 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: 3.0 +PowerLawBrokenSph: + break_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.1 + gaussian_limits: + lower: 0.0 + upper: inf + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + einstein_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 8.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + inner_slope: + type: Uniform + lower_limit: 0.0 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: 3.0 + outer_slope: + type: Uniform + lower_limit: 0.0 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: 3.0 diff --git a/autogalaxy/config/priors/mass/total/power_law_core.yaml b/autogalaxy/config/priors/mass/total/power_law_core.yaml index bad6ee493..72f9f8de4 100644 --- a/autogalaxy/config/priors/mass/total/power_law_core.yaml +++ b/autogalaxy/config/priors/mass/total/power_law_core.yaml @@ -1,134 +1,134 @@ -PowerLawCore: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - core_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 0.2 - width_modifier: - type: Absolute - value: 0.1 - gaussian_limits: - lower: 0.0 - upper: inf - einstein_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 8.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - ell_comps_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - ell_comps_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -1.0 - upper_limit: 1.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: -1.0 - upper: 1.0 - slope: - type: Uniform - lower_limit: 1.5 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: 1.0 - upper: 3.0 -PowerLawCoreSph: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.1 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - core_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 0.2 - width_modifier: - type: Absolute - value: 0.1 - gaussian_limits: - lower: 0.0 - upper: inf - einstein_radius: - type: Uniform - lower_limit: 0.0 - upper_limit: 8.0 - width_modifier: - type: Relative - value: 0.25 - gaussian_limits: - lower: 0.0 - upper: inf - slope: - type: Uniform - lower_limit: 1.5 - upper_limit: 3.0 - width_modifier: - type: Absolute - value: 0.2 - gaussian_limits: - lower: 1.0 - upper: 3.0 +PowerLawCore: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + core_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 0.2 + width_modifier: + type: Absolute + value: 0.1 + gaussian_limits: + lower: 0.0 + upper: inf + einstein_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 8.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: -1.0 + upper: 1.0 + slope: + type: Uniform + lower_limit: 1.5 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: 1.0 + upper: 3.0 +PowerLawCoreSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + core_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 0.2 + width_modifier: + type: Absolute + value: 0.1 + gaussian_limits: + lower: 0.0 + upper: inf + einstein_radius: + type: Uniform + lower_limit: 0.0 + upper_limit: 8.0 + width_modifier: + type: Relative + value: 0.25 + gaussian_limits: + lower: 0.0 + upper: inf + slope: + type: Uniform + lower_limit: 1.5 + upper_limit: 3.0 + width_modifier: + type: Absolute + value: 0.2 + gaussian_limits: + lower: 1.0 + upper: 3.0 diff --git a/autogalaxy/config/priors/mesh/delaunay.yaml b/autogalaxy/config/priors/mesh/delaunay.yaml index 604de83de..783f4b746 100644 --- a/autogalaxy/config/priors/mesh/delaunay.yaml +++ b/autogalaxy/config/priors/mesh/delaunay.yaml @@ -1 +1 @@ -Delaunay: +Delaunay: diff --git a/autogalaxy/config/priors/mesh/rectangular.yaml b/autogalaxy/config/priors/mesh/rectangular.yaml index 26a1c354c..53c565cd6 100644 --- a/autogalaxy/config/priors/mesh/rectangular.yaml +++ b/autogalaxy/config/priors/mesh/rectangular.yaml @@ -1,21 +1,21 @@ -Rectangular: - shape_0: - type: Uniform - lower_limit: 20.0 - upper_limit: 45.0 - width_modifier: - type: Absolute - value: 8.0 - gaussian_limits: - lower: 3.0 - upper: inf - shape_1: - type: Uniform - lower_limit: 20.0 - upper_limit: 45.0 - width_modifier: - type: Absolute - value: 8.0 - gaussian_limits: - lower: 3.0 - upper: inf +Rectangular: + shape_0: + type: Uniform + lower_limit: 20.0 + upper_limit: 45.0 + width_modifier: + type: Absolute + value: 8.0 + gaussian_limits: + lower: 3.0 + upper: inf + shape_1: + type: Uniform + lower_limit: 20.0 + upper_limit: 45.0 + width_modifier: + type: Absolute + value: 8.0 + gaussian_limits: + lower: 3.0 + upper: inf diff --git a/autogalaxy/config/priors/point_sources.yaml b/autogalaxy/config/priors/point_sources.yaml index 67adf1f37..5ff02c31c 100644 --- a/autogalaxy/config/priors/point_sources.yaml +++ b/autogalaxy/config/priors/point_sources.yaml @@ -1,85 +1,85 @@ -Point: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf -PointFlux: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - flux: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf -PointSourceChi: - centre_0: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf - centre_1: - type: Gaussian - mean: 0.0 - sigma: 0.3 - lower_limit: -inf - upper_limit: inf - width_modifier: - type: Absolute - value: 0.05 - gaussian_limits: - lower: -inf - upper: inf +Point: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf +PointFlux: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + flux: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf +PointSourceChi: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -inf + upper_limit: inf + width_modifier: + type: Absolute + value: 0.05 + gaussian_limits: + lower: -inf + upper: inf diff --git a/autogalaxy/config/priors/regularization/adaptive_brightness.yaml b/autogalaxy/config/priors/regularization/adaptive_brightness.yaml index 1697df3bd..5e911e9dc 100644 --- a/autogalaxy/config/priors/regularization/adaptive_brightness.yaml +++ b/autogalaxy/config/priors/regularization/adaptive_brightness.yaml @@ -1,62 +1,62 @@ -AdaptiveBrightness: - inner_coefficient: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - outer_coefficient: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - signal_scale: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf -AdaptiveBrightnessSplit: - inner_coefficient: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - outer_coefficient: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - signal_scale: - type: Uniform - lower_limit: 0.0 - upper_limit: 1.0 - width_modifier: - type: Relative - value: 0.2 - gaussian_limits: - lower: 0.0 - upper: inf +AdaptiveBrightness: + inner_coefficient: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + outer_coefficient: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + signal_scale: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf +AdaptiveBrightnessSplit: + inner_coefficient: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + outer_coefficient: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + signal_scale: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.2 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/regularization/constant.yaml b/autogalaxy/config/priors/regularization/constant.yaml index f54978b5a..35b1dbb9f 100644 --- a/autogalaxy/config/priors/regularization/constant.yaml +++ b/autogalaxy/config/priors/regularization/constant.yaml @@ -1,11 +1,11 @@ -Constant: - coefficient: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +Constant: + coefficient: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/regularization/constant_split.yaml b/autogalaxy/config/priors/regularization/constant_split.yaml index 106692048..2ea6fba46 100644 --- a/autogalaxy/config/priors/regularization/constant_split.yaml +++ b/autogalaxy/config/priors/regularization/constant_split.yaml @@ -1,11 +1,11 @@ -ConstantSplit: - coefficient: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +ConstantSplit: + coefficient: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/regularization/constant_zeroth.yaml b/autogalaxy/config/priors/regularization/constant_zeroth.yaml index 9122df418..a58d659de 100644 --- a/autogalaxy/config/priors/regularization/constant_zeroth.yaml +++ b/autogalaxy/config/priors/regularization/constant_zeroth.yaml @@ -1,21 +1,21 @@ -ConstantZeroth: - coefficient_neighbor: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf - coefficient_zeroth: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +ConstantZeroth: + coefficient_neighbor: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf + coefficient_zeroth: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/priors/regularization/zeroth.yaml b/autogalaxy/config/priors/regularization/zeroth.yaml index 7ad61a7ff..16d05b0d2 100644 --- a/autogalaxy/config/priors/regularization/zeroth.yaml +++ b/autogalaxy/config/priors/regularization/zeroth.yaml @@ -1,11 +1,11 @@ -Zeroth: - coefficient: - type: LogUniform - lower_limit: 1.0e-06 - upper_limit: 1000000.0 - width_modifier: - type: Relative - value: 0.5 - gaussian_limits: - lower: 0.0 - upper: inf +Zeroth: + coefficient: + type: LogUniform + lower_limit: 1.0e-06 + upper_limit: 1000000.0 + width_modifier: + type: Relative + value: 0.5 + gaussian_limits: + lower: 0.0 + upper: inf diff --git a/autogalaxy/config/visualize/general.yaml b/autogalaxy/config/visualize/general.yaml index 4a6fd0ebc..e022ac819 100644 --- a/autogalaxy/config/visualize/general.yaml +++ b/autogalaxy/config/visualize/general.yaml @@ -1,9 +1,9 @@ -general: - backend: default - imshow_origin: upper - zoom_around_mask: true -inversion: - reconstruction_vmax_factor: 0.5 -zoom: - plane_percent: 0.01 +general: + backend: default + imshow_origin: upper + zoom_around_mask: true +inversion: + reconstruction_vmax_factor: 0.5 +zoom: + plane_percent: 0.01 inversion_percent: 0.01 \ No newline at end of file diff --git a/autogalaxy/config/visualize/include.yaml b/autogalaxy/config/visualize/include.yaml index 0c9a25708..54497fe44 100644 --- a/autogalaxy/config/visualize/include.yaml +++ b/autogalaxy/config/visualize/include.yaml @@ -1,11 +1,11 @@ -include_1d: - einstein_radius: true - half_light_radius: true -include_2d: - tangential_critical_curves: true - tangential_caustics: true - radial_critical_curves: true - radial_caustics: true - light_profile_centres: true - mass_profile_centres: true - multiple_images: true +include_1d: + einstein_radius: true + half_light_radius: true +include_2d: + tangential_critical_curves: true + tangential_caustics: true + radial_critical_curves: true + radial_caustics: true + light_profile_centres: true + mass_profile_centres: true + multiple_images: true diff --git a/autogalaxy/config/visualize/mat_wrap_1d.yaml b/autogalaxy/config/visualize/mat_wrap_1d.yaml index 2eca68f71..590cf0b5b 100644 --- a/autogalaxy/config/visualize/mat_wrap_1d.yaml +++ b/autogalaxy/config/visualize/mat_wrap_1d.yaml @@ -1,19 +1,19 @@ -EinsteinRadiusAXVLine: - figure: - c: b - linestyle: -- - subplot: - c: b - linestyle: -- -HalfLightRadiusAXVLine: - figure: - c: g - linestyle: -. - subplot: - c: kg - linestyle: -. -ModelFluxesYXScatter: - figure: - c: c - subplot: - c: c +EinsteinRadiusAXVLine: + figure: + c: b + linestyle: -- + subplot: + c: b + linestyle: -- +HalfLightRadiusAXVLine: + figure: + c: g + linestyle: -. + subplot: + c: kg + linestyle: -. +ModelFluxesYXScatter: + figure: + c: c + subplot: + c: c diff --git a/autogalaxy/config/visualize/mat_wrap_2d.yaml b/autogalaxy/config/visualize/mat_wrap_2d.yaml index 74d23f1db..3d8be5b01 100644 --- a/autogalaxy/config/visualize/mat_wrap_2d.yaml +++ b/autogalaxy/config/visualize/mat_wrap_2d.yaml @@ -1,63 +1,63 @@ -TangentialCriticalCurvesPlot: - figure: - c: w - linestyle: '-' - linewidth: 2 - subplot: - c: w - linestyle: '-' - linewidth: 2 -TangentialCausticsPlot: - figure: - c: w - linestyle: '-' - linewidth: 2 - subplot: - c: w - linestyle: '-' - linewidth: 2 -RadialCriticalCurvesPlot: - figure: - c: y - linestyle: '-' - linewidth: 2 - subplot: - c: y - linestyle: '-' - linewidth: 2 -RadialCausticsPlot: - figure: - c: y - linestyle: '-' - linewidth: 2 - subplot: - c: y - linestyle: '-' - linewidth: 2 -LightProfileCentresScatter: - figure: - c: k,r,g,b,m,y - marker: + - s: 20 - subplot: - c: r,g,b,m,y,k - marker: + - s: 26 -MassProfileCentresScatter: - figure: - c: k,r,g,b,m,y - marker: x - s: 20 - subplot: - c: r,g,b,m,y,k - marker: x - s: 26 -MultipleImagesScatter: - figure: - c: k,r,g,b,m,y - marker: o - s: 16 - subplot: - c: r,g,b,m,y,k - marker: o - s: 16 +TangentialCriticalCurvesPlot: + figure: + c: w + linestyle: '-' + linewidth: 2 + subplot: + c: w + linestyle: '-' + linewidth: 2 +TangentialCausticsPlot: + figure: + c: w + linestyle: '-' + linewidth: 2 + subplot: + c: w + linestyle: '-' + linewidth: 2 +RadialCriticalCurvesPlot: + figure: + c: y + linestyle: '-' + linewidth: 2 + subplot: + c: y + linestyle: '-' + linewidth: 2 +RadialCausticsPlot: + figure: + c: y + linestyle: '-' + linewidth: 2 + subplot: + c: y + linestyle: '-' + linewidth: 2 +LightProfileCentresScatter: + figure: + c: k,r,g,b,m,y + marker: + + s: 20 + subplot: + c: r,g,b,m,y,k + marker: + + s: 26 +MassProfileCentresScatter: + figure: + c: k,r,g,b,m,y + marker: x + s: 20 + subplot: + c: r,g,b,m,y,k + marker: x + s: 26 +MultipleImagesScatter: + figure: + c: k,r,g,b,m,y + marker: o + s: 16 + subplot: + c: r,g,b,m,y,k + marker: o + s: 16 diff --git a/autogalaxy/config/visualize/plots.yaml b/autogalaxy/config/visualize/plots.yaml index c46c62db0..305878ca9 100644 --- a/autogalaxy/config/visualize/plots.yaml +++ b/autogalaxy/config/visualize/plots.yaml @@ -1,98 +1,98 @@ -# The `plots` section customizes every image that is output to hard-disk during a model-fit. - -# For example, if `plots: fit: subplot_fit=True``, the ``fit_dataset.png`` subplot file will -# be plotted every time visualization is performed. - -dataset: # Settings for plots of all datasets (e.g. ImagingPlotter, InterferometerPlotter). - subplot_dataset: true # Plot subplot containing all dataset quantities (e.g. the data, noise-map, etc.)? - data: false # Plot the individual data of every dataset? - noise_map: false # Plot the individual noise-map of every dataset? - signal_to_noise_map: false # Plot the individual signal-to-noise-map of every dataset? - over_sampling: false # Plot the over-sampling sub-size, used to evaluate light profiles, of every dataset? - over_sampling_non_uniform: false # Plot the over-sampling sub-size, used to evaluate non uniform grids, of every dataset? - over_sampling_pixelization: false # Plot the over-sampling sub-size, used to evaluate pixelizations, of every dataset? -imaging: # Settings for plots of imaging datasets (e.g. ImagingPlotter). - psf: false -fit: # Settings for plots of all fits (e.g. FitImagingPlotter, FitInterferometerPlotter). - subplot_fit: true # Plot subplot of all fit quantities for any dataset (e.g. the model data, residual-map, etc.)? - subplot_fit_log10: true # Plot subplot of all fit quantities for any dataset using log10 color maps (e.g. the model data, residual-map, etc.)? - all_at_end_png: true # Plot all individual plots listed below as .png (even if False)? - all_at_end_fits: true # Plot all individual plots listed below as .fits (even if False)? - all_at_end_pdf: false # Plot all individual plots listed below as publication-quality .pdf (even if False)? - subplot_of_galaxies: false # Plot subplot of the model-image, subtracted image and other quantities of each galaxy? - subplot_galaxy_images: false # Plot subplot of the image of each galaxy in the model? - subtracted_images_of_galaxies: false - data: false # Plot individual plots of the data? - noise_map: false # Plot individual plots of the noise-map? - signal_to_noise_map: false # Plot individual plots of the signal-to-noise-map? - model_data: false # Plot individual plots of the model-data? - residual_map: false # Plot individual plots of the residual-map? - normalized_residual_map: false # Plot individual plots of the normalized-residual-map? - chi_squared_map: false # Plot individual plots of the chi-squared-map? - residual_flux_fraction: false # Plot individual plots of the residual_flux_fraction? - model_images_of_galaxies: false # Plot individual plots of each galaxy's model image? -fit_imaging: {} # Settings for plots of fits to imaging datasets (e.g. FitImagingPlotter). -galaxies: # Settings for plots of galaxies (e.g. GalaxiesPlotter). - subplot_galaxies: true # Plot subplot of all quantities in each galaxies group (e.g. images, convergence)? - all_at_end_png: true # Plot all individual plots listed below as .png (even if False)? - all_at_end_fits: true # Plot all individual plots listed below as .fits (even if False)? - all_at_end_pdf: false # Plot all individual plots listed below as publication-quality .pdf (even if False)? - subplot_galaxy_images: false # Plot subplot of the image of each galaxy in the model? - image: false - source_plane_image: false - convergence: false - deflections: false - potential: false - magnification: false -galaxies_1d: # Settings for 1D plots of galaxies (e.g. GalaxiesPlotter). - image: false - convergence: false - potential: false -inversion: # Settings for plots of inversions (e.g. InversionPlotter). - subplot_inversion: true # Plot subplot of all quantities in each inversion (e.g. reconstrucuted image, reconstruction)? - subplot_mappings: true # Plot subplot of the image-to-source pixels mappings of each pixelization? - all_at_end_png: true # Plot all individual plots listed below as .png (even if False)? - all_at_end_fits: true # Plot all individual plots listed below as .fits (even if False)? - all_at_end_pdf: false # Plot all individual plots listed below as publication-quality .pdf (even if False)? - data_subtracted: false # Plot individual plots of the data with the other inversion linear objects subtracted? - errors: false # Plot image of the errors of every mesh-pixel reconstructed value? - sub_pixels_per_image_pixels: false # Plot the number of sub pixels per masked data pixels? - mesh_pixels_per_image_pixels: false # Plot the number of image-plane mesh pixels per masked data pixels? - reconstructed_image: false # Plot image of the reconstructed data (e.g. in the image-plane)? - reconstruction: false # Plot the reconstructed inversion (e.g. the pixelization's mesh in the source-plane)? - regularization_weights: false # Plot the effective regularization weight of every inversion mesh pixel? -adapt: # Settings for plots of adapt images used by adaptive pixelizations. - images_of_galaxies: true - model_image: true -interferometer: # Settings for plots of interferometer datasets (e.g. InterferometerPlotter). - amplitudes_vs_uv_distances: false - phases_vs_uv_distances: false - uv_wavelengths: false - dirty_image: false - dirty_noise_map: false - dirty_signal_to_noise_map: false -fit_interferometer: # Settings for plots of fits to interferometer datasets (e.g. FitInterferometerPlotter). - subplot_fit_dirty_images: false # Plot subplot of the dirty-images of all interferometer datasets? - subplot_fit_real_space: false # Plot subplot of the real-space images of all interferometer datasets? - amplitudes_vs_uv_distances: false - phases_vs_uv_distances: false - uv_wavelengths: false - dirty_image: false - dirty_noise_map: false - dirty_signal_to_noise_map: false - dirty_residual_map: false - dirty_normalized_residual_map: false - dirty_chi_squared_map: false -fit_ellipse: # Settings for plots of ellipse fitting fits (e.g. FitEllipse) - data : true # Plot the data of the ellipse fit? - data_no_ellipse: true # Plot the data without the black data ellipses, which obscure noisy data? -fit_quantity: # Settings for plots of fit quantities (e.g. FitQuantityPlotter). - all_at_end_png: true # Plot all individual plots listed below as .png (even if False)? - all_at_end_fits: true # Plot all individual plots listed below as .fits (even if False)? - all_at_end_pdf: false # Plot all individual plots listed below as publication-quality .pdf (even if False)? - chi_squared_map: false - image: true - model_image: false - noise_map: false - residual_map: false - normalized_residual_map: false +# The `plots` section customizes every image that is output to hard-disk during a model-fit. + +# For example, if `plots: fit: subplot_fit=True``, the ``fit_dataset.png`` subplot file will +# be plotted every time visualization is performed. + +dataset: # Settings for plots of all datasets (e.g. ImagingPlotter, InterferometerPlotter). + subplot_dataset: true # Plot subplot containing all dataset quantities (e.g. the data, noise-map, etc.)? + data: false # Plot the individual data of every dataset? + noise_map: false # Plot the individual noise-map of every dataset? + signal_to_noise_map: false # Plot the individual signal-to-noise-map of every dataset? + over_sampling: false # Plot the over-sampling sub-size, used to evaluate light profiles, of every dataset? + over_sampling_non_uniform: false # Plot the over-sampling sub-size, used to evaluate non uniform grids, of every dataset? + over_sampling_pixelization: false # Plot the over-sampling sub-size, used to evaluate pixelizations, of every dataset? +imaging: # Settings for plots of imaging datasets (e.g. ImagingPlotter). + psf: false +fit: # Settings for plots of all fits (e.g. FitImagingPlotter, FitInterferometerPlotter). + subplot_fit: true # Plot subplot of all fit quantities for any dataset (e.g. the model data, residual-map, etc.)? + subplot_fit_log10: true # Plot subplot of all fit quantities for any dataset using log10 color maps (e.g. the model data, residual-map, etc.)? + all_at_end_png: true # Plot all individual plots listed below as .png (even if False)? + all_at_end_fits: true # Plot all individual plots listed below as .fits (even if False)? + all_at_end_pdf: false # Plot all individual plots listed below as publication-quality .pdf (even if False)? + subplot_of_galaxies: false # Plot subplot of the model-image, subtracted image and other quantities of each galaxy? + subplot_galaxy_images: false # Plot subplot of the image of each galaxy in the model? + subtracted_images_of_galaxies: false + data: false # Plot individual plots of the data? + noise_map: false # Plot individual plots of the noise-map? + signal_to_noise_map: false # Plot individual plots of the signal-to-noise-map? + model_data: false # Plot individual plots of the model-data? + residual_map: false # Plot individual plots of the residual-map? + normalized_residual_map: false # Plot individual plots of the normalized-residual-map? + chi_squared_map: false # Plot individual plots of the chi-squared-map? + residual_flux_fraction: false # Plot individual plots of the residual_flux_fraction? + model_images_of_galaxies: false # Plot individual plots of each galaxy's model image? +fit_imaging: {} # Settings for plots of fits to imaging datasets (e.g. FitImagingPlotter). +galaxies: # Settings for plots of galaxies (e.g. GalaxiesPlotter). + subplot_galaxies: true # Plot subplot of all quantities in each galaxies group (e.g. images, convergence)? + all_at_end_png: true # Plot all individual plots listed below as .png (even if False)? + all_at_end_fits: true # Plot all individual plots listed below as .fits (even if False)? + all_at_end_pdf: false # Plot all individual plots listed below as publication-quality .pdf (even if False)? + subplot_galaxy_images: false # Plot subplot of the image of each galaxy in the model? + image: false + source_plane_image: false + convergence: false + deflections: false + potential: false + magnification: false +galaxies_1d: # Settings for 1D plots of galaxies (e.g. GalaxiesPlotter). + image: false + convergence: false + potential: false +inversion: # Settings for plots of inversions (e.g. InversionPlotter). + subplot_inversion: true # Plot subplot of all quantities in each inversion (e.g. reconstrucuted image, reconstruction)? + subplot_mappings: true # Plot subplot of the image-to-source pixels mappings of each pixelization? + all_at_end_png: true # Plot all individual plots listed below as .png (even if False)? + all_at_end_fits: true # Plot all individual plots listed below as .fits (even if False)? + all_at_end_pdf: false # Plot all individual plots listed below as publication-quality .pdf (even if False)? + data_subtracted: false # Plot individual plots of the data with the other inversion linear objects subtracted? + errors: false # Plot image of the errors of every mesh-pixel reconstructed value? + sub_pixels_per_image_pixels: false # Plot the number of sub pixels per masked data pixels? + mesh_pixels_per_image_pixels: false # Plot the number of image-plane mesh pixels per masked data pixels? + reconstructed_image: false # Plot image of the reconstructed data (e.g. in the image-plane)? + reconstruction: false # Plot the reconstructed inversion (e.g. the pixelization's mesh in the source-plane)? + regularization_weights: false # Plot the effective regularization weight of every inversion mesh pixel? +adapt: # Settings for plots of adapt images used by adaptive pixelizations. + images_of_galaxies: true + model_image: true +interferometer: # Settings for plots of interferometer datasets (e.g. InterferometerPlotter). + amplitudes_vs_uv_distances: false + phases_vs_uv_distances: false + uv_wavelengths: false + dirty_image: false + dirty_noise_map: false + dirty_signal_to_noise_map: false +fit_interferometer: # Settings for plots of fits to interferometer datasets (e.g. FitInterferometerPlotter). + subplot_fit_dirty_images: false # Plot subplot of the dirty-images of all interferometer datasets? + subplot_fit_real_space: false # Plot subplot of the real-space images of all interferometer datasets? + amplitudes_vs_uv_distances: false + phases_vs_uv_distances: false + uv_wavelengths: false + dirty_image: false + dirty_noise_map: false + dirty_signal_to_noise_map: false + dirty_residual_map: false + dirty_normalized_residual_map: false + dirty_chi_squared_map: false +fit_ellipse: # Settings for plots of ellipse fitting fits (e.g. FitEllipse) + data : true # Plot the data of the ellipse fit? + data_no_ellipse: true # Plot the data without the black data ellipses, which obscure noisy data? +fit_quantity: # Settings for plots of fit quantities (e.g. FitQuantityPlotter). + all_at_end_png: true # Plot all individual plots listed below as .png (even if False)? + all_at_end_fits: true # Plot all individual plots listed below as .fits (even if False)? + all_at_end_pdf: false # Plot all individual plots listed below as publication-quality .pdf (even if False)? + chi_squared_map: false + image: true + model_image: false + noise_map: false + residual_map: false + normalized_residual_map: false diff --git a/autogalaxy/profiles/light/decorators.py b/autogalaxy/profiles/light/decorators.py index d963612b6..7e75029cb 100644 --- a/autogalaxy/profiles/light/decorators.py +++ b/autogalaxy/profiles/light/decorators.py @@ -1,72 +1,72 @@ -import numpy as np -from functools import wraps -from typing import Optional, Union - -import autoarray as aa - - -def check_operated_only(func): - """ - Checks if a light profile is a `LightProfileOperated` class and therefore already has had operations like a - PSF convolution performed. - - This is compared to the `only_operated` input to determine if the image of that light profile is returned, or - an array of zeros. - - Parameters - ---------- - func - A function which checks the light profile class and determines what image is returned. - - Returns - ------- - A function that returns a 2D image. - """ - - @wraps(func) - def wrapper( - obj, - grid: aa.type.Grid1D2DLike, - operated_only: Optional[bool] = None, - *args, - **kwargs - ) -> Union[aa.Array2D, np.ndarray]: - """ - This decorator checks if a light profile is a `LightProfileOperated` class and therefore already has had operations like a - PSF convolution performed. - - This is compared to the `only_operated` input to determine if the image of that light profile is returned, or - an array of zeros. - - Parameters - ---------- - obj - A light profile with an `image_2d_from` function whose class is inspected to determine if the image is - operated on. - grid - A grid_like object of (y,x) coordinates on which the function values are evaluated. - operated_only - By default this is None and the image is returned irrespecive of light profile class (E.g. it does not matter - if it is already operated or not). If this input is included as a bool, the light profile image is only - returned if they are or are not already operated. - - Returns - ------- - The 2D image, which is customized depending on whether it has been operated on. - """ - - from autogalaxy.profiles.light.operated import ( - LightProfileOperated, - ) - - if operated_only is None: - return func(obj, grid, operated_only, *args, **kwargs) - elif operated_only: - if isinstance(obj, LightProfileOperated): - return func(obj, grid, operated_only, *args, **kwargs) - return np.zeros((grid.shape[0],)) - if not isinstance(obj, LightProfileOperated): - return func(obj, grid, operated_only, *args, **kwargs) - return np.zeros((grid.shape[0],)) - - return wrapper +import numpy as np +from functools import wraps +from typing import Optional, Union + +import autoarray as aa + + +def check_operated_only(func): + """ + Checks if a light profile is a `LightProfileOperated` class and therefore already has had operations like a + PSF convolution performed. + + This is compared to the `only_operated` input to determine if the image of that light profile is returned, or + an array of zeros. + + Parameters + ---------- + func + A function which checks the light profile class and determines what image is returned. + + Returns + ------- + A function that returns a 2D image. + """ + + @wraps(func) + def wrapper( + obj, + grid: aa.type.Grid1D2DLike, + operated_only: Optional[bool] = None, + *args, + **kwargs + ) -> Union[aa.Array2D, np.ndarray]: + """ + This decorator checks if a light profile is a `LightProfileOperated` class and therefore already has had operations like a + PSF convolution performed. + + This is compared to the `only_operated` input to determine if the image of that light profile is returned, or + an array of zeros. + + Parameters + ---------- + obj + A light profile with an `image_2d_from` function whose class is inspected to determine if the image is + operated on. + grid + A grid_like object of (y,x) coordinates on which the function values are evaluated. + operated_only + By default this is None and the image is returned irrespecive of light profile class (E.g. it does not matter + if it is already operated or not). If this input is included as a bool, the light profile image is only + returned if they are or are not already operated. + + Returns + ------- + The 2D image, which is customized depending on whether it has been operated on. + """ + + from autogalaxy.profiles.light.operated import ( + LightProfileOperated, + ) + + if operated_only is None: + return func(obj, grid, operated_only, *args, **kwargs) + elif operated_only: + if isinstance(obj, LightProfileOperated): + return func(obj, grid, operated_only, *args, **kwargs) + return np.zeros((grid.shape[0],)) + if not isinstance(obj, LightProfileOperated): + return func(obj, grid, operated_only, *args, **kwargs) + return np.zeros((grid.shape[0],)) + + return wrapper diff --git a/autogalaxy/profiles/light/snr/sersic.py b/autogalaxy/profiles/light/snr/sersic.py index d44a6b12a..2ea33deac 100644 --- a/autogalaxy/profiles/light/snr/sersic.py +++ b/autogalaxy/profiles/light/snr/sersic.py @@ -1,75 +1,75 @@ -from typing import Tuple - -from autogalaxy.profiles.light.snr.abstract import LightProfileSNR -from autogalaxy.profiles.light import standard as lp - - -class Sersic(lp.Sersic, LightProfileSNR): - def __init__( - self, - signal_to_noise_ratio: float = 10.0, - centre: Tuple[float, float] = (0.0, 0.0), - ell_comps: Tuple[float, float] = (0.0, 0.0), - effective_radius: float = 0.6, - sersic_index: float = 4.0, - ): - """ - An elliptical Sersic light profile. - - Instead of an `intensity` a `signal_to_noise_ratio` is input which sets the signal to noise of the brightest - pixel of the profile's image when used to simulate imaging data. - - Parameters - ---------- - signal_to_noise_ratio - The signal to noise of the light profile when it is used to simulate strong lens imaging. - centre - The (y,x) arc-second coordinates of the profile centre. - ell_comps - The first and second ellipticity components of the elliptical coordinate system. - effective_radius - The circular radius containing half the light of this profile. - sersic_index - Controls the concentration of the profile (lower -> less concentrated, higher -> more concentrated). - """ - super().__init__( - centre=centre, - ell_comps=ell_comps, - intensity=0.0, - effective_radius=effective_radius, - sersic_index=sersic_index, - ) - - LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio) - - -class SersicSph(lp.SersicSph, LightProfileSNR): - def __init__( - self, - signal_to_noise_ratio: float = 10.0, - centre: Tuple[float, float] = (0.0, 0.0), - effective_radius: float = 0.6, - sersic_index: float = 4.0, - ): - """ - The spherical Sersic light profile. - - Parameters - ---------- - centre - The (y,x) arc-second coordinates of the profile centre. - intensity - Overall intensity normalisation of the light profile (units are dimensionless and derived from the data - the light profile's image is compared too, which is expected to be electrons per second). - effective_radius - The circular radius containing half the light of this profile. - sersic_index - Controls the concentration of the of the light profile. - """ - super().__init__( - centre=centre, - intensity=0.0, - effective_radius=effective_radius, - sersic_index=sersic_index, - ) - LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio) +from typing import Tuple + +from autogalaxy.profiles.light.snr.abstract import LightProfileSNR +from autogalaxy.profiles.light import standard as lp + + +class Sersic(lp.Sersic, LightProfileSNR): + def __init__( + self, + signal_to_noise_ratio: float = 10.0, + centre: Tuple[float, float] = (0.0, 0.0), + ell_comps: Tuple[float, float] = (0.0, 0.0), + effective_radius: float = 0.6, + sersic_index: float = 4.0, + ): + """ + An elliptical Sersic light profile. + + Instead of an `intensity` a `signal_to_noise_ratio` is input which sets the signal to noise of the brightest + pixel of the profile's image when used to simulate imaging data. + + Parameters + ---------- + signal_to_noise_ratio + The signal to noise of the light profile when it is used to simulate strong lens imaging. + centre + The (y,x) arc-second coordinates of the profile centre. + ell_comps + The first and second ellipticity components of the elliptical coordinate system. + effective_radius + The circular radius containing half the light of this profile. + sersic_index + Controls the concentration of the profile (lower -> less concentrated, higher -> more concentrated). + """ + super().__init__( + centre=centre, + ell_comps=ell_comps, + intensity=0.0, + effective_radius=effective_radius, + sersic_index=sersic_index, + ) + + LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio) + + +class SersicSph(lp.SersicSph, LightProfileSNR): + def __init__( + self, + signal_to_noise_ratio: float = 10.0, + centre: Tuple[float, float] = (0.0, 0.0), + effective_radius: float = 0.6, + sersic_index: float = 4.0, + ): + """ + The spherical Sersic light profile. + + Parameters + ---------- + centre + The (y,x) arc-second coordinates of the profile centre. + intensity + Overall intensity normalisation of the light profile (units are dimensionless and derived from the data + the light profile's image is compared too, which is expected to be electrons per second). + effective_radius + The circular radius containing half the light of this profile. + sersic_index + Controls the concentration of the of the light profile. + """ + super().__init__( + centre=centre, + intensity=0.0, + effective_radius=effective_radius, + sersic_index=sersic_index, + ) + LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio) diff --git a/autogalaxy/profiles/mass/abstract/jax_utils.py b/autogalaxy/profiles/mass/abstract/jax_utils.py index 0b2eba439..9a20233aa 100644 --- a/autogalaxy/profiles/mass/abstract/jax_utils.py +++ b/autogalaxy/profiles/mass/abstract/jax_utils.py @@ -1,99 +1,99 @@ -import jax.numpy as jnp - -from jax import custom_jvp - - -r1_s1 = [2.5, 2, 1.5, 1, 0.5] - - -def reg1(z, _ , i_sqrt_pi): - v = z - for coef in r1_s1: - v = z - coef / v - return i_sqrt_pi / v - - -r2_s1 = [1.320522, 35.7668, 219.031, 1540.787, 3321.99, 36183.31] -r2_s2 = [1.841439, 61.57037, 364.2191, 2186.181, 9022.228, 24322.84, 32066.6] - - -def reg2(z, sqrt_pi, _): - mz2 = -z**2 - f1 = sqrt_pi - f2 = 1.0 - for s in r2_s1: - f1 = s - f1 * mz2 - for s in r2_s2: - f2 = s - f2 * mz2 - - return jnp.exp(mz2) + 1j * z * f1 / f2 - - -r3_s1 = [5.9126262, 30.180142, 93.15558, 181.92853, 214.38239, 122.60793] -r3_s2 = [10.479857, 53.992907, 170.35400, 348.70392, 457.33448, 352.73063, 122.60793] - - -def reg3(z, sqrt_pi, _): - miz = -1j * z - f1 = sqrt_pi - f2 = 1 - for s in r3_s1: - f1 = s + f1 * miz - for s in r3_s2: - f2 = s + f2 * miz - - return f1 / f2 - - -@custom_jvp -def w_f_approx(z): - """Compute the Faddeeva function :math:`w_{\\mathrm F}(z)` using the - approximation given in Zaghloul (2017). - - :param z: complex number - :type z: ``complex`` or ``numpy.array(dtype=complex)`` - :return: :math:`w_\\mathrm{F}(z)` - :rtype: ``complex`` - """ - sqrt_pi = 1 / jnp.sqrt(jnp.pi) - i_sqrt_pi = 1j * sqrt_pi - - z_imag2 = z.imag**2 - abs_z2 = z.real**2 + z_imag2 - - # use a single partial fraction approx for all large abs(z)**2 - # to have better approx of the auto-derivatives - r1 = (abs_z2 >= 62.0) | ((abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 >= 1e-13)) - # region bounds for 5 taken directly from Zaghloul (2017) - # https://dl.acm.org/doi/pdf/10.1145/3119904 - r2_1 = (abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 < 1e-13) - r2_2 = (abs_z2 >= 2.5) & (abs_z2 < 30.0) & (z_imag2 < 0.072) - r2 = r2_1 | r2_2 - r3 = jnp.logical_not(r1) & jnp.logical_not(r2) - - # exploit symmetry to avoid overflow in some regions - r_flip = z.imag < 0 - z_adjust = jnp.where(r_flip, -z, z) - two_exp_zz = 2 * jnp.exp(-z_adjust**2) - - args = (z_adjust, sqrt_pi, i_sqrt_pi) - wz = jnp.empty_like(z) - wz = jnp.where(r1, reg1(*args), wz) - wz = jnp.where(r2, reg2(*args), wz) - wz = jnp.where(r3, reg3(*args), wz) - - # exploit symmetry to avoid overflow in some regions - wz = jnp.where(r_flip, two_exp_zz - wz, wz) - - return wz - - -@w_f_approx.defjvp -def w_f_approx_jvp(primals, tangents): - # define a custom jvp to avoid the issue using `jnp.where` with `jax.grad` - z, = primals - z_dot, = tangents - primal_out = w_f_approx(z) - i_sqrt_pi = 1j / jnp.sqrt(jnp.pi) - tangent_out = z_dot * 2 * (i_sqrt_pi - z * primal_out) - return primal_out, tangent_out +import jax.numpy as jnp + +from jax import custom_jvp + + +r1_s1 = [2.5, 2, 1.5, 1, 0.5] + + +def reg1(z, _ , i_sqrt_pi): + v = z + for coef in r1_s1: + v = z - coef / v + return i_sqrt_pi / v + + +r2_s1 = [1.320522, 35.7668, 219.031, 1540.787, 3321.99, 36183.31] +r2_s2 = [1.841439, 61.57037, 364.2191, 2186.181, 9022.228, 24322.84, 32066.6] + + +def reg2(z, sqrt_pi, _): + mz2 = -z**2 + f1 = sqrt_pi + f2 = 1.0 + for s in r2_s1: + f1 = s - f1 * mz2 + for s in r2_s2: + f2 = s - f2 * mz2 + + return jnp.exp(mz2) + 1j * z * f1 / f2 + + +r3_s1 = [5.9126262, 30.180142, 93.15558, 181.92853, 214.38239, 122.60793] +r3_s2 = [10.479857, 53.992907, 170.35400, 348.70392, 457.33448, 352.73063, 122.60793] + + +def reg3(z, sqrt_pi, _): + miz = -1j * z + f1 = sqrt_pi + f2 = 1 + for s in r3_s1: + f1 = s + f1 * miz + for s in r3_s2: + f2 = s + f2 * miz + + return f1 / f2 + + +@custom_jvp +def w_f_approx(z): + """Compute the Faddeeva function :math:`w_{\\mathrm F}(z)` using the + approximation given in Zaghloul (2017). + + :param z: complex number + :type z: ``complex`` or ``numpy.array(dtype=complex)`` + :return: :math:`w_\\mathrm{F}(z)` + :rtype: ``complex`` + """ + sqrt_pi = 1 / jnp.sqrt(jnp.pi) + i_sqrt_pi = 1j * sqrt_pi + + z_imag2 = z.imag**2 + abs_z2 = z.real**2 + z_imag2 + + # use a single partial fraction approx for all large abs(z)**2 + # to have better approx of the auto-derivatives + r1 = (abs_z2 >= 62.0) | ((abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 >= 1e-13)) + # region bounds for 5 taken directly from Zaghloul (2017) + # https://dl.acm.org/doi/pdf/10.1145/3119904 + r2_1 = (abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 < 1e-13) + r2_2 = (abs_z2 >= 2.5) & (abs_z2 < 30.0) & (z_imag2 < 0.072) + r2 = r2_1 | r2_2 + r3 = jnp.logical_not(r1) & jnp.logical_not(r2) + + # exploit symmetry to avoid overflow in some regions + r_flip = z.imag < 0 + z_adjust = jnp.where(r_flip, -z, z) + two_exp_zz = 2 * jnp.exp(-z_adjust**2) + + args = (z_adjust, sqrt_pi, i_sqrt_pi) + wz = jnp.empty_like(z) + wz = jnp.where(r1, reg1(*args), wz) + wz = jnp.where(r2, reg2(*args), wz) + wz = jnp.where(r3, reg3(*args), wz) + + # exploit symmetry to avoid overflow in some regions + wz = jnp.where(r_flip, two_exp_zz - wz, wz) + + return wz + + +@w_f_approx.defjvp +def w_f_approx_jvp(primals, tangents): + # define a custom jvp to avoid the issue using `jnp.where` with `jax.grad` + z, = primals + z_dot, = tangents + primal_out = w_f_approx(z) + i_sqrt_pi = 1j / jnp.sqrt(jnp.pi) + tangent_out = z_dot * 2 * (i_sqrt_pi - z * primal_out) + return primal_out, tangent_out diff --git a/autogalaxy/profiles/mass/abstract/mge.py b/autogalaxy/profiles/mass/abstract/mge.py index 1958eb3ef..4ad78e82e 100644 --- a/autogalaxy/profiles/mass/abstract/mge.py +++ b/autogalaxy/profiles/mass/abstract/mge.py @@ -1,8 +1,8 @@ -import os - -if os.environ.get("USE_JAX", "0") == "1": - USING_JAX = True - from .mge_jax import MassProfileMGE -else: - USING_JAX = False - from .mge_numpy import MassProfileMGE +import os + +if os.environ.get("USE_JAX", "0") == "1": + USING_JAX = True + from .mge_jax import MassProfileMGE +else: + USING_JAX = False + from .mge_numpy import MassProfileMGE diff --git a/autogalaxy/profiles/mass/dark/nfw_hk24_util.py b/autogalaxy/profiles/mass/dark/nfw_hk24_util.py index 71bdce62c..2dceb9bf8 100644 --- a/autogalaxy/profiles/mass/dark/nfw_hk24_util.py +++ b/autogalaxy/profiles/mass/dark/nfw_hk24_util.py @@ -1,256 +1,256 @@ -""" -Created on Wed Apr 3 15:07:27 2024 - -@author: felixvecchi -""" - -import numpy as np -from astropy.cosmology import Planck15 - -cosmo = Planck15 - - -def semi_major_axis_from(x1: np.ndarray, x2: np.ndarray, e: np.ndarray) -> np.ndarray: - """ - Returns the semi-major axis of the ellipse at a given point. - - Parameters - ---------- - x1 - Horizontal coordinate, scaled by r_s, so unitless - x2 - Vertical coordinate, scaled by r_s, so unitless - e - Eccentricity. - """ - return np.sqrt(x1**2 + x2**2 / (1 - e**2)) - - -def capital_F_from(chi: np.ndarray) -> np.ndarray: - """ - Equation 16 from Heyrovský & Karamazov. - - Parameters - ---------- - chi - Dimenionless radial coordinate. - - Returns - ------- - F(chi) - """ - F = np.zeros(chi.shape) - - root_min = np.sqrt(1 - chi[chi < 1] ** 2) - F[chi < 1] = np.arctanh(root_min) / root_min - F[chi == 1] = 1 - root_plus = np.sqrt(chi[chi > 1] ** 2 - 1) - F[chi > 1] = np.arctan(root_plus) / root_plus - return F - - -def kappa_from(k_s: float, a: np.ndarray) -> np.ndarray: - """ - Equation 16 from Heyrovský & Karamazov. - - Parameters - ---------- - k_s - Halo convergence parameter. - a - Semi major axis scaled by a_scale. - - Returns - ------- - Convergence as a function of a - """ - F = capital_F_from(a) - kappa = 2 * k_s * (1 - F) / (a**2 - 1) - kappa[a == 1] = 2 / 3 * k_s - return kappa - - -def small_f_1(x1: np.ndarray, x2: np.ndarray, e: float) -> np.ndarray: - """ - Equation 32 HK+24 - - Parameters - ---------- - x1 - Horizontal coordinate, scaled by r_s, so unitless - x2 - Vertical coordinate, scaled by r_s, so unitless - e - Eccentricity. - - Returns - ------- - f_1 - """ - a = semi_major_axis_from(x1, x2, e) - F = capital_F_from(a) - f1 = (1 - e**2) ** (-1 / 2) * F - return f1 - - -def small_f_2(x1: np.ndarray, x2: np.ndarray, e: float) -> np.ndarray: - """ - Equation 32 HK+24 - - Parameters - ---------- - x1 - Horizontal coordinate, scaled by r_s, so unitless - x2 - Vertical coordinate, scaled by r_s, so unitless - e - Eccentricity. - - Returns - ------- - f_3 - - """ - norm = np.sqrt(x1**2 + x2**2) - f2 = np.log(norm / (1 + np.sqrt(1 - e**2))) - return f2 - - -def small_f_3(x1: np.ndarray, x2: np.ndarray, e: float) -> np.ndarray: - """ - Equation 32 HK+24 - - Parameters - ---------- - x1 - Horizontal coordinate, scaled by r_s, so unitless - x2 - Vertical coordinate, scaled by r_s, so unitless - e - Eccentricity. - - Returns - ------- - f_3 - - """ - root = np.sqrt(1 - e**2) - f3 = np.arctan(x1 * x2 * (1 - root) / (x1**2 * root + x2**2)) - return f3 - - -def small_f_0(x1: np.ndarray, x2: np.ndarray, e: float) -> np.ndarray: - """ - Equation 37 HK+24 - - Parameters - ---------- - x1 - Horizontal coordinate, scaled by r_s, so unitless - x2 - Vertical coordinate, scaled by r_s, so unitless - e - Eccentricity. - - Returns - ------- - f_0 - - """ - a = semi_major_axis_from(x1, x2, e) - F = capital_F_from(a) - pre_factor = 1 / (2 * np.sqrt(1 - e**2)) - nominator = x1**2 + x2**2 + e**2 - 2 + (1 - e**2 * x1**2) * F - denominator = 1 - x1**2 - x2**2 / (1 - e**2) - - f0 = 1 + pre_factor * (nominator / denominator) - - return f0 - - -def g1_g2_from(x1, x2, e, k_s): - """ - Both components of the shear - - Equation 35 and 36 HK+24 - - Parameters - ---------- - x1 : numpy array - horizontal coordinate, scaled by r_s, so unitless - x2 : numpy array - vertical coordinate, scaled by r_s, so unitless - e : scalar - eccentricity. - k_s : scaler - halo convergence parameter - - Returns - ------- - tuple of 2 numpy arrays - gamma1, gamma2 (g1 in '+' and g2 in 'x' shape) - """ - - # Factorized functions g1 and g2 - f0 = small_f_0(x1, x2, e) - f1 = small_f_1(x1, x2, e) - f2 = small_f_2(x1, x2, e) - f3 = small_f_3(x1, x2, e) - - # Prefactor for both g1 and g2 - full_pre_factor = ( - 4 - * k_s - * np.sqrt(1 - e**2) - / (((x1 - e) ** 2 + x2**2) ** 2 * ((x1 + e) ** 2 + x2**2) ** 2) - ) - - # Prefactors for g1 - pre_f0_g1 = ( - ((x1 - e) ** 2 + x2**2) * ((x1 + e) ** 2 + x2**2) * (x1**2 - x2**2 - e**2) - ) - - pre_f1_g1 = ( - 2 * e**2 * (x1**2 - 1) * ((x1**2 - x2**2 - e**2) ** 2 - 4 * x1**2 * x2**2) - - (x1**2 - x2**2 - e**2) ** 3 * (3 + e**2) / 2 - + 6 * x1**2 * x2**2 * (e**2 - 1) * (x1**2 - x2**2 - e**2) - ) - - pre_f2_g1 = -( - (x1**2 - x2**2 - e**2) * ((x1**2 + x2**2) ** 2 - e**4) - - 8 * e**2 * x1**2 * x2**2 - ) - - pre_f3_g1 = 2 * x1 * x2 * ((x1**2 + x2**2 + e**2) ** 2 - 4 * e**2 * (x2**2 + e**2)) - - # First component shear - g1 = full_pre_factor * ( - pre_f0_g1 * f0 + pre_f1_g1 * f1 + pre_f2_g1 * f2 + pre_f3_g1 * f3 - ) - - # Prefactors g2 - pre_f0_g2 = 2 * x1 * x2 * ((x1 - e) ** 2 + x2**2) * ((x1 + e) ** 2 + x2**2) - - pre_f1_g2 = ( - x1 - * x2 - * ( - (x1**2 + x2**2 + e**2) - * ((5 * e**2 - 3) * x1**2 - 3 * (1 + e**2) * x2**2 + (5 - 3 * e**2) * e**2) - - 4 * e**2 * x1**2 * (1 + e**2) - ) - ) - - pre_f2_g2 = -2 * x1 * x2 * ((x1**2 + x2**2 + e**2) ** 2 - 4 * e**2 * (x2**2 + e**2)) - - pre_f3_g2 = -( - (x1**2 - x2**2 - e**2) * ((x1**2 + x2**2) ** 2 - e**4) - - 8 * e**2 * x1**2 * x2**2 - ) - - # Second component shear - g2 = full_pre_factor * ( - pre_f0_g2 * f0 + pre_f1_g2 * f1 + pre_f2_g2 * f2 + pre_f3_g2 * f3 - ) - - return g1, g2 +""" +Created on Wed Apr 3 15:07:27 2024 + +@author: felixvecchi +""" + +import numpy as np +from astropy.cosmology import Planck15 + +cosmo = Planck15 + + +def semi_major_axis_from(x1: np.ndarray, x2: np.ndarray, e: np.ndarray) -> np.ndarray: + """ + Returns the semi-major axis of the ellipse at a given point. + + Parameters + ---------- + x1 + Horizontal coordinate, scaled by r_s, so unitless + x2 + Vertical coordinate, scaled by r_s, so unitless + e + Eccentricity. + """ + return np.sqrt(x1**2 + x2**2 / (1 - e**2)) + + +def capital_F_from(chi: np.ndarray) -> np.ndarray: + """ + Equation 16 from Heyrovský & Karamazov. + + Parameters + ---------- + chi + Dimenionless radial coordinate. + + Returns + ------- + F(chi) + """ + F = np.zeros(chi.shape) + + root_min = np.sqrt(1 - chi[chi < 1] ** 2) + F[chi < 1] = np.arctanh(root_min) / root_min + F[chi == 1] = 1 + root_plus = np.sqrt(chi[chi > 1] ** 2 - 1) + F[chi > 1] = np.arctan(root_plus) / root_plus + return F + + +def kappa_from(k_s: float, a: np.ndarray) -> np.ndarray: + """ + Equation 16 from Heyrovský & Karamazov. + + Parameters + ---------- + k_s + Halo convergence parameter. + a + Semi major axis scaled by a_scale. + + Returns + ------- + Convergence as a function of a + """ + F = capital_F_from(a) + kappa = 2 * k_s * (1 - F) / (a**2 - 1) + kappa[a == 1] = 2 / 3 * k_s + return kappa + + +def small_f_1(x1: np.ndarray, x2: np.ndarray, e: float) -> np.ndarray: + """ + Equation 32 HK+24 + + Parameters + ---------- + x1 + Horizontal coordinate, scaled by r_s, so unitless + x2 + Vertical coordinate, scaled by r_s, so unitless + e + Eccentricity. + + Returns + ------- + f_1 + """ + a = semi_major_axis_from(x1, x2, e) + F = capital_F_from(a) + f1 = (1 - e**2) ** (-1 / 2) * F + return f1 + + +def small_f_2(x1: np.ndarray, x2: np.ndarray, e: float) -> np.ndarray: + """ + Equation 32 HK+24 + + Parameters + ---------- + x1 + Horizontal coordinate, scaled by r_s, so unitless + x2 + Vertical coordinate, scaled by r_s, so unitless + e + Eccentricity. + + Returns + ------- + f_3 + + """ + norm = np.sqrt(x1**2 + x2**2) + f2 = np.log(norm / (1 + np.sqrt(1 - e**2))) + return f2 + + +def small_f_3(x1: np.ndarray, x2: np.ndarray, e: float) -> np.ndarray: + """ + Equation 32 HK+24 + + Parameters + ---------- + x1 + Horizontal coordinate, scaled by r_s, so unitless + x2 + Vertical coordinate, scaled by r_s, so unitless + e + Eccentricity. + + Returns + ------- + f_3 + + """ + root = np.sqrt(1 - e**2) + f3 = np.arctan(x1 * x2 * (1 - root) / (x1**2 * root + x2**2)) + return f3 + + +def small_f_0(x1: np.ndarray, x2: np.ndarray, e: float) -> np.ndarray: + """ + Equation 37 HK+24 + + Parameters + ---------- + x1 + Horizontal coordinate, scaled by r_s, so unitless + x2 + Vertical coordinate, scaled by r_s, so unitless + e + Eccentricity. + + Returns + ------- + f_0 + + """ + a = semi_major_axis_from(x1, x2, e) + F = capital_F_from(a) + pre_factor = 1 / (2 * np.sqrt(1 - e**2)) + nominator = x1**2 + x2**2 + e**2 - 2 + (1 - e**2 * x1**2) * F + denominator = 1 - x1**2 - x2**2 / (1 - e**2) + + f0 = 1 + pre_factor * (nominator / denominator) + + return f0 + + +def g1_g2_from(x1, x2, e, k_s): + """ + Both components of the shear + + Equation 35 and 36 HK+24 + + Parameters + ---------- + x1 : numpy array + horizontal coordinate, scaled by r_s, so unitless + x2 : numpy array + vertical coordinate, scaled by r_s, so unitless + e : scalar + eccentricity. + k_s : scaler + halo convergence parameter + + Returns + ------- + tuple of 2 numpy arrays + gamma1, gamma2 (g1 in '+' and g2 in 'x' shape) + """ + + # Factorized functions g1 and g2 + f0 = small_f_0(x1, x2, e) + f1 = small_f_1(x1, x2, e) + f2 = small_f_2(x1, x2, e) + f3 = small_f_3(x1, x2, e) + + # Prefactor for both g1 and g2 + full_pre_factor = ( + 4 + * k_s + * np.sqrt(1 - e**2) + / (((x1 - e) ** 2 + x2**2) ** 2 * ((x1 + e) ** 2 + x2**2) ** 2) + ) + + # Prefactors for g1 + pre_f0_g1 = ( + ((x1 - e) ** 2 + x2**2) * ((x1 + e) ** 2 + x2**2) * (x1**2 - x2**2 - e**2) + ) + + pre_f1_g1 = ( + 2 * e**2 * (x1**2 - 1) * ((x1**2 - x2**2 - e**2) ** 2 - 4 * x1**2 * x2**2) + - (x1**2 - x2**2 - e**2) ** 3 * (3 + e**2) / 2 + + 6 * x1**2 * x2**2 * (e**2 - 1) * (x1**2 - x2**2 - e**2) + ) + + pre_f2_g1 = -( + (x1**2 - x2**2 - e**2) * ((x1**2 + x2**2) ** 2 - e**4) + - 8 * e**2 * x1**2 * x2**2 + ) + + pre_f3_g1 = 2 * x1 * x2 * ((x1**2 + x2**2 + e**2) ** 2 - 4 * e**2 * (x2**2 + e**2)) + + # First component shear + g1 = full_pre_factor * ( + pre_f0_g1 * f0 + pre_f1_g1 * f1 + pre_f2_g1 * f2 + pre_f3_g1 * f3 + ) + + # Prefactors g2 + pre_f0_g2 = 2 * x1 * x2 * ((x1 - e) ** 2 + x2**2) * ((x1 + e) ** 2 + x2**2) + + pre_f1_g2 = ( + x1 + * x2 + * ( + (x1**2 + x2**2 + e**2) + * ((5 * e**2 - 3) * x1**2 - 3 * (1 + e**2) * x2**2 + (5 - 3 * e**2) * e**2) + - 4 * e**2 * x1**2 * (1 + e**2) + ) + ) + + pre_f2_g2 = -2 * x1 * x2 * ((x1**2 + x2**2 + e**2) ** 2 - 4 * e**2 * (x2**2 + e**2)) + + pre_f3_g2 = -( + (x1**2 - x2**2 - e**2) * ((x1**2 + x2**2) ** 2 - e**4) + - 8 * e**2 * x1**2 * x2**2 + ) + + # Second component shear + g2 = full_pre_factor * ( + pre_f0_g2 * f0 + pre_f1_g2 * f1 + pre_f2_g2 * f2 + pre_f3_g2 * f3 + ) + + return g1, g2 diff --git a/autogalaxy/profiles/mass/dark/nfw_virial_mass_conc.py b/autogalaxy/profiles/mass/dark/nfw_virial_mass_conc.py index ef890eead..5ca0d3590 100644 --- a/autogalaxy/profiles/mass/dark/nfw_virial_mass_conc.py +++ b/autogalaxy/profiles/mass/dark/nfw_virial_mass_conc.py @@ -1,92 +1,92 @@ -from typing import Tuple - -from autogalaxy.profiles.mass.dark.nfw import NFWSph - -from astropy import units - -import numpy as np -import warnings - -from autogalaxy.cosmology.wrap import Planck15 - - -def kappa_s_and_scale_radius( - virial_mass, concentration, virial_overdens, redshift_object, redshift_source -): - cosmology = Planck15() - - cosmic_average_density = ( - cosmology.critical_density(redshift_object).to(units.solMass / units.kpc**3) - ).value - - critical_surface_density = ( - cosmology.critical_surface_density_between_redshifts_solar_mass_per_kpc2_from( - redshift_0=redshift_object, redshift_1=redshift_source - ) - ) - - kpc_per_arcsec = cosmology.kpc_per_arcsec_from(redshift=redshift_object) - - virial_radius = ( - virial_mass / (virial_overdens * cosmic_average_density * (4.0 * np.pi / 3.0)) - ) ** ( - 1.0 / 3.0 - ) # r_vir - de_c = ( - virial_overdens - / 3.0 - * ( - concentration**3 - / (np.log(1.0 + concentration) - concentration / (1.0 + concentration)) - ) - ) # rho_c - - scale_radius_kpc = virial_radius / concentration # scale radius in kpc - rho_s = cosmic_average_density * de_c # rho_s - kappa_s = rho_s * scale_radius_kpc / critical_surface_density # kappa_s - scale_radius = scale_radius_kpc / kpc_per_arcsec # scale radius in arcsec - - return kappa_s, scale_radius, virial_radius - - -class NFWVirialMassConcSph(NFWSph): - def __init__( - self, - centre: Tuple[float, float] = (0.0, 0.0), - virial_mass: float = 1e12, - concentration: float = 10, - virial_overdens: float = 200, - redshift_object: float = 0.5, - redshift_source: float = 1.0, - ): - """ - Spherical NFW profile initialized with the mass and concentration of the halo. - - Parameters - ---------- - centre - The (y,x) arc-second coordinates of the profile centre. - virial_mass - The virial mass of the dark matter halo. - concentration - The concentration of the dark matter halo. - virial_overdens - The virial overdensity. - """ - self.virial_mass = virial_mass - self.concentration = concentration - self.virial_overdens = virial_overdens - - ( - kappa_s, - scale_radius, - virial_radius, - ) = kappa_s_and_scale_radius( - virial_mass=virial_mass, - concentration=concentration, - virial_overdens=virial_overdens, - redshift_object=redshift_object, - redshift_source=redshift_source, - ) - - super().__init__(centre=centre, kappa_s=kappa_s, scale_radius=scale_radius) +from typing import Tuple + +from autogalaxy.profiles.mass.dark.nfw import NFWSph + +from astropy import units + +import numpy as np +import warnings + +from autogalaxy.cosmology.wrap import Planck15 + + +def kappa_s_and_scale_radius( + virial_mass, concentration, virial_overdens, redshift_object, redshift_source +): + cosmology = Planck15() + + cosmic_average_density = ( + cosmology.critical_density(redshift_object).to(units.solMass / units.kpc**3) + ).value + + critical_surface_density = ( + cosmology.critical_surface_density_between_redshifts_solar_mass_per_kpc2_from( + redshift_0=redshift_object, redshift_1=redshift_source + ) + ) + + kpc_per_arcsec = cosmology.kpc_per_arcsec_from(redshift=redshift_object) + + virial_radius = ( + virial_mass / (virial_overdens * cosmic_average_density * (4.0 * np.pi / 3.0)) + ) ** ( + 1.0 / 3.0 + ) # r_vir + de_c = ( + virial_overdens + / 3.0 + * ( + concentration**3 + / (np.log(1.0 + concentration) - concentration / (1.0 + concentration)) + ) + ) # rho_c + + scale_radius_kpc = virial_radius / concentration # scale radius in kpc + rho_s = cosmic_average_density * de_c # rho_s + kappa_s = rho_s * scale_radius_kpc / critical_surface_density # kappa_s + scale_radius = scale_radius_kpc / kpc_per_arcsec # scale radius in arcsec + + return kappa_s, scale_radius, virial_radius + + +class NFWVirialMassConcSph(NFWSph): + def __init__( + self, + centre: Tuple[float, float] = (0.0, 0.0), + virial_mass: float = 1e12, + concentration: float = 10, + virial_overdens: float = 200, + redshift_object: float = 0.5, + redshift_source: float = 1.0, + ): + """ + Spherical NFW profile initialized with the mass and concentration of the halo. + + Parameters + ---------- + centre + The (y,x) arc-second coordinates of the profile centre. + virial_mass + The virial mass of the dark matter halo. + concentration + The concentration of the dark matter halo. + virial_overdens + The virial overdensity. + """ + self.virial_mass = virial_mass + self.concentration = concentration + self.virial_overdens = virial_overdens + + ( + kappa_s, + scale_radius, + virial_radius, + ) = kappa_s_and_scale_radius( + virial_mass=virial_mass, + concentration=concentration, + virial_overdens=virial_overdens, + redshift_object=redshift_object, + redshift_source=redshift_source, + ) + + super().__init__(centre=centre, kappa_s=kappa_s, scale_radius=scale_radius) diff --git a/autogalaxy/profiles/mass/total/jax_utils.py b/autogalaxy/profiles/mass/total/jax_utils.py index 5bed36c6c..5237f34cd 100644 --- a/autogalaxy/profiles/mass/total/jax_utils.py +++ b/autogalaxy/profiles/mass/total/jax_utils.py @@ -1,47 +1,47 @@ -import jax -import jax.numpy as jnp -from jax.tree_util import Partial as partial - - -# A version of scan that will *not* re-compile partial functions when variables change -# taken from https://github.com/google/jax/issues/14743#issuecomment-1456900634 -scan = jax.jit(jax.lax.scan, static_argnames=("length", "reverse", "unroll")) - - -def body_fun(carry, n, factor, ei2phi, slope): - omega_nm1, partial_sum = carry - two_n = 2 * n - two_minus_slope = 2 - slope - ratio = (two_n - two_minus_slope) / (two_n + two_minus_slope) - omega_n = -factor * ratio * ei2phi * omega_nm1 - partial_sum = partial_sum + omega_n - return (omega_n, partial_sum), None - - -def omega(eiphi, slope, factor, n_terms=20): - """JAX implementation of the numerical evaluation of the angular component of - the complex deflection angle for the elliptical power law profile as given as - given by Tessore and Metcalf 2015. Based on equation 29, and gives - omega (e.g. can be used as a drop in replacement for the exp(i * phi) * special.hyp2f1 - term in equation 13). - - Parameters - ---------- - eiphi: - `exp(i * phi)` where `phi` is the elliptical angle of the profile - slope: - The density slope of the power-law (lower value -> shallower profile, higher value - -> steeper profile). - factor: - The second flattening of and ellipse with axis ration q give by `f = (1 - q) / (1 + q)` - n_terms: - The number of terms to calculate for the series expansion, defaults to 20 (this should - be sufficient most of the time) - """ - # use modified scan with a partial'ed function to avoid re-compile - (_, partial_sum), _ = scan( - partial(body_fun, factor=factor, ei2phi=eiphi**2, slope=slope), - (eiphi, eiphi), - jnp.arange(1, n_terms), - ) - return partial_sum +import jax +import jax.numpy as jnp +from jax.tree_util import Partial as partial + + +# A version of scan that will *not* re-compile partial functions when variables change +# taken from https://github.com/google/jax/issues/14743#issuecomment-1456900634 +scan = jax.jit(jax.lax.scan, static_argnames=("length", "reverse", "unroll")) + + +def body_fun(carry, n, factor, ei2phi, slope): + omega_nm1, partial_sum = carry + two_n = 2 * n + two_minus_slope = 2 - slope + ratio = (two_n - two_minus_slope) / (two_n + two_minus_slope) + omega_n = -factor * ratio * ei2phi * omega_nm1 + partial_sum = partial_sum + omega_n + return (omega_n, partial_sum), None + + +def omega(eiphi, slope, factor, n_terms=20): + """JAX implementation of the numerical evaluation of the angular component of + the complex deflection angle for the elliptical power law profile as given as + given by Tessore and Metcalf 2015. Based on equation 29, and gives + omega (e.g. can be used as a drop in replacement for the exp(i * phi) * special.hyp2f1 + term in equation 13). + + Parameters + ---------- + eiphi: + `exp(i * phi)` where `phi` is the elliptical angle of the profile + slope: + The density slope of the power-law (lower value -> shallower profile, higher value + -> steeper profile). + factor: + The second flattening of and ellipse with axis ration q give by `f = (1 - q) / (1 + q)` + n_terms: + The number of terms to calculate for the series expansion, defaults to 20 (this should + be sufficient most of the time) + """ + # use modified scan with a partial'ed function to avoid re-compile + (_, partial_sum), _ = scan( + partial(body_fun, factor=factor, ei2phi=eiphi**2, slope=slope), + (eiphi, eiphi), + jnp.arange(1, n_terms), + ) + return partial_sum diff --git a/eden.ini b/eden.ini index d16b30eb0..a22a58033 100644 --- a/eden.ini +++ b/eden.ini @@ -1,3 +1,3 @@ -[eden] -name=autogalaxy -prefix=ag +[eden] +name=autogalaxy +prefix=ag diff --git a/optional_requirements.txt b/optional_requirements.txt index 8f0a11171..5633b5068 100644 --- a/optional_requirements.txt +++ b/optional_requirements.txt @@ -1,8 +1,8 @@ -numba -pylops>=1.10.0,<=2.3.1 -pynufft -ultranest==3.6.2 -zeus-mcmc==2.5.4 -getdist==1.4 -#jax>=0.4.13 +numba +pylops>=1.10.0,<=2.3.1 +pynufft +ultranest==3.6.2 +zeus-mcmc==2.5.4 +getdist==1.4 +#jax>=0.4.13 #jaxlib>=0.4.13 \ No newline at end of file diff --git a/test_autogalaxy/config/general.yaml b/test_autogalaxy/config/general.yaml index 26e205c6b..184efbab5 100644 --- a/test_autogalaxy/config/general.yaml +++ b/test_autogalaxy/config/general.yaml @@ -1,41 +1,41 @@ -analysis: - n_cores: 1 -fits: - flip_for_ds9: true -grid: - remove_projected_centre: false -inversion: - check_reconstruction: false # If True, the inversion's reconstruction is checked to ensure the solution of a meshs's mapper is not an invalid solution where the values are all the same. - use_positive_only_solver: false # If True, inversion's use a positive-only linear algebra solver by default, which is slower but prevents unphysical negative values in the reconstructed solutuion. - no_regularization_add_to_curvature_diag_value: 1.0e-8 # The default value added to the curvature matrix's diagonal when regularization is not applied to a linear object, which prevents inversion's failing due to the matrix being singular. - positive_only_uses_p_initial: false # If True, the positive-only solver of an inversion's uses an initial guess of the reconstructed data's values as which values should be positive, speeding up the solver. - use_border_relocator: false # If True, by default a pixelization's border is used to relocate all pixels outside its border to the border. -hpc: - hpc_mode: false - iterations_per_update: 5000 -adapt: - adapt_minimum_percent: 0.01 - adapt_noise_limit: 100000000.0 -model: - ignore_prior_limits: true -numba: - cache: true - nopython: true - parallel: false - use_numba: true -output: - force_pickle_overwrite: false - info_whitespace_length: 80 - log_file: output.log - log_level: INFO - log_to_file: false - model_results_decimal_places: 3 - remove_files: false - samples_to_csv: false -pixelization: - voronoi_nn_max_interpolation_neighbors: 300 -structures: - native_binned_only: false # If True, data structures are only stored in their native and binned format. This is used to reduce memory usage in autocti. -test: - check_likelihood_function: false # if True, when a search is resumed the likelihood of a previous sample is recalculated to ensure it is consistent with the previous run. +analysis: + n_cores: 1 +fits: + flip_for_ds9: true +grid: + remove_projected_centre: false +inversion: + check_reconstruction: false # If True, the inversion's reconstruction is checked to ensure the solution of a meshs's mapper is not an invalid solution where the values are all the same. + use_positive_only_solver: false # If True, inversion's use a positive-only linear algebra solver by default, which is slower but prevents unphysical negative values in the reconstructed solutuion. + no_regularization_add_to_curvature_diag_value: 1.0e-8 # The default value added to the curvature matrix's diagonal when regularization is not applied to a linear object, which prevents inversion's failing due to the matrix being singular. + positive_only_uses_p_initial: false # If True, the positive-only solver of an inversion's uses an initial guess of the reconstructed data's values as which values should be positive, speeding up the solver. + use_border_relocator: false # If True, by default a pixelization's border is used to relocate all pixels outside its border to the border. +hpc: + hpc_mode: false + iterations_per_update: 5000 +adapt: + adapt_minimum_percent: 0.01 + adapt_noise_limit: 100000000.0 +model: + ignore_prior_limits: true +numba: + cache: true + nopython: true + parallel: false + use_numba: true +output: + force_pickle_overwrite: false + info_whitespace_length: 80 + log_file: output.log + log_level: INFO + log_to_file: false + model_results_decimal_places: 3 + remove_files: false + samples_to_csv: false +pixelization: + voronoi_nn_max_interpolation_neighbors: 300 +structures: + native_binned_only: false # If True, data structures are only stored in their native and binned format. This is used to reduce memory usage in autocti. +test: + check_likelihood_function: false # if True, when a search is resumed the likelihood of a previous sample is recalculated to ensure it is consistent with the previous run. exception_override: true \ No newline at end of file diff --git a/test_autogalaxy/config/grids.yaml b/test_autogalaxy/config/grids.yaml index fc0c3dbac..7bdb9f566 100644 --- a/test_autogalaxy/config/grids.yaml +++ b/test_autogalaxy/config/grids.yaml @@ -1,233 +1,233 @@ -interpolate: - convergence_2d_from: - Isothermal: false - IsothermalSph: true - deflections_yx_2d_from: - Isothermal: false - IsothermalSph: true - image_2d_from: - sersic: false - sersicSph: true - potential_2d_from: - Isothermal: false - IsothermalSph: true -# Certain light and mass profile calculations become ill defined at (0.0, 0.0) or close to this value. This can lead -# to numerical issues in the calculation of the profile, for example a np.nan may arise, crashing the code. - -# To avoid this, we set a minimum value for the radial coordinate of the profile. If the radial coordinate is below -# this value, it is rounded up to this value. This ensures that the profile cannot receive a radial coordinate of 0.0. - -# For example, if an input grid coordinate has a radial coordinate of 1e-12, for most profiles this will be rounded up -# to radial_minimum=1e-08. This is a small enough value that it should not impact the results of the profile calculation. - -radial_minimum: - radial_minimum: - MockGridRadialMinimum: 2.5 - MockIsothermal: 0.0001 - MockIsothermalSph: 0.03 - Chameleon: 0.0001 - ChameleonSph: 0.0001 - DevVaucouleurs: 0.0001 - DevVaucouleursSph: 0.0001 - ExponentialGradient: 0.0001 - ElsonFreeFall: 0.0001 - ElsonFreeFallSph: 0.0001 - Exponential: 0.0001 - ExponentialCore: 0.0001 - ExponentialCoreSph: 0.0001 - ExponentialSph: 0.0001 - ExternalShear: 0.0001 - Gaussian: 0.0001 - GaussianSph: 0.0001 - gNFW: 0.0001 - gNFWMCRLudlow: 0.0001 - gNFWSph: 0.0001 - Isothermal: 0.0001 - IsothermalCore: 0.0001 - IsothermalCoreSph: 0.0001 - IsothermalSph: 0.0001 - MassSheet: 0.0001 - Moffat: 0.0001 - MoffatSph: 0.0001 - NFW: 0.0001 - NFWMCRDuffySph: 0.0001 - NFWMCRLudlow: 0.0001 - NFWMCRLudlowSph: 0.0001 - NFWMCRScatterLudlow: 0.0001 - NFWMCRScatterLudlowSph: 0.0001 - NFWSph: 0.0001 - NFWTruncatedMCRDuffySph: 0.0001 - NFWTruncatedMCRLudlowSph: 0.0001 - NFWTruncatedMCRScatterLudlowSph: 0.0001 - NFWTruncatedSph: 0.0001 - PointMass: 0.0001 - PowerLaw: 0.0001 - PowerLawBroken: 0.0001 - PowerLawBrokenSph: 0.0001 - PowerLawCore: 0.0001 - PowerLawCoreSph: 0.0001 - PowerLawSph: 0.0001 - Sersic: 0.0001 - SersicCore: 0.0001 - SersicCoreSph: 0.0001 - SersicGradient: 0.0001 - SersicSph: 0.0001 - ExponentialGradientSph: 0.0001 - SersicGradientSph: 0.0001 - EllProfile: 0.0001 - SersicAdaptTest: 0.0001 - - -# Over sampling is an important numerical technique, whereby light profiles images are evaluated on a higher resolution -# grid than the image data to ensure the calculation is accurate. - -# By default, a user does not specify the over sampling factor, and a default over sampling scheme is used for each -# profile. This scheme first goes to the centre of the profile, and computes circles with certain radial values -# (e.g. radii). It then assigns an over sampling `sub_size` to each circle, where the central circles have the highest -# over sampling factor and the outer circles have the lowest. - -# The size of the circles that are appropriate for determining the over sampling factor are dependent on the resolution -# of the grid. For a high resolution grid (e.g. low pixel scale), a smaller circle central circle is necessary to -# over sample the profile accurately. The config file below therefore specifies the "radial factors" used for -# automatically determining the over sampling factors for each profile, which is the factor the pixel scale is multiplied -# by to determine the circle size. - -# The config entry below defines the default over sampling factor for each profile, where: - -# radial_factor_list: The factors that are multiplied by the pixel scale to determine the circle size that is used. -# sub_size_list: The over sampling factor that is used for each circle size. - -# For the default entries below, oversampling of degree 32 x 32 is used within a circle of radius 3.01 x pixel scale, -# 4 x 4 within a circle of radius 10.01 x pixel scale and 2 x 2 for all pixels outside of this radius. - -over_sampling: - radial_factor_list: - Chameleon: [1.0] - ChameleonSph: [1.0] - DevVaucouleurs: [1.0] - DevVaucouleursSph: [1.0] - dPIE: [1.0] - dPIESph: [1.0] - ExponentialRadialGradient: [1.0] - ExponentialRadialGradientSph: [1.0] - ElsonFreeFall: [1.0] - ElsonFreeFallSph: [1.0] - Exponential: [1.0] - ExponentialCore: [1.0] - ExponentialCoreSph: [1.0] - ExponentialSph: [1.0] - ExternalShear: [1.0] - Gaussian: [1.0] - GaussianSph: [1.0] - gNFW: [1.0] - gNFWMCRLudlow: [1.0] - gNFWVirialMassConcSph: [1.0] - gNFWSph: [1.0] - Isothermal: [1.0] - IsothermalCore: [1.0] - IsothermalCoreSph: [1.0] - IsothermalSph: [1.0] - MassSheet: [1.0] - Moffat: [1.0] - MoffatSph: [1.0] - PowerLawMultipole: [1.0] - NFW: [1.0] - NFWMCRDuffySph: [1.0] - NFWMCRLudlow: [1.0] - NFWMCRLudlowSph: [1.0] - NFWMCRScatterLudlow: [1.0] - NFWMCRScatterLudlowSph: [1.0] - NFWVirialMassConcSph: [1.0] - NFWSph: [1.0] - NFWTruncatedMCRDuffySph: [1.0] - NFWTruncatedMCRLudlowSph: [1.0] - NFWTruncatedMCRScatterLudlowSph: [1.0] - NFWTruncatedSph: [1.0] - PointMass: [1.0] - PowerLaw: [1.0] - PowerLawBroken: [1.0] - PowerLawBrokenSph: [1.0] - PowerLawCore: [1.0] - PowerLawCoreSph: [1.0] - PowerLawSph: [1.0] - Sersic: [1.0] - SersicCore: [1.0] - SersicCoreSph: [1.0] - SersicRadialGradient: [1.0] - SersicSph: [1.0] - SersicRadialGradientSph: [1.0] - ShapeletCartesianSph: [1.0] - ShapeletCartesian: [1.0] - ShapeletPolarSph: [1.0] - ShapeletPolar: [1.0] - ShapeletExponentialSph: [1.0] - ShapeletExponential: [1.0] - SMBH: [1.0] - SMBHBinary: [1.0] - EllProfile: [1.0] - SersicAdaptTest: [0.1] - sub_size_list: - Chameleon: [1, 1] - ChameleonSph: [1, 1] - DevVaucouleurs: [1, 1] - DevVaucouleursSph: [1, 1] - dPIE: [1, 1] - dPIESph: [1, 1] - ExponentialRadialGradient: [1, 1] - ExponentialRadialGradientSph: [1, 1] - ElsonFreeFall: [1, 1] - ElsonFreeFallSph: [1, 1] - Exponential: [1, 1] - ExponentialCore: [1, 1] - ExponentialCoreSph: [1, 1] - ExponentialSph: [1, 1] - ExternalShear: [1, 1] - Gaussian: [1, 1] - GaussianSph: [1, 1] - gNFW: [1, 1] - gNFWMCRLudlow: [1, 1] - gNFWVirialMassConcSph: [1, 1] - gNFWSph: [1, 1] - Isothermal: [1, 1] - IsothermalCore: [1, 1] - IsothermalCoreSph: [1, 1] - IsothermalSph: [1, 1] - MassSheet: [1, 1] - Moffat: [1, 1] - MoffatSph: [1, 1] - PowerLawMultipole: [1, 1] - NFW: [1, 1] - NFWMCRDuffySph: [1, 1] - NFWMCRLudlow: [1, 1] - NFWMCRLudlowSph: [1, 1] - NFWMCRScatterLudlow: [1, 1] - NFWMCRScatterLudlowSph: [1, 1] - NFWVirialMassConcSph : [1, 1] - NFWSph: [1, 1] - NFWTruncatedMCRDuffySph: [1, 1] - NFWTruncatedMCRLudlowSph: [1, 1] - NFWTruncatedMCRScatterLudlowSph: [1, 1] - NFWTruncatedSph: [1, 1] - PointMass: [1, 1] - PowerLaw: [1, 1] - PowerLawBroken: [1, 1] - PowerLawBrokenSph: [1, 1] - PowerLawCore: [1, 1] - PowerLawCoreSph: [1, 1] - PowerLawSph: [1, 1] - Sersic: [1, 1] - SersicCore: [1, 1] - SersicCoreSph: [1, 1] - SersicRadialGradient: [1, 1] - SersicSph: [1, 1] - SersicRadialGradientSph: [1, 1] - ShapeletCartesianSph: [1, 1] - ShapeletCartesian: [1, 1] - ShapeletPolarSph: [1, 1] - ShapeletPolar: [1, 1] - ShapeletExponentialSph: [1, 1] - ShapeletExponential: [1, 1] - SMBH: [1, 1] - SMBHBinary: [1, 1] - EllProfile: [1, 1] +interpolate: + convergence_2d_from: + Isothermal: false + IsothermalSph: true + deflections_yx_2d_from: + Isothermal: false + IsothermalSph: true + image_2d_from: + sersic: false + sersicSph: true + potential_2d_from: + Isothermal: false + IsothermalSph: true +# Certain light and mass profile calculations become ill defined at (0.0, 0.0) or close to this value. This can lead +# to numerical issues in the calculation of the profile, for example a np.nan may arise, crashing the code. + +# To avoid this, we set a minimum value for the radial coordinate of the profile. If the radial coordinate is below +# this value, it is rounded up to this value. This ensures that the profile cannot receive a radial coordinate of 0.0. + +# For example, if an input grid coordinate has a radial coordinate of 1e-12, for most profiles this will be rounded up +# to radial_minimum=1e-08. This is a small enough value that it should not impact the results of the profile calculation. + +radial_minimum: + radial_minimum: + MockGridRadialMinimum: 2.5 + MockIsothermal: 0.0001 + MockIsothermalSph: 0.03 + Chameleon: 0.0001 + ChameleonSph: 0.0001 + DevVaucouleurs: 0.0001 + DevVaucouleursSph: 0.0001 + ExponentialGradient: 0.0001 + ElsonFreeFall: 0.0001 + ElsonFreeFallSph: 0.0001 + Exponential: 0.0001 + ExponentialCore: 0.0001 + ExponentialCoreSph: 0.0001 + ExponentialSph: 0.0001 + ExternalShear: 0.0001 + Gaussian: 0.0001 + GaussianSph: 0.0001 + gNFW: 0.0001 + gNFWMCRLudlow: 0.0001 + gNFWSph: 0.0001 + Isothermal: 0.0001 + IsothermalCore: 0.0001 + IsothermalCoreSph: 0.0001 + IsothermalSph: 0.0001 + MassSheet: 0.0001 + Moffat: 0.0001 + MoffatSph: 0.0001 + NFW: 0.0001 + NFWMCRDuffySph: 0.0001 + NFWMCRLudlow: 0.0001 + NFWMCRLudlowSph: 0.0001 + NFWMCRScatterLudlow: 0.0001 + NFWMCRScatterLudlowSph: 0.0001 + NFWSph: 0.0001 + NFWTruncatedMCRDuffySph: 0.0001 + NFWTruncatedMCRLudlowSph: 0.0001 + NFWTruncatedMCRScatterLudlowSph: 0.0001 + NFWTruncatedSph: 0.0001 + PointMass: 0.0001 + PowerLaw: 0.0001 + PowerLawBroken: 0.0001 + PowerLawBrokenSph: 0.0001 + PowerLawCore: 0.0001 + PowerLawCoreSph: 0.0001 + PowerLawSph: 0.0001 + Sersic: 0.0001 + SersicCore: 0.0001 + SersicCoreSph: 0.0001 + SersicGradient: 0.0001 + SersicSph: 0.0001 + ExponentialGradientSph: 0.0001 + SersicGradientSph: 0.0001 + EllProfile: 0.0001 + SersicAdaptTest: 0.0001 + + +# Over sampling is an important numerical technique, whereby light profiles images are evaluated on a higher resolution +# grid than the image data to ensure the calculation is accurate. + +# By default, a user does not specify the over sampling factor, and a default over sampling scheme is used for each +# profile. This scheme first goes to the centre of the profile, and computes circles with certain radial values +# (e.g. radii). It then assigns an over sampling `sub_size` to each circle, where the central circles have the highest +# over sampling factor and the outer circles have the lowest. + +# The size of the circles that are appropriate for determining the over sampling factor are dependent on the resolution +# of the grid. For a high resolution grid (e.g. low pixel scale), a smaller circle central circle is necessary to +# over sample the profile accurately. The config file below therefore specifies the "radial factors" used for +# automatically determining the over sampling factors for each profile, which is the factor the pixel scale is multiplied +# by to determine the circle size. + +# The config entry below defines the default over sampling factor for each profile, where: + +# radial_factor_list: The factors that are multiplied by the pixel scale to determine the circle size that is used. +# sub_size_list: The over sampling factor that is used for each circle size. + +# For the default entries below, oversampling of degree 32 x 32 is used within a circle of radius 3.01 x pixel scale, +# 4 x 4 within a circle of radius 10.01 x pixel scale and 2 x 2 for all pixels outside of this radius. + +over_sampling: + radial_factor_list: + Chameleon: [1.0] + ChameleonSph: [1.0] + DevVaucouleurs: [1.0] + DevVaucouleursSph: [1.0] + dPIE: [1.0] + dPIESph: [1.0] + ExponentialRadialGradient: [1.0] + ExponentialRadialGradientSph: [1.0] + ElsonFreeFall: [1.0] + ElsonFreeFallSph: [1.0] + Exponential: [1.0] + ExponentialCore: [1.0] + ExponentialCoreSph: [1.0] + ExponentialSph: [1.0] + ExternalShear: [1.0] + Gaussian: [1.0] + GaussianSph: [1.0] + gNFW: [1.0] + gNFWMCRLudlow: [1.0] + gNFWVirialMassConcSph: [1.0] + gNFWSph: [1.0] + Isothermal: [1.0] + IsothermalCore: [1.0] + IsothermalCoreSph: [1.0] + IsothermalSph: [1.0] + MassSheet: [1.0] + Moffat: [1.0] + MoffatSph: [1.0] + PowerLawMultipole: [1.0] + NFW: [1.0] + NFWMCRDuffySph: [1.0] + NFWMCRLudlow: [1.0] + NFWMCRLudlowSph: [1.0] + NFWMCRScatterLudlow: [1.0] + NFWMCRScatterLudlowSph: [1.0] + NFWVirialMassConcSph: [1.0] + NFWSph: [1.0] + NFWTruncatedMCRDuffySph: [1.0] + NFWTruncatedMCRLudlowSph: [1.0] + NFWTruncatedMCRScatterLudlowSph: [1.0] + NFWTruncatedSph: [1.0] + PointMass: [1.0] + PowerLaw: [1.0] + PowerLawBroken: [1.0] + PowerLawBrokenSph: [1.0] + PowerLawCore: [1.0] + PowerLawCoreSph: [1.0] + PowerLawSph: [1.0] + Sersic: [1.0] + SersicCore: [1.0] + SersicCoreSph: [1.0] + SersicRadialGradient: [1.0] + SersicSph: [1.0] + SersicRadialGradientSph: [1.0] + ShapeletCartesianSph: [1.0] + ShapeletCartesian: [1.0] + ShapeletPolarSph: [1.0] + ShapeletPolar: [1.0] + ShapeletExponentialSph: [1.0] + ShapeletExponential: [1.0] + SMBH: [1.0] + SMBHBinary: [1.0] + EllProfile: [1.0] + SersicAdaptTest: [0.1] + sub_size_list: + Chameleon: [1, 1] + ChameleonSph: [1, 1] + DevVaucouleurs: [1, 1] + DevVaucouleursSph: [1, 1] + dPIE: [1, 1] + dPIESph: [1, 1] + ExponentialRadialGradient: [1, 1] + ExponentialRadialGradientSph: [1, 1] + ElsonFreeFall: [1, 1] + ElsonFreeFallSph: [1, 1] + Exponential: [1, 1] + ExponentialCore: [1, 1] + ExponentialCoreSph: [1, 1] + ExponentialSph: [1, 1] + ExternalShear: [1, 1] + Gaussian: [1, 1] + GaussianSph: [1, 1] + gNFW: [1, 1] + gNFWMCRLudlow: [1, 1] + gNFWVirialMassConcSph: [1, 1] + gNFWSph: [1, 1] + Isothermal: [1, 1] + IsothermalCore: [1, 1] + IsothermalCoreSph: [1, 1] + IsothermalSph: [1, 1] + MassSheet: [1, 1] + Moffat: [1, 1] + MoffatSph: [1, 1] + PowerLawMultipole: [1, 1] + NFW: [1, 1] + NFWMCRDuffySph: [1, 1] + NFWMCRLudlow: [1, 1] + NFWMCRLudlowSph: [1, 1] + NFWMCRScatterLudlow: [1, 1] + NFWMCRScatterLudlowSph: [1, 1] + NFWVirialMassConcSph : [1, 1] + NFWSph: [1, 1] + NFWTruncatedMCRDuffySph: [1, 1] + NFWTruncatedMCRLudlowSph: [1, 1] + NFWTruncatedMCRScatterLudlowSph: [1, 1] + NFWTruncatedSph: [1, 1] + PointMass: [1, 1] + PowerLaw: [1, 1] + PowerLawBroken: [1, 1] + PowerLawBrokenSph: [1, 1] + PowerLawCore: [1, 1] + PowerLawCoreSph: [1, 1] + PowerLawSph: [1, 1] + Sersic: [1, 1] + SersicCore: [1, 1] + SersicCoreSph: [1, 1] + SersicRadialGradient: [1, 1] + SersicSph: [1, 1] + SersicRadialGradientSph: [1, 1] + ShapeletCartesianSph: [1, 1] + ShapeletCartesian: [1, 1] + ShapeletPolarSph: [1, 1] + ShapeletPolar: [1, 1] + ShapeletExponentialSph: [1, 1] + ShapeletExponential: [1, 1] + SMBH: [1, 1] + SMBHBinary: [1, 1] + EllProfile: [1, 1] SersicAdaptTest: [8, 1] \ No newline at end of file diff --git a/test_autogalaxy/config/lensing.yaml b/test_autogalaxy/config/lensing.yaml index 9d68e82f6..f98be8aba 100644 --- a/test_autogalaxy/config/lensing.yaml +++ b/test_autogalaxy/config/lensing.yaml @@ -1,11 +1,11 @@ -general: - calculation_grid: - convergence_threshold: 0.1 - pixels: 81 -grids: - radial_minimum: - radial_minimum: - isothermal: 0.01 - isothermalsph: 0.01 - mockisothermal: 0.01 - mockisothermalsph: 0.01 +general: + calculation_grid: + convergence_threshold: 0.1 + pixels: 81 +grids: + radial_minimum: + radial_minimum: + isothermal: 0.01 + isothermalsph: 0.01 + mockisothermal: 0.01 + mockisothermalsph: 0.01 diff --git a/test_autogalaxy/config/non_linear.yaml b/test_autogalaxy/config/non_linear.yaml index f4788e591..415e4e616 100644 --- a/test_autogalaxy/config/non_linear.yaml +++ b/test_autogalaxy/config/non_linear.yaml @@ -1,107 +1,107 @@ -GridSearch: - general: - number_of_cores: 2 - step_size: 0.1 -mcmc: - Emcee: - auto_correlations: - change_threshold: 0.01 - check_for_convergence: true - check_size: 100 - required_length: 50 - initialize: - ball_lower_limit: 0.49 - ball_upper_limit: 0.51 - method: ball - parallel: - number_of_cores: 1 - printing: - silence: false - run: - nsteps: 2000 - search: - nwalkers: 50 - updates: - iterations_per_update: 2500 - remove_state_files_at_end: true -mock: - MockMLEr: - initialize: - method: prior - printing: - silence: false - updates: - iterations_per_update: 2500 - remove_state_files_at_end: true - MockSearch: - initialize: - method: prior - printing: - silence: false - search: {} - updates: - iterations_per_update: 2500 - remove_state_files_at_end: true -nest: - DynestyDynamic: - initialize: - method: prior - parallel: - force_x1_cpu: false - number_of_cores: 1 - printing: - silence: false - search: - bootstrap: null - bound: multi - enlarge: null - evidence_tolerance: 0.01 - first_update: null - fmove: 0.9 - logl_max: .inf - max_move: 100 - maxcall: null - maxcall_init: null - maxiter: null - maxiter_init: null - n_effective_init: 0 - sample: auto - sampling_efficiency: 0.5 - slices: 5 - update_interval: null - walks: 25 - settings: - stagger_resampling_likelihood: false - updates: - iterations_per_update: 2500 - remove_state_files_at_end: true - DynestyStatic: - initialize: - method: prior - parallel: - number_of_cores: 1 - printing: - silence: false - search: - bootstrap: null - bound: multi - dlogz: -1.0 - enlarge: null - facc: 0.5 - first_update: null - fmove: 0.9 - logl_max: .inf - max_move: 0 - maxcall: null - maxiter: null - n_effective: 0 - nlive: 150 - sample: auto - slices: 5 - update_interval: null - walks: 5 - settings: - stagger_resampling_likelihood: false - updates: - iterations_per_update: 2500 - remove_state_files_at_end: true +GridSearch: + general: + number_of_cores: 2 + step_size: 0.1 +mcmc: + Emcee: + auto_correlations: + change_threshold: 0.01 + check_for_convergence: true + check_size: 100 + required_length: 50 + initialize: + ball_lower_limit: 0.49 + ball_upper_limit: 0.51 + method: ball + parallel: + number_of_cores: 1 + printing: + silence: false + run: + nsteps: 2000 + search: + nwalkers: 50 + updates: + iterations_per_update: 2500 + remove_state_files_at_end: true +mock: + MockMLEr: + initialize: + method: prior + printing: + silence: false + updates: + iterations_per_update: 2500 + remove_state_files_at_end: true + MockSearch: + initialize: + method: prior + printing: + silence: false + search: {} + updates: + iterations_per_update: 2500 + remove_state_files_at_end: true +nest: + DynestyDynamic: + initialize: + method: prior + parallel: + force_x1_cpu: false + number_of_cores: 1 + printing: + silence: false + search: + bootstrap: null + bound: multi + enlarge: null + evidence_tolerance: 0.01 + first_update: null + fmove: 0.9 + logl_max: .inf + max_move: 100 + maxcall: null + maxcall_init: null + maxiter: null + maxiter_init: null + n_effective_init: 0 + sample: auto + sampling_efficiency: 0.5 + slices: 5 + update_interval: null + walks: 25 + settings: + stagger_resampling_likelihood: false + updates: + iterations_per_update: 2500 + remove_state_files_at_end: true + DynestyStatic: + initialize: + method: prior + parallel: + number_of_cores: 1 + printing: + silence: false + search: + bootstrap: null + bound: multi + dlogz: -1.0 + enlarge: null + facc: 0.5 + first_update: null + fmove: 0.9 + logl_max: .inf + max_move: 0 + maxcall: null + maxiter: null + n_effective: 0 + nlive: 150 + sample: auto + slices: 5 + update_interval: null + walks: 5 + settings: + stagger_resampling_likelihood: false + updates: + iterations_per_update: 2500 + remove_state_files_at_end: true diff --git a/test_autogalaxy/config/notation.yaml b/test_autogalaxy/config/notation.yaml index eaf0f0594..a17a55800 100644 --- a/test_autogalaxy/config/notation.yaml +++ b/test_autogalaxy/config/notation.yaml @@ -1,83 +1,83 @@ -label: - label: - alpha: \alpha - angle_binary: \theta - beta: \beta - break_radius: \theta_{\rm B} - centre_0: y - centre_1: x - coefficient: \lambda - core_radius: C_{\rm r} - core_radius_0: C_{rm r0} - core_radius_1: C_{\rm r1} - effective_radius: R_{\rm eff} - einstein_radius: \theta_{\rm Ein} - ell_comps_0: \epsilon_{\rm 1} - ell_comps_1: \epsilon_{\rm 2} - multipole_comps_0: M_{\rm 1} - multipole_comps_1: M_{\rm 2} - flux: F - gamma: \gamma - gamma_1: \gamma - gamma_2: \gamma - inner_coefficient: \lambda_{\rm 1} - inner_slope: t_{\rm 1} - intensity: I_{\rm b} - kappa: \kappa - kappa_s: \kappa_{\rm s} - log10m_vir: log_{\rm 10}(m_{vir}) - m: m - mass: M - mass_at_200: M_{\rm 200} - mass_ratio: M_{\rm ratio} - mass_to_light_gradient: \Gamma - mass_to_light_ratio: \Psi - mass_to_light_ratio_base: \Psi_{\rm base} - mass_to_light_radius: R_{\rm ref} - noise_factor: \omega_{\rm 1} - noise_power: \omega{\rm 2} - noise_scale: \sigma_{\rm 1} - normalization_scale: n - outer_coefficient: \lambda_{\rm 2} - outer_slope: t_{\rm 2} - overdens: \Delta_{\rm vir} - pixels: N_{\rm pix} - radius_break: R_{\rm b} - redshift: z - redshift_object: z_{\rm obj} - redshift_source: z_{\rm src} - scale_radius: R_{\rm s} - scatter: \sigma - separation: s - sersic_index: n - shape_0: y_{\rm pix} - shape_1: x_{\rm pix} - sigma: \sigma - signal_scale: V - sky_scale: \sigma_{\rm 0} - slope: \gamma - truncation_radius: R_{\rm t} - weight_floor: W_{\rm f} - weight_power: W_{\rm p} - superscript: - externalshear: ext - inputdeflections: defl - pixelization: pix - point: point - redshift: '' - regularization: reg -label_format: - format: - angular_diameter_distance_to_earth: '{:.2f}' - concentration: '{:.2f}' - einstein_mass: '{:.4e}' - einstein_radius: '{:.2f}' - kpc_per_arcsec: '{:.2f}' - luminosity: '{:.4e}' - m: '{:.1f}' - mass: '{:.4e}' - mass_at_truncation_radius: '{:.4e}' - radius: '{:.2f}' - redshift: '{:.2f}' - rho: '{:.2f}' - sersic_luminosity: '{:.4e}' +label: + label: + alpha: \alpha + angle_binary: \theta + beta: \beta + break_radius: \theta_{\rm B} + centre_0: y + centre_1: x + coefficient: \lambda + core_radius: C_{\rm r} + core_radius_0: C_{rm r0} + core_radius_1: C_{\rm r1} + effective_radius: R_{\rm eff} + einstein_radius: \theta_{\rm Ein} + ell_comps_0: \epsilon_{\rm 1} + ell_comps_1: \epsilon_{\rm 2} + multipole_comps_0: M_{\rm 1} + multipole_comps_1: M_{\rm 2} + flux: F + gamma: \gamma + gamma_1: \gamma + gamma_2: \gamma + inner_coefficient: \lambda_{\rm 1} + inner_slope: t_{\rm 1} + intensity: I_{\rm b} + kappa: \kappa + kappa_s: \kappa_{\rm s} + log10m_vir: log_{\rm 10}(m_{vir}) + m: m + mass: M + mass_at_200: M_{\rm 200} + mass_ratio: M_{\rm ratio} + mass_to_light_gradient: \Gamma + mass_to_light_ratio: \Psi + mass_to_light_ratio_base: \Psi_{\rm base} + mass_to_light_radius: R_{\rm ref} + noise_factor: \omega_{\rm 1} + noise_power: \omega{\rm 2} + noise_scale: \sigma_{\rm 1} + normalization_scale: n + outer_coefficient: \lambda_{\rm 2} + outer_slope: t_{\rm 2} + overdens: \Delta_{\rm vir} + pixels: N_{\rm pix} + radius_break: R_{\rm b} + redshift: z + redshift_object: z_{\rm obj} + redshift_source: z_{\rm src} + scale_radius: R_{\rm s} + scatter: \sigma + separation: s + sersic_index: n + shape_0: y_{\rm pix} + shape_1: x_{\rm pix} + sigma: \sigma + signal_scale: V + sky_scale: \sigma_{\rm 0} + slope: \gamma + truncation_radius: R_{\rm t} + weight_floor: W_{\rm f} + weight_power: W_{\rm p} + superscript: + externalshear: ext + inputdeflections: defl + pixelization: pix + point: point + redshift: '' + regularization: reg +label_format: + format: + angular_diameter_distance_to_earth: '{:.2f}' + concentration: '{:.2f}' + einstein_mass: '{:.4e}' + einstein_radius: '{:.2f}' + kpc_per_arcsec: '{:.2f}' + luminosity: '{:.4e}' + m: '{:.1f}' + mass: '{:.4e}' + mass_at_truncation_radius: '{:.4e}' + radius: '{:.2f}' + redshift: '{:.2f}' + rho: '{:.2f}' + sersic_luminosity: '{:.4e}' diff --git a/test_autogalaxy/config/output.yaml b/test_autogalaxy/config/output.yaml index 5cb8812dc..4a44b384b 100644 --- a/test_autogalaxy/config/output.yaml +++ b/test_autogalaxy/config/output.yaml @@ -1,63 +1,63 @@ -# Determines whether files saved by the search are output to the hard-disk. This is true both when saving to the -# directory structure and when saving to database. - -# Files can be listed name: bool where the name is the name of the file without a suffix (e.g. model not model.json) -# and bool is true or false. - -# If a given file is not listed then the default value is used. - -default: true # If true then files which are not explicitly listed here are output anyway. If false then they are not. - -### Samples ### - -# The `samples.csv`file contains every sampled value of every free parameter with its log likelihood and weight. - -# This file is often large, therefore disabling it can significantly reduce hard-disk space use. - -# `samples.csv` is used to perform marginalization, infer model parameter errors and do other analysis of the search -# chains. Even if output of `samples.csv` is disabled, these tasks are still performed by the fit and output to -# the `samples_summary.json` file. However, without a `samples.csv` file these types of tasks cannot be performed -# after the fit is complete, for example via the database. - -samples: true - -# The `samples.csv` file contains every accepted sampled value of every free parameter with its log likelihood and -# weight. For certain searches, the majority of samples have a very low weight, which has no numerical impact on the -# results of the model-fit. However, these samples are still output to the `samples.csv` file, taking up hard-disk space -# and slowing down analysis of the samples (e.g. via the database). - -# The `samples_weight_threshold` below specifies the threshold value of the weight such that samples with a weight -# below this value are not output to the `samples.csv` file. This can be used to reduce the size of the `samples.csv` -# file and speed up analysis of the samples. - -# Note that for many searches (e.g. MCMC) all samples have equal weight, and thus this threshold has no impact and -# there is no simple way to save hard-disk space. However, for nested sampling, the majority of samples have a very -# low weight and this threshold can be used to save hard-disk space. - -# Set value to empty (e.g. delete 1.0e-10 below) to disable this feature. - -samples_weight_threshold: 1.0e-10 - -### Search Internal ### - -# The search internal folder which contains a saved state of the non-linear search, as a .pickle or .dill file. - -# If the entry below is false, the folder is still output during the model-fit, as it is required to resume the fit -# from where it left off. Therefore, settings `false` below does not impact model-fitting checkpointing and resumption. -# Instead, the search internal folder is deleted once the fit is completed. - -# The search internal folder file is often large, therefore deleting it after a fit is complete can significantly -# reduce hard-disk space use. - -# The search internal representation (e.g. what you can load from the output .pickle file) may have additional -# quantities specific to the non-linear search that you are interested in inspecting. Deleting the folder means this -# information is list. - -search_internal: false - -# Other Files: - -covariance: false # `covariance.csv`: The [free parameters x free parameters] covariance matrix. -data: true # `data.json`: The value of every data point in the data. -noise_map: true # `noise_map.json`: The value of every RMS noise map value. - +# Determines whether files saved by the search are output to the hard-disk. This is true both when saving to the +# directory structure and when saving to database. + +# Files can be listed name: bool where the name is the name of the file without a suffix (e.g. model not model.json) +# and bool is true or false. + +# If a given file is not listed then the default value is used. + +default: true # If true then files which are not explicitly listed here are output anyway. If false then they are not. + +### Samples ### + +# The `samples.csv`file contains every sampled value of every free parameter with its log likelihood and weight. + +# This file is often large, therefore disabling it can significantly reduce hard-disk space use. + +# `samples.csv` is used to perform marginalization, infer model parameter errors and do other analysis of the search +# chains. Even if output of `samples.csv` is disabled, these tasks are still performed by the fit and output to +# the `samples_summary.json` file. However, without a `samples.csv` file these types of tasks cannot be performed +# after the fit is complete, for example via the database. + +samples: true + +# The `samples.csv` file contains every accepted sampled value of every free parameter with its log likelihood and +# weight. For certain searches, the majority of samples have a very low weight, which has no numerical impact on the +# results of the model-fit. However, these samples are still output to the `samples.csv` file, taking up hard-disk space +# and slowing down analysis of the samples (e.g. via the database). + +# The `samples_weight_threshold` below specifies the threshold value of the weight such that samples with a weight +# below this value are not output to the `samples.csv` file. This can be used to reduce the size of the `samples.csv` +# file and speed up analysis of the samples. + +# Note that for many searches (e.g. MCMC) all samples have equal weight, and thus this threshold has no impact and +# there is no simple way to save hard-disk space. However, for nested sampling, the majority of samples have a very +# low weight and this threshold can be used to save hard-disk space. + +# Set value to empty (e.g. delete 1.0e-10 below) to disable this feature. + +samples_weight_threshold: 1.0e-10 + +### Search Internal ### + +# The search internal folder which contains a saved state of the non-linear search, as a .pickle or .dill file. + +# If the entry below is false, the folder is still output during the model-fit, as it is required to resume the fit +# from where it left off. Therefore, settings `false` below does not impact model-fitting checkpointing and resumption. +# Instead, the search internal folder is deleted once the fit is completed. + +# The search internal folder file is often large, therefore deleting it after a fit is complete can significantly +# reduce hard-disk space use. + +# The search internal representation (e.g. what you can load from the output .pickle file) may have additional +# quantities specific to the non-linear search that you are interested in inspecting. Deleting the folder means this +# information is list. + +search_internal: false + +# Other Files: + +covariance: false # `covariance.csv`: The [free parameters x free parameters] covariance matrix. +data: true # `data.json`: The value of every data point in the data. +noise_map: true # `noise_map.json`: The value of every RMS noise map value. + diff --git a/test_autogalaxy/config/text.yaml b/test_autogalaxy/config/text.yaml index e5f604ce1..9803defba 100644 --- a/test_autogalaxy/config/text.yaml +++ b/test_autogalaxy/config/text.yaml @@ -1,11 +1,11 @@ -label_format: - format: - mass: '{:.4e}' - mass_value: mass_value - param0: '{:.2f}' - param00: '{:.2f}' - param000: '{:.2f}' - param11: '{:.4f}' - param12: '{:.2e}' - radius: '{:.2f}' - radius_value: radius_value +label_format: + format: + mass: '{:.4e}' + mass_value: mass_value + param0: '{:.2f}' + param00: '{:.2f}' + param000: '{:.2f}' + param11: '{:.4f}' + param12: '{:.2e}' + radius: '{:.2f}' + radius_value: radius_value diff --git a/test_autogalaxy/config/visualize.yaml b/test_autogalaxy/config/visualize.yaml index 2b170d7c2..419056a4d 100644 --- a/test_autogalaxy/config/visualize.yaml +++ b/test_autogalaxy/config/visualize.yaml @@ -1,447 +1,447 @@ -general: - general: - backend: default - imshow_origin: upper - zoom_around_mask: true -include: - include_1d: - einstein_radius: true - half_light_radius: true - include_2d: - border: false - tangential_caustics: false - radial_caustics: false - tangential_critical_curves: false - radial_critical_curves: false - grid: false - light_profile_centres: true - mapper_image_plane_mesh_grid: false - mapper_source_plane_data_grid: false - mapper_source_plane_mesh_grid: false - mask: true - mass_profile_centres: true - multiple_images: false - origin: true - parallel_overscan: true - positions: true - serial_overscan: true - serial_prescan: true -mat_wrap: - Axis: - figure: - emit: true - subplot: - emit: false - Cmap: - figure: - cmap: default - linscale: 2.0 - linthresh: 1.0 - norm: linear - vmax: null - vmin: null - subplot: - cmap: default - linscale: 2.0 - linthresh: 1.0 - norm: linear - vmax: null - vmin: null - Colorbar: - figure: - fraction: 3.0 - pad: 4.0 - subplot: - fraction: 0.1 - pad: 0.2 - ColorbarTickParams: - figure: - labelsize: 1 - subplot: - labelsize: 1 - Figure: - figure: - aspect: square - figsize: (7,7) - subplot: - aspect: square - figsize: auto - Legend: - figure: - fontsize: 12 - include: true - subplot: - fontsize: 13 - include: false - Text: - figure: - fontsize: 16 - subplot: - fontsize: 10 - TickParams: - figure: - labelsize: 16 - subplot: - labelsize: 10 - Title: - figure: - fontsize: 11 - subplot: - fontsize: 15 - XLabel: - figure: - fontsize: 3 - subplot: - fontsize: 4 - XTicks: - figure: - fontsize: 17 - subplot: - fontsize: 11 - YLabel: - figure: - fontsize: 1 - subplot: - fontsize: 2 - YTicks: - figure: - fontsize: 16 - subplot: - fontsize: 10 -mat_wrap_1d: - AXVLine: - figure: - c: k - ymin: 0.5 - subplot: - c: k - ymin: 0.6 - FillBetween: - figure: - alpha: 0.6 - color: k - subplot: - alpha: 0.5 - color: k - YXPlot: - figure: - c: k - linestyle: '-' - linewidth: 3 - subplot: - c: k - linestyle: '-' - linewidth: 1 - YXScatter: - figure: - c: k - marker: . - subplot: - c: k - marker: x - EinsteinRadiusAXVLine: - figure: {} - subplot: {} - HalfLightRadiusAXVLine: - figure: {} - subplot: {} -mat_wrap_2d: - ArrayOverlay: - figure: - alpha: 0.5 - subplot: - alpha: 0.7 - BorderScatter: - figure: - c: c - marker: + - s: 13 - subplot: - c: k - marker: . - s: 7 - GridErrorbar: - figure: - c: k - marker: o - subplot: - c: b - marker: . - GridPlot: - figure: - c: k - linestyle: '-' - linewidth: 3 - subplot: - c: k - linestyle: '-' - linewidth: 1 - GridScatter: - figure: - c: y - marker: x - s: 14 - subplot: - c: r - marker: . - s: 6 - IndexScatter: - figure: - c: r,g,b,y,k,w - marker: . - s: 20 - subplot: - c: r,g,b,y,w,k - marker: + - s: 21 - MaskScatter: - figure: - c: g - marker: . - s: 12 - subplot: - c: w - marker: . - s: 8 - MeshGridScatter: - figure: - c: r - marker: . - s: 5 - subplot: - c: g - marker: o - s: 6 - OriginScatter: - figure: - c: k - marker: x - s: 80 - subplot: - c: r - marker: . - s: 81 - ParallelOverscanPlot: - figure: - c: k - linestyle: '-' - linewidth: 1 - subplot: - c: k - linestyle: '-' - linewidth: 1 - PatchOverlay: - figure: - edgecolor: c - facecolor: null - subplot: - edgecolor: y - facecolor: null - PositionsScatter: - figure: - c: r,g,b - marker: o - s: 15 - subplot: - c: c,g,b - marker: . - s: 5 - SerialOverscanPlot: - figure: - c: k - linestyle: '-' - linewidth: 2 - subplot: - c: k - linestyle: '-' - linewidth: 1 - SerialPrescanPlot: - figure: - c: k - linestyle: '-' - linewidth: 3 - subplot: - c: k - linestyle: '-' - linewidth: 1 - VectorYXQuiver: - figure: - alpha: 1.0 - angles: xy - headlength: 0 - headwidth: 1 - linewidth: 5 - pivot: middle - units: xy - subplot: - alpha: 1.1 - angles: xy1 - headlength: 0.1 - headwidth: 11 - linewidth: 51 - pivot: middle1 - units: xy1 - VoronoiDrawer: - figure: - alpha: 0.7 - edgecolor: k - linewidth: 0.3 - subplot: - alpha: 0.5 - edgecolor: r - linewidth: 1.0 - TangentialCausticsPlot: - figure: - c: w,g - pointsize: 21 - style: -- - width: 5 - subplot: - c: g - pointsize: 23 - style: -- - width: 7 - TangentialCriticalCurvesPlot: - figure: - c: w,k - pointsize: 20 - style: '-' - width: 4 - subplot: - c: b - pointsize: 22 - style: '-' - width: 6 - RadialCausticsPlot: - figure: - c: w,g - pointsize: 21 - style: -- - width: 5 - subplot: - c: g - pointsize: 23 - style: -- - width: 7 - RadialCriticalCurvesPlot: - figure: - c: w,k - pointsize: 20 - style: '-' - width: 4 - subplot: - c: b - pointsize: 22 - style: '-' - width: 6 - LightProfileCentresScatter: - figure: - c: k,r - marker: + - s: 1 - subplot: - c: b - marker: . - s: 15 - MassProfileCentresScatter: - figure: - c: r,k - marker: x - s: 2 - subplot: - c: k - marker: o - s: 16 - MultipleImagesScatter: - figure: - c: k,w - marker: o - s: 3 - subplot: - c: g - marker: . - s: 17 -plots: - dataset: - data: true - noise_map: false - signal_to_noise_map: false - subplot_dataset: true - fit: - all_at_end_fits: true - all_at_end_png: false - chi_squared_map: true - data: true - model_data: true - model_images_of_galaxies: false - noise_map: false - normalized_residual_map: true - residual_map: false - signal_to_noise_map: false - subplot_fit: true - subplot_of_galaxies: false - subtracted_images_of_galaxies: true - fit_imaging: {} - fit_interferometer: - amplitudes_vs_uv_distances: false - dirty_chi_squared_map: false - dirty_image: false - dirty_noise_map: false - dirty_normalized_residual_map: false - dirty_residual_map: false - dirty_signal_to_noise_map: false - phases_vs_uv_distances: false - uv_wavelengths: false - fit_quantity: - all_at_end_fits: false - all_at_end_png: false - chi_squared_map: false - image: true - model_image: true - noise_map: false - normalized_residual_map: false - residual_map: false - subplot_fit: false - galaxies_1d: - convergence: false - image: true - potential: true - adapt: - images_of_galaxies: true - model_image: true - imaging: - psf: true - interferometer: - amplitudes_vs_uv_distances: false - dirty_image: false - dirty_noise_map: false - dirty_signal_to_noise_map: false - phases_vs_uv_distances: false - uv_wavelengths: false - inversion: - all_at_end_png: false - chi_squared_map: true - errors: false - interpolated_errors: true - interpolated_reconstruction: true - normalized_residual_map: false - reconstructed_image: true - reconstruction: true - regularization_weights: false - residual_map: false - subplot_inversion: true - other: - stochastic_histogram: false - galaxies: - all_at_end_fits: true - all_at_end_png: false - convergence: true - deflections: false - image: true - magnification: true - potential: false - source_plane_image: true - subplot_galaxies: true - subplot_galaxy_images: true - positions: - image_with_positions: true +general: + general: + backend: default + imshow_origin: upper + zoom_around_mask: true +include: + include_1d: + einstein_radius: true + half_light_radius: true + include_2d: + border: false + tangential_caustics: false + radial_caustics: false + tangential_critical_curves: false + radial_critical_curves: false + grid: false + light_profile_centres: true + mapper_image_plane_mesh_grid: false + mapper_source_plane_data_grid: false + mapper_source_plane_mesh_grid: false + mask: true + mass_profile_centres: true + multiple_images: false + origin: true + parallel_overscan: true + positions: true + serial_overscan: true + serial_prescan: true +mat_wrap: + Axis: + figure: + emit: true + subplot: + emit: false + Cmap: + figure: + cmap: default + linscale: 2.0 + linthresh: 1.0 + norm: linear + vmax: null + vmin: null + subplot: + cmap: default + linscale: 2.0 + linthresh: 1.0 + norm: linear + vmax: null + vmin: null + Colorbar: + figure: + fraction: 3.0 + pad: 4.0 + subplot: + fraction: 0.1 + pad: 0.2 + ColorbarTickParams: + figure: + labelsize: 1 + subplot: + labelsize: 1 + Figure: + figure: + aspect: square + figsize: (7,7) + subplot: + aspect: square + figsize: auto + Legend: + figure: + fontsize: 12 + include: true + subplot: + fontsize: 13 + include: false + Text: + figure: + fontsize: 16 + subplot: + fontsize: 10 + TickParams: + figure: + labelsize: 16 + subplot: + labelsize: 10 + Title: + figure: + fontsize: 11 + subplot: + fontsize: 15 + XLabel: + figure: + fontsize: 3 + subplot: + fontsize: 4 + XTicks: + figure: + fontsize: 17 + subplot: + fontsize: 11 + YLabel: + figure: + fontsize: 1 + subplot: + fontsize: 2 + YTicks: + figure: + fontsize: 16 + subplot: + fontsize: 10 +mat_wrap_1d: + AXVLine: + figure: + c: k + ymin: 0.5 + subplot: + c: k + ymin: 0.6 + FillBetween: + figure: + alpha: 0.6 + color: k + subplot: + alpha: 0.5 + color: k + YXPlot: + figure: + c: k + linestyle: '-' + linewidth: 3 + subplot: + c: k + linestyle: '-' + linewidth: 1 + YXScatter: + figure: + c: k + marker: . + subplot: + c: k + marker: x + EinsteinRadiusAXVLine: + figure: {} + subplot: {} + HalfLightRadiusAXVLine: + figure: {} + subplot: {} +mat_wrap_2d: + ArrayOverlay: + figure: + alpha: 0.5 + subplot: + alpha: 0.7 + BorderScatter: + figure: + c: c + marker: + + s: 13 + subplot: + c: k + marker: . + s: 7 + GridErrorbar: + figure: + c: k + marker: o + subplot: + c: b + marker: . + GridPlot: + figure: + c: k + linestyle: '-' + linewidth: 3 + subplot: + c: k + linestyle: '-' + linewidth: 1 + GridScatter: + figure: + c: y + marker: x + s: 14 + subplot: + c: r + marker: . + s: 6 + IndexScatter: + figure: + c: r,g,b,y,k,w + marker: . + s: 20 + subplot: + c: r,g,b,y,w,k + marker: + + s: 21 + MaskScatter: + figure: + c: g + marker: . + s: 12 + subplot: + c: w + marker: . + s: 8 + MeshGridScatter: + figure: + c: r + marker: . + s: 5 + subplot: + c: g + marker: o + s: 6 + OriginScatter: + figure: + c: k + marker: x + s: 80 + subplot: + c: r + marker: . + s: 81 + ParallelOverscanPlot: + figure: + c: k + linestyle: '-' + linewidth: 1 + subplot: + c: k + linestyle: '-' + linewidth: 1 + PatchOverlay: + figure: + edgecolor: c + facecolor: null + subplot: + edgecolor: y + facecolor: null + PositionsScatter: + figure: + c: r,g,b + marker: o + s: 15 + subplot: + c: c,g,b + marker: . + s: 5 + SerialOverscanPlot: + figure: + c: k + linestyle: '-' + linewidth: 2 + subplot: + c: k + linestyle: '-' + linewidth: 1 + SerialPrescanPlot: + figure: + c: k + linestyle: '-' + linewidth: 3 + subplot: + c: k + linestyle: '-' + linewidth: 1 + VectorYXQuiver: + figure: + alpha: 1.0 + angles: xy + headlength: 0 + headwidth: 1 + linewidth: 5 + pivot: middle + units: xy + subplot: + alpha: 1.1 + angles: xy1 + headlength: 0.1 + headwidth: 11 + linewidth: 51 + pivot: middle1 + units: xy1 + VoronoiDrawer: + figure: + alpha: 0.7 + edgecolor: k + linewidth: 0.3 + subplot: + alpha: 0.5 + edgecolor: r + linewidth: 1.0 + TangentialCausticsPlot: + figure: + c: w,g + pointsize: 21 + style: -- + width: 5 + subplot: + c: g + pointsize: 23 + style: -- + width: 7 + TangentialCriticalCurvesPlot: + figure: + c: w,k + pointsize: 20 + style: '-' + width: 4 + subplot: + c: b + pointsize: 22 + style: '-' + width: 6 + RadialCausticsPlot: + figure: + c: w,g + pointsize: 21 + style: -- + width: 5 + subplot: + c: g + pointsize: 23 + style: -- + width: 7 + RadialCriticalCurvesPlot: + figure: + c: w,k + pointsize: 20 + style: '-' + width: 4 + subplot: + c: b + pointsize: 22 + style: '-' + width: 6 + LightProfileCentresScatter: + figure: + c: k,r + marker: + + s: 1 + subplot: + c: b + marker: . + s: 15 + MassProfileCentresScatter: + figure: + c: r,k + marker: x + s: 2 + subplot: + c: k + marker: o + s: 16 + MultipleImagesScatter: + figure: + c: k,w + marker: o + s: 3 + subplot: + c: g + marker: . + s: 17 +plots: + dataset: + data: true + noise_map: false + signal_to_noise_map: false + subplot_dataset: true + fit: + all_at_end_fits: true + all_at_end_png: false + chi_squared_map: true + data: true + model_data: true + model_images_of_galaxies: false + noise_map: false + normalized_residual_map: true + residual_map: false + signal_to_noise_map: false + subplot_fit: true + subplot_of_galaxies: false + subtracted_images_of_galaxies: true + fit_imaging: {} + fit_interferometer: + amplitudes_vs_uv_distances: false + dirty_chi_squared_map: false + dirty_image: false + dirty_noise_map: false + dirty_normalized_residual_map: false + dirty_residual_map: false + dirty_signal_to_noise_map: false + phases_vs_uv_distances: false + uv_wavelengths: false + fit_quantity: + all_at_end_fits: false + all_at_end_png: false + chi_squared_map: false + image: true + model_image: true + noise_map: false + normalized_residual_map: false + residual_map: false + subplot_fit: false + galaxies_1d: + convergence: false + image: true + potential: true + adapt: + images_of_galaxies: true + model_image: true + imaging: + psf: true + interferometer: + amplitudes_vs_uv_distances: false + dirty_image: false + dirty_noise_map: false + dirty_signal_to_noise_map: false + phases_vs_uv_distances: false + uv_wavelengths: false + inversion: + all_at_end_png: false + chi_squared_map: true + errors: false + interpolated_errors: true + interpolated_reconstruction: true + normalized_residual_map: false + reconstructed_image: true + reconstruction: true + regularization_weights: false + residual_map: false + subplot_inversion: true + other: + stochastic_histogram: false + galaxies: + all_at_end_fits: true + all_at_end_png: false + convergence: true + deflections: false + image: true + magnification: true + potential: false + source_plane_image: true + subplot_galaxies: true + subplot_galaxy_images: true + positions: + image_with_positions: true diff --git a/test_autogalaxy/profiles/test_dict.py b/test_autogalaxy/profiles/test_dict.py index cf55fc14d..53b4fad06 100644 --- a/test_autogalaxy/profiles/test_dict.py +++ b/test_autogalaxy/profiles/test_dict.py @@ -1,34 +1,34 @@ -import pytest -from autoconf.dictable import to_dict, from_dict - -import autogalaxy as ag -from autogalaxy.profiles.geometry_profiles import GeometryProfile - - -@pytest.fixture(name="ell_sersic") -def make_ell_sersic(): - return ag.mp.Sersic() - - -@pytest.fixture(name="ell_sersic_dict") -def make_ell_sersic_dict(): - return { - "type": "instance", - "class_path": "autogalaxy.profiles.mass.stellar.sersic.Sersic", - "arguments": { - "centre": {"type": "tuple", "values": [0.0, 0.0]}, - "ell_comps": {"type": "tuple", "values": [0.0, 0.0]}, - "intensity": 0.1, - "effective_radius": 0.6, - "sersic_index": 0.6, - "mass_to_light_ratio": 1.0, - }, - } - - -def test__to_dict(ell_sersic, ell_sersic_dict): - assert to_dict(ell_sersic) == ell_sersic_dict - - -def test__from_dict(ell_sersic, ell_sersic_dict): - assert ell_sersic == from_dict(ell_sersic_dict) +import pytest +from autoconf.dictable import to_dict, from_dict + +import autogalaxy as ag +from autogalaxy.profiles.geometry_profiles import GeometryProfile + + +@pytest.fixture(name="ell_sersic") +def make_ell_sersic(): + return ag.mp.Sersic() + + +@pytest.fixture(name="ell_sersic_dict") +def make_ell_sersic_dict(): + return { + "type": "instance", + "class_path": "autogalaxy.profiles.mass.stellar.sersic.Sersic", + "arguments": { + "centre": {"type": "tuple", "values": [0.0, 0.0]}, + "ell_comps": {"type": "tuple", "values": [0.0, 0.0]}, + "intensity": 0.1, + "effective_radius": 0.6, + "sersic_index": 0.6, + "mass_to_light_ratio": 1.0, + }, + } + + +def test__to_dict(ell_sersic, ell_sersic_dict): + assert to_dict(ell_sersic) == ell_sersic_dict + + +def test__from_dict(ell_sersic, ell_sersic_dict): + assert ell_sersic == from_dict(ell_sersic_dict) diff --git a/test_autogalaxy/test_regression.py b/test_autogalaxy/test_regression.py index 2f4bb5c54..a3466f95e 100644 --- a/test_autogalaxy/test_regression.py +++ b/test_autogalaxy/test_regression.py @@ -1,76 +1,76 @@ -import pytest - -from autogalaxy import Galaxy -from autogalaxy.abstract_fit import AbstractFitInversion -import autofit as af -import autoarray as aa -from autogalaxy.profiles.light.linear import LightProfileLinear, Sersic - - -class FitInversion(AbstractFitInversion): - def __init__( - self, model_obj, settings_inversion: aa.SettingsInversion, light_profiles - ): - super().__init__(model_obj=model_obj, settings_inversion=settings_inversion) - self.light_profiles = light_profiles - - @property - def linear_light_profile_intensity_dict(self): - return {light_profile: 1.0 for light_profile in self.light_profiles} - - -@pytest.fixture(name="light_profile") -def make_light_profile(): - return Sersic() - - -def test_no_modify_state(light_profile): - model_obj = af.ModelInstance( - { - "galaxies": af.ModelInstance( - { - "galaxy": Galaxy( - redshift=0.5, - light_profile=light_profile, - ) - } - ) - } - ) - - fit_inversion = FitInversion( - model_obj=model_obj, - settings_inversion=aa.SettingsInversion(use_linear_operators=True), - light_profiles=[light_profile], - ) - result = fit_inversion.model_obj_linear_light_profiles_to_light_profiles - - assert result.galaxies.galaxy.light_profile is not light_profile - assert model_obj.galaxies.galaxy.light_profile is light_profile - - -@pytest.fixture(name="path") -def make_path(): - return "galaxies", 0, "light_profile" - - -@pytest.fixture(name="model_obj") -def make_model_obj(light_profile): - return af.ModelInstance( - { - "galaxies": [ - Galaxy( - redshift=0.5, - light_profile=light_profile, - ) - ] - } - ) - - -def test_list_galaxies(model_obj, path): - assert model_obj.path_instance_tuples_for_class((LightProfileLinear,))[0][0] == path - - -def test_object_from_path(model_obj, path, light_profile): - assert model_obj.object_for_path(path) == light_profile +import pytest + +from autogalaxy import Galaxy +from autogalaxy.abstract_fit import AbstractFitInversion +import autofit as af +import autoarray as aa +from autogalaxy.profiles.light.linear import LightProfileLinear, Sersic + + +class FitInversion(AbstractFitInversion): + def __init__( + self, model_obj, settings_inversion: aa.SettingsInversion, light_profiles + ): + super().__init__(model_obj=model_obj, settings_inversion=settings_inversion) + self.light_profiles = light_profiles + + @property + def linear_light_profile_intensity_dict(self): + return {light_profile: 1.0 for light_profile in self.light_profiles} + + +@pytest.fixture(name="light_profile") +def make_light_profile(): + return Sersic() + + +def test_no_modify_state(light_profile): + model_obj = af.ModelInstance( + { + "galaxies": af.ModelInstance( + { + "galaxy": Galaxy( + redshift=0.5, + light_profile=light_profile, + ) + } + ) + } + ) + + fit_inversion = FitInversion( + model_obj=model_obj, + settings_inversion=aa.SettingsInversion(use_linear_operators=True), + light_profiles=[light_profile], + ) + result = fit_inversion.model_obj_linear_light_profiles_to_light_profiles + + assert result.galaxies.galaxy.light_profile is not light_profile + assert model_obj.galaxies.galaxy.light_profile is light_profile + + +@pytest.fixture(name="path") +def make_path(): + return "galaxies", 0, "light_profile" + + +@pytest.fixture(name="model_obj") +def make_model_obj(light_profile): + return af.ModelInstance( + { + "galaxies": [ + Galaxy( + redshift=0.5, + light_profile=light_profile, + ) + ] + } + ) + + +def test_list_galaxies(model_obj, path): + assert model_obj.path_instance_tuples_for_class((LightProfileLinear,))[0][0] == path + + +def test_object_from_path(model_obj, path, light_profile): + assert model_obj.object_for_path(path) == light_profile From a35e2098ac15786f40c43ad320d5448b67358caa Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Thu, 13 Mar 2025 20:42:05 +0000 Subject: [PATCH 22/26] minor --- autogalaxy/profiles/geometry_profiles.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autogalaxy/profiles/geometry_profiles.py b/autogalaxy/profiles/geometry_profiles.py index 8bd7ec6b4..aa9399410 100644 --- a/autogalaxy/profiles/geometry_profiles.py +++ b/autogalaxy/profiles/geometry_profiles.py @@ -132,7 +132,7 @@ def _cartesian_grid_via_radial_from( The circular radius of each coordinate from the profile center. """ if use_jax: - grid_angles = np.arctan2(grid.array[:, 0], grid.array[:, 1]) + grid_angles = np.arctan2(np.array(grid)[:, 0], np.array(grid)[:, 1]) else: grid_angles = np.arctan2(grid[:, 0], grid[:, 1]) cos_theta, sin_theta = self.angle_to_profile_grid_from(grid_angles=grid_angles) @@ -151,7 +151,7 @@ def transformed_to_reference_frame_grid_from(self, grid, **kwargs): The (y, x) coordinates in the original reference frame of the grid. """ if use_jax: - return np.subtract(grid.array, np.array(self.centre)) + return np.subtract(np.array(grid), np.array(self.centre)) else: return np.subtract(grid, self.centre) @@ -319,8 +319,8 @@ def elliptical_radii_grid_from( """ return np.sqrt( np.add( - np.square(grid.array[:, 1]), - np.square(np.divide(grid.array[:, 0], self.axis_ratio)), + np.square(np.array(grid)[:, 1]), + np.square(np.divide(np.array(grid)[:, 0], self.axis_ratio)), ) ) @@ -343,7 +343,7 @@ def eccentric_radii_grid_from( The (y, x) coordinates in the reference frame of the elliptical profile. """ - grid_radii = self.elliptical_radii_grid_from(grid=grid, **kwargs).array + grid_radii = np.array(self.elliptical_radii_grid_from(grid=grid, **kwargs)) return np.multiply(np.sqrt(self.axis_ratio), grid_radii) # .view(np.ndarray) From dc7f1e1c25bfdd0aab66ca54b19d304eead428ff Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Wed, 2 Apr 2025 20:18:59 +0100 Subject: [PATCH 23/26] remove convolver for psf --- autogalaxy/__init__.py | 2 -- autogalaxy/galaxy/to_inversion.py | 14 ++++---- autogalaxy/imaging/fit_imaging.py | 6 ++-- autogalaxy/operate/image.py | 35 ++++++------------- autogalaxy/profiles/light/linear/abstract.py | 12 +++---- autogalaxy/profiles/light/snr/abstract.py | 2 +- test_autogalaxy/conftest.py | 5 --- test_autogalaxy/imaging/test_fit_imaging.py | 4 +-- .../imaging/test_simulate_and_fit_imaging.py | 2 +- test_autogalaxy/operate/test_image.py | 22 ++++++------ .../profiles/light/linear/test_abstract.py | 8 ++--- 11 files changed, 46 insertions(+), 66 deletions(-) diff --git a/autogalaxy/__init__.py b/autogalaxy/__init__.py index ba666865d..947855403 100644 --- a/autogalaxy/__init__.py +++ b/autogalaxy/__init__.py @@ -22,8 +22,6 @@ from autoarray.inversion.pixelization.border_relocator import BorderRelocator from autoarray.mask.mask_1d import Mask1D # noqa from autoarray.mask.mask_2d import Mask2D # noqa -from autoarray.operators.convolver import Convolver # noqa -from autoarray.operators.convolver import Convolver # noqa from autoarray.operators.transformer import TransformerDFT # noqa from autoarray.operators.transformer import TransformerNUFFT # noqa from autoarray.layout.layout import Layout2D # noqa diff --git a/autogalaxy/galaxy/to_inversion.py b/autogalaxy/galaxy/to_inversion.py index 67869b23c..00f47782c 100644 --- a/autogalaxy/galaxy/to_inversion.py +++ b/autogalaxy/galaxy/to_inversion.py @@ -81,20 +81,20 @@ def __init__( self.run_time_dict = run_time_dict @property - def convolver(self) -> Optional[aa.Convolver]: + def psf(self) -> Optional[aa.Kernel2D]: """ - Returns the convolver of the imaging dataset, if the inversion is performed on an imaging dataset. + Returns the PSF of the imaging dataset, if the inversion is performed on an imaging dataset. The `GalaxiesToInversion` class acts as an interface between the dataset and inversion module for - both imaging and interferometer datasets. Only imaging datasets have a convolver, thus this property - ensures that for an interferometer dataset code which references a convolver does not raise an error. + both imaging and interferometer datasets. Only imaging datasets have a PSF, thus this property + ensures that for an interferometer dataset code which references a PSF does not raise an error. Returns ------- - The convolver of the imaging dataset, if it is an imaging dataset. + The psf of the imaging dataset, if it is an imaging dataset. """ try: - return self.dataset.convolver + return self.dataset.psf except AttributeError: return None @@ -310,7 +310,7 @@ def cls_light_profile_func_list_galaxy_dict_from( lp_linear_func = LightProfileLinearObjFuncList( grid=self.dataset.grids.lp, blurring_grid=self.dataset.grids.blurring, - convolver=self.dataset.convolver, + psf=self.dataset.psf, light_profile_list=light_profile_list, regularization=light_profile.regularization, ) diff --git a/autogalaxy/imaging/fit_imaging.py b/autogalaxy/imaging/fit_imaging.py index da96317bb..8371acc76 100644 --- a/autogalaxy/imaging/fit_imaging.py +++ b/autogalaxy/imaging/fit_imaging.py @@ -103,7 +103,7 @@ def blurred_image(self) -> aa.Array2D: return self.galaxies.blurred_image_2d_from( grid=self.grids.lp, - convolver=self.dataset.convolver, + psf=self.dataset.psf, blurring_grid=self.grids.blurring, ) @@ -120,7 +120,7 @@ def galaxies_to_inversion(self) -> GalaxiesToInversion: data=self.profile_subtracted_image, noise_map=self.noise_map, grids=self.grids, - convolver=self.dataset.convolver, + psf=self.dataset.psf, w_tilde=self.w_tilde, ) @@ -179,7 +179,7 @@ def galaxy_model_image_dict(self) -> Dict[Galaxy, np.ndarray]: galaxy_blurred_image_2d_dict = self.galaxies.galaxy_blurred_image_2d_dict_from( grid=self.grids.lp, - convolver=self.dataset.convolver, + psf=self.dataset.psf, blurring_grid=self.grids.blurring, ) diff --git a/autogalaxy/operate/image.py b/autogalaxy/operate/image.py index bc639e421..c051b3a74 100644 --- a/autogalaxy/operate/image.py +++ b/autogalaxy/operate/image.py @@ -2,6 +2,8 @@ import numpy as np from typing import TYPE_CHECKING, Dict, List, Optional +from autoarray import Array2D + if TYPE_CHECKING: from autogalaxy.galaxy.galaxy import Galaxy @@ -34,31 +36,19 @@ def _blurred_image_2d_from( self, image_2d: aa.Array2D, blurring_image_2d: aa.Array2D, - psf: Optional[aa.Kernel2D], - convolver: aa.Convolver, + psf: aa.Kernel2D, ) -> aa.Array2D: - if psf is not None: - return psf.convolved_array_with_mask_from( - array=image_2d.native + blurring_image_2d.native, - mask=image_2d.mask, - ) - - elif convolver is not None: - return convolver.convolve_image( - image=image_2d, blurring_image=blurring_image_2d - ) - else: - raise exc.OperateException( - "A PSF or Convolver was not passed to the `blurred_image_2d_list_from()` function." - ) + values = psf.convolve_image( + image=image_2d, blurring_image=blurring_image_2d, + ) + return Array2D(values=values, mask=image_2d.mask) def blurred_image_2d_from( self, grid: aa.Grid2D, blurring_grid: aa.Grid2D, - psf: Optional[aa.Kernel2D] = None, - convolver: aa.Convolver = None, + psf: aa.Kernel2D = None, ) -> aa.Array2D: """ Evaluate the light object's 2D image from a input 2D grid of coordinates and convolve it with a PSF. @@ -92,7 +82,6 @@ def blurred_image_2d_from( image_2d=image_2d_not_operated, blurring_image_2d=blurring_image_2d_not_operated, psf=psf, - convolver=convolver, ) if self.has(cls=LightProfileOperated): @@ -224,8 +213,7 @@ def blurred_image_2d_list_from( self, grid: aa.Grid2D, blurring_grid: aa.Grid2D, - psf: Optional[aa.Kernel2D] = None, - convolver: aa.Convolver = None, + psf: aa.Kernel2D = None, ) -> List[aa.Array2D]: """ Evaluate the light object's list of 2D images from a input 2D grid of coordinates and convolve each image with @@ -267,7 +255,6 @@ def blurred_image_2d_list_from( image_2d=image_2d_not_operated, blurring_image_2d=blurring_image_2d_not_operated, psf=psf, - convolver=convolver, ) image_2d_operated = image_2d_operated_list[i] @@ -375,7 +362,7 @@ def galaxy_image_2d_dict_from( raise NotImplementedError def galaxy_blurred_image_2d_dict_from( - self, grid, convolver, blurring_grid + self, grid, psf, blurring_grid ) -> Dict[Galaxy, aa.Array2D]: """ Evaluate the light object's dictionary mapping galaixes to their corresponding 2D images and convolve each @@ -418,7 +405,7 @@ def galaxy_blurred_image_2d_dict_from( galaxy_key ] - blurred_image_2d = convolver.convolve_image( + blurred_image_2d = psf.convolve_image( image=image_2d_not_operated, blurring_image=blurring_image_2d_not_operated, ) diff --git a/autogalaxy/profiles/light/linear/abstract.py b/autogalaxy/profiles/light/linear/abstract.py index a44194e3b..ff96ed0ca 100644 --- a/autogalaxy/profiles/light/linear/abstract.py +++ b/autogalaxy/profiles/light/linear/abstract.py @@ -143,7 +143,7 @@ def __init__( self, grid: aa.type.Grid1D2DLike, blurring_grid: aa.type.Grid1D2DLike, - convolver: Optional[aa.Convolver], + psf: Optional[aa.Kernel2D], light_profile_list: List[LightProfileLinear], regularization=Optional[aa.reg.Regularization], run_time_dict: Optional[Dict] = None, @@ -184,8 +184,8 @@ def __init__( blurring_grid The blurring grid is all points whose light is outside the data's mask but close enough to the mask that it may be blurred into the mask. This is also used when evaluating the image of each light profile. - convolver - The convolver used to blur the light profile images of each light profile, the output of which + psf + The psf used to blur the light profile images of each light profile, the output of which makes up the columns of the `operated_mapping matrix`. light_profile_list A list of the linear light profiles that are used to fit the data via linear algebra. @@ -210,7 +210,7 @@ def __init__( ) self.blurring_grid = blurring_grid - self.convolver = convolver + self.psf = psf self.light_profile_list = light_profile_list @property @@ -271,7 +271,7 @@ def mapping_matrix(self) -> np.ndarray: @cached_property def operated_mapping_matrix_override(self) -> Optional[np.ndarray]: """ - The inversion object takes the `mapping_matrix` of each linear object and combines it with the `Convolver` + 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 @@ -298,7 +298,7 @@ def operated_mapping_matrix_override(self) -> Optional[np.ndarray]: blurring_image_2d = light_profile.image_2d_from(grid=self.blurring_grid) - blurred_image_2d = self.convolver.convolve_image( + blurred_image_2d = self.psf.convolve_image( image=image_2d, blurring_image=blurring_image_2d ) diff --git a/autogalaxy/profiles/light/snr/abstract.py b/autogalaxy/profiles/light/snr/abstract.py index 49b34a766..9824da3aa 100644 --- a/autogalaxy/profiles/light/snr/abstract.py +++ b/autogalaxy/profiles/light/snr/abstract.py @@ -84,7 +84,7 @@ def set_intensity_from( image_2d = self.image_2d_from(grid=grid) if psf is not None: - image_2d = psf.convolved_array_from(array=image_2d) + image_2d = psf.convolve_image_no_blurring(image=image_2d) brightest_value = np.max(image_2d) diff --git a/test_autogalaxy/conftest.py b/test_autogalaxy/conftest.py index 5fb97e1c1..08653cb85 100644 --- a/test_autogalaxy/conftest.py +++ b/test_autogalaxy/conftest.py @@ -135,11 +135,6 @@ def make_mask_2d_7x7(): return fixtures.make_mask_2d_7x7() -@pytest.fixture(name="convolver_7x7") -def make_convolver_7x7(): - return fixtures.make_convolver_7x7() - - @pytest.fixture(name="mask_2d_7x7_1_pix") def make_mask_2d_7x7_1_pix(): return fixtures.make_mask_2d_7x7_1_pix() diff --git a/test_autogalaxy/imaging/test_fit_imaging.py b/test_autogalaxy/imaging/test_fit_imaging.py index 3b3103fc2..f66d300b0 100644 --- a/test_autogalaxy/imaging/test_fit_imaging.py +++ b/test_autogalaxy/imaging/test_fit_imaging.py @@ -239,13 +239,13 @@ def test__galaxy_model_image_dict(masked_imaging_7x7): g0_blurred_image_2d = g0.blurred_image_2d_from( grid=masked_imaging_7x7.grids.lp, blurring_grid=masked_imaging_7x7.grids.blurring, - convolver=masked_imaging_7x7.convolver, + psf=masked_imaging_7x7.psf, ) g1_blurred_image_2d = g1.blurred_image_2d_from( grid=masked_imaging_7x7.grids.lp, blurring_grid=masked_imaging_7x7.grids.blurring, - convolver=masked_imaging_7x7.convolver, + psf=masked_imaging_7x7.psf, ) assert fit.galaxy_model_image_dict[g0] == pytest.approx(g0_blurred_image_2d, 1.0e-4) diff --git a/test_autogalaxy/imaging/test_simulate_and_fit_imaging.py b/test_autogalaxy/imaging/test_simulate_and_fit_imaging.py index e60c00cce..bd4af6ff5 100644 --- a/test_autogalaxy/imaging/test_simulate_and_fit_imaging.py +++ b/test_autogalaxy/imaging/test_simulate_and_fit_imaging.py @@ -202,7 +202,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_agree_with_standa galaxy_image = galaxy.blurred_image_2d_from( grid=masked_dataset.grids.lp, - convolver=masked_dataset.convolver, + psf=masked_dataset.psf, blurring_grid=masked_dataset.grids.blurring, ) diff --git a/test_autogalaxy/operate/test_image.py b/test_autogalaxy/operate/test_image.py index d2fea8ca9..656185080 100644 --- a/test_autogalaxy/operate/test_image.py +++ b/test_autogalaxy/operate/test_image.py @@ -9,14 +9,14 @@ def test__blurred_image_2d_from( - grid_2d_7x7, blurring_grid_2d_7x7, psf_3x3, convolver_7x7 + grid_2d_7x7, blurring_grid_2d_7x7, psf_3x3, ): lp = ag.lp.Sersic(intensity=1.0) image_2d = lp.image_2d_from(grid=grid_2d_7x7) blurring_image_2d = lp.image_2d_from(grid=blurring_grid_2d_7x7) - blurred_image_2d_manual = convolver_7x7.convolve_image( + blurred_image_2d_manual = psf_3x3.convolve_image( image=image_2d, blurring_image=blurring_image_2d ) @@ -31,7 +31,7 @@ def test__blurred_image_2d_from( lp_blurred_image_2d = lp.blurred_image_2d_from( grid=grid_2d_7x7, blurring_grid=blurring_grid_2d_7x7, - convolver=convolver_7x7, + psf=psf_3x3 ) assert blurred_image_2d_manual.native == pytest.approx( @@ -55,7 +55,7 @@ def test__blurred_image_2d_from( grid=grid_2d_7x7, psf=psf_3x3, blurring_grid=blurring_grid_2d_7x7 ) - blurred_image_2d_manual_not_operated = convolver_7x7.convolve_image( + blurred_image_2d_manual_not_operated = psf_3x3.convolve_image( image=image_2d_not_operated, blurring_image=blurring_image_2d_not_operated, ) @@ -167,7 +167,7 @@ def test__visibilities_from_grid_and_transformer(grid_2d_7x7, transformer_7x7_7) def test__blurred_image_2d_list_from( - grid_2d_7x7, blurring_grid_2d_7x7, psf_3x3, convolver_7x7 + grid_2d_7x7, blurring_grid_2d_7x7, psf_3x3, ): lp_0 = ag.lp.Gaussian(intensity=1.0) lp_1 = ag.lp.Gaussian(intensity=2.0) @@ -196,7 +196,7 @@ def test__blurred_image_2d_list_from( blurred_image_2d_list = gal.blurred_image_2d_list_from( grid=grid_2d_7x7, blurring_grid=blurring_grid_2d_7x7, - convolver=convolver_7x7, + psf=psf_3x3 ) assert blurred_image_2d_list[0].native == pytest.approx( @@ -226,7 +226,7 @@ def test__blurred_image_2d_list_from( blurred_image_2d_list = gal.blurred_image_2d_list_from( grid=grid_2d_7x7, blurring_grid=blurring_grid_2d_7x7, - convolver=convolver_7x7, + psf=psf_3x3 ) assert blurred_image_2d_list[0].native == pytest.approx( @@ -297,7 +297,7 @@ def test__visibilities_list_from(grid_2d_7x7, transformer_7x7_7): def test__galaxy_blurred_image_2d_dict_from( - grid_2d_7x7, blurring_grid_2d_7x7, convolver_7x7 + grid_2d_7x7, blurring_grid_2d_7x7, psf_3x3 ): lp_0 = ag.lp.Sersic(intensity=1.0) @@ -312,13 +312,13 @@ def test__galaxy_blurred_image_2d_dict_from( blurred_image_2d_list = galaxies.blurred_image_2d_list_from( grid=grid_2d_7x7, - convolver=convolver_7x7, + psf=psf_3x3, blurring_grid=blurring_grid_2d_7x7, ) blurred_image_dict = galaxies.galaxy_blurred_image_2d_dict_from( grid=grid_2d_7x7, - convolver=convolver_7x7, + psf=psf_3x3, blurring_grid=blurring_grid_2d_7x7, ) @@ -329,7 +329,7 @@ def test__galaxy_blurred_image_2d_dict_from( image_2d = lp_0.image_2d_from(grid=grid_2d_7x7) blurring_image_2d = lp_0.image_2d_from(grid=blurring_grid_2d_7x7) - image_2d_convolved = convolver_7x7.convolve_image( + image_2d_convolved = psf_3x3.convolve_image( image=image_2d, blurring_image=blurring_image_2d ) diff --git a/test_autogalaxy/profiles/light/linear/test_abstract.py b/test_autogalaxy/profiles/light/linear/test_abstract.py index f8ca3ad0e..6d122e212 100644 --- a/test_autogalaxy/profiles/light/linear/test_abstract.py +++ b/test_autogalaxy/profiles/light/linear/test_abstract.py @@ -9,14 +9,14 @@ ) -def test__mapping_matrix_from(grid_2d_7x7, blurring_grid_2d_7x7, convolver_7x7): +def test__mapping_matrix_from(grid_2d_7x7, blurring_grid_2d_7x7, psf_3x3): lp_0 = ag.lp_linear.Sersic(effective_radius=1.0) lp_1 = ag.lp_linear.Sersic(effective_radius=2.0) lp_linear_obj_func_list = LightProfileLinearObjFuncList( grid=grid_2d_7x7, blurring_grid=blurring_grid_2d_7x7, - convolver=convolver_7x7, + psf=psf_3x3, light_profile_list=[lp_0, lp_1], ) @@ -35,13 +35,13 @@ def test__mapping_matrix_from(grid_2d_7x7, blurring_grid_2d_7x7, convolver_7x7): lp_0_blurred_image = lp_0.blurred_image_2d_from( grid=grid_2d_7x7, blurring_grid=blurring_grid_2d_7x7, - convolver=convolver_7x7, + psf=psf_3x3 ) lp_1_blurred_image = lp_1.blurred_image_2d_from( grid=grid_2d_7x7, blurring_grid=blurring_grid_2d_7x7, - convolver=convolver_7x7, + psf=psf_3x3 ) assert lp_linear_obj_func_list.operated_mapping_matrix_override[ From 545fc09a88a82e3f5aba90c4bd8e77fbc1daf17c Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Wed, 2 Apr 2025 20:58:17 +0100 Subject: [PATCH 24/26] black --- autogalaxy/analysis/analysis/analysis.py | 12 +- autogalaxy/analysis/chaining_util.py | 40 +++---- autogalaxy/convert.py | 6 +- autogalaxy/operate/deflections.py | 104 ++++++++---------- autogalaxy/operate/image.py | 3 +- autogalaxy/profiles/geometry_profiles.py | 2 + autogalaxy/profiles/light/snr/abstract.py | 4 +- .../profiles/light/standard/gaussian.py | 4 +- .../profiles/mass/abstract/jax_utils.py | 16 +-- autogalaxy/profiles/mass/abstract/mge_jax.py | 18 +-- .../mass/dark/gnfw_virial_mass_gnfw_conc.py | 4 +- autogalaxy/profiles/mass/stellar/gaussian.py | 7 +- test_autogalaxy/operate/test_image.py | 24 ++-- .../profiles/light/linear/test_abstract.py | 8 +- 14 files changed, 108 insertions(+), 144 deletions(-) diff --git a/autogalaxy/analysis/analysis/analysis.py b/autogalaxy/analysis/analysis/analysis.py index ae583b03c..084af3104 100644 --- a/autogalaxy/analysis/analysis/analysis.py +++ b/autogalaxy/analysis/analysis/analysis.py @@ -192,18 +192,18 @@ def profile_log_likelihood_function( try: info_dict["image_pixels"] = self.dataset.grids.lp.shape_slim - info_dict[ - "sub_total_light_profiles" - ] = self.dataset.grids.lp.over_sampler.sub_total + info_dict["sub_total_light_profiles"] = ( + self.dataset.grids.lp.over_sampler.sub_total + ) except AttributeError: pass if fit.model_obj.has(cls=aa.Pixelization): info_dict["use_w_tilde"] = fit.inversion.settings.use_w_tilde try: - info_dict[ - "sub_total_pixelization" - ] = self.dataset.grids.pixelization.over_sampler.sub_total + info_dict["sub_total_pixelization"] = ( + self.dataset.grids.pixelization.over_sampler.sub_total + ) except AttributeError: pass info_dict["use_positive_only_solver"] = ( diff --git a/autogalaxy/analysis/chaining_util.py b/autogalaxy/analysis/chaining_util.py index 930b6a5f6..95306e45f 100644 --- a/autogalaxy/analysis/chaining_util.py +++ b/autogalaxy/analysis/chaining_util.py @@ -215,39 +215,29 @@ def extra_galaxies_from( for extra_galaxy_index in range(len(result.instance.extra_galaxies)): if hasattr(result.instance.extra_galaxies[extra_galaxy_index], "mass"): - extra_galaxies[ - extra_galaxy_index - ].mass.centre = result.instance.extra_galaxies[ - extra_galaxy_index - ].mass.centre - extra_galaxies[ - extra_galaxy_index - ].mass.einstein_radius = result.model.extra_galaxies[ - extra_galaxy_index - ].mass.einstein_radius + extra_galaxies[extra_galaxy_index].mass.centre = ( + result.instance.extra_galaxies[extra_galaxy_index].mass.centre + ) + extra_galaxies[extra_galaxy_index].mass.einstein_radius = ( + result.model.extra_galaxies[extra_galaxy_index].mass.einstein_radius + ) if free_centre: - extra_galaxies[ - extra_galaxy_index - ].mass.centre = result.model.extra_galaxies[ - extra_galaxy_index - ].mass.centre + extra_galaxies[extra_galaxy_index].mass.centre = ( + result.model.extra_galaxies[extra_galaxy_index].mass.centre + ) elif light_as_model: extra_galaxies = result.instance.extra_galaxies.as_model((LightProfile,)) for extra_galaxy_index in range(len(result.instance.extra_galaxies)): if extra_galaxies[extra_galaxy_index].bulge is not None: - extra_galaxies[ - extra_galaxy_index - ].bulge.centre = result.instance.extra_galaxies[ - extra_galaxy_index - ].bulge.centre + extra_galaxies[extra_galaxy_index].bulge.centre = ( + result.instance.extra_galaxies[extra_galaxy_index].bulge.centre + ) if free_centre: - extra_galaxies[ - extra_galaxy_index - ].bulge.centre = result.model.extra_galaxies[ - extra_galaxy_index - ].bulge.centre + extra_galaxies[extra_galaxy_index].bulge.centre = ( + result.model.extra_galaxies[extra_galaxy_index].bulge.centre + ) else: extra_galaxies = result.instance.extra_galaxies.as_model(()) diff --git a/autogalaxy/convert.py b/autogalaxy/convert.py index 4c1ae9299..80488824e 100644 --- a/autogalaxy/convert.py +++ b/autogalaxy/convert.py @@ -66,11 +66,7 @@ def axis_ratio_and_angle_from(ell_comps: Tuple[float, float]) -> Tuple[float, fl angle *= 180.0 / np.pi if use_jax: - angle = jax.lax.select( - angle < -45, - angle + 180, - angle - ) + angle = jax.lax.select(angle < -45, angle + 180, angle) else: if abs(angle) > 45 and angle < 0: angle += 180 diff --git a/autogalaxy/operate/deflections.py b/autogalaxy/operate/deflections.py index ef60c45fa..f1ef3a89f 100644 --- a/autogalaxy/operate/deflections.py +++ b/autogalaxy/operate/deflections.py @@ -99,16 +99,10 @@ def one_step(r, _, theta, fun, fun_dr): @partial(jit, static_argnums=(4,)) def step_r(r, theta, fun, fun_dr, N=20): one_step_partial = jax.tree_util.Partial( - one_step, - theta=theta, - fun=fun, - fun_dr=fun_dr + one_step, theta=theta, fun=fun, fun_dr=fun_dr ) new_r = jax.lax.scan(one_step_partial, r, xs=np.arange(N))[0] - return np.stack([ - new_r * np.sin(theta), - new_r * np.cos(theta) - ]).T + return np.stack([new_r * np.sin(theta), new_r * np.cos(theta)]).T class OperateDeflections: @@ -129,7 +123,7 @@ class OperateDeflections: def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): raise NotImplementedError - + def deflections_yx_scalar(self, y, x, pixel_scales): if not use_jax: return @@ -140,13 +134,13 @@ def deflections_yx_scalar(self, y, x, pixel_scales): y=y.reshape(1), x=x.reshape(1), shape_native=(1, 1), - pixel_scales=pixel_scales + pixel_scales=pixel_scales, ) return self.deflections_yx_2d_from(g).squeeze() def __eq__(self, other): return self.__dict__ == other.__dict__ and self.__class__ is other.__class__ - + def __hash__(self): return hash(repr(self)) @@ -754,85 +748,73 @@ def jacobian_stack(self, y, x, pixel_scales): return else: return np.stack( - jax.jacfwd( - self.deflections_yx_scalar, - argnums=(0, 1) - )(y, x, pixel_scales) + jax.jacfwd(self.deflections_yx_scalar, argnums=(0, 1))( + y, x, pixel_scales + ) ) - + def jacobian_stack_vector(self, y, x, pixel_scales): if not use_jax: return else: return np.vectorize( - jax.tree_util.Partial( - self.jacobian_stack, - pixel_scales=pixel_scales - ), - signature='(),()->(i,i)' + jax.tree_util.Partial(self.jacobian_stack, pixel_scales=pixel_scales), + signature="(),()->(i,i)", )(y, x) - + def convergence_mag_shear_yx(self, y, x): J = self.jacobian_stack_vector(y, x, 0.05) K = 0.5 * (J[..., 0, 0] + J[..., 1, 1]) mag_shear = 0.5 * np.sqrt( - (J[..., 0, 1] + J[..., 1, 0])**2 + (J[..., 0, 0] - J[..., 1, 1])**2 + (J[..., 0, 1] + J[..., 1, 0]) ** 2 + (J[..., 0, 0] - J[..., 1, 1]) ** 2 ) return K, mag_shear - + @partial(jit, static_argnums=(0,)) def tangential_eigen_value_yx(self, y, x): K, mag_shear = self.convergence_mag_shear_yx(y, x) return 1 - K - mag_shear - + @partial(jit, static_argnums=(0, 3)) def tangential_eigen_value_rt(self, r, theta, centre=(0.0, 0.0)): y = r * np.sin(theta) + centre[0] x = r * np.cos(theta) + centre[1] return self.tangential_eigen_value_yx(y, x) - + @partial(jit, static_argnums=(0, 3)) def grad_r_tangential_eigen_value(self, r, theta, centre=(0.0, 0.0)): # ignore `self` with the `argnums` below - tangential_eigen_part = partial( - self.tangential_eigen_value_rt, - centre=centre - ) + tangential_eigen_part = partial(self.tangential_eigen_value_rt, centre=centre) return np.vectorize( - jax.jacfwd(tangential_eigen_part, argnums=(0,)), - signature='(),()->()' + jax.jacfwd(tangential_eigen_part, argnums=(0,)), signature="(),()->()" )(r, theta)[0] @partial(jit, static_argnums=(0,)) def radial_eigen_value_yx(self, y, x): K, mag_shear = self.convergence_mag_shear_yx(y, x) return 1 - K + mag_shear - + @partial(jit, static_argnums=(0, 3)) def radial_eigen_value_rt(self, r, theta, centre=(0.0, 0.0)): y = r * np.sin(theta) + centre[0] x = r * np.cos(theta) + centre[1] return self.radial_eigen_value_yx(y, x) - + @partial(jit, static_argnums=(0, 3)) def grad_r_radial_eigen_value(self, r, theta, centre=(0.0, 0.0)): # ignore `self` with the `argnums` below - radial_eigen_part = partial( - self.radial_eigen_value_rt, - centre=centre - ) + radial_eigen_part = partial(self.radial_eigen_value_rt, centre=centre) return np.vectorize( - jax.jacfwd(radial_eigen_part, argnums=(0,)), - signature='(),()->()' + jax.jacfwd(radial_eigen_part, argnums=(0,)), signature="(),()->()" )(r, theta)[0] - + def tangential_critical_curve_jax( self, init_r=0.1, init_centre=(0.0, 0.0), n_points=300, n_steps=20, - threshold=1e-5 + threshold=1e-5, ): """ Returns all tangential critical curves of the lensing system, which are computed as follows: @@ -865,8 +847,10 @@ def tangential_critical_curve_jax( r, theta, jax.tree_util.Partial(self.tangential_eigen_value_rt, centre=init_centre), - jax.tree_util.Partial(self.grad_r_tangential_eigen_value, centre=init_centre), - n_steps + jax.tree_util.Partial( + self.grad_r_tangential_eigen_value, centre=init_centre + ), + n_steps, ) new_yx = new_yx + np.array(init_centre) # filter out nan values @@ -876,14 +860,14 @@ def tangential_critical_curve_jax( value = np.abs(self.tangential_eigen_value_yx(new_yx[:, 0], new_yx[:, 1])) gdx = value <= threshold return aa.structures.grids.irregular_2d.Grid2DIrregular(values=new_yx[gdx]) - + def radial_critical_curve_jax( self, init_r=0.01, init_centre=(0.0, 0.0), n_points=300, n_steps=20, - threshold=1e-5 + threshold=1e-5, ): """ Returns all radial critical curves of the lensing system, which are computed as follows: @@ -917,7 +901,7 @@ def radial_critical_curve_jax( theta, jax.tree_util.Partial(self.radial_eigen_value_rt, centre=init_centre), jax.tree_util.Partial(self.grad_r_radial_eigen_value, centre=init_centre), - n_steps + n_steps, ) new_yx = new_yx + np.array(init_centre) # filter out nan values @@ -953,45 +937,51 @@ def jacobian_from(self, grid): a11 = aa.Array2D( values=1.0 - - np.gradient(deflections.native[:, :, 1], grid.native[0, :, 1], axis=1), + - np.gradient( + deflections.native[:, :, 1], grid.native[0, :, 1], axis=1 + ), mask=grid.mask, ) a12 = aa.Array2D( values=-1.0 - * np.gradient(deflections.native[:, :, 1], grid.native[:, 0, 0], axis=0), + * np.gradient( + deflections.native[:, :, 1], grid.native[:, 0, 0], axis=0 + ), mask=grid.mask, ) a21 = aa.Array2D( values=-1.0 - * np.gradient(deflections.native[:, :, 0], grid.native[0, :, 1], axis=1), + * np.gradient( + deflections.native[:, :, 0], grid.native[0, :, 1], axis=1 + ), mask=grid.mask, ) a22 = aa.Array2D( values=1 - - np.gradient(deflections.native[:, :, 0], grid.native[:, 0, 0], axis=0), + - np.gradient( + deflections.native[:, :, 0], grid.native[:, 0, 0], axis=0 + ), mask=grid.mask, ) return [[a11, a12], [a21, a22]] else: A = self.jacobian_stack_vector( - grid.array[:, 0], - grid.array[:, 1], - grid.pixel_scales + grid.array[:, 0], grid.array[:, 1], grid.pixel_scales ) a = np.eye(2).reshape(1, 2, 2) - A return [ [ aa.Array2D(values=a[..., 1, 1], mask=grid.mask), - aa.Array2D(values=a[..., 1, 0], mask=grid.mask) + aa.Array2D(values=a[..., 1, 0], mask=grid.mask), ], [ aa.Array2D(values=a[..., 0, 1], mask=grid.mask), - aa.Array2D(values=a[..., 0, 0], mask=grid.mask) - ] + aa.Array2D(values=a[..., 0, 0], mask=grid.mask), + ], ] # transpose the result diff --git a/autogalaxy/operate/image.py b/autogalaxy/operate/image.py index c051b3a74..a1fa126da 100644 --- a/autogalaxy/operate/image.py +++ b/autogalaxy/operate/image.py @@ -40,7 +40,8 @@ def _blurred_image_2d_from( ) -> aa.Array2D: values = psf.convolve_image( - image=image_2d, blurring_image=blurring_image_2d, + image=image_2d, + blurring_image=blurring_image_2d, ) return Array2D(values=values, mask=image_2d.mask) diff --git a/autogalaxy/profiles/geometry_profiles.py b/autogalaxy/profiles/geometry_profiles.py index aa9399410..7175851d7 100644 --- a/autogalaxy/profiles/geometry_profiles.py +++ b/autogalaxy/profiles/geometry_profiles.py @@ -4,9 +4,11 @@ if os.environ.get("USE_JAX", "0") == "1": import jax.numpy as np + use_jax = True else: import numpy as np + use_jax = False import autoarray as aa diff --git a/autogalaxy/profiles/light/snr/abstract.py b/autogalaxy/profiles/light/snr/abstract.py index 9824da3aa..71350f0c0 100644 --- a/autogalaxy/profiles/light/snr/abstract.py +++ b/autogalaxy/profiles/light/snr/abstract.py @@ -84,7 +84,9 @@ def set_intensity_from( image_2d = self.image_2d_from(grid=grid) if psf is not None: - image_2d = psf.convolve_image_no_blurring(image=image_2d) + image_2d = psf.convolve_image_no_blurring( + image=image_2d, mask=image_2d.mask + ) brightest_value = np.max(image_2d) diff --git a/autogalaxy/profiles/light/standard/gaussian.py b/autogalaxy/profiles/light/standard/gaussian.py index a297c6bf5..ec16af0a8 100644 --- a/autogalaxy/profiles/light/standard/gaussian.py +++ b/autogalaxy/profiles/light/standard/gaussian.py @@ -66,7 +66,9 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray) -> np.ndarray: np.exp( -0.5 * np.square( - np.divide(grid_radii.array, self.sigma / np.sqrt(self.axis_ratio)) + np.divide( + grid_radii.array, self.sigma / np.sqrt(self.axis_ratio) + ) ) ), ) diff --git a/autogalaxy/profiles/mass/abstract/jax_utils.py b/autogalaxy/profiles/mass/abstract/jax_utils.py index 9a20233aa..e241488f3 100644 --- a/autogalaxy/profiles/mass/abstract/jax_utils.py +++ b/autogalaxy/profiles/mass/abstract/jax_utils.py @@ -6,7 +6,7 @@ r1_s1 = [2.5, 2, 1.5, 1, 0.5] -def reg1(z, _ , i_sqrt_pi): +def reg1(z, _, i_sqrt_pi): v = z for coef in r1_s1: v = z - coef / v @@ -18,7 +18,7 @@ def reg1(z, _ , i_sqrt_pi): def reg2(z, sqrt_pi, _): - mz2 = -z**2 + mz2 = -(z**2) f1 = sqrt_pi f2 = 1.0 for s in r2_s1: @@ -64,17 +64,17 @@ def w_f_approx(z): # use a single partial fraction approx for all large abs(z)**2 # to have better approx of the auto-derivatives r1 = (abs_z2 >= 62.0) | ((abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 >= 1e-13)) - # region bounds for 5 taken directly from Zaghloul (2017) + # region bounds for 5 taken directly from Zaghloul (2017) # https://dl.acm.org/doi/pdf/10.1145/3119904 r2_1 = (abs_z2 >= 30.0) & (abs_z2 < 62.0) & (z_imag2 < 1e-13) r2_2 = (abs_z2 >= 2.5) & (abs_z2 < 30.0) & (z_imag2 < 0.072) r2 = r2_1 | r2_2 r3 = jnp.logical_not(r1) & jnp.logical_not(r2) - # exploit symmetry to avoid overflow in some regions + # exploit symmetry to avoid overflow in some regions r_flip = z.imag < 0 z_adjust = jnp.where(r_flip, -z, z) - two_exp_zz = 2 * jnp.exp(-z_adjust**2) + two_exp_zz = 2 * jnp.exp(-(z_adjust**2)) args = (z_adjust, sqrt_pi, i_sqrt_pi) wz = jnp.empty_like(z) @@ -82,7 +82,7 @@ def w_f_approx(z): wz = jnp.where(r2, reg2(*args), wz) wz = jnp.where(r3, reg3(*args), wz) - # exploit symmetry to avoid overflow in some regions + # exploit symmetry to avoid overflow in some regions wz = jnp.where(r_flip, two_exp_zz - wz, wz) return wz @@ -91,8 +91,8 @@ def w_f_approx(z): @w_f_approx.defjvp def w_f_approx_jvp(primals, tangents): # define a custom jvp to avoid the issue using `jnp.where` with `jax.grad` - z, = primals - z_dot, = tangents + (z,) = primals + (z_dot,) = tangents primal_out = w_f_approx(z) i_sqrt_pi = 1j / jnp.sqrt(jnp.pi) tangent_out = z_dot * 2 * (i_sqrt_pi - z * primal_out) diff --git a/autogalaxy/profiles/mass/abstract/mge_jax.py b/autogalaxy/profiles/mass/abstract/mge_jax.py index 89d845262..42a568a4c 100644 --- a/autogalaxy/profiles/mass/abstract/mge_jax.py +++ b/autogalaxy/profiles/mass/abstract/mge_jax.py @@ -65,14 +65,11 @@ def eta(p): i = np.arange(1, p, 1) kesi_last = 1 / 2**p k = kesi_last + np.cumsum(np.cumprod((p + 1 - i) / i) * kesi_last) - - kesi_list = np.hstack([ - np.array([0.5]), - np.ones(p), - k[::-1], - np.array([kesi_last]) - ]) - coef = (-1)**np.arange(0, 2 * p + 1, 1) + + kesi_list = np.hstack( + [np.array([0.5]), np.ones(p), k[::-1], np.array([kesi_last])] + ) + coef = (-1) ** np.arange(0, 2 * p + 1, 1) eta_const = 2.0 * np.sqrt(2.0 * np.pi) * 10 ** (p / 3.0) eta_list = coef * kesi_list return eta_const, eta_list @@ -111,10 +108,7 @@ def _decompose_convergence_via_mge( amplitude_list = np.zeros(func_gaussians) f_sigma = eta_constant * np.sum( - eta_n * np.real(func( - sigma_list.reshape(-1, 1) * kesis - )), - axis=1 + eta_n * np.real(func(sigma_list.reshape(-1, 1) * kesis)), axis=1 ) amplitude_list = f_sigma * d_log_sigma / np.sqrt(2.0 * np.pi) amplitude_list = amplitude_list.at[0].multiply(0.5) diff --git a/autogalaxy/profiles/mass/dark/gnfw_virial_mass_gnfw_conc.py b/autogalaxy/profiles/mass/dark/gnfw_virial_mass_gnfw_conc.py index ad466df1a..5be2e7840 100644 --- a/autogalaxy/profiles/mass/dark/gnfw_virial_mass_gnfw_conc.py +++ b/autogalaxy/profiles/mass/dark/gnfw_virial_mass_gnfw_conc.py @@ -49,9 +49,7 @@ def kappa_s_and_scale_radius( ############################## def integrand(r): - return (r**2 / r**inner_slope) * (1 + r / scale_radius_kpc) ** ( - inner_slope - 3 - ) + return (r**2 / r**inner_slope) * (1 + r / scale_radius_kpc) ** (inner_slope - 3) de_c = ( (overdens / 3.0) diff --git a/autogalaxy/profiles/mass/stellar/gaussian.py b/autogalaxy/profiles/mass/stellar/gaussian.py index d0cf66499..bead9e95f 100644 --- a/autogalaxy/profiles/mass/stellar/gaussian.py +++ b/autogalaxy/profiles/mass/stellar/gaussian.py @@ -1,6 +1,7 @@ import copy import numpy as np from autofit.jax_wrapper import use_jax + if use_jax: import jax from scipy.special import wofz @@ -192,11 +193,7 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray): def axis_ratio(self): axis_ratio = super().axis_ratio if use_jax: - return jax.lax.select( - axis_ratio < 0.9999, - axis_ratio, - 0.9999 - ) + return jax.lax.select(axis_ratio < 0.9999, axis_ratio, 0.9999) else: return axis_ratio if axis_ratio < 0.9999 else 0.9999 diff --git a/test_autogalaxy/operate/test_image.py b/test_autogalaxy/operate/test_image.py index 656185080..cd0917de9 100644 --- a/test_autogalaxy/operate/test_image.py +++ b/test_autogalaxy/operate/test_image.py @@ -9,7 +9,9 @@ def test__blurred_image_2d_from( - grid_2d_7x7, blurring_grid_2d_7x7, psf_3x3, + grid_2d_7x7, + blurring_grid_2d_7x7, + psf_3x3, ): lp = ag.lp.Sersic(intensity=1.0) @@ -29,9 +31,7 @@ def test__blurred_image_2d_from( ) lp_blurred_image_2d = lp.blurred_image_2d_from( - grid=grid_2d_7x7, - blurring_grid=blurring_grid_2d_7x7, - psf=psf_3x3 + grid=grid_2d_7x7, blurring_grid=blurring_grid_2d_7x7, psf=psf_3x3 ) assert blurred_image_2d_manual.native == pytest.approx( @@ -167,7 +167,9 @@ def test__visibilities_from_grid_and_transformer(grid_2d_7x7, transformer_7x7_7) def test__blurred_image_2d_list_from( - grid_2d_7x7, blurring_grid_2d_7x7, psf_3x3, + grid_2d_7x7, + blurring_grid_2d_7x7, + psf_3x3, ): lp_0 = ag.lp.Gaussian(intensity=1.0) lp_1 = ag.lp.Gaussian(intensity=2.0) @@ -194,9 +196,7 @@ def test__blurred_image_2d_list_from( ) blurred_image_2d_list = gal.blurred_image_2d_list_from( - grid=grid_2d_7x7, - blurring_grid=blurring_grid_2d_7x7, - psf=psf_3x3 + grid=grid_2d_7x7, blurring_grid=blurring_grid_2d_7x7, psf=psf_3x3 ) assert blurred_image_2d_list[0].native == pytest.approx( @@ -224,9 +224,7 @@ def test__blurred_image_2d_list_from( ) blurred_image_2d_list = gal.blurred_image_2d_list_from( - grid=grid_2d_7x7, - blurring_grid=blurring_grid_2d_7x7, - psf=psf_3x3 + grid=grid_2d_7x7, blurring_grid=blurring_grid_2d_7x7, psf=psf_3x3 ) assert blurred_image_2d_list[0].native == pytest.approx( @@ -296,9 +294,7 @@ def test__visibilities_list_from(grid_2d_7x7, transformer_7x7_7): assert (lp_1_visibilities == visibilities_list[1]).all() -def test__galaxy_blurred_image_2d_dict_from( - grid_2d_7x7, blurring_grid_2d_7x7, psf_3x3 -): +def test__galaxy_blurred_image_2d_dict_from(grid_2d_7x7, blurring_grid_2d_7x7, psf_3x3): lp_0 = ag.lp.Sersic(intensity=1.0) g0 = ag.Galaxy(redshift=0.5, light_profile=lp_0) diff --git a/test_autogalaxy/profiles/light/linear/test_abstract.py b/test_autogalaxy/profiles/light/linear/test_abstract.py index 6d122e212..53ae0c6ee 100644 --- a/test_autogalaxy/profiles/light/linear/test_abstract.py +++ b/test_autogalaxy/profiles/light/linear/test_abstract.py @@ -33,15 +33,11 @@ def test__mapping_matrix_from(grid_2d_7x7, blurring_grid_2d_7x7, psf_3x3): ) lp_0_blurred_image = lp_0.blurred_image_2d_from( - grid=grid_2d_7x7, - blurring_grid=blurring_grid_2d_7x7, - psf=psf_3x3 + grid=grid_2d_7x7, blurring_grid=blurring_grid_2d_7x7, psf=psf_3x3 ) lp_1_blurred_image = lp_1.blurred_image_2d_from( - grid=grid_2d_7x7, - blurring_grid=blurring_grid_2d_7x7, - psf=psf_3x3 + grid=grid_2d_7x7, blurring_grid=blurring_grid_2d_7x7, psf=psf_3x3 ) assert lp_linear_obj_func_list.operated_mapping_matrix_override[ From 82622f74862915f93020756c66df6740f3eb9666 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Thu, 3 Apr 2025 17:23:06 +0100 Subject: [PATCH 25/26] remove grid relocate radial --- autogalaxy/config/grids.yaml | 75 ------------------ autogalaxy/profiles/geometry_profiles.py | 2 - .../light/linear/shapelets/cartesian.py | 1 - .../light/linear/shapelets/exponential.py | 1 - .../profiles/light/standard/chameleon.py | 1 - autogalaxy/profiles/light/standard/eff.py | 1 - .../profiles/light/standard/gaussian.py | 1 - autogalaxy/profiles/light/standard/moffat.py | 1 - autogalaxy/profiles/light/standard/sersic.py | 1 - .../light/standard/shapelets/cartesian.py | 1 - .../light/standard/shapelets/exponential.py | 1 - .../light/standard/shapelets/polar.py | 1 - autogalaxy/profiles/mass/dark/abstract.py | 2 - autogalaxy/profiles/mass/dark/gnfw.py | 4 - autogalaxy/profiles/mass/dark/nfw.py | 8 -- .../profiles/mass/dark/nfw_truncated.py | 1 - autogalaxy/profiles/mass/point/point.py | 1 - .../profiles/mass/sheets/external_shear.py | 1 - autogalaxy/profiles/mass/sheets/mass_sheet.py | 1 - autogalaxy/profiles/mass/stellar/chameleon.py | 2 - autogalaxy/profiles/mass/stellar/gaussian.py | 3 - autogalaxy/profiles/mass/stellar/sersic.py | 6 -- .../profiles/mass/stellar/sersic_gradient.py | 2 - autogalaxy/profiles/mass/total/isothermal.py | 4 - autogalaxy/profiles/mass/total/power_law.py | 2 - .../profiles/mass/total/power_law_broken.py | 2 - .../profiles/mass/total/power_law_core.py | 4 - .../mass/total/power_law_multipole.py | 2 - test_autogalaxy/config/grids.yaml | 78 ------------------- test_autogalaxy/config/lensing.yaml | 7 -- .../files/config/grids/radial_minimum.ini | 32 -------- 31 files changed, 249 deletions(-) delete mode 100644 autogalaxy/config/grids.yaml delete mode 100644 test_autogalaxy/config/grids.yaml delete mode 100644 test_autogalaxy/profiles/files/config/grids/radial_minimum.ini diff --git a/autogalaxy/config/grids.yaml b/autogalaxy/config/grids.yaml deleted file mode 100644 index 60a0204f6..000000000 --- a/autogalaxy/config/grids.yaml +++ /dev/null @@ -1,75 +0,0 @@ -# Certain light and mass profile calculations become ill defined at (0.0, 0.0) or close to this value. This can lead -# to numerical issues in the calculation of the profile, for example a np.nan may arise, crashing the code. - -# To avoid this, we set a minimum value for the radial coordinate of the profile. If the radial coordinate is below -# this value, it is rounded up to this value. This ensures that the profile cannot receive a radial coordinate of 0.0. - -# For example, if an input grid coordinate has a radial coordinate of 1e-12, for most profiles this will be rounded up -# to radial_minimum=1e-08. This is a small enough value that it should not impact the results of the profile calculation. - -radial_minimum: - radial_minimum: - Chameleon: 1.0e-08 - ChameleonSph: 1.0e-08 - DevVaucouleurs: 1.0e-06 - DevVaucouleursSph: 1.0e-06 - dPIE: 1.0e-08 - dPIESph: 1.0e-08 - ExponentialGradient: 1.0e-06 - ExponentialGradientSph: 1.0e-06 - ElsonFreeFall: 1.0e-08 - ElsonFreeFallSph: 1.0e-08 - Exponential: 1.0e-06 - ExponentialCore: 1.0e-06 - ExponentialCoreSph: 1.0e-06 - ExponentialSph: 1.0e-06 - ExternalShear: 1.0e-08 - Gaussian: 1.0e-08 - GaussianGradient: 1.0e-08 - GaussianSph: 1.0e-08 - gNFW: 1.0e-06 - gNFWMCRLudlow: 1.0e-06 - gNFWVirialMassConcSph: 1.0e-06 - gNFWSph: 1.0e-06 - Isothermal: 1.0e-08 - IsothermalCore: 1.0e-08 - IsothermalCoreSph: 1.0e-08 - IsothermalSph: 1.0e-08 - MassSheet: 1.0e-08 - Moffat: 1.0e-08 - MoffatSph: 1.0e-08 - PowerLawMultipole: 1.0e-08 - NFW: 1.0e-06 - NFWMCRDuffySph: 1.0e-06 - NFWMCRLudlow: 1.0e-06 - NFWMCRLudlowSph: 1.0e-06 - NFWMCRScatterLudlow: 1.0e-06 - NFWMCRScatterLudlowSph: 1.0e-06 - NFWVirialMassConcSph : 1.0e-06 - NFWSph: 1.0e-06 - NFWTruncatedMCRDuffySph: 1.0e-06 - NFWTruncatedMCRLudlowSph: 1.0e-06 - NFWTruncatedMCRScatterLudlowSph: 1.0e-06 - NFWTruncatedSph: 1.0e-06 - PointMass: 1.0e-08 - PowerLaw: 1.0e-08 - PowerLawBroken: 1.0e-08 - PowerLawBrokenSph: 1.0e-08 - PowerLawCore: 1.0e-08 - PowerLawCoreSph: 1.0e-08 - PowerLawSph: 1.0e-08 - Sersic: 1.0e-06 - SersicCore: 1.0e-06 - SersicCoreSph: 1.0e-06 - SersicGradient: 1.0e-06 - SersicSph: 1.0e-06 - SersicGradientSph: 1.0e-06 - ShapeletCartesianSph: 1.0e-8 - ShapeletCartesian: 1.0e-8 - ShapeletPolarSph: 1.0e-8 - ShapeletPolar: 1.0e-8 - ShapeletExponentialSph: 1.0e-8 - ShapeletExponential: 1.0e-8 - SMBH: 1.0e-8 - SMBHBinary: 1.0e-8 - EllProfile: 1.0e-08 \ No newline at end of file diff --git a/autogalaxy/profiles/geometry_profiles.py b/autogalaxy/profiles/geometry_profiles.py index 7175851d7..33e86cefa 100644 --- a/autogalaxy/profiles/geometry_profiles.py +++ b/autogalaxy/profiles/geometry_profiles.py @@ -307,7 +307,6 @@ def rotated_grid_from_reference_frame_from( ) @aa.grid_dec.to_array - @aa.grid_dec.relocate_to_radial_minimum def elliptical_radii_grid_from( self, grid: aa.type.Grid2DLike, **kwargs ) -> np.ndarray: @@ -327,7 +326,6 @@ def elliptical_radii_grid_from( ) @aa.grid_dec.to_array - @aa.grid_dec.relocate_to_radial_minimum def eccentric_radii_grid_from( self, grid: aa.type.Grid2DLike, **kwargs ) -> np.ndarray: diff --git a/autogalaxy/profiles/light/linear/shapelets/cartesian.py b/autogalaxy/profiles/light/linear/shapelets/cartesian.py index f6363a093..989f2c18f 100644 --- a/autogalaxy/profiles/light/linear/shapelets/cartesian.py +++ b/autogalaxy/profiles/light/linear/shapelets/cartesian.py @@ -54,7 +54,6 @@ def __init__( @aa.grid_dec.to_array @check_operated_only @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def image_2d_from( self, grid: aa.type.Grid2DLike, operated_only: Optional[bool] = None, **kwargs ) -> np.ndarray: diff --git a/autogalaxy/profiles/light/linear/shapelets/exponential.py b/autogalaxy/profiles/light/linear/shapelets/exponential.py index 2fd12efa8..2469116dd 100644 --- a/autogalaxy/profiles/light/linear/shapelets/exponential.py +++ b/autogalaxy/profiles/light/linear/shapelets/exponential.py @@ -53,7 +53,6 @@ def __init__( @aa.grid_dec.to_array @check_operated_only @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def image_2d_from( self, grid: aa.type.Grid2DLike, operated_only: Optional[bool] = None, **kwargs ) -> np.ndarray: diff --git a/autogalaxy/profiles/light/standard/chameleon.py b/autogalaxy/profiles/light/standard/chameleon.py index 6e1ce199d..96279be5d 100644 --- a/autogalaxy/profiles/light/standard/chameleon.py +++ b/autogalaxy/profiles/light/standard/chameleon.py @@ -94,7 +94,6 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray) -> np.ndarray: @aa.grid_dec.to_array @check_operated_only @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def image_2d_from( self, grid: aa.type.Grid2DLike, operated_only: Optional[bool] = None, **kwargs ) -> np.ndarray: diff --git a/autogalaxy/profiles/light/standard/eff.py b/autogalaxy/profiles/light/standard/eff.py index 138e094f8..675834995 100644 --- a/autogalaxy/profiles/light/standard/eff.py +++ b/autogalaxy/profiles/light/standard/eff.py @@ -61,7 +61,6 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray) -> np.ndarray: @aa.grid_dec.to_array @check_operated_only @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def image_2d_from( self, grid: aa.type.Grid2DLike, operated_only: Optional[bool] = None, **kwargs ) -> np.ndarray: diff --git a/autogalaxy/profiles/light/standard/gaussian.py b/autogalaxy/profiles/light/standard/gaussian.py index ec16af0a8..18f5e69b0 100644 --- a/autogalaxy/profiles/light/standard/gaussian.py +++ b/autogalaxy/profiles/light/standard/gaussian.py @@ -87,7 +87,6 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray) -> np.ndarray: @aa.grid_dec.to_array @check_operated_only @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def image_2d_from( self, grid: aa.type.Grid2DLike, operated_only: Optional[bool] = None, **kwargs ) -> np.ndarray: diff --git a/autogalaxy/profiles/light/standard/moffat.py b/autogalaxy/profiles/light/standard/moffat.py index 8b6c69f38..fb88e5cc8 100644 --- a/autogalaxy/profiles/light/standard/moffat.py +++ b/autogalaxy/profiles/light/standard/moffat.py @@ -72,7 +72,6 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray) -> np.ndarray: @aa.grid_dec.to_array @check_operated_only @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def image_2d_from( self, grid: aa.type.Grid2DLike, operated_only: Optional[bool] = None, **kwargs ) -> np.ndarray: diff --git a/autogalaxy/profiles/light/standard/sersic.py b/autogalaxy/profiles/light/standard/sersic.py index 7ac96daed..94d2364d5 100644 --- a/autogalaxy/profiles/light/standard/sersic.py +++ b/autogalaxy/profiles/light/standard/sersic.py @@ -149,7 +149,6 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray, **kwargs) -> np.ndarra @aa.grid_dec.to_array @check_operated_only @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def image_2d_from( self, grid: aa.type.Grid2DLike, operated_only: Optional[bool] = None, **kwargs ) -> aa.Array2D: diff --git a/autogalaxy/profiles/light/standard/shapelets/cartesian.py b/autogalaxy/profiles/light/standard/shapelets/cartesian.py index a98856bc8..9045eaeb2 100644 --- a/autogalaxy/profiles/light/standard/shapelets/cartesian.py +++ b/autogalaxy/profiles/light/standard/shapelets/cartesian.py @@ -63,7 +63,6 @@ def coefficient_tag(self) -> str: @aa.grid_dec.to_array @check_operated_only @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def image_2d_from( self, grid: aa.type.Grid2DLike, operated_only: Optional[bool] = None, **kwargs ) -> np.ndarray: diff --git a/autogalaxy/profiles/light/standard/shapelets/exponential.py b/autogalaxy/profiles/light/standard/shapelets/exponential.py index d15d4eda0..78915d4ff 100644 --- a/autogalaxy/profiles/light/standard/shapelets/exponential.py +++ b/autogalaxy/profiles/light/standard/shapelets/exponential.py @@ -64,7 +64,6 @@ def coefficient_tag(self) -> str: @aa.grid_dec.to_array @check_operated_only @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def image_2d_from( self, grid: aa.type.Grid2DLike, operated_only: Optional[bool] = None, **kwargs ) -> np.ndarray: diff --git a/autogalaxy/profiles/light/standard/shapelets/polar.py b/autogalaxy/profiles/light/standard/shapelets/polar.py index f9da6ad4f..84f144efb 100644 --- a/autogalaxy/profiles/light/standard/shapelets/polar.py +++ b/autogalaxy/profiles/light/standard/shapelets/polar.py @@ -64,7 +64,6 @@ def coefficient_tag(self) -> str: @aa.grid_dec.to_array @check_operated_only @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def image_2d_from( self, grid: aa.type.Grid2DLike, operated_only: Optional[bool] = None, **kwargs ) -> np.ndarray: diff --git a/autogalaxy/profiles/mass/dark/abstract.py b/autogalaxy/profiles/mass/dark/abstract.py index faba381d4..5379ed17e 100644 --- a/autogalaxy/profiles/mass/dark/abstract.py +++ b/autogalaxy/profiles/mass/dark/abstract.py @@ -58,7 +58,6 @@ def __init__( @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """Calculate the projected convergence at a given set of arc-second gridded coordinates. @@ -76,7 +75,6 @@ def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_via_mge_from(self, grid: aa.type.Grid2DLike, **kwargs): """Calculate the projected convergence at a given set of arc-second gridded coordinates. diff --git a/autogalaxy/profiles/mass/dark/gnfw.py b/autogalaxy/profiles/mass/dark/gnfw.py index 96cda9a4e..35066d62e 100644 --- a/autogalaxy/profiles/mass/dark/gnfw.py +++ b/autogalaxy/profiles/mass/dark/gnfw.py @@ -88,7 +88,6 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_mge_from(self, grid: aa.type.Grid2DLike, **kwargs): return self._deflections_2d_via_mge_from( grid=grid, sigmas_factor=self.axis_ratio @@ -96,7 +95,6 @@ def deflections_2d_via_mge_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_integral_from( self, grid: aa.type.Grid2DLike, tabulate_bins=1000, **kwargs ): @@ -233,7 +231,6 @@ def integral_y(y, eta): @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def potential_2d_from(self, grid: aa.type.Grid2DLike, tabulate_bins=1000, **kwargs): """ Calculate the potential at a given set of arc-second gridded coordinates. @@ -365,7 +362,6 @@ def __init__( @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_integral_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. diff --git a/autogalaxy/profiles/mass/dark/nfw.py b/autogalaxy/profiles/mass/dark/nfw.py index 489db98c8..8da6dd9a3 100644 --- a/autogalaxy/profiles/mass/dark/nfw.py +++ b/autogalaxy/profiles/mass/dark/nfw.py @@ -48,7 +48,6 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_integral_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. @@ -91,7 +90,6 @@ def calculate_deflection_component(npow, index): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_cse_from(self, grid: aa.type.Grid2DLike, **kwargs): return self._deflections_2d_via_cse_from(grid=grid, **kwargs) @@ -122,7 +120,6 @@ def deflection_func(u, y, x, npow, axis_ratio, scale_radius): @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_via_cse_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the projected 2D convergence from a grid of (y,x) arc second coordinates, by computing and summing @@ -149,7 +146,6 @@ def convergence_func(self, grid_radius: float) -> float: @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def potential_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the potential at a given set of arc-second gridded coordinates. @@ -263,7 +259,6 @@ def coord_func(r): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def shear_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Analytic calculation shear from Heyrovský & Karamazov 2024 @@ -304,7 +299,6 @@ def shear_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Analytic calculation convergence from Heyrovský & Karamazov 2024 @@ -376,7 +370,6 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_analytic_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. @@ -405,7 +398,6 @@ def deflection_func_sph(self, grid_radius): @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def potential_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the potential at a given set of arc-second gridded coordinates. diff --git a/autogalaxy/profiles/mass/dark/nfw_truncated.py b/autogalaxy/profiles/mass/dark/nfw_truncated.py index 773ef10c9..5f634cff5 100644 --- a/autogalaxy/profiles/mass/dark/nfw_truncated.py +++ b/autogalaxy/profiles/mass/dark/nfw_truncated.py @@ -29,7 +29,6 @@ def __init__( @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. diff --git a/autogalaxy/profiles/mass/point/point.py b/autogalaxy/profiles/mass/point/point.py index 711db7c25..581484e62 100644 --- a/autogalaxy/profiles/mass/point/point.py +++ b/autogalaxy/profiles/mass/point/point.py @@ -40,7 +40,6 @@ def potential_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): grid_radii = self.radial_grid_from(grid=grid, **kwargs) return self._cartesian_grid_via_radial_from( diff --git a/autogalaxy/profiles/mass/sheets/external_shear.py b/autogalaxy/profiles/mass/sheets/external_shear.py index 083c48963..01ee3b45a 100644 --- a/autogalaxy/profiles/mass/sheets/external_shear.py +++ b/autogalaxy/profiles/mass/sheets/external_shear.py @@ -56,7 +56,6 @@ def potential_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. diff --git a/autogalaxy/profiles/mass/sheets/mass_sheet.py b/autogalaxy/profiles/mass/sheets/mass_sheet.py index ed9c1144a..ee28451e0 100644 --- a/autogalaxy/profiles/mass/sheets/mass_sheet.py +++ b/autogalaxy/profiles/mass/sheets/mass_sheet.py @@ -34,7 +34,6 @@ def potential_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): grid_radii = self.radial_grid_from(grid=grid, **kwargs) return self._cartesian_grid_via_radial_from( diff --git a/autogalaxy/profiles/mass/stellar/chameleon.py b/autogalaxy/profiles/mass/stellar/chameleon.py index 580b94ad4..77d8005ac 100644 --- a/autogalaxy/profiles/mass/stellar/chameleon.py +++ b/autogalaxy/profiles/mass/stellar/chameleon.py @@ -53,7 +53,6 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_analytic_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. @@ -127,7 +126,6 @@ def deflections_2d_via_analytic_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """Calculate the projected convergence at a given set of arc-second gridded coordinates. Parameters diff --git a/autogalaxy/profiles/mass/stellar/gaussian.py b/autogalaxy/profiles/mass/stellar/gaussian.py index bead9e95f..f16998fae 100644 --- a/autogalaxy/profiles/mass/stellar/gaussian.py +++ b/autogalaxy/profiles/mass/stellar/gaussian.py @@ -63,7 +63,6 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_analytic_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. @@ -91,7 +90,6 @@ def deflections_2d_via_analytic_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_integral_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. @@ -148,7 +146,6 @@ def deflection_func(u, y, x, npow, axis_ratio, sigma): @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """Calculate the projected convergence at a given set of arc-second gridded coordinates. diff --git a/autogalaxy/profiles/mass/stellar/sersic.py b/autogalaxy/profiles/mass/stellar/sersic.py index a7608c903..4c9e57a0c 100644 --- a/autogalaxy/profiles/mass/stellar/sersic.py +++ b/autogalaxy/profiles/mass/stellar/sersic.py @@ -137,7 +137,6 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_mge_from( self, grid: aa.type.Grid2DLike, func_terms=28, func_gaussians=20, **kwargs ): @@ -163,7 +162,6 @@ def deflections_2d_via_mge_from( @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_cse_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the projected 2D deflection angles from a grid of (y,x) arc second coordinates, by computing and @@ -183,7 +181,6 @@ def deflections_2d_via_cse_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """Calculate the projected convergence at a given set of arc-second gridded coordinates. @@ -200,7 +197,6 @@ def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_via_mge_from( self, grid: aa.type.Grid2DLike, func_terms=28, func_gaussians=20, **kwargs ): @@ -225,7 +221,6 @@ def convergence_2d_via_mge_from( @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_via_cse_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the projected 2D convergence from a grid of (y,x) arc second coordinates, by computing and summing @@ -384,7 +379,6 @@ def elliptical_effective_radius(self): class Sersic(AbstractSersic, MassProfileMGE, MassProfileCSE): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_integral_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. diff --git a/autogalaxy/profiles/mass/stellar/sersic_gradient.py b/autogalaxy/profiles/mass/stellar/sersic_gradient.py index 3b2495548..426e7a1cc 100644 --- a/autogalaxy/profiles/mass/stellar/sersic_gradient.py +++ b/autogalaxy/profiles/mass/stellar/sersic_gradient.py @@ -52,7 +52,6 @@ def __init__( @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_2d_via_integral_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. @@ -126,7 +125,6 @@ def deflection_func( @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """Calculate the projected convergence at a given set of arc-second gridded coordinates. diff --git a/autogalaxy/profiles/mass/total/isothermal.py b/autogalaxy/profiles/mass/total/isothermal.py index f5073bd23..e7fac6830 100644 --- a/autogalaxy/profiles/mass/total/isothermal.py +++ b/autogalaxy/profiles/mass/total/isothermal.py @@ -91,7 +91,6 @@ def axis_ratio(self): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles on a grid of (y,x) arc-second coordinates. @@ -129,7 +128,6 @@ def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def shear_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the (gamma_y, gamma_x) shear vector field on a grid of (y,x) arc-second coordinates. @@ -191,7 +189,6 @@ def axis_ratio(self): @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def potential_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the potential on a grid of (y,x) arc-second coordinates. @@ -206,7 +203,6 @@ def potential_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles on a grid of (y,x) arc-second coordinates. diff --git a/autogalaxy/profiles/mass/total/power_law.py b/autogalaxy/profiles/mass/total/power_law.py index cdab5afe3..ee0864e71 100644 --- a/autogalaxy/profiles/mass/total/power_law.py +++ b/autogalaxy/profiles/mass/total/power_law.py @@ -61,7 +61,6 @@ def potential_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles on a grid of (y,x) arc-second coordinates. @@ -165,7 +164,6 @@ def __init__( @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): eta = self.radial_grid_from(grid=grid, **kwargs) deflection_r = ( diff --git a/autogalaxy/profiles/mass/total/power_law_broken.py b/autogalaxy/profiles/mass/total/power_law_broken.py index 233240550..530ca4faa 100644 --- a/autogalaxy/profiles/mass/total/power_law_broken.py +++ b/autogalaxy/profiles/mass/total/power_law_broken.py @@ -52,7 +52,6 @@ def __init__( @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Returns the dimensionless density kappa=Sigma/Sigma_c (eq. 1) @@ -77,7 +76,6 @@ def potential_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from(self, grid, max_terms=20, **kwargs): """ Returns the complex deflection angle from eq. 18 and 19 diff --git a/autogalaxy/profiles/mass/total/power_law_core.py b/autogalaxy/profiles/mass/total/power_law_core.py index 3a5a52d49..dc43fa235 100644 --- a/autogalaxy/profiles/mass/total/power_law_core.py +++ b/autogalaxy/profiles/mass/total/power_law_core.py @@ -52,7 +52,6 @@ def einstein_radius_rescaled(self): @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Returns the two dimensional projected convergence on a grid of (y,x) arc-second coordinates. @@ -78,7 +77,6 @@ def convergence_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def potential_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the potential on a grid of (y,x) arc-second coordinates. @@ -109,7 +107,6 @@ def potential_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles on a grid of (y,x) arc-second coordinates. @@ -219,7 +216,6 @@ def __init__( @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from(self, grid: aa.type.Grid2DLike, **kwargs): """ Calculate the deflection angles on a grid of (y,x) arc-second coordinates. diff --git a/autogalaxy/profiles/mass/total/power_law_multipole.py b/autogalaxy/profiles/mass/total/power_law_multipole.py index da5c5cc8a..47ff2aa17 100644 --- a/autogalaxy/profiles/mass/total/power_law_multipole.py +++ b/autogalaxy/profiles/mass/total/power_law_multipole.py @@ -148,7 +148,6 @@ def jacobian( @aa.grid_dec.to_vector_yx @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def deflections_yx_2d_from( self, grid: aa.type.Grid1D2DLike, **kwargs ) -> np.ndarray: @@ -195,7 +194,6 @@ def deflections_yx_2d_from( @aa.over_sample @aa.grid_dec.to_array @aa.grid_dec.transform - @aa.grid_dec.relocate_to_radial_minimum def convergence_2d_from(self, grid: aa.type.Grid1D2DLike, **kwargs) -> np.ndarray: """ Returns the two dimensional projected convergence on a grid of (y,x) arc-second coordinates. diff --git a/test_autogalaxy/config/grids.yaml b/test_autogalaxy/config/grids.yaml deleted file mode 100644 index 378707832..000000000 --- a/test_autogalaxy/config/grids.yaml +++ /dev/null @@ -1,78 +0,0 @@ -interpolate: - convergence_2d_from: - Isothermal: false - IsothermalSph: true - deflections_yx_2d_from: - Isothermal: false - IsothermalSph: true - image_2d_from: - sersic: false - sersicSph: true - potential_2d_from: - Isothermal: false - IsothermalSph: true -# Certain light and mass profile calculations become ill defined at (0.0, 0.0) or close to this value. This can lead -# to numerical issues in the calculation of the profile, for example a np.nan may arise, crashing the code. - -# To avoid this, we set a minimum value for the radial coordinate of the profile. If the radial coordinate is below -# this value, it is rounded up to this value. This ensures that the profile cannot receive a radial coordinate of 0.0. - -# For example, if an input grid coordinate has a radial coordinate of 1e-12, for most profiles this will be rounded up -# to radial_minimum=1e-08. This is a small enough value that it should not impact the results of the profile calculation. - -radial_minimum: - radial_minimum: - MockGridRadialMinimum: 2.5 - MockIsothermal: 0.0001 - MockIsothermalSph: 0.03 - Chameleon: 0.0001 - ChameleonSph: 0.0001 - DevVaucouleurs: 0.0001 - DevVaucouleursSph: 0.0001 - ExponentialGradient: 0.0001 - ElsonFreeFall: 0.0001 - ElsonFreeFallSph: 0.0001 - Exponential: 0.0001 - ExponentialCore: 0.0001 - ExponentialCoreSph: 0.0001 - ExponentialSph: 0.0001 - ExternalShear: 0.0001 - Gaussian: 0.0001 - GaussianSph: 0.0001 - gNFW: 0.0001 - gNFWMCRLudlow: 0.0001 - gNFWSph: 0.0001 - Isothermal: 0.0001 - IsothermalCore: 0.0001 - IsothermalCoreSph: 0.0001 - IsothermalSph: 0.0001 - MassSheet: 0.0001 - Moffat: 0.0001 - MoffatSph: 0.0001 - NFW: 0.0001 - NFWMCRDuffySph: 0.0001 - NFWMCRLudlow: 0.0001 - NFWMCRLudlowSph: 0.0001 - NFWMCRScatterLudlow: 0.0001 - NFWMCRScatterLudlowSph: 0.0001 - NFWSph: 0.0001 - NFWTruncatedMCRDuffySph: 0.0001 - NFWTruncatedMCRLudlowSph: 0.0001 - NFWTruncatedMCRScatterLudlowSph: 0.0001 - NFWTruncatedSph: 0.0001 - PointMass: 0.0001 - PowerLaw: 0.0001 - PowerLawBroken: 0.0001 - PowerLawBrokenSph: 0.0001 - PowerLawCore: 0.0001 - PowerLawCoreSph: 0.0001 - PowerLawSph: 0.0001 - Sersic: 0.0001 - SersicCore: 0.0001 - SersicCoreSph: 0.0001 - SersicGradient: 0.0001 - SersicSph: 0.0001 - ExponentialGradientSph: 0.0001 - SersicGradientSph: 0.0001 - EllProfile: 0.0001 - SersicAdaptTest: 0.0001 diff --git a/test_autogalaxy/config/lensing.yaml b/test_autogalaxy/config/lensing.yaml index f98be8aba..319dc389d 100644 --- a/test_autogalaxy/config/lensing.yaml +++ b/test_autogalaxy/config/lensing.yaml @@ -2,10 +2,3 @@ general: calculation_grid: convergence_threshold: 0.1 pixels: 81 -grids: - radial_minimum: - radial_minimum: - isothermal: 0.01 - isothermalsph: 0.01 - mockisothermal: 0.01 - mockisothermalsph: 0.01 diff --git a/test_autogalaxy/profiles/files/config/grids/radial_minimum.ini b/test_autogalaxy/profiles/files/config/grids/radial_minimum.ini deleted file mode 100644 index 589fba3d9..000000000 --- a/test_autogalaxy/profiles/files/config/grids/radial_minimum.ini +++ /dev/null @@ -1,32 +0,0 @@ -[radial_minimum] -EllProfile=1.0 -MockGridRadialMinimum=2.5 -IsothermalSph=1.0 -SersicSph=1.0 -Sersic=1.0 -ExternalShear=1.0 -Gaussian=1.0 -Isothermal=1.0 -Exponential=1.0 -SersicCore=1.0 -SersicCoreSph=1.0 -DevVaucouleurs=1.0 -DevVaucouleursSph=1.0 -ExponentialSph=1.0 -GaussianSph=1.0 -MassSheet=1.0 -SersicGradientSph=1.0 -SersicGradient=1.0 -gNFWSph=1.0 -EllMassProfile=1.0 -PowerLawCore=1.0 -PowerLawCoreSph=1.0 -PowerLaw=1.0 -PowerLawSph=1.0 -IsothermalCore=1.0 -IsothermalCoreSph=1.0 -gNFW=1.0 -NFWTruncatedSph=1.0 -NFW=1.0 -NFWSph=1.0 -PointMass=1.0 \ No newline at end of file From 2ace7ea745a0c20ed456fa4a3610f57a09de2a64 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Fri, 4 Apr 2025 16:19:16 +0100 Subject: [PATCH 26/26] pylops docs remove --- docs/installation/conda.rst | 1 - docs/installation/overview.rst | 2 -- docs/installation/pip.rst | 1 - docs/installation/source.rst | 1 - files/citations.bib | 11 ----------- files/citations.md | 1 - files/citations.tex | 3 --- optional_requirements.txt | 1 - paper/paper.bib | 11 +---------- paper/paper.md | 3 +-- 10 files changed, 2 insertions(+), 33 deletions(-) diff --git a/docs/installation/conda.rst b/docs/installation/conda.rst index 2df01a4ed..e0cdf6096 100644 --- a/docs/installation/conda.rst +++ b/docs/installation/conda.rst @@ -106,7 +106,6 @@ For interferometer analysis there are two optional dependencies that must be ins .. code-block:: bash pip install pynufft - pip install pylops==2.3.1 **PyAutoGalaxy** will run without these libraries and it is recommended that you only install them if you intend to do interferometer analysis. diff --git a/docs/installation/overview.rst b/docs/installation/overview.rst index 87beb953c..b4fcddafa 100644 --- a/docs/installation/overview.rst +++ b/docs/installation/overview.rst @@ -65,5 +65,3 @@ Dependencies And the following optional dependencies: **pynufft**: https://github.com/jyhmiinlin/pynufft - -**PyLops**: https://github.com/PyLops/pylops diff --git a/docs/installation/pip.rst b/docs/installation/pip.rst index e5c90874d..22cc619bb 100644 --- a/docs/installation/pip.rst +++ b/docs/installation/pip.rst @@ -86,7 +86,6 @@ For interferometer analysis there are two optional dependencies that must be ins .. code-block:: bash pip install pynufft - pip install pylops==2.3.1 **PyAutoGalaxy** will run without these libraries and it is recommended that you only install them if you intend to do interferometer analysis. diff --git a/docs/installation/source.rst b/docs/installation/source.rst index ec1d3ca02..5028ca403 100644 --- a/docs/installation/source.rst +++ b/docs/installation/source.rst @@ -56,7 +56,6 @@ For unit tests to pass you will also need the following optional requirements: .. code-block:: bash pip install pynufft - pip install pylops==2.3.1 If you are using a ``conda`` environment, add the source repository as follows: diff --git a/files/citations.bib b/files/citations.bib index c17bec016..d7bc603ab 100644 --- a/files/citations.bib +++ b/files/citations.bib @@ -33,17 +33,6 @@ @article{astropy2 Bdsk-Url-1 = {https://doi.org/10.3847/1538-3881/aabc4f} } -@article{PyLops, -abstract = {Linear operators and optimisation are at the core of many algorithms used in signal and image processing, remote sensing, and inverse problems. For small to medium-scale problems, existing software packages (e.g., MATLAB, Python numpy and scipy) allow for explicitly building dense (or sparse) matrices and performing algebraic operations (e.g., computation of matrix-vector products and manipulation of matrices) with syntax that closely represents their corresponding analytical forms. However, many real application, large-scale operators do not lend themselves to explicit matrix representations, usually forcing practitioners to forego of the convenient linear-algebra syntax available for their explicit-matrix counterparts. PyLops is an open-source Python library providing a flexible and scalable framework for the creation and combination of so-called linear operators, class-based entities that represent matrices and inherit their associated syntax convenience, but do not rely on the creation of explicit matrices. We show that PyLops operators can dramatically reduce the memory load and CPU computations compared to explicit-matrix calculations, while still allowing users to seamlessly use their existing knowledge of compact matrix-based syntax that scales to any problem size because no explicit matrices are required.}, -archivePrefix = {arXiv}, -arxivId = {1907.12349}, -author = {Ravasi, Matteo and Vasconcelos, Ivan}, -eprint = {1907.12349}, -file = {:home/jammy/Documents/Papers/Software/PyLops.pdf:pdf}, -title = {{PyLops -- A Linear-Operator Python Library for large scale optimization}}, -url = {http://arxiv.org/abs/1907.12349}, -year = {2019} -} @article{colossus, abstract = {This paper introduces Colossus, a public, open-source python package for calculations related to cosmology, the large-scale structure (LSS) of matter in the universe, and the properties of dark matter halos. The code is designed to be fast and easy to use, with a coherent, well-documented user interface. The cosmology module implements Friedman-Lemaitre-Robertson-Walker cosmologies including curvature, relativistic species, and different dark energy equations of state, and provides fast computations of the linear matter power spectrum, variance, and correlation function. The LSS module is concerned with the properties of peaks in Gaussian random fields and halos in a statistical sense, including their peak height, peak curvature, halo bias, and mass function. The halo module deals with spherical overdensity radii and masses, density profiles, concentration, and the splashback radius. To facilitate the rapid exploration of these quantities, Colossus implements more than 40 different fitting functions from the literature. I discuss the core routines in detail, with particular emphasis on their accuracy. Colossus is available at bitbucket.org/bdiemer/colossus.}, diff --git a/files/citations.md b/files/citations.md index 3e6588046..68c78b7e9 100644 --- a/files/citations.md +++ b/files/citations.md @@ -18,7 +18,6 @@ This work uses the following software packages: - `NumPy` https://github.com/numpy/numpy [@numpy] - `PyAutoFit` https://github.com/rhayes777/PyAutoFit [@pyautofit] - `PyAutoGalaxy` https://github.com/Jammy2211/PyAutoGalaxy [@Nightingale2018] [@pyautogalaxy] -- `PyLops` https://github.com/equinor/pylops [@pylops] - `PyNUFFT` https://github.com/jyhmiinlin/pynufft [@pynufft] - `PySwarms` https://github.com/ljvmiranda921/pyswarms [@pyswarms] - `Python` https://www.python.org/ [@python] diff --git a/files/citations.tex b/files/citations.tex index cce7006df..b3c11ab2c 100644 --- a/files/citations.tex +++ b/files/citations.tex @@ -50,9 +50,6 @@ \section*{Software Citations} \href{https://github.com/Jammy2211/PyAutoGalaxy}{\textt{PyAutoGalaxy}} \citep{Nightingale2018, pyautogalaxy} -\item -\href{https://github.com/equinor/pylops}{\textt{PyLops}} -\citep{pylops} \item \href{https://github.com/jyhmiinlin/pynufft}{\textt{PyNUFFT}} diff --git a/optional_requirements.txt b/optional_requirements.txt index 5633b5068..418b74e2f 100644 --- a/optional_requirements.txt +++ b/optional_requirements.txt @@ -1,5 +1,4 @@ numba -pylops>=1.10.0,<=2.3.1 pynufft ultranest==3.6.2 zeus-mcmc==2.5.4 diff --git a/paper/paper.bib b/paper/paper.bib index 7748bc669..5df87d1aa 100644 --- a/paper/paper.bib +++ b/paper/paper.bib @@ -30,16 +30,7 @@ @article{astropy2 Volume = {156}, Year = 2018, Bdsk-Url-1 = {https://doi.org/10.3847/1538-3881/aabc4f}} -@article{PyLops, -archivePrefix = {arXiv}, -arxivId = {1907.12349}, -author = {Ravasi, Matteo and Vasconcelos, Ivan}, -eprint = {1907.12349}, -file = {:home/jammy/Documents/Papers/Software/PyLops.pdf:pdf}, -title = {{PyLops -- A Linear-Operator Python Library for large scale optimization}}, -url = {http://arxiv.org/abs/1907.12349}, -year = {2019} -} + @article{colossus, archivePrefix = {arXiv}, arxivId = {1712.04512}, diff --git a/paper/paper.md b/paper/paper.md index d790aba5b..011da2511 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -127,7 +127,7 @@ reconstruct the source galaxies of strong gravitational lenses in `PyAutoGalaxy` `PyAutoGalaxy` includes a comprehensive visualization library for the analysis of both direct imaging and interferometer datasets and tools for preprocessing data to formats suitable for galaxy model-fitting. The `astropy` cosmology module handles unit conversions and calculations are optimized using the packages `NumPy` [@numpy], `numba` [@numba], - `PyNUFFT` [@pynufft] and `PyLops` [@PyLops]. +and `PyNUFFT` [@pynufft]. To perform model-fitting, `PyAutoGalaxy` adopts the probabilistic programming language `PyAutoFit` (https://github.com/rhayes777/PyAutoFit). `PyAutoFit` allows users to compose a @@ -172,7 +172,6 @@ taken without a local `PyAutoGalaxy` installation. - `numba` [@numba] - `NumPy` [@numpy] - `PyAutoFit` [@pyautofit] -- `PyLops` [@PyLops] - `PyNUFFT` [@pynufft] - `pyprojroot` (https://github.com/chendaniely/pyprojroot) - `PySwarms` [@pyswarms]