diff --git a/autolens/analysis/plotter_interface.py b/autolens/analysis/plotter_interface.py index d62226e76..112cce7a4 100644 --- a/autolens/analysis/plotter_interface.py +++ b/autolens/analysis/plotter_interface.py @@ -26,19 +26,19 @@ class PlotterInterface(AgPlotterInterface): The path on the hard-disk to the `image` folder of the non-linear searches results. """ - def tracer(self, tracer: Tracer, grid: aa.type.Grid2DLike, during_analysis: bool): + def tracer(self, tracer: Tracer, grid: aa.type.Grid2DLike): """ Visualizes a `Tracer` object. - Images are output to the `image` folder of the `image_path` in a subfolder called `tracer`. When - used with a non-linear search the `image_path` points to the search's results folder and this function - visualizes the maximum log likelihood `Tracer` inferred by the search so far. + Images are output to the `image` folder of the `image_path`. When used with a non-linear search the `image_path` + points to the search's results folder and this function visualizes the maximum log likelihood `Tracer` + inferred by the search so far. - Visualization includes individual images of attributes of the tracer (e.g. its image, convergence, deflection - angles) and a subplot of all these attributes on the same figure. + Visualization includes a subplot of individual images of attributes of the tracer (e.g. its image, convergence, + deflection angles) and .fits files containing its attributes grouped together. - The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under the - [tracer] header. + The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under + the `tracer` header. Parameters ---------- @@ -47,14 +47,12 @@ def tracer(self, tracer: Tracer, grid: aa.type.Grid2DLike, during_analysis: bool grid A 2D grid of (y,x) arc-second coordinates used to perform ray-tracing, which is the masked grid tied to the dataset. - during_analysis - Whether visualization is performed during a non-linear search or once it is completed. """ def should_plot(name): return plot_setting(section="tracer", name=name) - mat_plot_2d = self.mat_plot_2d_from(subfolders="tracer") + mat_plot_2d = self.mat_plot_2d_from() tracer_plotter = TracerPlotter( tracer=tracer, @@ -66,81 +64,24 @@ def should_plot(name): if should_plot("subplot_galaxies_images"): tracer_plotter.subplot_galaxies_images() - tracer_plotter.figures_2d( - image=should_plot("image"), - source_plane=should_plot("source_plane_image"), - deflections_y=should_plot("deflections"), - deflections_x=should_plot("deflections"), - magnification=should_plot("magnification"), - ) - - mat_plot_2d.use_log10 = True - - tracer_plotter.figures_2d( - convergence=should_plot("convergence"), - potential=should_plot("potential"), - ) - - if should_plot("lens_image"): - tracer_plotter.figures_2d_of_planes( - plane_image=True, plane_index=0, zoom_to_brightest=False - ) - - mat_plot_2d.use_log10 = False - - if not during_analysis and should_plot("all_at_end_png"): - mat_plot_2d = self.mat_plot_2d_from( - subfolders=path.join("tracer", "end"), - ) - - tracer_plotter = TracerPlotter( - tracer=tracer, - grid=grid, - mat_plot_2d=mat_plot_2d, - include_2d=self.include_2d, - ) - - tracer_plotter.figures_2d( - image=True, - source_plane=True, - deflections_y=True, - deflections_x=True, - magnification=True, - ) - - mat_plot_2d.use_log10 = True - - tracer_plotter.figures_2d( - convergence=True, - potential=True, - ) - - tracer_plotter.figures_2d_of_planes( - plane_image=True, plane_index=0, zoom_to_brightest=False - ) - - mat_plot_2d.use_log10 = False + if should_plot("fits_tracer"): + number_plots = 4 - if not during_analysis and should_plot("all_at_end_fits"): - mat_plot_2d = self.mat_plot_2d_from( - subfolders=path.join("tracer", "fits"), format="fits" + multi_plotter = aplt.MultiFigurePlotter( + plotter_list=[tracer_plotter] * number_plots ) - tracer_plotter = TracerPlotter( - tracer=tracer, - grid=grid, - mat_plot_2d=mat_plot_2d, - include_2d=self.include_2d, - ) - - tracer_plotter.figures_2d( - image=True, - source_plane=True, - convergence=True, - potential=True, - deflections_y=True, - deflections_x=True, - magnification=True, + multi_plotter.output_to_fits( + func_name_list=["figures_2d"] * number_plots, + figure_name_list=[ + "convergence", + "potential", + "deflections_y", + "deflections_x", + ], + tag_list=["convergence", "potential", "deflections_y", "deflections_x"], + filename="tracer", + remove_fits_first=True, ) def image_with_positions(self, image: aa.Array2D, positions: aa.Grid2DIrregular): @@ -148,13 +89,13 @@ def image_with_positions(self, image: aa.Array2D, positions: aa.Grid2DIrregular) Visualizes the positions of a model-fit, where these positions are used to resample lens models where the positions to do trace within an input threshold of one another in the source-plane. - Images are output to the `image` folder of the `image_path` in a subfolder called `positions`. 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`. When used with a non-linear search the `image_path` + is the output folder of the non-linear search. The visualization is an image of the strong lens with the positions overlaid. The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under the - [tracer] header. + `positions` header. Parameters ---------- @@ -167,7 +108,7 @@ def image_with_positions(self, image: aa.Array2D, positions: aa.Grid2DIrregular) def should_plot(name): return plot_setting(section=["positions"], name=name) - mat_plot_2d = self.mat_plot_2d_from(subfolders="positions") + mat_plot_2d = self.mat_plot_2d_from() if positions is not None: visuals_2d = aplt.Visuals2D(positions=positions) @@ -178,6 +119,8 @@ def should_plot(name): include_2d=self.include_2d, visuals_2d=visuals_2d, ) + image_plotter.set_filename("image_with_positions") + if should_plot("image_with_positions"): image_plotter.figure_2d() diff --git a/autolens/config/visualize/plots.yaml b/autolens/config/visualize/plots.yaml index 372d27db6..7739397b0 100644 --- a/autolens/config/visualize/plots.yaml +++ b/autolens/config/visualize/plots.yaml @@ -1,105 +1,43 @@ - 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 - noise_map: false - signal_to_noise_map: false - imaging: # Settings for plots of imaging datasets (e.g. ImagingPlotter) - psf: false - positions: # Settings for plots with resampling image-positions on (e.g. the image). - image_with_positions: true - point_dataset: # Settings for plots of point source datasets (e.g. PointDatasetPlotter). - subplot_dataset: true # Plot subplot containing all dataset quantities (e.g. the data, noise-map, etc.)? - positions: false # Plot the positions of th multiple images of the point source in the image plane? - fluxes: false # Plot the fluxes of the multiple images of the point source in the image plane? - 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.)? - 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_planes: false # Plot subplot of the model-image, subtracted image and other quantities of each plane? - subplot_galaxies_images: false # Plot subplot of the image of each plane in the model? - data: false - noise_map: false - signal_to_noise_map: false - model_data: false - residual_map: false - 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_planes: false # Plot individual plots of each plane's model image? - subtracted_images_of_planes: false # Plot individual plots of each plane's subtracted image? - plane_images_of_planes: false # Plot individual plots of each plane's image (e.g. in the source plane)? - fit_imaging: {} # Settings for plots of fits to imaging datasets (e.g. FitImagingPlotter). - fit_point_dataset: # Settings for plots of fits to point source datasets (e.g. FitPointDatasetPlotter). - positions: false # Plot the positions of th multiple images of the point source in the image plane? - fluxes: false # Plot the fluxes of the multiple images of the point source in the image plane? - tracer: # Settings for plots of tracers (e.g. TracerPlotter). - subplot_tracer: true # Plot subplot of all quantities in each tracer (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_galaxies_images: false # Plot subplot of the image of each plane in the tracer? - image: false # Plot image of the tracer (e.g. lens and lensed source in the image-plane)? - source_plane_image: false # Plot image of the tracer's source-plane? - lens_image: false # Plot image of the foreground lens galaxy (log10)? - convergence: false # Plot image of the tracer's convergence (log10)? - potential: false # Plot image of the tracer's potential (log10)? - deflections: false # Plot images of the tracer's y and x deflections? - magnification: false # Plot image of the tracer's magnification? - 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)? - reconstruction_noise_map: false - reconstructed_image: false - reconstruction: false - regularization_weights: false - 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_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 - 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 +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.)? + +positions: # Settings for plots with resampling image-positions on (e.g. the image). + image_with_positions: true + +point_dataset: # Settings for plots of point source datasets (e.g. PointDatasetPlotter). + subplot_dataset: true # Plot subplot containing all dataset quantities (e.g. the data, noise-map, etc.)? + +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.)? + subplot_of_planes: false # Plot subplot of the model-image, subtracted image and other quantities of each plane? + subplot_galaxies_images: false # Plot subplot of the image of each plane in the model? + +fit_imaging: {} # Settings for plots of fits to imaging datasets (e.g. FitImagingPlotter). + +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? + +fit_point_dataset: {} # Settings for plots of fits to point source datasets (e.g. FitPointDatasetPlotter). + +tracer: # Settings for plots of tracers (e.g. TracerPlotter). + subplot_tracer: true # Plot subplot of all quantities in each tracer (e.g. images, convergence)? + subplot_galaxies_images: false # Plot subplot of the image of each plane in the tracer? + fits_tracer: false # Output tracer.fits file of tracer's convergence, potential, deflections_y and deflections_x? + +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? + +adapt: # Settings for plots of adapt images used by adaptive pixelizations. + subplot_adapt_images: true # Plot subplot showing each adapt image used for adaptive pixelization? + +fit_quantity: # Settings for plots of fit quantities (e.g. FitQuantityPlotter). + subplot_fit: true + +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)? + subplot_galaxy_images: false # Plot subplot of the image of each galaxy in the model? + subplot_galaxies_1d: false # Plot subplot of all quantities in 1D of each galaxies group (e.g. images, convergence)? + subplot_galaxies_1d_decomposed: false # Plot subplot of all quantities in 1D decomposed of each galaxies group (e.g. images, convergence)? diff --git a/autolens/imaging/model/plotter_interface.py b/autolens/imaging/model/plotter_interface.py index 3ae546fe9..fbf023b3b 100644 --- a/autolens/imaging/model/plotter_interface.py +++ b/autolens/imaging/model/plotter_interface.py @@ -1,10 +1,11 @@ -from os import path from typing import List import autoarray.plot as aplt from autogalaxy.imaging.model.plotter_interface import PlotterInterfaceImaging as AgPlotterInterfaceImaging +from autogalaxy.imaging.model.plotter_interface import fits_to_fits + from autolens.analysis.plotter_interface import PlotterInterface from autolens.imaging.fit_imaging import FitImaging from autolens.imaging.plot.fit_imaging_plotters import FitImagingPlotter @@ -18,35 +19,30 @@ class PlotterInterfaceImaging(PlotterInterface): imaging_combined = AgPlotterInterfaceImaging.imaging_combined def fit_imaging( - self, fit: FitImaging, during_analysis: bool, subfolders: str = "fit_dataset" + self, fit: FitImaging, ): """ Visualizes a `FitImaging` object, which fits an imaging dataset. - Images are output to the `image` folder of the `image_path` in a subfolder called `fit`. When - used with a non-linear search the `image_path` points to the search's results folder and this function - visualizes the maximum log likelihood `FitImaging` inferred by the search so far. + Images are output to the `image` folder of the `image_path`. When used with a non-linear search the `image_path` + points to the search's results folder and this function visualizes the maximum log likelihood `FitImaging` + inferred by the search so far. - Visualization includes individual images of attributes of the `FitImaging` (e.g. the model data, residual map) - and a subplot of all `FitImaging`'s images on the same figure. + Visualization includes a subplot of individual images of attributes of the `FitImaging` (e.g. the model data, + residual map) and .fits files containing its attributes grouped together. - The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under the - [fit] header. + The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under + the `fit` and `fit_imaging` header. Parameters ---------- fit The maximum log likelihood `FitImaging` of the non-linear search which is used to plot the fit. - during_analysis - Whether visualization is performed during a non-linear search or once it is completed. - visuals_2d - An object containing attributes which may be plotted over the figure (e.g. the centres of mass and light - profiles). """ if plot_setting(section="tracer", name="subplot_tracer"): - mat_plot_2d = self.mat_plot_2d_from(subfolders="") + mat_plot_2d = self.mat_plot_2d_from() fit_plotter = FitImagingPlotter( fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d @@ -57,29 +53,7 @@ def fit_imaging( def should_plot(name): return plot_setting(section=["fit", "fit_imaging"], name=name) - mat_plot_2d = self.mat_plot_2d_from(subfolders=subfolders) - - fit_plotter = FitImagingPlotter( - fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d - ) - - fit_plotter.figures_2d( - data=should_plot("data"), - noise_map=should_plot("noise_map"), - signal_to_noise_map=should_plot("signal_to_noise_map"), - model_image=should_plot("model_data"), - residual_map=should_plot("residual_map"), - chi_squared_map=should_plot("chi_squared_map"), - normalized_residual_map=should_plot("normalized_residual_map"), - ) - - fit_plotter.figures_2d_of_planes( - subtracted_image=should_plot("subtracted_images_of_planes"), - model_image=should_plot("model_images_of_planes"), - plane_image=should_plot("plane_images_of_planes"), - ) - - mat_plot_2d = self.mat_plot_2d_from(subfolders="") + mat_plot_2d = self.mat_plot_2d_from() fit_plotter = FitImagingPlotter( fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d @@ -103,78 +77,32 @@ def should_plot(name): except IndexError: pass - if not during_analysis and should_plot("all_at_end_png"): - - mat_plot_2d = self.mat_plot_2d_from( - subfolders=path.join("fit_dataset", "end"), - ) - - fit_plotter = FitImagingPlotter( - fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d - ) - - fit_plotter.figures_2d( - data=True, - noise_map=True, - signal_to_noise_map=True, - model_image=True, - residual_map=True, - normalized_residual_map=True, - chi_squared_map=True, - ) - - fit_plotter.figures_2d_of_planes( - subtracted_image=True, model_image=True, plane_image=True - ) - - if not during_analysis and should_plot("all_at_end_fits"): - - mat_plot_2d = self.mat_plot_2d_from( - subfolders=path.join("fit_dataset", "fits"), format="fits" - ) - - fit_plotter = FitImagingPlotter( - fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d - ) - - fit_plotter.figures_2d( - data=True, - noise_map=True, - signal_to_noise_map=True, - model_image=True, - residual_map=True, - normalized_residual_map=True, - chi_squared_map=True, - ) - - fit_plotter.figures_2d_of_planes( - subtracted_image=True, model_image=True, plane_image=True, interpolate_to_uniform=True - ) + fits_to_fits(should_plot=should_plot, fit=fit, mat_plot_2d=mat_plot_2d, fit_plotter_cls=FitImagingPlotter) 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. + Images are output to the `image` folder of the `image_path`. When used with a non-linear search the `image_path` + is the output folder of the non-linear search. + + Visualization includes a subplot of 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. + the `fit` and `fit_imaging` headers. Parameters ---------- - fit + fit_list 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") + mat_plot_2d = self.mat_plot_2d_from() fit_plotter_list = [ FitImagingPlotter( @@ -268,9 +196,9 @@ def make_subplot_fit(filename_suffix): open_subplot=False, ) - make_subplot_fit(filename_suffix="fit") + make_subplot_fit(filename_suffix="fit_combined") + + for plotter in multi_plotter.plotter_list: + plotter.mat_plot_2d.use_log10 = True - # for plotter in multi_plotter.plotter_list: - # plotter.mat_plot_2d.use_log10 = True - # - # make_subplot_fit(filename_suffix="fit_log10") \ No newline at end of file + make_subplot_fit(filename_suffix="fit_combined_log10") \ No newline at end of file diff --git a/autolens/imaging/model/visualizer.py b/autolens/imaging/model/visualizer.py index 66caf6c67..22611f7fd 100644 --- a/autolens/imaging/model/visualizer.py +++ b/autolens/imaging/model/visualizer.py @@ -76,9 +76,6 @@ def visualize( 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). - during_analysis - If True the visualization is being performed midway through the non-linear search before it is finished, - which may change which images are output. """ fit = analysis.fit_from(instance=instance) @@ -99,7 +96,7 @@ def visualize( ) try: - plotter_interface.fit_imaging(fit=fit, during_analysis=during_analysis) + plotter_interface.fit_imaging(fit=fit) except exc.InversionException: pass @@ -111,17 +108,16 @@ def visualize( grid = ag.Grid2D.from_extent(extent=extent, shape_native=shape_native) plotter_interface.tracer( - tracer=tracer, grid=grid, during_analysis=during_analysis + tracer=tracer, grid=grid, ) plotter_interface.galaxies( galaxies=tracer.galaxies, grid=fit.grids.lp, - during_analysis=during_analysis, ) if fit.inversion is not None: if fit.inversion.has(cls=ag.AbstractMapper): plotter_interface.inversion( - inversion=fit.inversion, during_analysis=during_analysis + inversion=fit.inversion, ) @staticmethod diff --git a/autolens/interferometer/model/plotter_interface.py b/autolens/interferometer/model/plotter_interface.py index 3b7574605..96c6e014c 100644 --- a/autolens/interferometer/model/plotter_interface.py +++ b/autolens/interferometer/model/plotter_interface.py @@ -4,6 +4,8 @@ PlotterInterfaceInterferometer as AgPlotterInterfaceInterferometer, ) +from autogalaxy.interferometer.model.plotter_interface import fits_to_fits + from autolens.interferometer.fit_interferometer import FitInterferometer from autolens.interferometer.plot.fit_interferometer_plotters import ( FitInterferometerPlotter, @@ -19,37 +21,30 @@ class PlotterInterfaceInterferometer(PlotterInterface): def fit_interferometer( self, fit: FitInterferometer, - during_analysis: bool, - subfolders: str = "fit_dataset", ): """ Visualizes a `FitInterferometer` object, which fits an interferometer dataset. - Images are output to the `image` folder of the `image_path` in a subfolder called `fit`. 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`. 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 `FitInterferometer` (e.g. the model data, - residual map) and a subplot of all `FitInterferometer`'s images on the same figure. + Visualization includes a subplot of individual images of attributes of the `FitInterferometer` (e.g. the model + data,residual map) and .fits files containing its attributes grouped together. - The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under the - [fit] header. + The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under + the `fit` and `fit_interferometer` headers. Parameters ---------- fit The maximum log likelihood `FitInterferometer` of the non-linear search which is used to plot the fit. - during_analysis - Whether visualization is performed during a non-linear search or once it is completed. - visuals_2d - An object containing attributes which may be plotted over the figure (e.g. the centres of mass and light - profiles). """ def should_plot(name): return plot_setting(section=["fit", "fit_interferometer"], name=name) - mat_plot_1d = self.mat_plot_1d_from(subfolders="") - mat_plot_2d = self.mat_plot_2d_from(subfolders="") + mat_plot_1d = self.mat_plot_1d_from() + mat_plot_2d = self.mat_plot_2d_from() fit_plotter = FitInterferometerPlotter( fit=fit, @@ -67,8 +62,8 @@ def should_plot(name): if should_plot("subplot_fit_real_space"): fit_plotter.subplot_fit_real_space() - mat_plot_1d = self.mat_plot_1d_from(subfolders=subfolders) - mat_plot_2d = self.mat_plot_2d_from(subfolders=subfolders) + mat_plot_1d = self.mat_plot_1d_from() + mat_plot_2d = self.mat_plot_2d_from() fit_plotter = FitInterferometerPlotter( fit=fit, @@ -77,89 +72,14 @@ def should_plot(name): mat_plot_2d=mat_plot_2d, ) - fit_plotter.figures_2d( - data=should_plot("data"), - noise_map=should_plot("noise_map"), - signal_to_noise_map=should_plot("signal_to_noise_map"), - model_data=should_plot("model_data"), - residual_map_real=should_plot("residual_map"), - chi_squared_map_real=should_plot("chi_squared_map"), - normalized_residual_map_real=should_plot("normalized_residual_map"), - residual_map_imag=should_plot("residual_map"), - chi_squared_map_imag=should_plot("chi_squared_map"), - normalized_residual_map_imag=should_plot("normalized_residual_map"), - dirty_image=should_plot("data"), - dirty_noise_map=should_plot("noise_map"), - dirty_signal_to_noise_map=should_plot("signal_to_noise_map"), - dirty_model_image=should_plot("model_data"), - dirty_residual_map=should_plot("residual_map"), - dirty_normalized_residual_map=should_plot("normalized_residual_map"), - dirty_chi_squared_map=should_plot("chi_squared_map"), - ) - if plot_setting(section="inversion", name="subplot_mappings"): fit_plotter.subplot_mappings_of_plane( plane_index=len(fit.tracer.planes) - 1 ) - if not during_analysis and should_plot("all_at_end_png"): - mat_plot_1d = self.mat_plot_1d_from(subfolders=path.join(subfolders, "end")) - mat_plot_2d = self.mat_plot_2d_from(subfolders=path.join(subfolders, "end")) - - fit_plotter = FitInterferometerPlotter( - fit=fit, - include_2d=self.include_2d, - mat_plot_1d=mat_plot_1d, - mat_plot_2d=mat_plot_2d, - ) - - fit_plotter.figures_2d( - data=True, - noise_map=True, - signal_to_noise_map=True, - model_data=True, - residual_map_real=True, - chi_squared_map_real=True, - normalized_residual_map_real=True, - residual_map_imag=True, - chi_squared_map_imag=True, - normalized_residual_map_imag=True, - dirty_image=True, - dirty_noise_map=True, - dirty_signal_to_noise_map=True, - dirty_model_image=True, - dirty_residual_map=True, - dirty_normalized_residual_map=True, - dirty_chi_squared_map=True, - ) - - plane_index_max = len(fit.tracer.planes) - 1 - - fit_plotter.figures_2d_of_planes( - plane_index=plane_index_max, plane_image=True - ) - - if not during_analysis and should_plot("all_at_end_fits"): - mat_plot_2d = self.mat_plot_2d_from( - subfolders=path.join("fit_dataset", "fits"), format="fits" - ) - - fit_plotter = FitInterferometerPlotter( - fit=fit, include_2d=self.include_2d, mat_plot_2d=mat_plot_2d - ) - - fit_plotter.figures_2d( - dirty_image=True, - dirty_noise_map=True, - dirty_signal_to_noise_map=True, - dirty_model_image=True, - dirty_residual_map=True, - dirty_normalized_residual_map=True, - dirty_chi_squared_map=True, - ) - - plane_index_max = len(fit.tracer.planes) - 1 - - fit_plotter.figures_2d_of_planes( - plane_index=plane_index_max, plane_image=True - ) + fits_to_fits( + should_plot=should_plot, + fit=fit, + mat_plot_2d=mat_plot_2d, + fit_plotter_cls=FitInterferometerPlotter, + ) diff --git a/autolens/interferometer/model/visualizer.py b/autolens/interferometer/model/visualizer.py index c1dc14ae0..74cb75eb7 100644 --- a/autolens/interferometer/model/visualizer.py +++ b/autolens/interferometer/model/visualizer.py @@ -78,9 +78,6 @@ def visualize( 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). - during_analysis - If True the visualization is being performed midway through the non-linear search before it is finished, - which may change which images are output. """ fit = analysis.fit_from(instance=instance) @@ -101,7 +98,7 @@ def visualize( try: plotter_interface.fit_interferometer( - fit=fit, during_analysis=during_analysis + fit=fit, ) except exc.InversionException: pass @@ -109,17 +106,17 @@ def visualize( tracer = fit.tracer_linear_light_profiles_to_light_profiles plotter_interface.tracer( - tracer=tracer, grid=fit.grids.lp, during_analysis=during_analysis + tracer=tracer, + grid=fit.grids.lp, ) plotter_interface.galaxies( galaxies=tracer.galaxies, grid=fit.grids.lp, - during_analysis=during_analysis, ) if fit.inversion is not None: try: plotter_interface.inversion( - inversion=fit.inversion, during_analysis=during_analysis + inversion=fit.inversion, ) except IndexError: pass diff --git a/autolens/point/fit/positions/abstract.py b/autolens/point/fit/positions/abstract.py index 7ac074216..5b3d176a3 100644 --- a/autolens/point/fit/positions/abstract.py +++ b/autolens/point/fit/positions/abstract.py @@ -69,4 +69,4 @@ def __init__( @property def positions(self): - return self.data \ No newline at end of file + return self.data diff --git a/autolens/point/fit/positions/source/separations.py b/autolens/point/fit/positions/source/separations.py index 155202047..2c35269b8 100644 --- a/autolens/point/fit/positions/source/separations.py +++ b/autolens/point/fit/positions/source/separations.py @@ -117,18 +117,26 @@ def chi_squared_map(self) -> float: multiplied by the magnifications squared, divided by the noise-map values squared. """ - return self.residual_map**2.0 / (self.magnifications_at_positions**-2.0 * self.noise_map**2.0) + return self.residual_map**2.0 / ( + self.magnifications_at_positions**-2.0 * self.noise_map**2.0 + ) @property def noise_normalization(self) -> float: """ Returns the normalization of the noise-map, which is the sum of the noise-map values squared. """ - return npw.sum(npw.log(2 * np.pi * (self.magnifications_at_positions**-2.0 *self.noise_map**2.0))) + return npw.sum( + npw.log( + 2 + * np.pi + * (self.magnifications_at_positions**-2.0 * self.noise_map**2.0) + ) + ) @property def log_likelihood(self) -> float: """ Returns the log likelihood of the point-source source-plane fit, which is the sum of the chi-squared values. """ - return -0.5 * (sum(self.chi_squared_map) + self.noise_normalization) \ No newline at end of file + return -0.5 * (sum(self.chi_squared_map) + self.noise_normalization) diff --git a/autolens/point/model/plotter_interface.py b/autolens/point/model/plotter_interface.py index 51417f66a..8d4d8e04e 100644 --- a/autolens/point/model/plotter_interface.py +++ b/autolens/point/model/plotter_interface.py @@ -15,13 +15,13 @@ def dataset_point(self, dataset: PointDataset): """ Output visualization of an `PointDataset` dataset, typically before a model-fit is performed. - 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`. When used with a non-linear search the `image_path` + is the output folder of the non-linear search. + Visualization includes individual images of the different points of the dataset (e.g. the positions and fluxes) The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under - the `dataset` header. + the `point_dataset` header. Parameters ---------- @@ -32,18 +32,7 @@ def dataset_point(self, dataset: PointDataset): def should_plot(name): return plot_setting(section=["point_dataset"], name=name) - mat_plot_2d = self.mat_plot_2d_from(subfolders="dataset") - - dataset_plotter = PointDatasetPlotter( - dataset=dataset, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d - ) - - dataset_plotter.figures_2d( - positions=should_plot("positions"), - fluxes=should_plot("fluxes"), - ) - - mat_plot_2d = self.mat_plot_2d_from(subfolders="") + mat_plot_2d = self.mat_plot_2d_from() dataset_plotter = PointDatasetPlotter( dataset=dataset, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d @@ -55,8 +44,6 @@ def should_plot(name): def fit_point( self, fit: FitPointDataset, - during_analysis: bool, - subfolders: str = "fit_dataset", ): """ Visualizes a `FitPointDataset` object, which fits an imaging dataset. @@ -65,38 +52,22 @@ def fit_point( used with a non-linear search the `image_path` points to the search's results folder and this function visualizes the maximum log likelihood `FitImaging` inferred by the search so far. - Visualization includes individual images of attributes of the `FitPointDataset` (e.g. the model data and data) - and a subplot of all `FitPointDataset`'s images on the same figure. + Visualization includes a subplot of individual images of attributes of the `FitPointDataset` (e.g. the model + data and data) and .fits files containing its attributes grouped together. - The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under the - [fit] header. + The images output by the `PlotterInterface` are customized using the file `config/visualize/plots.yaml` under + the `fit` and `fit_point_dataset` headers. Parameters ---------- fit The maximum log likelihood `FitPointDataset` of the non-linear search which is used to plot the fit. - during_analysis - Whether visualization is performed during a non-linear search or once it is completed. - visuals_2d - An object containing attributes which may be plotted over the figure (e.g. the centres of mass and light - profiles). """ def should_plot(name): return plot_setting(section=["fit", "fit_point_dataset"], name=name) - mat_plot_2d = self.mat_plot_2d_from(subfolders=subfolders) - - fit_plotter = FitPointDatasetPlotter( - fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d - ) - - fit_plotter.figures_2d( - positions=should_plot("positions"), - fluxes=should_plot("fluxes"), - ) - - mat_plot_2d = self.mat_plot_2d_from(subfolders="") + mat_plot_2d = self.mat_plot_2d_from() fit_plotter = FitPointDatasetPlotter( fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d @@ -104,14 +75,3 @@ def should_plot(name): if should_plot("subplot_fit"): fit_plotter.subplot_fit() - - if not during_analysis and should_plot("all_at_end_png"): - mat_plot_2d = self.mat_plot_2d_from( - subfolders=path.join("fit_dataset", "end"), - ) - - fit_plotter = FitPointDatasetPlotter( - fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d - ) - - fit_plotter.figures_2d(positions=True, fluxes=True) diff --git a/autolens/point/model/visualizer.py b/autolens/point/model/visualizer.py index fe86e98f8..216421629 100644 --- a/autolens/point/model/visualizer.py +++ b/autolens/point/model/visualizer.py @@ -61,9 +61,6 @@ def visualize( 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). - during_analysis - If True the visualization is being performed midway through the non-linear search before it is finished, - which may change which images are output. """ fit = analysis.fit_from(instance=instance) @@ -71,7 +68,7 @@ def visualize( image_path=paths.image_path, title_prefix=analysis.title_prefix ) - plotter_interface.fit_point(fit=fit, during_analysis=during_analysis) + plotter_interface.fit_point(fit=fit) tracer = fit.tracer @@ -80,10 +77,10 @@ def visualize( ) plotter_interface.tracer( - tracer=tracer, grid=grid, during_analysis=during_analysis + tracer=tracer, + grid=grid, ) plotter_interface.galaxies( galaxies=tracer.galaxies, grid=grid, - during_analysis=during_analysis, ) diff --git a/autolens/quantity/model/visualizer.py b/autolens/quantity/model/visualizer.py index 69b6d0426..70aa13e49 100644 --- a/autolens/quantity/model/visualizer.py +++ b/autolens/quantity/model/visualizer.py @@ -38,9 +38,6 @@ def visualize( 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). - during_analysis - If True the visualization is being performed midway through the non-linear search before it is finished, - which may change which images are output. """ if os.environ.get("PYAUTOFIT_TEST_MODE") == "1": @@ -57,5 +54,4 @@ def visualize( plotter_interface.tracer( tracer=fit.tracer, grid=analysis.dataset.grids.lp, - during_analysis=during_analysis, ) diff --git a/docs/installation/conda.rst b/docs/installation/conda.rst index 67fa5615c..8a765e348 100644 --- a/docs/installation/conda.rst +++ b/docs/installation/conda.rst @@ -46,7 +46,7 @@ You may get warnings which state something like: .. code-block:: bash - ERROR: autoarray 2024.11.6.1 has requirement numpy<=1.22.1, but you'll have numpy 1.22.2 which is incompatible. + ERROR: autoarray 2025.1.18.7 has requirement numpy<=1.22.1, but you'll have numpy 1.22.2 which is incompatible. ERROR: numba 0.53.1 has requirement llvmlite<0.37,>=0.36.0rc1, but you'll have llvmlite 0.38.0 which is incompatible. If you see these messages, they do not mean that the installation has failed and the instructions below will diff --git a/docs/installation/pip.rst b/docs/installation/pip.rst index e79ee015e..05a9cf968 100644 --- a/docs/installation/pip.rst +++ b/docs/installation/pip.rst @@ -27,7 +27,7 @@ You may get warnings which state something like: .. code-block:: bash - ERROR: autoarray 2024.11.6.1 has requirement numpy<=1.22.1, but you'll have numpy 1.22.2 which is incompatible. + ERROR: autoarray 2025.1.18.7 has requirement numpy<=1.22.1, but you'll have numpy 1.22.2 which is incompatible. ERROR: numba 0.53.1 has requirement llvmlite<0.37,>=0.36.0rc1, but you'll have llvmlite 0.38.0 which is incompatible. If you see these messages, they do not mean that the installation has failed and the instructions below will diff --git a/test_autolens/analysis/test_plotter_interface.py b/test_autolens/analysis/test_plotter_interface.py index 77b95d7d3..27506324a 100644 --- a/test_autolens/analysis/test_plotter_interface.py +++ b/test_autolens/analysis/test_plotter_interface.py @@ -25,25 +25,15 @@ def test__tracer( plotter_interface.tracer( tracer=tracer_x2_plane_7x7, grid=masked_imaging_7x7.grids.lp, - during_analysis=False, ) - plot_path = path.join(plot_path, "tracer") - assert path.join(plot_path, "subplot_galaxies_images.png") in plot_patch.paths - assert path.join(plot_path, "image_2d.png") in plot_patch.paths - assert path.join(plot_path, "plane_image_of_plane_1.png") in plot_patch.paths - assert path.join(plot_path, "convergence_2d.png") in plot_patch.paths - assert path.join(plot_path, "potential_2d.png") not in plot_patch.paths - assert path.join(plot_path, "deflections_y_2d.png") not in plot_patch.paths - assert path.join(plot_path, "deflections_x_2d.png") not in plot_patch.paths - assert path.join(plot_path, "magnification_2d.png") in plot_patch.paths - - convergence = al.util.array_2d.numpy_array_2d_via_fits_from( - file_path=path.join(plot_path, "fits", "convergence_2d.fits"), hdu=0 + + image = al.util.array_2d.numpy_array_2d_via_fits_from( + file_path=path.join(plot_path, "tracer.fits"), hdu=0 ) - assert convergence.shape == (7, 7) + assert image.shape == (5, 5) def test__image_with_positions( @@ -56,6 +46,4 @@ def test__image_with_positions( plotter_interface.image_with_positions(image=image_7x7, positions=positions_x2) - plot_path = path.join(plot_path, "positions") - assert path.join(plot_path, "image_with_positions.png") in plot_patch.paths diff --git a/test_autolens/config/visualize.yaml b/test_autolens/config/visualize.yaml index f4d4bd3b9..389d4ca5e 100644 --- a/test_autolens/config/visualize.yaml +++ b/test_autolens/config/visualize.yaml @@ -71,87 +71,32 @@ mat_wrap_2d: s: 17 plots: dataset: - data: true - noise_map: false - signal_to_noise_map: false subplot_dataset: true - uv_wavelengths: false fit: - all_at_end_fits: true - all_at_end_png: false - chi_squared_map: true - data: true - model_data: true - model_images_of_planes: false - noise_map: false - normalized_residual_map: true - plane_images_of_planes: true - residual_map: false - signal_to_noise_map: false subplot_fit: true subplots_of_planes: false - subtracted_images_of_planes: true + fits_fit: true # Output a .fits file containing the fit model data, residual map, normalized residual map and chi-squared? + fits_model_galaxy_images : true # Output a .fits file containing the model images of every galaxy? fit_imaging: {} fit_interferometer: subplot_fit_real_space: true subplot_fit_dirty_images: true - 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_point_dataset: # Settings for plots of fits to point source datasets (e.g. FitPointDatasetPlotter). - positions: true # Plot the positions of th multiple images of the point source in the image plane? - fluxes: true # Plot the fluxes of the multiple images of the point source in the image plane? + fits_dirty_images: true # output dirty_images.fits showing the dirty image, noise-map, model-data, resiual-map, normalized residual map and chi-squared map? + fit_point_dataset: {} fit_quantity: - all_at_end_fits: true - all_at_end_png: true - chi_squared_map: false - image: true - model_image: false - noise_map: false - residual_map: false subplot_fit: true galaxies: - convergence: false - image: false - potential: false + subplot_galaxies: true + subplot_galaxy_images: true + subplot_galaxies_1d: true + subplot_galaxies_1d_decomposed: 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 + subplot_adapt_images: true inversion: - all_at_end_png: false - chi_squared_map: true - errors: false - normalized_residual_map: false - reconstructed_image: true - reconstruction: true - regularization_weights: false - residual_map: false subplot_inversion: true positions: image_with_positions: true tracer: - 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_tracer: true - subplot_galaxies_images: true \ No newline at end of file + subplot_galaxies_images: true + fits_tracer: true # Output tracer.fits file of tracer's convergence, potential, deflections_y and deflections_x? \ No newline at end of file diff --git a/test_autolens/imaging/model/test_plotter_interface_imaging.py b/test_autolens/imaging/model/test_plotter_interface_imaging.py index ca6e01d20..c3cb38ea4 100644 --- a/test_autolens/imaging/model/test_plotter_interface_imaging.py +++ b/test_autolens/imaging/model/test_plotter_interface_imaging.py @@ -23,28 +23,24 @@ def test__fit_imaging( plotter_interface = PlotterInterfaceImaging(image_path=plot_path) plotter_interface.fit_imaging( - fit=fit_imaging_x2_plane_inversion_7x7, during_analysis=False + fit=fit_imaging_x2_plane_inversion_7x7, ) assert path.join(plot_path, "subplot_tracer.png") in plot_patch.paths assert path.join(plot_path, "subplot_fit.png") in plot_patch.paths assert path.join(plot_path, "subplot_fit_log10.png") in plot_patch.paths - plot_path = path.join(plot_path, "fit_dataset") - - assert path.join(plot_path, "data.png") in plot_patch.paths - assert path.join(plot_path, "noise_map.png") not in plot_patch.paths - - assert path.join(plot_path, "lens_subtracted_image.png") in plot_patch.paths - assert path.join(plot_path, "source_model_image.png") not in plot_patch.paths + image = al.util.array_2d.numpy_array_2d_via_fits_from( + file_path=path.join(plot_path, "fit.fits"), hdu=0 + ) - assert path.join(plot_path, "reconstruction.png") in plot_patch.paths + assert image.shape == (5, 5) image = al.util.array_2d.numpy_array_2d_via_fits_from( - file_path=path.join(plot_path, "fits", "data.fits"), hdu=0 + file_path=path.join(plot_path, "model_galaxy_images.fits"), hdu=0 ) - assert image.shape == (7, 7) + assert image.shape == (5, 5) def test__fit_imaging_combined( fit_imaging_x2_plane_inversion_7x7, plot_path, plot_patch @@ -56,6 +52,4 @@ def test__fit_imaging_combined( visualizer.fit_imaging_combined(fit_list=2 * [fit_imaging_x2_plane_inversion_7x7]) - plot_path = path.join(plot_path, "combined") - - assert path.join(plot_path, "subplot_fit.png") in plot_patch.paths \ No newline at end of file + assert path.join(plot_path, "subplot_fit_combined.png") in plot_patch.paths \ No newline at end of file diff --git a/test_autolens/interferometer/model/test_plotter_interface_interferometer.py b/test_autolens/interferometer/model/test_plotter_interface_interferometer.py index be0d81fa9..8a883c4fd 100644 --- a/test_autolens/interferometer/model/test_plotter_interface_interferometer.py +++ b/test_autolens/interferometer/model/test_plotter_interface_interferometer.py @@ -1,6 +1,9 @@ from os import path import pytest + +import autolens as al + from autolens.interferometer.model.plotter_interface import ( PlotterInterfaceInterferometer, ) @@ -22,14 +25,27 @@ def test__fit_interferometer( plotter_interface = PlotterInterfaceInterferometer(image_path=plot_path) plotter_interface.fit_interferometer( - fit=fit_interferometer_x2_plane_7x7, during_analysis=True + fit=fit_interferometer_x2_plane_7x7, ) assert path.join(plot_path, "subplot_fit.png") in plot_patch.paths assert path.join(plot_path, "subplot_fit_real_space.png") in plot_patch.paths assert path.join(plot_path, "subplot_fit_dirty_images.png") in plot_patch.paths - plot_path = path.join(plot_path, "fit_dataset") + # visibilities = ag.util.array_2d.numpy_array_2d_via_fits_from( + # file_path=path.join(plot_path, "fit.fits"), hdu=0 + # ) + # + # assert visibilities.shape == (5, 5) + + image = al.util.array_2d.numpy_array_2d_via_fits_from( + file_path=path.join(plot_path, "model_galaxy_images.fits"), hdu=0 + ) + + assert image.shape == (5, 5) + + image = al.util.array_2d.numpy_array_2d_via_fits_from( + file_path=path.join(plot_path, "dirty_images.fits"), hdu=0 + ) - assert path.join(plot_path, "data.png") in plot_patch.paths - assert path.join(plot_path, "noise_map.png") not in plot_patch.paths + assert image.shape == (5, 5) diff --git a/test_autolens/point/fit/positions/source/test_separations.py b/test_autolens/point/fit/positions/source/test_separations.py index cb8c9ed26..85cdbe550 100644 --- a/test_autolens/point/fit/positions/source/test_separations.py +++ b/test_autolens/point/fit/positions/source/test_separations.py @@ -37,12 +37,13 @@ def test__two_sets_of_positions__residuals_likelihood_correct(): name="point_0", data=positions, noise_map=noise_map, tracer=tracer, solver=None ) - assert fit.magnifications_at_positions.in_list == pytest.approx([1.1111049387688177, 1.0526308864400329], 1.0e-4) + assert fit.magnifications_at_positions.in_list == pytest.approx( + [1.1111049387688177, 1.0526308864400329], 1.0e-4 + ) assert fit.model_data.in_list == [(0.0, 0.9), (0.0, 1.9)] - assert fit.chi_squared_map.in_list == pytest.approx([3.9999555592589244, 3.9999947369459807], 1.0e-4) - assert fit.log_likelihood == pytest.approx(-5.144705033951853, 1.0e-4) + assert fit.log_likelihood == pytest.approx(-4.98805743691215, 1.0e-4) def test__multi_plane_position_solving(): diff --git a/test_autolens/point/model/test_plotter_interface_point.py b/test_autolens/point/model/test_plotter_interface_point.py index 7d29802e0..ebe613bec 100644 --- a/test_autolens/point/model/test_plotter_interface_point.py +++ b/test_autolens/point/model/test_plotter_interface_point.py @@ -19,10 +19,6 @@ def test__fit_point(fit_point_dataset_x2_plane, include_2d_all, plot_path, plot_ plotter_interface = PlotterInterfacePoint(image_path=plot_path) - plotter_interface.fit_point(fit=fit_point_dataset_x2_plane, during_analysis=False) + plotter_interface.fit_point(fit=fit_point_dataset_x2_plane) assert path.join(plot_path, "subplot_fit.png") in plot_patch.paths - - plot_path = path.join(plot_path, "fit_dataset") - - assert path.join(plot_path, "fit_point_positions.png") in plot_patch.paths