Skip to content

Commit

Permalink
added errors and snr to fit plootter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Oct 25, 2024
1 parent 123c932 commit c2c0f92
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions autolens/imaging/plot/fit_imaging_plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ def figures_2d_of_planes(
subtracted_image: bool = False,
model_image: bool = False,
plane_image: bool = False,
plane_errors: bool = False,
plane_signal_to_noise_map: bool = False,
use_source_vmax: bool = False,
zoom_to_brightest: bool = True,
interpolate_to_uniform: bool = False,
Expand Down Expand Up @@ -178,6 +180,14 @@ 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.
use_source_vmax
If `True`, the maximum value of the lensed source (e.g. in the image-plane) is used to set the `vmax` of
certain plots (e.g. the `data`) in order to ensure the lensed source is visible compared to the lens.
Expand Down Expand Up @@ -294,6 +304,36 @@ def figures_2d_of_planes(
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
)

if use_source_vmax:
self.mat_plot_2d.cmap.kwargs.pop("vmax")

Expand Down

0 comments on commit c2c0f92

Please sign in to comment.