FitsRawFormatterBase#

class lsst.obs.base.FitsRawFormatterBase(*args, **kwargs)#

Bases: FitsImageFormatterBase

Abstract base class for reading and writing raw data to and from FITS files.

Attributes Summary

checked_parameters

The parameters passed by the butler user, after checking them against the storage class and transforming None into an empty dict (dict).

filterDefinitions

FilterDefinitions, defining the filters for this instrument.

metadata

The metadata read from this file.

observationInfo

The ObservationInfo extracted from this file's metadata (ObservationInfo, read-only).

translatorClass

MetadataTranslator to translate metadata header to ObservationInfo.

wcsFlipX

Control whether the WCS is flipped in the X-direction (bool).

Methods Summary

attachComponentsFromMetadata(exposure)

Attach all lsst.afw.image.Exposure components 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.

makeFilterLabel()

Construct a FilterLabel from metadata.

makeRawSkyWcsFromBoresight(boresight, ...)

Class method to make a raw sky WCS from boresight and detector.

makeVisitInfo()

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).

readImage()

Read just the image component of the Exposure.

readMetadata()

Read all header metadata directly into a PropertyList.

stripMetadata()

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 ObservationInfo extracted from this file’s metadata (ObservationInfo, read-only).

translatorClass#

MetadataTranslator to translate metadata header to ObservationInfo.

wcsFlipX: ClassVar[bool] = False#

Control whether the WCS is flipped in the X-direction (bool).

Methods Documentation

attachComponentsFromMetadata(exposure)#

Attach all lsst.afw.image.Exposure components derived from metadata (including the stripped metadata itself).

Parameters#

exposurelsst.afw.image.Exposure

Exposure to attach components to (modified in place). Must already have a detector attached.

classmethod fromMetadata(metadata, obsInfo=None, storageClass=None, location=None)#

Construct a possibly-limited formatter from known metadata.

Parameters#

metadatalsst.daf.base.PropertyList

Raw header metadata, with any fixes (see astro_metadata_translator.fix_header) applied but nothing stripped.

obsInfoastro_metadata_translator.ObservationInfo, optional

Structured information already extracted from metadata. If not provided, will be read from metadata on first use.

storageClasslsst.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.

locationlsst.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#

formatterFitsRawFormatterBase

An instance of cls.

abstract getDetector(id)#

Return the detector that acquired this raw exposure.

Parameters#

idint

The identifying number of the detector to get.

Returns#

detectorDetector

The detector associated with that id.

isOnSky()#

Boolean to determine if the exposure is thought to be on the sky.

Returns#

onSkybool

Returns True if the observation looks like it was taken on the sky. Returns False if 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.

makeFilterLabel()#

Construct a FilterLabel from metadata.

Returns#

filterFilterLabel

Object that identifies the filter for this image.

classmethod makeRawSkyWcsFromBoresight(boresight, orientation, detector)#

Class method to make a raw sky WCS from boresight and detector.

Parameters#

boresightlsst.geom.SpherePoint

The ICRS boresight RA/Dec

orientationlsst.geom.Angle

The rotation angle of the focal plane on the sky.

detectorlsst.afw.cameraGeom.Detector

Where to get the camera geometry from.

Returns#

skyWcsSkyWcs

Reversible mapping from pixel coordinates to sky coordinates.

makeVisitInfo()#

Construct a VisitInfo from metadata.

Returns#

visitInfoVisitInfo

Structured metadata about the observation.

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#

visitInfoVisitInfo

The information about the telescope boresight and camera orientation angle for this exposure.

detectorDetector

The detector used to acquire this exposure.

Returns#

skyWcsSkyWcs

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.

readComponent(component)#

Read a component dataset.

Parameters#

componentstr, optional

Component to read from the file.

Returns#

objcomponent-dependent

In-memory component object.

Raises#

KeyError

Raised if the requested component cannot be handled.

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#

imageImage

In-memory image component.

readMetadata()#

Read all header metadata directly into a PropertyList.

Returns#

metadataPropertyList

Header 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_datasetobject

The Python object to serialize.

uriResourcePath

The URI to use when writing the file.

Notes#

By default this method will attempt to call to_bytes and 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_bytes method.