Skip to content

Commit

Permalink
interferometer
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Oct 25, 2024
1 parent c2c0f92 commit e9a009e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
45 changes: 45 additions & 0 deletions autolens/interferometer/plot/fit_interferometer_plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand All @@ -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):
Expand Down
2 changes: 0 additions & 2 deletions test_autolens/imaging/plot/test_fit_imaging_plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e9a009e

Please sign in to comment.