PlotImageSubtractionCutoutsTask#

class lsst.analysis.ap.PlotImageSubtractionCutoutsTask(*, output_path, **kwargs)#

Bases: Task

Generate template/science/difference image cutouts of DiaSources and an optional manifest for upload to a Zooniverse project.

Parameters#

output_pathstr

The path to write the output to; manifest goes here, while the images themselves go into output_path/images/.

Methods Summary

generate_image(science, template, ...[, ...])

Get a 3-part cutout image to save to disk, for a single source.

run(data, butler[, njobs])

Generate cutout images and a manifest for upload to Zooniverse from a collection of DiaSources.

write_images(data, butler[, njobs])

Make the 3-part cutout images for each requested source and write them to disk.

write_manifest(sources)

Save a Zooniverse manifest attaching image URLs to source ids.

Methods Documentation

generate_image(science, template, difference, center, scale, dia_source_id=None, save_as_numpy=False, source=None, footprint=None)#

Get a 3-part cutout image to save to disk, for a single source.

Parameters#

sciencelsst.afw.image.ExposureF

Science exposure to include in the cutout.

templatelsst.afw.image.ExposureF

Matched template exposure to include in the cutout.

differencelsst.afw.image.ExposureF

Matched science minus template exposure to include in the cutout.

centerlsst.geom.SpherePoint

Center of the source to be cut out of each image.

scalefloat

Pixel scale in arcseconds.

dia_source_idint, optional

DiaSourceId to use in the filename, if saving to disk.

save_as_numpybool, optional

Save the raw cutout images in numpy format.

sourcenumpy.record, optional

DiaSource record for this cutout, to add metadata to the image.

footprintlsst.afw.detection.Footprint, optional

Detected source footprint; if specified, extract a square surrounding the footprint bbox, otherwise use config.size.

Returns#

image: io.BytesIO

The generated image, to be output to a file or displayed on screen.

run(data, butler, njobs=0)#

Generate cutout images and a manifest for upload to Zooniverse from a collection of DiaSources.

Parameters#

datapandas.DataFrame

The DiaSources to extract cutouts for. Must contain at least these fields: ra, dec, diaSourceId, detector, visit, instrument.

butlerlsst.daf.butler.Butler

The butler connection to use to load the data; create it with the collections you wish to load images from.

njobsint, optional

Number of multiprocessing jobs to make cutouts with; default of 0 means don’t use multiprocessing at all.

Returns#

source_idslist [int]

DiaSourceIds of cutout images that were generated.

write_images(data, butler, njobs=0)#

Make the 3-part cutout images for each requested source and write them to disk.

Creates images/ and numpy/ subdirectories if they do not already exist; images are written there as PNG and npy files.

Parameters#

datapandas.DataFrame

The DiaSources to extract cutouts for. Must contain at least these fields: ra, dec, diaSourceId, detector, visit, instrument.

butlerlsst.daf.butler.Butler

The butler connection to use to load the data; create it with the collections you wish to load images from.

njobsint, optional

Number of multiprocessing jobs to make cutouts with; default of 0 means don’t use multiprocessing at all.

Returns#

sourceslist

DiaSourceIds that had cutouts made.

write_manifest(sources)#

Save a Zooniverse manifest attaching image URLs to source ids.

Parameters#

sourceslist [int]

The diaSourceIds of the sources that had cutouts succesfully made.