cutout_grid#

lsst.analysis.ap.cutout_grid(sources, butler, instrument, n_per_row=4, config=None, output=None, figsize=None, ra_column='ra', dec_column='dec', detector_column='detector', visit_column='visit', id_column='diaSourceId')#

Render science/template/difference cutouts for many sources in a grid.

This is a thin wrapper around PlotImageSubtractionCutoutsTask: it calls generate_image for each source (which returns a PNG in memory) and arranges the resulting rasters in a single matplotlib figure.

Parameters#

sourcespandas.DataFrame

DiaSources to cut out. Must contain at least ra, dec, diaSourceId, detector, visit, instrument plus whatever annotation fields the task config requires (see PlotImageSubtractionCutoutsConfig.add_metadata).

butlerlsst.daf.butler.Butler

Butler initialized with the relevant collections.

instrumentstr

Name of the instrument for the data being plotted.

n_per_rowint

Number of cutouts per row in the resulting figure.

configPlotImageSubtractionCutoutsConfig, optional

Cutout config to use (see plotImageSubtractionCutouts.PlotImageSubtractionCutoutsConfig). Defaults to a fresh instance with add_metadata=False (annotations get cluttered in a grid).

outputstr, optional

If given, save the figure to this path with bbox_inches="tight".

figsizetuple [float, float], optional

Figure size in inches. Defaults to (n_per_row*3.5, n_rows*1.7).

Returns#

fig : matplotlib.figure.Figure