plot_cutouts_with_object_markers#
- lsst.analysis.ap.plot_cutouts_with_object_markers(sources, butler, objects, *, output_path=None, display_cutouts=False, size=51, image_type='difference', image_datasets={'difference': 'difference_image', 'science': 'preliminary_visit_image', 'template': 'template_detector'}, marker_size=80, marker_symbol='o', palette=('lime', 'red', 'cyan', 'magenta', 'yellow', 'orange', 'deepskyblue', 'pink', 'white', 'violet', 'gold', 'lightgreen'), source_marker_size=80, current_source_marker_size=180, current_source_color='yellow')#
Plot per-diaSource cutouts with overlaid markers at given diaObject sky positions.
For each diaSource in
sources, fetch a square cutout frombutlercentered on the source’s (ra, dec). On each cutout draw:A small
+marker at every other diaSource insourceswhose sky position lands inside the cutout, regardless of which (visit, detector) it was detected on.A distinct
xmarker for the diaSource the cutout is centered on (the “current” diaSource).One color-coded marker per distinct diaObjectId in
objects, cycling throughpalette; the same color identifies the same diaObject across every cutout in the run.
Markers that fall outside the cutout bounds are skipped.
Typical use: visualize how a group of diaSources (all originally associated with one diaObjectId in run 1) got redistributed across diaObjects in run 2.
sourcesandobjectsare usually built from the output offind_objects_sharing_sources:sources, ro1, ro2 = find_objects_sharing_sources( diaObjectId, sources1, sources2, objects1, objects2) objects = pd.concat([ro1, ro2]) plot_cutouts_with_object_markers( sources, butler1, objects, display_cutouts=True, )
Parameters#
- sources
pandas.DataFrame DiaSources to cut out. Must contain
diaSourceId,ra,dec,visit, anddetectorcolumns.- butler
lsst.daf.butler.Butler Butler containing the image datasets for these (visit, detector) pairs.
- objects
pandas.DataFrame DiaObjects to mark. Must contain
diaObjectId,ra, anddeccolumns. Duplicate diaObjectIds are dropped (first row wins). If anobj2_diaObjectIdcolumn is present (e.g. for rows from amatchedDataFrame returned bycompare_objects), the run-2 id is shown in the legend in preference to the run-1diaObjectId.- output_path
str, optional Directory to write
{diaSourceId}.pngfiles to. Created if missing. Pass None to skip writing.- display_cutouts
bool, optional If True, display each cutout inline (notebook).
- size
int, optional Cutout side length in pixels.
- image_type{“science”, “template”, “difference”}, optional
Which image to render.
- image_datasets
dict[str,str], optional Mapping from image-type key to butler dataset name.
- marker_size
int, optional matplotlib scatter
sparameter for diaObject markers.- marker_symbol
str, optional matplotlib scatter
markerparameter for diaObject markers.- palettesequence of
str, optional Color cycle used to assign one color per diaObjectId.
- source_marker_size
int, optional Scatter
sparameter for the small+markers drawn at the positions of the other diaSources insources.- current_source_marker_size
int, optional Scatter
sparameter for the distinct marker drawn at the diaSource the cutout is centered on.- current_source_color
str, optional Color of the current-diaSource marker.