diff --git a/autolens/aggregator/subplot.py b/autolens/aggregator/subplot.py index d8b0d948c..caf1484e5 100644 --- a/autolens/aggregator/subplot.py +++ b/autolens/aggregator/subplot.py @@ -17,7 +17,7 @@ class FITSFit(Enum): The HDUs that can be extracted from the fit.fits file. """ - model_image = "MODEL_IMAGE" + model_data = "MODEL_DATA" residual_map = "RESIDUAL_MAP" normalized_residual_map = "NORMALIZED_RESIDUAL_MAP" chi_squared_map = "CHI_SQUARED_MAP" @@ -68,7 +68,7 @@ class SubplotFit(Enum): data = (0, 0) data_source_scale = (1, 0) signal_to_noise_map = (2, 0) - model_image = (3, 0) + model_data = (3, 0) lens_light_model = (1, 0) lens_light_subtracted_image = (1, 1) source_model_image = (1, 2) @@ -89,7 +89,7 @@ class SubplotFitLog10(Enum): data = (0, 0) data_source_scale = (1, 0) signal_to_noise_map = (2, 0) - model_image = (3, 0) + model_data = (3, 0) lens_light_model = (1, 0) lens_light_subtracted_image = (1, 1) source_model_image = (1, 2) diff --git a/autolens/analysis/plotter_interface.py b/autolens/analysis/plotter_interface.py index 9210d5dd6..d3f858cca 100644 --- a/autolens/analysis/plotter_interface.py +++ b/autolens/analysis/plotter_interface.py @@ -65,14 +65,20 @@ def should_plot(name): tracer_plotter.subplot_galaxies_images() if should_plot("fits_tracer"): + + zoom = aa.Zoom2D(mask=grid.mask) + mask = zoom.mask_2d_from(buffer=1) + grid_zoom = aa.Grid2D.from_mask(mask=mask) + + image_list = [ + tracer.convergence_2d_from(grid=grid_zoom).native, + tracer.potential_2d_from(grid=grid_zoom).native, + tracer.deflections_yx_2d_from(grid=grid_zoom).native[:, :, 0], + tracer.deflections_yx_2d_from(grid=grid_zoom).native[:, :, 1], + ] + hdu_list = hdu_list_for_output_from( - values_list=[ - grid.mask.astype("float"), - tracer.convergence_2d_from(grid=grid).native, - tracer.potential_2d_from(grid=grid).native, - tracer.deflections_yx_2d_from(grid=grid).native[:, :, 0], - tracer.deflections_yx_2d_from(grid=grid).native[:, :, 1], - ], + values_list=[image_list[0].mask.astype("float")] + image_list, ext_name_list=[ "mask", "convergence", diff --git a/autolens/config/visualize/plots.yaml b/autolens/config/visualize/plots.yaml index 9cf6dd61b..e43e492c8 100644 --- a/autolens/config/visualize/plots.yaml +++ b/autolens/config/visualize/plots.yaml @@ -11,6 +11,7 @@ # These can be disabled to save on hard-disk space but will lead to certain database functionality being disabled. subplot_format: [png] # Output format of all subplots, can be png, pdf or both (e.g. [png, pdf]) +fits_are_zoomed: true # If true, output .fits files are zoomed in on the center of the unmasked region image, saving hard-disk space. 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.)? @@ -37,7 +38,7 @@ tracer: # Settings for plots of tracers (e.g. 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? - fits_reconstruction: false # output reconstruction.fits containing the reconstructed pixelization and noise map on the adaptive mesh? + csv_reconstruction: false # output reconstruction.csv containing the source-plane mesh y, x, reconstruction and noise map values. 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? diff --git a/autolens/imaging/model/visualizer.py b/autolens/imaging/model/visualizer.py index 22611f7fd..b758ea5ff 100644 --- a/autolens/imaging/model/visualizer.py +++ b/autolens/imaging/model/visualizer.py @@ -102,8 +102,10 @@ def visualize( tracer = fit.tracer_linear_light_profiles_to_light_profiles - extent = fit.data.extent_of_zoomed_array(buffer=0) - shape_native = fit.data.zoomed_around_mask(buffer=0).shape_native + zoom = ag.Zoom2D(mask=fit.mask) + + extent = zoom.extent_from(buffer=0) + shape_native = zoom.shape_native grid = ag.Grid2D.from_extent(extent=extent, shape_native=shape_native) diff --git a/autolens/imaging/plot/fit_imaging_plotters.py b/autolens/imaging/plot/fit_imaging_plotters.py index 5ddfb2295..a3ec0bf68 100644 --- a/autolens/imaging/plot/fit_imaging_plotters.py +++ b/autolens/imaging/plot/fit_imaging_plotters.py @@ -80,12 +80,11 @@ def tracer_plotter(self) -> TracerPlotter: Returns an `TracerPlotter` corresponding to the `Tracer` in the `FitImaging`. """ - extent = self.fit.data.extent_of_zoomed_array(buffer=0) - shape_native = self.fit.data.zoomed_around_mask(buffer=0).shape_native + zoom = aa.Zoom2D(mask=self.fit.mask) grid = aa.Grid2D.from_extent( - extent=extent, - shape_native=shape_native + extent=zoom.extent_from(buffer=0), + shape_native=zoom.shape_native ) return TracerPlotter( diff --git a/test_autolens/analysis/test_plotter_interface.py b/test_autolens/analysis/test_plotter_interface.py index 9f6142615..8077e02d5 100644 --- a/test_autolens/analysis/test_plotter_interface.py +++ b/test_autolens/analysis/test_plotter_interface.py @@ -33,7 +33,7 @@ def test__tracer( file_path=path.join(plot_path, "tracer.fits"), hdu=0 ) - assert image.shape == (7, 7) + assert image.shape == (5, 5) def test__image_with_positions( diff --git a/test_autolens/imaging/model/test_plotter_interface_imaging.py b/test_autolens/imaging/model/test_plotter_interface_imaging.py index 6ee0d0cc7..e430d2cb9 100644 --- a/test_autolens/imaging/model/test_plotter_interface_imaging.py +++ b/test_autolens/imaging/model/test_plotter_interface_imaging.py @@ -34,13 +34,13 @@ def test__fit_imaging( file_path=path.join(plot_path, "fit.fits"), hdu=0 ) - assert image.shape == (7, 7) + assert image.shape == (5, 5) image = al.ndarray_via_fits_from( 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 diff --git a/test_autolens/interferometer/model/test_plotter_interface_interferometer.py b/test_autolens/interferometer/model/test_plotter_interface_interferometer.py index 285535de0..02c4c1a96 100644 --- a/test_autolens/interferometer/model/test_plotter_interface_interferometer.py +++ b/test_autolens/interferometer/model/test_plotter_interface_interferometer.py @@ -36,7 +36,7 @@ def test__fit_interferometer( file_path=path.join(plot_path, "model_galaxy_images.fits"), hdu=0 ) - assert image.shape == (7, 7) + assert image.shape == (5, 5) image = al.ndarray_via_fits_from( file_path=path.join(plot_path, "dirty_images.fits"), hdu=0