FitsRawFormatterBase#
- class lsst.obs.base.FitsRawFormatterBase(*args, **kwargs)#
Bases:
FitsImageFormatterBaseAbstract base class for reading and writing raw data to and from FITS files.
Attributes Summary
The parameters passed by the butler user, after checking them against the storage class and transforming
Noneinto an emptydict(dict).FilterDefinitions, defining the filters for this instrument.The metadata read from this file.
The
ObservationInfoextracted from this file's metadata (ObservationInfo, read-only).MetadataTranslatorto translate metadata header toObservationInfo.Control whether the WCS is flipped in the X-direction (
bool).Methods Summary
attachComponentsFromMetadata(exposure)Attach all
lsst.afw.image.Exposurecomponents derived from metadata (including the stripped metadata itself).fromMetadata(metadata[, obsInfo, ...])Construct a possibly-limited formatter from known metadata.
getDetector(id)Return the detector that acquired this raw exposure.
isOnSky()Boolean to determine if the exposure is thought to be on the sky.
Construct a FilterLabel from metadata.
makeRawSkyWcsFromBoresight(boresight, ...)Class method to make a raw sky WCS from boresight and detector.
Construct a VisitInfo from metadata.
makeWcs(visitInfo, detector)Create a SkyWcs from information about the exposure.
readComponent(component)Read a component dataset.
readFull()Read the full dataset (while still accounting for parameters).
Read just the image component of the Exposure.
Read all header metadata directly into a PropertyList.
Remove metadata entries that are parsed into components.
write_local_file(in_memory_dataset, uri)Serialize the in-memory dataset to a local file.
Attributes Documentation
- checked_parameters#
- filterDefinitions#
FilterDefinitions, defining the filters for this instrument.
- metadata#
The metadata read from this file. It will be stripped as components are extracted from it (
lsst.daf.base.PropertyList).
- observationInfo#
The
ObservationInfoextracted from this file’s metadata (ObservationInfo, read-only).
- translatorClass#
MetadataTranslatorto translate metadata header toObservationInfo.
- wcsFlipX: ClassVar[bool] = False#
Control whether the WCS is flipped in the X-direction (
bool).
Methods Documentation
- attachComponentsFromMetadata(exposure)#
Attach all
lsst.afw.image.Exposurecomponents derived from metadata (including the stripped metadata itself).Parameters#
- exposure
lsst.afw.image.Exposure Exposure to attach components to (modified in place). Must already have a detector attached.
- exposure
- classmethod fromMetadata(metadata, obsInfo=None, storageClass=None, location=None)#
Construct a possibly-limited formatter from known metadata.
Parameters#
- metadata
lsst.daf.base.PropertyList Raw header metadata, with any fixes (see
astro_metadata_translator.fix_header) applied but nothing stripped.- obsInfo
astro_metadata_translator.ObservationInfo, optional Structured information already extracted from
metadata. If not provided, will be read frommetadataon first use.- storageClass
lsst.daf.butler.StorageClass, optional StorageClass for this file. If not provided, the formatter will only support
makeWcs,makeVisitInfo,makeFilter, and other operations that operate purely on metadata and not the actual file.- location
lsst.daf.butler.Location, optional. Location of the file. If not provided, the formatter will only support
makeWcs,makeVisitInfo,makeFilter, and other operations that operate purely on metadata and not the actual file.
Returns#
- formatter
FitsRawFormatterBase An instance of
cls.
- metadata
- abstract getDetector(id)#
Return the detector that acquired this raw exposure.
Parameters#
- id
int The identifying number of the detector to get.
Returns#
- detector
Detector The detector associated with that
id.
- id
- isOnSky()#
Boolean to determine if the exposure is thought to be on the sky.
Returns#
- onSky
bool Returns
Trueif the observation looks like it was taken on the sky. ReturnsFalseif this observation looks like a calibration observation.
Notes#
If there is tracking RA/Dec information associated with the observation it is assumed that the observation is on sky. Currently the observation type is not checked.
- onSky
- makeFilterLabel()#
Construct a FilterLabel from metadata.
Returns#
- filter
FilterLabel Object that identifies the filter for this image.
- filter
- classmethod makeRawSkyWcsFromBoresight(boresight, orientation, detector)#
Class method to make a raw sky WCS from boresight and detector.
Parameters#
- boresight
lsst.geom.SpherePoint The ICRS boresight RA/Dec
- orientation
lsst.geom.Angle The rotation angle of the focal plane on the sky.
- detector
lsst.afw.cameraGeom.Detector Where to get the camera geometry from.
Returns#
- skyWcs
SkyWcs Reversible mapping from pixel coordinates to sky coordinates.
- boresight
- makeVisitInfo()#
Construct a VisitInfo from metadata.
Returns#
- visitInfo
VisitInfo Structured metadata about the observation.
- visitInfo
- makeWcs(visitInfo, detector)#
Create a SkyWcs from information about the exposure.
If VisitInfo is not None, use it and the detector to create a SkyWcs, otherwise return the metadata-based SkyWcs (always created, so that the relevant metadata keywords are stripped).
Parameters#
- visitInfo
VisitInfo The information about the telescope boresight and camera orientation angle for this exposure.
- detector
Detector The detector used to acquire this exposure.
Returns#
- skyWcs
SkyWcs Reversible mapping from pixel coordinates to sky coordinates.
Raises#
- InitialSkyWcsError
Raised if there is an error generating the SkyWcs, chained from the lower-level exception if available.
- visitInfo
- readComponent(component)#
Read a component dataset.
Parameters#
- component
str, optional Component to read from the file.
Returns#
- objcomponent-dependent
In-memory component object.
Raises#
- KeyError
Raised if the requested component cannot be handled.
- component
- readFull()#
Read the full dataset (while still accounting for parameters).
Returns#
- objcomponent-dependent
In-memory component object.
- readImage()#
Read just the image component of the Exposure.
Returns#
- image
Image In-memory image component.
- image
- readMetadata()#
Read all header metadata directly into a PropertyList.
Returns#
- metadata
PropertyList Header metadata.
- metadata
- stripMetadata()#
Remove metadata entries that are parsed into components.
- write_local_file(in_memory_dataset: Any, uri: ResourcePath) None#
Serialize the in-memory dataset to a local file.
Parameters#
- in_memory_dataset
object The Python object to serialize.
- uri
ResourcePath The URI to use when writing the file.
Notes#
By default this method will attempt to call
to_bytesand then write these bytes to the file.Raises#
- FormatterNotImplementedError
Raised if the formatter subclass has not implemented this method or has failed to implement the
to_bytesmethod.
- in_memory_dataset