From e9a009eb788f45d29de01045408c7a29011f0a13 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Fri, 25 Oct 2024 14:44:30 +0100 Subject: [PATCH] interferometer --- .../plot/fit_interferometer_plotters.py | 45 +++++++++++++++++++ .../imaging/plot/test_fit_imaging_plotters.py | 2 - 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/autolens/interferometer/plot/fit_interferometer_plotters.py b/autolens/interferometer/plot/fit_interferometer_plotters.py index f064dea82..15374ea55 100644 --- a/autolens/interferometer/plot/fit_interferometer_plotters.py +++ b/autolens/interferometer/plot/fit_interferometer_plotters.py @@ -370,7 +370,10 @@ def figures_2d_of_planes( self, plane_index: Optional[int] = None, plane_image: bool = False, + plane_errors: bool = False, + plane_signal_to_noise_map: bool = False, zoom_to_brightest: bool = True, + interpolate_to_uniform: bool = False, ): """ Plots images representing each individual `Plane` in the fit's `Tracer` in 2D, which are computed via the @@ -390,9 +393,20 @@ def figures_2d_of_planes( Whether to make a 2D plot (via `imshow`) of the image of a plane in its source-plane (e.g. unlensed). Depending on how the fit is performed, this could either be an image of light profiles of the reconstruction of an `Inversion`. + plane_errors + Whether to make a 2D plot (via `imshow`) of the errors of a plane in its source-plane, where the + errors can only be computed when a pixelized source reconstruction is performed and they correspond to + the errors in each reconstructed pixel as given by the inverse curvature matrix. + plane_signal_to_noise_map + Whether to make a 2D plot (via `imshow`) of the signal-to-noise map of a plane in its source-plane, + where the signal-to-noise map values can only be computed when a pixelized source reconstruction and they + are the ratio of reconstructed flux to error in each pixel. zoom_to_brightest For images not in the image-plane (e.g. the `plane_image`), whether to automatically zoom the plot to the brightest regions of the galaxies being plotted as opposed to the full extent of the grid. + interpolate_to_uniform + If `True`, the mapper's reconstruction is interpolated to a uniform grid before plotting, for example + meaning that an irregular Delaunay grid can be plotted as a uniform grid. """ if plane_image: if not self.tracer.planes[plane_index].has(cls=aa.Pixelization): @@ -408,6 +422,37 @@ def figures_2d_of_planes( pixelization_index=0, reconstruction=True, zoom_to_brightest=zoom_to_brightest, + interpolate_to_uniform=interpolate_to_uniform, + ) + + if plane_errors: + + if self.tracer.planes[plane_index].has(cls=aa.Pixelization): + + inversion_plotter = self.inversion_plotter_of_plane( + plane_index=plane_index + ) + + inversion_plotter.figures_2d_of_pixelization( + pixelization_index=0, + errors=True, + zoom_to_brightest=zoom_to_brightest, + interpolate_to_uniform=interpolate_to_uniform + ) + + if plane_signal_to_noise_map: + + if self.tracer.planes[plane_index].has(cls=aa.Pixelization): + + inversion_plotter = self.inversion_plotter_of_plane( + plane_index=plane_index + ) + + inversion_plotter.figures_2d_of_pixelization( + pixelization_index=0, + signal_to_noise_map=True, + zoom_to_brightest=zoom_to_brightest, + interpolate_to_uniform=interpolate_to_uniform ) def subplot_fit_real_space(self): diff --git a/test_autolens/imaging/plot/test_fit_imaging_plotters.py b/test_autolens/imaging/plot/test_fit_imaging_plotters.py index 3e6b12aea..05fd07087 100644 --- a/test_autolens/imaging/plot/test_fit_imaging_plotters.py +++ b/test_autolens/imaging/plot/test_fit_imaging_plotters.py @@ -88,8 +88,6 @@ def test__figures_of_plane( subtracted_image=True, model_image=True, plane_index=0, plane_image=True ) - print(plot_patch.paths) - assert path.join(plot_path, "source_subtracted_image.png") in plot_patch.paths assert ( path.join(plot_path, "lens_subtracted_image.png") not in plot_patch.paths