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 from butler centered on the source’s (ra, dec). On each cutout draw:

  • A small + marker at every other diaSource in sources whose sky position lands inside the cutout, regardless of which (visit, detector) it was detected on.

  • A distinct x marker for the diaSource the cutout is centered on (the “current” diaSource).

  • One color-coded marker per distinct diaObjectId in objects, cycling through palette; 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. sources and objects are usually built from the output of find_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#

sourcespandas.DataFrame

DiaSources to cut out. Must contain diaSourceId, ra, dec, visit, and detector columns.

butlerlsst.daf.butler.Butler

Butler containing the image datasets for these (visit, detector) pairs.

objectspandas.DataFrame

DiaObjects to mark. Must contain diaObjectId, ra, and dec columns. Duplicate diaObjectIds are dropped (first row wins). If an obj2_diaObjectId column is present (e.g. for rows from a matched DataFrame returned by compare_objects), the run-2 id is shown in the legend in preference to the run-1 diaObjectId.

output_pathstr, optional

Directory to write {diaSourceId}.png files to. Created if missing. Pass None to skip writing.

display_cutoutsbool, optional

If True, display each cutout inline (notebook).

sizeint, optional

Cutout side length in pixels.

image_type{“science”, “template”, “difference”}, optional

Which image to render.

image_datasetsdict [str, str], optional

Mapping from image-type key to butler dataset name.

marker_sizeint, optional

matplotlib scatter s parameter for diaObject markers.

marker_symbolstr, optional

matplotlib scatter marker parameter for diaObject markers.

palettesequence of str, optional

Color cycle used to assign one color per diaObjectId.

source_marker_sizeint, optional

Scatter s parameter for the small + markers drawn at the positions of the other diaSources in sources.

current_source_marker_sizeint, optional

Scatter s parameter for the distinct marker drawn at the diaSource the cutout is centered on.

current_source_colorstr, optional

Color of the current-diaSource marker.