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:
- 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. 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 toResourcePath.temporary_uri
).
- butler
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 inoutput_root
.Methods Documentation
- extract_ref(stencil: SkyStencil, ref: DatasetRef) 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.id
notNone
(useextract_search
instead when this is not the case). Need not have an expanded data ID. May represent an image-like dataset component.
- stencil
- Returns:
- result
Extraction
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.
- result
- 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
dict
orDataCoordinate
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.
- stencil
- Returns:
- result
Extraction
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.
- result
- extract_uuid(stencil: SkyStencil, uuid: UUID, *, component: str | None = None) Extraction ¶
Extract a subimage from a dataset identified by its UUID.
- Parameters:
- Returns:
- result
Extraction
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.
- result
- process_ref(stencil: SkyStencil, ref: DatasetRef, *, mask_plane: str | None = 'STENCIL') 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.id
notNone
(useextract_search
instead when this is not the case). Need not have an expanded data ID. May represent an image-like dataset component.- mask
str
, 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 toSTENCIL
.
- stencil
- Returns:
- uri
ResourcePath
Full path to the extracted cutout.
- uri
- process_search(stencil: SkyStencil, dataset_type_name: str, data_id: DataCoordinate | Mapping[str, Any], collections: Sequence[str], *, mask_plane: str | None = '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
dict
orDataCoordinate
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
str
, 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 toSTENCIL
.
- stencil
- Returns:
- uri
ResourcePath
Full path to the extracted cutout.
- uri
- 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:
- 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
str
, 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 toSTENCIL
.
- stencil
- Returns:
- uri
ResourcePath
Full path to the extracted cutout.
- uri
- write_fits(extract_result: Extraction) ResourcePath ¶
Write a
Extraction
to a remote FITS file inoutput_root
.- Parameters:
- extract_result
Extraction
Result of a call to a
extract_*
method.
- extract_result
- Returns:
- uri
ResourcePath
Full path to the extracted cutout.
- uri