From 82dec5bb81989b648c1b3acfbb56ea369d269a05 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 24 Jun 2025 16:04:53 +0100 Subject: [PATCH 1/5] move some imports --- autolens/imaging/mock/mock_fit_imaging.py | 4 +++- autolens/imaging/model/analysis.py | 7 ------- autolens/point/fit/positions/image/pair.py | 3 --- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/autolens/imaging/mock/mock_fit_imaging.py b/autolens/imaging/mock/mock_fit_imaging.py index 763dd8f7e..d8477d3fb 100644 --- a/autolens/imaging/mock/mock_fit_imaging.py +++ b/autolens/imaging/mock/mock_fit_imaging.py @@ -7,13 +7,15 @@ class MockFitImaging(aa.m.MockFitImaging): def __init__( self, tracer=None, - dataset=aa.m.MockDataset(), + dataset=None, inversion=None, noise_map=None, grid=None, blurred_image=None, ): + dataset = dataset or aa.m.MockDataset() + super().__init__( dataset=dataset, inversion=inversion, diff --git a/autolens/imaging/model/analysis.py b/autolens/imaging/model/analysis.py index b9f10100b..828c1e019 100644 --- a/autolens/imaging/model/analysis.py +++ b/autolens/imaging/model/analysis.py @@ -1,21 +1,14 @@ import logging -import numpy as np -from typing import Dict, Optional, Tuple -from autoconf.dictable import to_dict import autofit as af import autogalaxy as ag -from autoarray.exc import PixelizationException - from autolens.analysis.analysis.dataset import AnalysisDataset from autolens.imaging.model.result import ResultImaging from autolens.imaging.model.visualizer import VisualizerImaging from autolens.imaging.fit_imaging import FitImaging -from autolens import exc - logger = logging.getLogger(__name__) logger.setLevel(level="INFO") diff --git a/autolens/point/fit/positions/image/pair.py b/autolens/point/fit/positions/image/pair.py index ab2cf99b4..e7af82c2b 100644 --- a/autolens/point/fit/positions/image/pair.py +++ b/autolens/point/fit/positions/image/pair.py @@ -1,7 +1,4 @@ -import jax.numpy as jnp import numpy as np -from ott.geometry import pointcloud -from ott.solvers.linear import sinkhorn from scipy.optimize import linear_sum_assignment import autoarray as aa From f87cd570cf9014a79fc05c23eb3d2ee29febc10f Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Wed, 25 Jun 2025 15:38:31 +0100 Subject: [PATCH 2/5] speed up by making less imports at beggining --- autolens/imaging/plot/fit_imaging_plotters.py | 6 +++--- .../plot/fit_interferometer_plotters.py | 12 ++++++------ autolens/lens/plot/tracer_plotters.py | 12 ++++++------ autolens/lens/sensitivity.py | 6 +++--- autolens/lens/subhalo.py | 6 +++--- autolens/point/plot/fit_point_plotters.py | 12 ++++++------ autolens/point/plot/point_dataset_plotters.py | 12 ++++++------ autolens/point/visualise.py | 9 ++++++++- 8 files changed, 41 insertions(+), 34 deletions(-) diff --git a/autolens/imaging/plot/fit_imaging_plotters.py b/autolens/imaging/plot/fit_imaging_plotters.py index d5ec4b66a..8d01c7aef 100644 --- a/autolens/imaging/plot/fit_imaging_plotters.py +++ b/autolens/imaging/plot/fit_imaging_plotters.py @@ -19,9 +19,9 @@ class FitImagingPlotter(Plotter): def __init__( self, fit: FitImaging, - mat_plot_2d: aplt.MatPlot2D = aplt.MatPlot2D(), - visuals_2d: aplt.Visuals2D = aplt.Visuals2D(), - include_2d: aplt.Include2D = aplt.Include2D(), + mat_plot_2d: aplt.MatPlot2D = None, + visuals_2d: aplt.Visuals2D = None, + include_2d: aplt.Include2D = None, residuals_symmetric_cmap: bool = True ): """ diff --git a/autolens/interferometer/plot/fit_interferometer_plotters.py b/autolens/interferometer/plot/fit_interferometer_plotters.py index 07f35ee6c..9694a8d80 100644 --- a/autolens/interferometer/plot/fit_interferometer_plotters.py +++ b/autolens/interferometer/plot/fit_interferometer_plotters.py @@ -17,12 +17,12 @@ class FitInterferometerPlotter(Plotter): def __init__( self, fit: FitInterferometer, - mat_plot_1d: aplt.MatPlot1D = aplt.MatPlot1D(), - visuals_1d: aplt.Visuals1D = aplt.Visuals1D(), - include_1d: aplt.Include1D = aplt.Include1D(), - mat_plot_2d: aplt.MatPlot2D = aplt.MatPlot2D(), - visuals_2d: aplt.Visuals2D = aplt.Visuals2D(), - include_2d: aplt.Include2D = aplt.Include2D(), + mat_plot_1d: aplt.MatPlot1D = None, + visuals_1d: aplt.Visuals1D = None, + include_1d: aplt.Include1D = None, + mat_plot_2d: aplt.MatPlot2D = None, + visuals_2d: aplt.Visuals2D = None, + include_2d: aplt.Include2D = None, residuals_symmetric_cmap: bool = True, ): """ diff --git a/autolens/lens/plot/tracer_plotters.py b/autolens/lens/plot/tracer_plotters.py index 9d3e833b1..d894afff3 100644 --- a/autolens/lens/plot/tracer_plotters.py +++ b/autolens/lens/plot/tracer_plotters.py @@ -17,12 +17,12 @@ def __init__( self, tracer: Tracer, grid: aa.type.Grid2DLike, - mat_plot_1d: aplt.MatPlot1D = aplt.MatPlot1D(), - visuals_1d: aplt.Visuals1D = aplt.Visuals1D(), - include_1d: aplt.Include1D = aplt.Include1D(), - mat_plot_2d: aplt.MatPlot2D = aplt.MatPlot2D(), - visuals_2d: aplt.Visuals2D = aplt.Visuals2D(), - include_2d: aplt.Include2D = aplt.Include2D(), + mat_plot_1d: aplt.MatPlot1D = None, + visuals_1d: aplt.Visuals1D = None, + include_1d: aplt.Include1D = None, + mat_plot_2d: aplt.MatPlot2D = None, + visuals_2d: aplt.Visuals2D = None, + include_2d: aplt.Include2D = None, ): """ Plots the attributes of `Tracer` objects using the matplotlib methods `plot()` and `imshow()` and many diff --git a/autolens/lens/sensitivity.py b/autolens/lens/sensitivity.py index dfc5506a5..1777293bc 100644 --- a/autolens/lens/sensitivity.py +++ b/autolens/lens/sensitivity.py @@ -146,9 +146,9 @@ def __init__( source_image: Optional[aa.Array2D] = None, result: Optional[SubhaloSensitivityResult] = None, data_subtracted: Optional[aa.Array2D] = None, - mat_plot_2d: aplt.MatPlot2D = aplt.MatPlot2D(), - visuals_2d: aplt.Visuals2D = aplt.Visuals2D(), - include_2d: aplt.Include2D = aplt.Include2D(), + mat_plot_2d: aplt.MatPlot2D = None, + visuals_2d: aplt.Visuals2D = None, + include_2d: aplt.Include2D = None, ): """ Plots the simulated datasets and results of a sensitivity mapping analysis, where dark matter halos are used diff --git a/autolens/lens/subhalo.py b/autolens/lens/subhalo.py index 7fbb3f4e5..c5baf7639 100644 --- a/autolens/lens/subhalo.py +++ b/autolens/lens/subhalo.py @@ -173,9 +173,9 @@ def __init__( result: Optional[SubhaloGridSearchResult] = None, fit_imaging_with_subhalo: Optional[FitImaging] = None, fit_imaging_no_subhalo: Optional[FitImaging] = None, - mat_plot_2d: aplt.MatPlot2D = aplt.MatPlot2D(), - visuals_2d: aplt.Visuals2D = aplt.Visuals2D(), - include_2d: aplt.Include2D = aplt.Include2D(), + mat_plot_2d: aplt.MatPlot2D = None, + visuals_2d: aplt.Visuals2D = None, + include_2d: aplt.Include2D = None, ): """ Plots the results of scanning for a dark matter subhalo in strong lens imaging. diff --git a/autolens/point/plot/fit_point_plotters.py b/autolens/point/plot/fit_point_plotters.py index 0ac2a59b7..138fd7a8d 100644 --- a/autolens/point/plot/fit_point_plotters.py +++ b/autolens/point/plot/fit_point_plotters.py @@ -8,12 +8,12 @@ class FitPointDatasetPlotter(Plotter): def __init__( self, fit: FitPointDataset, - mat_plot_1d: aplt.MatPlot1D = aplt.MatPlot1D(), - visuals_1d: aplt.Visuals1D = aplt.Visuals1D(), - include_1d: aplt.Include1D = aplt.Include1D(), - mat_plot_2d: aplt.MatPlot2D = aplt.MatPlot2D(), - visuals_2d: aplt.Visuals2D = aplt.Visuals2D(), - include_2d: aplt.Include2D = aplt.Include2D(), + mat_plot_1d: aplt.MatPlot1D = None, + visuals_1d: aplt.Visuals1D = None, + include_1d: aplt.Include1D = None, + mat_plot_2d: aplt.MatPlot2D = None, + visuals_2d: aplt.Visuals2D = None, + include_2d: aplt.Include2D = None, ): """ Plots the attributes of `FitPointDataset` objects using matplotlib methods and functions which customize the diff --git a/autolens/point/plot/point_dataset_plotters.py b/autolens/point/plot/point_dataset_plotters.py index 692479147..c89b7e2ec 100644 --- a/autolens/point/plot/point_dataset_plotters.py +++ b/autolens/point/plot/point_dataset_plotters.py @@ -8,12 +8,12 @@ class PointDatasetPlotter(Plotter): def __init__( self, dataset: PointDataset, - mat_plot_1d: aplt.MatPlot1D = aplt.MatPlot1D(), - visuals_1d: aplt.Visuals1D = aplt.Visuals1D(), - include_1d: aplt.Include1D = aplt.Include1D(), - mat_plot_2d: aplt.MatPlot2D = aplt.MatPlot2D(), - visuals_2d: aplt.Visuals2D = aplt.Visuals2D(), - include_2d: aplt.Include2D = aplt.Include2D(), + mat_plot_1d: aplt.MatPlot1D = None, + visuals_1d: aplt.Visuals1D = None, + include_1d: aplt.Include1D = None, + mat_plot_2d: aplt.MatPlot2D = None, + visuals_2d: aplt.Visuals2D = None, + include_2d: aplt.Include2D = None, ): """ Plots the attributes of `PointDataset` objects using the matplotlib methods and functions functions which diff --git a/autolens/point/visualise.py b/autolens/point/visualise.py index 2bf253701..eef39cc0f 100644 --- a/autolens/point/visualise.py +++ b/autolens/point/visualise.py @@ -1,16 +1,19 @@ -from matplotlib import pyplot as plt import numpy as np from autolens.point.solver.step import Step def add_triangles(triangles, color): + from matplotlib import pyplot as plt + for triangle in triangles: triangle = np.append(triangle, [triangle[0]], axis=0) plt.plot(triangle[:, 0], triangle[:, 1], "o-", color=color) def visualise(step: Step): + from matplotlib import pyplot as plt + plt.figure(figsize=(8, 8)) add_triangles(step.initial_triangles, color="black") add_triangles(step.up_sampled, color="green") @@ -25,6 +28,8 @@ def visualise(step: Step): def plot_triangles(triangles, color="black", title="Triangles", point=None): + from matplotlib import pyplot as plt + plt.figure(figsize=(8, 8)) for triangle in triangles: triangle = np.append(triangle, [triangle[0]], axis=0) @@ -41,6 +46,8 @@ def plot_triangles(triangles, color="black", title="Triangles", point=None): def plot_triangles_compare(triangles_a, triangles_b, number=None): + from matplotlib import pyplot as plt + plt.figure(figsize=(8, 8)) for triangle in triangles_a: triangle = np.append(triangle, [triangle[0]], axis=0) From 3b1075d2791f0be7a8868b213f66181c0083e8b4 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Wed, 25 Jun 2025 17:32:59 +0100 Subject: [PATCH 3/5] autolen avoids cosmology import --- autolens/analysis/analysis/dataset.py | 4 ++-- autolens/analysis/analysis/lens.py | 8 +++++--- autolens/interferometer/model/analysis.py | 2 +- autolens/lens/tracer.py | 7 ++++--- autolens/lens/tracer_util.py | 10 +++++++--- autolens/point/model/analysis.py | 2 +- autolens/quantity/model/analysis.py | 2 +- 7 files changed, 21 insertions(+), 14 deletions(-) diff --git a/autolens/analysis/analysis/dataset.py b/autolens/analysis/analysis/dataset.py index c4e12d949..7dd173075 100644 --- a/autolens/analysis/analysis/dataset.py +++ b/autolens/analysis/analysis/dataset.py @@ -1,6 +1,6 @@ import os import logging -from typing import List, Optional, Union +from typing import List, Optional from autoconf import conf from autoconf.dictable import output_to_json @@ -28,7 +28,7 @@ def __init__( dataset, positions_likelihood_list: Optional[List[PositionsLH]] = None, adapt_image_maker: Optional[ag.AdaptImageMaker] = None, - cosmology: ag.cosmo.LensingCosmology = ag.cosmo.Planck15(), + cosmology: ag.cosmo.LensingCosmology = None, settings_inversion: aa.SettingsInversion = None, raise_inversion_positions_likelihood_exception: bool = True, title_prefix: str = None, diff --git a/autolens/analysis/analysis/lens.py b/autolens/analysis/analysis/lens.py index 24449ed4f..a539cb6fe 100644 --- a/autolens/analysis/analysis/lens.py +++ b/autolens/analysis/analysis/lens.py @@ -1,7 +1,7 @@ import jax.numpy as jnp import logging import numpy as np -from typing import Dict, List, Optional, Union +from typing import List, Optional import autofit as af import autoarray as aa @@ -23,7 +23,7 @@ class AnalysisLens: def __init__( self, positions_likelihood_list: Optional[List[PositionsLH]] = None, - cosmology: ag.cosmo.LensingCosmology = ag.cosmo.Planck15(), + cosmology: ag.cosmo.LensingCosmology = None, ): """ Analysis classes are used by PyAutoFit to fit a model to a dataset via a non-linear search. @@ -40,7 +40,9 @@ def __init__( cosmology The Cosmology assumed for this analysis. """ - self.cosmology = cosmology + from autogalaxy.cosmology.wrap import Planck15 + + self.cosmology = cosmology or Planck15() self.positions_likelihood_list = positions_likelihood_list def tracer_via_instance_from( diff --git a/autolens/interferometer/model/analysis.py b/autolens/interferometer/model/analysis.py index 0a33e5156..e26392a86 100644 --- a/autolens/interferometer/model/analysis.py +++ b/autolens/interferometer/model/analysis.py @@ -30,7 +30,7 @@ def __init__( dataset, positions_likelihood_list: Optional[PositionsLH] = None, adapt_image_maker: Optional[ag.AdaptImageMaker] = None, - cosmology: ag.cosmo.LensingCosmology = ag.cosmo.Planck15(), + cosmology: ag.cosmo.LensingCosmology = None, settings_inversion: aa.SettingsInversion = None, raise_inversion_positions_likelihood_exception: bool = True, title_prefix: str = None, diff --git a/autolens/lens/tracer.py b/autolens/lens/tracer.py index b1608dadc..d2f621baa 100644 --- a/autolens/lens/tracer.py +++ b/autolens/lens/tracer.py @@ -17,7 +17,7 @@ class Tracer(ABC, ag.OperateImageGalaxies, ag.OperateDeflections): def __init__( self, galaxies: Union[List[ag.Galaxy], af.ModelInstance], - cosmology: ag.cosmo.LensingCosmology = ag.cosmo.Planck15(), + cosmology: ag.cosmo.LensingCosmology = None, ): """ Performs gravitational lensing ray-tracing calculations based on an input list of galaxies and a cosmology. @@ -52,7 +52,7 @@ def __init__( self.galaxies = galaxies - self.cosmology = cosmology + self.cosmology = cosmology or ag.cosmo.Planck15() @property def galaxies_ascending_redshift(self) -> List[ag.Galaxy]: @@ -135,7 +135,7 @@ def sliced_tracer_from( line_of_sight_galaxies: List[ag.Galaxy], source_galaxies: List[ag.Galaxy], planes_between_lenses: List[int], - cosmology: ag.cosmo.LensingCosmology = ag.cosmo.Planck15(), + cosmology: ag.cosmo.LensingCosmology = None, ): """ Returns a tracer where the lens system is split into planes with specified redshift distances between them. @@ -182,6 +182,7 @@ def sliced_tracer_from( cosmology The cosmology used to perform ray-tracing calculations. """ + cosmology = cosmology or ag.cosmo.Planck15() lens_redshifts = tracer_util.plane_redshifts_from(galaxies=lens_galaxies) diff --git a/autolens/lens/tracer_util.py b/autolens/lens/tracer_util.py index 9debe0377..24f3276e6 100644 --- a/autolens/lens/tracer_util.py +++ b/autolens/lens/tracer_util.py @@ -86,7 +86,7 @@ def planes_from( def traced_grid_2d_list_from( planes: List[List[ag.Galaxy]], grid: aa.type.Grid2DLike, - cosmology: ag.cosmo.LensingCosmology = ag.cosmo.Planck15(), + cosmology: ag.cosmo.LensingCosmology = None, plane_index_limit: int = Optional[None], ): """ @@ -133,6 +133,7 @@ def traced_grid_2d_list_from( traced_grid_list A list of 2D (y,x) grids each of which are the input grid ray-traced to a redshift of the input list of planes. """ + cosmology = cosmology or ag.cosmo.Planck15() traced_grid_list = [] traced_deflection_list = [] @@ -175,7 +176,7 @@ def grid_2d_at_redshift_from( redshift: float, galaxies: List[ag.Galaxy], grid: aa.type.Grid2DLike, - cosmology: ag.cosmo.LensingCosmology = ag.cosmo.Planck15(), + cosmology: ag.cosmo.LensingCosmology = None, ) -> aa.type.Grid2DLike: """ Returns a ray-traced grid of 2D Cartesian (y,x) coordinates, which accounts for multi-plane ray-tracing, at a @@ -217,6 +218,7 @@ def grid_2d_at_redshift_from( cosmology The cosmology used for ray-tracing from which angular diameter distances between planes are computed. """ + cosmology = cosmology or ag.cosmo.Planck15() plane_redshifts = plane_redshifts_from(galaxies=galaxies) @@ -254,7 +256,7 @@ def grid_2d_at_redshift_from( def time_delays_from( galaxies: List[ag.Galaxy], grid: aa.type.Grid2DLike, - cosmology: ag.cosmo.LensingCosmology = ag.cosmo.Planck15(), + cosmology: ag.cosmo.LensingCosmology = None, ) -> aa.type.Grid2DLike: """ Returns the gravitational lensing time delay in days for a grid of 2D (y, x) coordinates. @@ -304,6 +306,8 @@ def time_delays_from( ------- The time delay at each (y, x) coordinate in the input grid, in units of days. """ + cosmology = cosmology or ag.cosmo.Planck15() + plane_redshifts = plane_redshifts_from(galaxies=galaxies) if len(plane_redshifts) != 2: diff --git a/autolens/point/model/analysis.py b/autolens/point/model/analysis.py index 88675a16c..27c05534b 100644 --- a/autolens/point/model/analysis.py +++ b/autolens/point/model/analysis.py @@ -33,7 +33,7 @@ def __init__( solver: PointSolver, fit_positions_cls=FitPositionsImagePairRepeat, image=None, - cosmology: ag.cosmo.LensingCosmology = ag.cosmo.Planck15(), + cosmology: ag.cosmo.LensingCosmology = None, title_prefix: str = None, ): """ diff --git a/autolens/quantity/model/analysis.py b/autolens/quantity/model/analysis.py index 4a5faa6ad..2e1f974f3 100644 --- a/autolens/quantity/model/analysis.py +++ b/autolens/quantity/model/analysis.py @@ -15,7 +15,7 @@ def __init__( self, dataset: ag.DatasetQuantity, func_str: str, - cosmology: ag.cosmo.LensingCosmology = ag.cosmo.Planck15(), + cosmology: ag.cosmo.LensingCosmology = None, ): """ Analysis classes are used by PyAutoFit to fit a model to a dataset via a non-linear search. From 6d01455c9aca1b4e465140b0890c80ffa6ec72c0 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Wed, 25 Jun 2025 19:25:30 +0100 Subject: [PATCH 4/5] fix unit tests from rectangular --- autolens/plot/abstract_plotters.py | 39 ++++++++++++++++++- .../imaging/test_simulate_and_fit_imaging.py | 18 ++++----- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/autolens/plot/abstract_plotters.py b/autolens/plot/abstract_plotters.py index 31332952a..42ce27272 100644 --- a/autolens/plot/abstract_plotters.py +++ b/autolens/plot/abstract_plotters.py @@ -2,13 +2,48 @@ set_backend() -from autoarray.plot.abstract_plotters import AbstractPlotter - from autolens.plot.get_visuals.one_d import GetVisuals1D from autolens.plot.get_visuals.two_d import GetVisuals2D +from autogalaxy.plot.abstract_plotters import AbstractPlotter + +from autogalaxy.plot.mat_plot.one_d import MatPlot1D +from autogalaxy.plot.mat_plot.two_d import MatPlot2D +from autogalaxy.plot.visuals.one_d import Visuals1D +from autogalaxy.plot.visuals.two_d import Visuals2D +from autogalaxy.plot.include.one_d import Include1D +from autogalaxy.plot.include.two_d import Include2D + class Plotter(AbstractPlotter): + + def __init__( + self, + mat_plot_1d: MatPlot1D = None, + visuals_1d: Visuals1D = None, + include_1d: Include1D = None, + mat_plot_2d: MatPlot2D = None, + visuals_2d: Visuals2D = None, + include_2d: Include2D = None, + ): + + super().__init__( + mat_plot_1d=mat_plot_1d, + visuals_1d=visuals_1d, + include_1d=include_1d, + mat_plot_2d=mat_plot_2d, + visuals_2d=visuals_2d, + include_2d=include_2d, + ) + + self.visuals_1d = visuals_1d or Visuals1D() + self.include_1d = include_1d or Include1D() + self.mat_plot_1d = mat_plot_1d or MatPlot1D() + + self.visuals_2d = visuals_2d or Visuals2D() + self.include_2d = include_2d or Include2D() + self.mat_plot_2d = mat_plot_2d or MatPlot2D() + @property def get_1d(self): return GetVisuals1D(visuals=self.visuals_1d, include=self.include_1d) diff --git a/test_autolens/imaging/test_simulate_and_fit_imaging.py b/test_autolens/imaging/test_simulate_and_fit_imaging.py index 1fd2f5bd3..56c1092ae 100644 --- a/test_autolens/imaging/test_simulate_and_fit_imaging.py +++ b/test_autolens/imaging/test_simulate_and_fit_imaging.py @@ -305,7 +305,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization( ), 1.0e-4, ) - assert fit_linear.figure_of_merit == pytest.approx(-84.04875317, 1.0e-4) + assert fit_linear.figure_of_merit == pytest.approx(-85.94918592874168, 1.0e-4) lens_galaxy_image = lens_galaxy.blurred_image_2d_from( grid=masked_dataset.grids.lp, @@ -321,11 +321,11 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization( ) assert fit_linear.galaxy_model_image_dict[source_galaxy_pix][0] == pytest.approx( - 0.063911, 1.0e-4 + 0.05425175, 1.0e-4 ) assert fit_linear.model_images_of_planes_list[1][0] == pytest.approx( - 0.063911, 1.0e-4 + 0.05425175, 1.0e-4 ) fit_linear = al.FitImaging( @@ -355,7 +355,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization( ), abs=1.0e-1, ) - assert fit_linear.figure_of_merit == pytest.approx(-84.11166, 1.0e-4) + assert fit_linear.figure_of_merit == pytest.approx(-86.01614801681916, 1.0e-4) pixelization = al.Pixelization( image_mesh=al.image_mesh.Overlay(shape=(3,3)), @@ -452,7 +452,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization_ 1.0e-4, ) - assert fit_linear.figure_of_merit == pytest.approx(-84.36224277776512, 1.0e-4) + assert fit_linear.figure_of_merit == pytest.approx(-86.288358299142, 1.0e-4) lens_galaxy_image = lens_galaxy.blurred_image_2d_from( grid=masked_dataset.grids.lp, @@ -468,15 +468,15 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization_ ) assert fit_linear.galaxy_model_image_dict[source_galaxy_pix][0] == pytest.approx( - 0.1473073435555056, 1.0e-4 + 0.1330676, 1.0e-4 ) assert fit_linear.model_images_of_planes_list[1][0] == pytest.approx( - 0.147307343555, 1.0e-4 + 0.1330676, 1.0e-4 ) assert fit_linear.subtracted_images_of_planes_list[1][0] == pytest.approx( - 0.35652124420455, 1.0e-4 + 0.34054169, 1.0e-4 ) fit_linear = al.FitImaging( @@ -506,7 +506,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization_ ), abs=1.0e-1, ) - assert fit_linear.figure_of_merit == pytest.approx(-84.66302233089499, abs=1.0e-4) + assert fit_linear.figure_of_merit == pytest.approx(-86.61380401245304, abs=1.0e-4) def test__simulate_imaging_data_and_fit__complex_fit_compare_mapping_matrix_w_tilde(): From c18abc3c2024514f61b388fee6ba233adda1f6ac Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Wed, 25 Jun 2025 19:26:54 +0100 Subject: [PATCH 5/5] fix interferometer --- .../interferometer/test_simulate_and_fit_interferometer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_autolens/interferometer/test_simulate_and_fit_interferometer.py b/test_autolens/interferometer/test_simulate_and_fit_interferometer.py index f14f6c764..86410bc94 100644 --- a/test_autolens/interferometer/test_simulate_and_fit_interferometer.py +++ b/test_autolens/interferometer/test_simulate_and_fit_interferometer.py @@ -313,4 +313,4 @@ def test__simulate_interferometer_data_and_fit__linear_light_profiles_and_pixeli ), 1.0e-2, ) - assert fit_linear.figure_of_merit == pytest.approx(-29.20551989, 1.0e-4) + assert fit_linear.figure_of_merit == pytest.approx(-29.223696823166, 1.0e-4)