autogalaxy.plot.GalaxiesPlotter#

class GalaxiesPlotter[source]#

Bases: Plotter

Plots the attributes of a list of galaxies using the matplotlib methods plot() and imshow() and many other matplotlib functions which customize the plot’s appearance.

The mat_plot_1d and mat_plot_2d attributes wrap matplotlib function calls to make the figure. By default, the settings passed to every matplotlib function called are those specified in the config/visualize/mat_wrap/*.ini files, but a user can manually input values into MatPlot2D to customize the figure’s appearance.

Overlaid on the figure are visuals, contained in the Visuals1D and Visuals2D objects. Attributes may be extracted from the MassProfile and plotted via the visuals object, if the corresponding entry is True in the Include1D or Include2D object or the config/visualize/include.ini file.

Parameters:
  • galaxies (List[Galaxy]) – The galaxies the plotter plots.

  • grid (Union[ndarray, Grid1D, Grid2D, Grid2DIterate, Grid2DIrregular]) – The 2D (y,x) grid of coordinates used to evaluate the galaxies light and mass quantities that are plotted.

  • mat_plot_1d (MatPlot1D) – Contains objects which wrap the matplotlib function calls that make 1D plots.

  • visuals_1d (Visuals1D) – Contains 1D visuals that can be overlaid on 1D plots.

  • include_1d (Include1D) – Specifies which attributes of the MassProfile are extracted and plotted as visuals for 1D plots.

  • mat_plot_2d (MatPlot2D) – Contains objects which wrap the matplotlib function calls that make 2D plots.

  • visuals_2d (Visuals2D) – Contains 2D visuals that can be overlaid on 2D plots.

  • include_2d (Include2D) – Specifies which attributes of the MassProfile are extracted and plotted as visuals for 2D plots.

Methods

close_subplot_figure

figures_2d

Plots the individual attributes of the plotter's Galaxies object in 2D, which are computed via the plotter's 2D grid object.

figures_2d_of_galaxies

Plots galaxy images for each individual Galaxy in the plotter's Galaxies in 2D, which are computed via the plotter's 2D grid object.

galaxy_indexes_from

Returns a list of all indexes of the galaxys in the fit, which is iterated over in figures that plot individual figures of each galaxy.

galaxy_plotter_from

Returns an GalaxyPlotter corresponding to a Galaxy in the Tracer.

get_subplot_figsize

Get the size of a sub plotter in (total_y_pixels, total_x_pixels), based on the number of subplots that are going to be plotted.

get_visuals_2d

rtype:

Visuals2D

get_visuals_2d_of_galaxy

rtype:

Visuals2D

open_subplot_figure

Setup a figure for plotting an image.

set_filename

set_format

set_mat_plot_1d_for_multi_plot

set_mat_plots_for_subplot

set_title

subplot

Plots the individual attributes of the plotter's Galaxies object in 2D on a subplot, which are computed via the plotter's 2D grid object.

subplot_galaxies

Standard subplot of the attributes of the plotter's Galaxies object.

subplot_galaxy_images

Subplot of the image of every galaxy.

subplot_of_plotters_figure

Attributes

get_1d

get_2d

is_for_subplot

galaxy_plotter_from(galaxy_index)[source]#

Returns an GalaxyPlotter corresponding to a Galaxy in the Tracer.

Returns:

The index of the galaxy in the Tracer used to make the GalaxyPlotter.

Return type:

galaxy_index

figures_2d(image=False, convergence=False, potential=False, deflections_y=False, deflections_x=False, magnification=False, plane_image=False, plane_grid=False, zoom_to_brightest=True, title_suffix='', filename_suffix='', source_plane_title=False)[source]#

Plots the individual attributes of the plotter’s Galaxies object in 2D, which are computed via the plotter’s 2D grid object.

The API is such that every plottable attribute of the Galaxies object is an input parameter of type bool of the function, which if switched to True means that it is plotted.

Parameters:
  • image (bool) – Whether to make a 2D plot (via imshow) of the image of the galaxies.

  • convergence (bool) – Whether to make a 2D plot (via imshow) of the convergence.

  • potential (bool) – Whether to make a 2D plot (via imshow) of the potential.

  • deflections_y (bool) – Whether to make a 2D plot (via imshow) of the y component of the deflection angles.

  • deflections_x (bool) – Whether to make a 2D plot (via imshow) of the x component of the deflection angles.

  • magnification (bool) – Whether to make a 2D plot (via imshow) of the magnification.

  • plane_image (bool) – Whether to make a 2D plot (via imshow) of the image of the plane in the soure-plane (e.g. its unlensed light).

  • zoom_to_brightest (bool) – Whether to automatically zoom the plot to the brightest regions of the galaxies being plotted as opposed to the full extent of the grid.

  • title_suffix (str) – Add a suffix to the end of the matplotlib title label.

  • filename_suffix (str) – Add a suffix to the end of the filename the plot is saved to hard-disk using.

galaxy_indexes_from(galaxy_index)[source]#

Returns a list of all indexes of the galaxys in the fit, which is iterated over in figures that plot individual figures of each galaxy.

Parameters:

galaxy_index (Optional[int]) – A specific galaxy index which when input means that only a single galaxy index is returned.

Returns:

A list of galaxy indexes corresponding to galaxys in the galaxy.

Return type:

list

figures_2d_of_galaxies(image=False, galaxy_index=None)[source]#

Plots galaxy images for each individual Galaxy in the plotter’s Galaxies in 2D, which are computed via the plotter’s 2D grid object.

The API is such that every plottable attribute of the galaxy object is an input parameter of type bool of the function, which if switched to True means that it is plotted.

Parameters:
  • image (bool) – Whether to make a 2D plot (via imshow) of the image of the galaxy in the soure-galaxy (e.g. its unlensed light).

  • galaxy_index (Optional[int]) – If input, plots for only a single galaxy based on its index are created.

subplot(image=False, convergence=False, potential=False, deflections_y=False, deflections_x=False, magnification=False, auto_filename='subplot_galaxies')[source]#

Plots the individual attributes of the plotter’s Galaxies object in 2D on a subplot, which are computed via the plotter’s 2D grid object.

The API is such that every plottable attribute of the Galaxies object is an input parameter of type bool of the function, which if switched to True means that it is included on the subplot.

Parameters:
  • image (bool) – Whether or not to include a 2D plot (via imshow) of the image.

  • convergence (bool) – Whether or not to include a 2D plot (via imshow) of the convergence.

  • potential (bool) – Whether or not to include a 2D plot (via imshow) of the potential.

  • deflections_y (bool) – Whether or not to include a 2D plot (via imshow) of the y component of the deflection angles.

  • deflections_x (bool) – Whether or not to include a 2D plot (via imshow) of the x component of the deflection angles.

  • magnification (bool) – Whether or not to include a 2D plot (via imshow) of the magnification.

  • auto_filename (str) – The default filename of the output subplot if written to hard-disk.

subplot_galaxies()[source]#

Standard subplot of the attributes of the plotter’s Galaxies object.

subplot_galaxy_images()[source]#

Subplot of the image of every galaxy.

For example, for a 2 galaxy Galaxies, this creates a subplot with 2 panels, one for each galaxy.