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, logger: Logger | None = None)#
Bases:
objectHigh-level interface to the image cutout functionality.
Parameters#
- butler
Butler Butler that subimages are extracted from.
- projection_finder
ProjectionObject 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.
- temporary_rootconvertible to
ResourcePath, optional Local filesystem root to write files to before they are transferred to
output_root(passed as the prefix argument toResourcePath.temporary_uri).- logger
logging.Logger, optional Logger to use for timing messages. If
None, a default logger will be used.
Methods Summary
extract_ref(stencil, ref[, cutout_mode])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
Extractionto a remote FITS file inoutput_root.Methods Documentation
- extract_ref(stencil: SkyStencil, ref: DatasetRef, cutout_mode: CutoutMode = CutoutMode.FULL_EXPOSURE) Extraction#
Extract a subimage from a fully-resolved
DatasetRef.Parameters#
- stencil
SkyStencil Definition of the cutout region, in sky coordinates.
- ref
DatasetRef Fully-resolved reference to the dataset to obtain the cutout from. Must have
DatasetRef.idnotNone(useextract_searchinstead when this is not the case). Need not have an expanded data ID. May represent an image-like dataset component.
Returns#
- result
Extraction Struct that combines the cutout itself with additional metadata and the pixel-coordinate stencil. The cutout is not masked;
Extraction.maskmust be called explicitly if desired.
- stencil
- extract_search(stencil: SkyStencil, dataset_type_name: str, data_id: DataCoordinate | Mapping[str, Any], collections: Sequence[str]) Extraction#
Extract a subimage from a dataset identified by a (dataset type, data ID, collection path) tuple.
Parameters#
- stencil
SkyStencil Definition of the cutout region, in sky coordinates.
- dataset_type_name
str Name of the butler dataset. Use
.-separate terms to read an image-like component.- data_id
dictorDataCoordinate Mapping-of-dimensions identifier for the dataset within its collection.
- collections
Iterable[str] Collections to search for the dataset, in the order they should be searched.
Returns#
- result
Extraction Struct that combines the cutout itself with additional metadata and the pixel-coordinate stencil. The cutout is not masked;
Extraction.maskmust be called explicitly if desired.
- stencil
- extract_uuid(stencil: SkyStencil, uuid: UUID, *, component: str | None = None, cutout_mode: CutoutMode = CutoutMode.FULL_EXPOSURE) Extraction#
Extract a subimage from a dataset identified by its UUID.
Parameters#
- stencil
SkyStencil Definition of the cutout region, in sky coordinates.
- uuid
UUID Unique ID of the dataset to read from.
- component
str, optional If not
None(default), read this component instead of the composite dataset.
Returns#
- result
Extraction Struct that combines the cutout itself with additional metadata and the pixel-coordinate stencil. The cutout is not masked;
Extraction.maskmust be called explicitly if desired.
- stencil
- process_ref(stencil: SkyStencil, ref: DatasetRef, *, mask_plane: str | None = 'OUTSIDE_STENCIL', cutout_mode: CutoutMode = CutoutMode.FULL_EXPOSURE) ResourcePath#
Extract and write a cutout from a fully-resolved
DatasetRef.Parameters#
- stencil
SkyStencil Definition of the cutout region, in sky coordinates.
- ref
DatasetRef Fully-resolved reference to the dataset to obtain the cutout from. Must have
DatasetRef.idnotNone(useextract_searchinstead when this is not the case). Need not have an expanded data ID. May represent an image-like dataset component.- mask_plane
str, optional If not
None, set this mask plane in the extracted cutout to flag pixels that lie outside the stencil region. Does nothing if the image type does not have a mask plane. Defaults toOUTSIDE_STENCIL.
Returns#
- uri
ResourcePath Full path to the extracted cutout.
- stencil
- process_search(stencil: SkyStencil, dataset_type_name: str, data_id: DataCoordinate | Mapping[str, Any], collections: Sequence[str], *, mask_plane: str | None = 'OUTSIDE_STENCIL') ResourcePath#
Extract and write a cutout from a dataset identified by a (dataset type, data ID, collection path) tuple.
Parameters#
- stencil
SkyStencil Definition of the cutout region, in sky coordinates.
- dataset_type_name
str Name of the butler dataset. Use
.-separate terms to read an image-like component.- data_id
dictorDataCoordinate Mapping-of-dimensions identifier for the dataset within its collection.
- collections
Iterable[str] Collections to search for the dataset, in the order they should be searched.
- mask_plane
str, optional If not
None, set this mask plane in the extracted cutout to flag pixels that lie outside the stencil region. Does nothing if the image type does not have a mask plane. Defaults toOUTSIDE_STENCIL.
Returns#
- uri
ResourcePath Full path to the extracted cutout.
- stencil
- process_uuid(stencil: SkyStencil, uuid: UUID, *, component: str | None = None, mask_plane: str | None = 'OUTSIDE_STENCIL', cutout_mode: CutoutMode = CutoutMode.FULL_EXPOSURE) ResourcePath#
Extract and write a cutout from a dataset identified by its UUID.
Parameters#
- stencil
SkyStencil Definition of the cutout region, in sky coordinates.
- uuid
UUID Unique ID of the dataset to extract the subimage from.
- component
str, optional If not
None(default), read this component instead of the composite dataset.- mask_plane
str, optional If not
None, set this mask plane in the extracted cutout to flag pixels that lie outside the stencil region. Does nothing if the image type does not have a mask plane. Defaults toOUTSIDE_STENCIL.
Returns#
- uri
ResourcePath Full path to the extracted cutout.
- stencil
- write_fits(extract_result: Extraction) ResourcePath#
Write a
Extractionto a remote FITS file inoutput_root.Parameters#
- extract_result
Extraction Result of a call to a
extract_*method.
Returns#
- uri
ResourcePath Full path to the extracted cutout.
- extract_result
- butler