ImageCutoutFactory

class lsst.dax.images.cutout.ImageCutoutFactory(butler: Butler, projection_finder: ProjectionFinder, output_root: str | ParseResult | ResourcePath | Path, temporary_root: str | ParseResult | ResourcePath | Path | None = None)

Bases: object

High-level interface to the image cutout functionality.

Parameters:
butlerButler

Butler that subimages are extracted from.

projection_finderProjectionObject

Object that obtains the WCS and bounding box for butler datasets of different types. May include caches.

output_rootconvertible to ResourcePath

Root of output file URIs. This will be combined with the originating dataset’s UUID and an encoding of the stencil to form the complete URI.

temporary_rootconvertible to ResourcePath, optional

Local filesystem root to write files to before they are transferred to output_root (passed as the prefix argument to ResourcePath.temporary_uri).

Methods Summary

extract_ref(stencil, ref)

Extract a subimage from a fully-resolved DatasetRef.

extract_search(stencil, dataset_type_name, ...)

Extract a subimage from a dataset identified by a (dataset type, data ID, collection path) tuple.

extract_uuid(stencil, uuid, *[, component])

Extract a subimage from a dataset identified by its UUID.

process_ref(stencil, ref, *[, mask_plane])

Extract and write a cutout from a fully-resolved DatasetRef.

process_search(stencil, dataset_type_name, ...)

Extract and write a cutout from a dataset identified by a (dataset type, data ID, collection path) tuple.

process_uuid(stencil, uuid, *[, component, ...])

Extract and write a cutout from a dataset identified by its UUID.

write_fits(extract_result)

Write a Extraction to a remote FITS file in output_root.

Methods Documentation

extract_ref(stencil: SkyStencil, ref: DatasetRef) Extraction

Extract a subimage from a fully-resolved DatasetRef.

Parameters:
stencilSkyStencil

Definition of the cutout region, in sky coordinates.

refDatasetRef

Fully-resolved reference to the dataset to obtain the cutout from. Must have DatasetRef.id not None (use extract_search instead when this is not the case). Need not have an expanded data ID. May represent an image-like dataset component.

Returns:
resultExtraction

Struct that combines the cutout itself with additional metadata and the pixel-coordinate stencil. The cutout is not masked; Extraction.mask must be called explicitly if desired.

Extract a subimage from a dataset identified by a (dataset type, data ID, collection path) tuple.

Parameters:
stencilSkyStencil

Definition of the cutout region, in sky coordinates.

dataset_type_namestr

Name of the butler dataset. Use .-separate terms to read an image-like component.

data_iddict or DataCoordinate

Mapping-of-dimensions identifier for the dataset within its collection.

collectionsIterable [ str ]

Collections to search for the dataset, in the order they should be searched.

Returns:
resultExtraction

Struct that combines the cutout itself with additional metadata and the pixel-coordinate stencil. The cutout is not masked; Extraction.mask must be called explicitly if desired.

extract_uuid(stencil: SkyStencil, uuid: UUID, *, component: str | None = None) Extraction

Extract a subimage from a dataset identified by its UUID.

Parameters:
stencilSkyStencil

Definition of the cutout region, in sky coordinates.

uuidUUID

Unique ID of the dataset to read from.

componentstr, optional

If not None (default), read this component instead of the composite dataset.

Returns:
resultExtraction

Struct that combines the cutout itself with additional metadata and the pixel-coordinate stencil. The cutout is not masked; Extraction.mask must be called explicitly if desired.

process_ref(stencil: SkyStencil, ref: DatasetRef, *, mask_plane: str | None = 'STENCIL') ResourcePath

Extract and write a cutout from a fully-resolved DatasetRef.

Parameters:
stencilSkyStencil

Definition of the cutout region, in sky coordinates.

refDatasetRef

Fully-resolved reference to the dataset to obtain the cutout from. Must have DatasetRef.id not None (use extract_search instead when this is not the case). Need not have an expanded data ID. May represent an image-like dataset component.

maskstr, optional

If not None, set this mask plane in the extracted cutout showing the approximate stencil region. Does nothing if the image type does not have a mask plane. Defaults to STENCIL.

Returns:
uriResourcePath

Full path to the extracted cutout.

Extract and write a cutout from a dataset identified by a (dataset type, data ID, collection path) tuple.

Parameters:
stencilSkyStencil

Definition of the cutout region, in sky coordinates.

dataset_type_namestr

Name of the butler dataset. Use .-separate terms to read an image-like component.

data_iddict or DataCoordinate

Mapping-of-dimensions identifier for the dataset within its collection.

collectionsIterable [ str ]

Collections to search for the dataset, in the order they should be searched.

maskstr, optional

If not None, set this mask plane in the extracted cutout showing the approximate stencil region. Does nothing if the image type does not have a mask plane. Defaults to STENCIL.

Returns:
uriResourcePath

Full path to the extracted cutout.

process_uuid(stencil: SkyStencil, uuid: UUID, *, component: str | None = None, mask_plane: str | None = 'STENCIL') ResourcePath

Extract and write a cutout from a dataset identified by its UUID.

Parameters:
stencilSkyStencil

Definition of the cutout region, in sky coordinates.

uuidUUID

Unique ID of the dataset to extract the subimage from.

componentstr, optional

If not None (default), read this component instead of the composite dataset.

maskstr, optional

If not None, set this mask plane in the extracted cutout showing the approximate stencil region. Does nothing if the image type does not have a mask plane. Defaults to STENCIL.

Returns:
uriResourcePath

Full path to the extracted cutout.

write_fits(extract_result: Extraction) ResourcePath

Write a Extraction to a remote FITS file in output_root.

Parameters:
extract_resultExtraction

Result of a call to a extract_* method.

Returns:
uriResourcePath

Full path to the extracted cutout.