PlotImageSubtractionCutoutsTask#
- class lsst.analysis.ap.PlotImageSubtractionCutoutsTask(*, output_path, **kwargs)#
Bases:
TaskGenerate template/science/difference image cutouts of DiaSources and an optional manifest for upload to a Zooniverse project.
Parameters#
- output_path
str 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#
- science
lsst.afw.image.ExposureF Science exposure to include in the cutout.
- template
lsst.afw.image.ExposureF Matched template exposure to include in the cutout.
- difference
lsst.afw.image.ExposureF Matched science minus template exposure to include in the cutout.
- center
lsst.geom.SpherePoint Center of the source to be cut out of each image.
- scale
float Pixel scale in arcseconds.
- dia_source_id
int, optional DiaSourceId to use in the filename, if saving to disk.
- save_as_numpy
bool, optional Save the raw cutout images in numpy format.
- source
numpy.record, optional DiaSource record for this cutout, to add metadata to the image.
- footprint
lsst.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.
- science
- run(data, butler, njobs=0)#
Generate cutout images and a manifest for upload to Zooniverse from a collection of DiaSources.
Parameters#
- data
pandas.DataFrame The DiaSources to extract cutouts for. Must contain at least these fields:
ra, dec, diaSourceId, detector, visit, instrument.- butler
lsst.daf.butler.Butler The butler connection to use to load the data; create it with the collections you wish to load images from.
- njobs
int, optional Number of multiprocessing jobs to make cutouts with; default of 0 means don’t use multiprocessing at all.
Returns#
- source_ids
list[int] DiaSourceIds of cutout images that were generated.
- data
- write_images(data, butler, njobs=0)#
Make the 3-part cutout images for each requested source and write them to disk.
Creates
images/andnumpy/subdirectories if they do not already exist; images are written there as PNG and npy files.Parameters#
- data
pandas.DataFrame The DiaSources to extract cutouts for. Must contain at least these fields:
ra, dec, diaSourceId, detector, visit, instrument.- butler
lsst.daf.butler.Butler The butler connection to use to load the data; create it with the collections you wish to load images from.
- njobs
int, optional Number of multiprocessing jobs to make cutouts with; default of 0 means don’t use multiprocessing at all.
Returns#
- sources
list DiaSourceIds that had cutouts made.
- data
- output_path