Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@lensing_plotters.set_include_and_plotter
@plotters.set_labels
def model_image_of_plane(fit, plane_index, include=None, plotter=None):
"""Plot the model image of a specific plane of a lens fit.
Set *autolens.datas.arrays.plotters.plotters* for a description of all input parameters not described below.
Parameters
-----------
fit : datas.fitting.fitting.AbstractFitter
The fit to the datas, which includes a list of every model image, residual_map, chi-squareds, etc.
plane_indexes : [int]
The plane from which the model image is generated.
"""
if isinstance(plotter, lensing_plotters.Plotter):
plotter = plotter.plotter_with_new_output(
@lensing_plotters.set_include_and_plotter
@plotters.set_labels
def image(fit, include=None, plotter=None):
"""Plot the image of a lens fit.
Set *autolens.datas.array.plotters.plotters* for a description of all input parameters not described below.
Parameters
-----------
image : datas.imaging.datas.Imaging
The datas-datas, which include the observed datas, noise_map, PSF, signal-to-noise_map, etc.
origin : True
If true, the origin of the datas's coordinate system is plotted as a 'x'.
"""
plotter.plot_array(
array=fit.data,
def __init__(self, image_path):
self.plotter = lensing_plotters.Plotter(
output=mat_objs.Output(path=image_path, format="png")
)
self.sub_plotter = lensing_plotters.SubPlotter(
output=mat_objs.Output(path=image_path + "subplots/", format="png")
)
self.include = lensing_plotters.Include()
self.plot_ray_tracing_all_at_end_png = plot_setting(
"ray_tracing", "all_at_end_png"
)
self.plot_ray_tracing_all_at_end_fits = plot_setting(
"ray_tracing", "all_at_end_fits"
)
self.plot_subplot_ray_tracing = plot_setting(
"ray_tracing", "subplot_ray_tracing"
)
@lensing_plotters.set_include_and_sub_plotter
@plotters.set_subplot_filename
def subplot_tracer(tracer, grid, positions=None, include=None, sub_plotter=None):
"""Plot the observed _tracer of an analysis, using the *Imaging* class object.
The visualization and output type can be fully customized.
Parameters
-----------
tracer : autolens.imaging.tracer.Imaging
Class containing the _tracer, noise_mappers and PSF that are to be plotted.
The font size of the figure ylabel.
output_path : str
The path where the _tracer is output if the output_type is a file format (e.g. png, fits)
output_format : str
How the _tracer is output. File formats (e.g. png, fits) output the _tracer to harddisk. 'show' displays the _tracer \
in the python interpreter window.
def __init__(self, image_path):
self.plotter = lensing_plotters.Plotter(
output=mat_objs.Output(path=image_path, format="png")
)
self.sub_plotter = lensing_plotters.SubPlotter(
output=mat_objs.Output(path=image_path + "subplots/", format="png")
)
self.include = lensing_plotters.Include()
self.plot_ray_tracing_all_at_end_png = plot_setting(
"ray_tracing", "all_at_end_png"
)
self.plot_ray_tracing_all_at_end_fits = plot_setting(
"ray_tracing", "all_at_end_fits"
)
self.plot_subplot_ray_tracing = plot_setting(
"ray_tracing", "subplot_ray_tracing"
)
self.plot_ray_tracing_image = plot_setting("ray_tracing", "image")
self.plot_ray_tracing_source_plane = plot_setting(
"ray_tracing", "source_plane_image"
@lensing_plotters.set_include_and_sub_plotter
@plotters.set_subplot_filename
def subplot_of_plane(fit, plane_index, include=None, sub_plotter=None):
"""Plot the model datas_ of an analysis, using the *Fitter* class object.
The visualization and output type can be fully customized.
Parameters
-----------
fit : autolens.lens.fitting.Fitter
Class containing fit between the model datas_ and observed lens datas_ (including residual_map, chi_squared_map etc.)
output_path : str
The path where the datas_ is output if the output_type is a file format (e.g. png, fits)
output_filename : str
The name of the file that is output, if the output_type is a file format (e.g. png, fits)
output_format : str
How the datas_ is output. File formats (e.g. png, fits) output the datas_ to harddisk. 'show' displays the datas_ \
@lensing_plotters.set_include_and_plotter
@plotters.set_labels
def potential(tracer, grid, include=None, plotter=None):
plotter.plot_array(
array=tracer.potential_from_grid(grid=grid),
mask=include.mask_from_grid(grid=grid),
critical_curves=include.critical_curves_from_obj(obj=tracer),
light_profile_centres=include.light_profile_centres_from_obj(obj=tracer),
mass_profile_centres=include.mass_profile_centres_from_obj(obj=tracer),
include_origin=include.origin,
)
def subtracted_image_of_plane(fit, plane_index, include=None, plotter=None):
"""Plot the model image of a specific plane of a lens fit.
Set *autolens.datas.arrays.plotters.plotters* for a description of all input parameters not described below.
Parameters
-----------
fit : datas.fitting.fitting.AbstractFitter
The fit to the datas, which includes a list of every model image, residual_map, chi-squareds, etc.
image_index : int
The index of the datas in the datas-set of which the model image is plotted.
plane_indexes : int
The plane from which the model image is generated.
"""
if isinstance(plotter, lensing_plotters.Plotter):
plotter = plotter.plotter_with_new_output(
filename=plotter.output.filename + "_" + str(plane_index)
)
if fit.tracer.total_planes > 1:
other_planes_model_images = [
model_image
for i, model_image in enumerate(fit.model_images_of_planes)
if i != plane_index
]
subtracted_image = fit.image - sum(other_planes_model_images)
else:
@lensing_plotters.set_include_and_sub_plotter
@plotters.set_subplot_filename
def subplot_fit_imaging(fit, include=None, sub_plotter=None):
number_subplots = 6
sub_plotter.open_subplot_figure(number_subplots=number_subplots)
sub_plotter.setup_subplot(number_subplots=number_subplots, subplot_index=1)
image(fit=fit, include=include, plotter=sub_plotter)
sub_plotter.setup_subplot(number_subplots=number_subplots, subplot_index=2)
signal_to_noise_map(fit=fit, include=include, plotter=sub_plotter)
sub_plotter.setup_subplot(number_subplots=number_subplots, subplot_index=3)