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 callsgenerate_imagefor each source (which returns a PNG in memory) and arranges the resulting rasters in a single matplotlib figure.Parameters#
- sources
pandas.DataFrame DiaSources to cut out. Must contain at least
ra, dec, diaSourceId, detector, visit, instrumentplus whatever annotation fields the task config requires (seePlotImageSubtractionCutoutsConfig.add_metadata).- butler
lsst.daf.butler.Butler Butler initialized with the relevant collections.
- instrument
str Name of the instrument for the data being plotted.
- n_per_row
int Number of cutouts per row in the resulting figure.
- config
PlotImageSubtractionCutoutsConfig, optional Cutout config to use (see
plotImageSubtractionCutouts.PlotImageSubtractionCutoutsConfig). Defaults to a fresh instance withadd_metadata=False(annotations get cluttered in a grid).- output
str, optional If given, save the figure to this path with
bbox_inches="tight".- figsize
tuple[float,float], optional Figure size in inches. Defaults to
(n_per_row*3.5, n_rows*1.7).
Returns#
fig :
matplotlib.figure.Figure- sources