FitsImageFormatterBase#
- class lsst.obs.base.formatters.fitsExposure.FitsImageFormatterBase(file_descriptor: FileDescriptor, *, ref: DatasetRef, write_parameters: Mapping[str, Any] | None = None, write_recipes: Mapping[str, Any] | None = None, **kwargs: Any)#
Bases:
FormatterV2Base class formatter for image-like storage classes stored via FITS.
Notes#
This class makes no assumptions about how many HDUs are used to represent the image on disk, and includes no support for writing. It’s really just a collection of miscellaneous boilerplate common to all FITS image formatters.
Concrete subclasses must implement
readComponent,readFull, andwrite_local_file(even if just to disable them by raising an exception).Attributes Summary
Declare whether
read_from_local_fileis available to this formatter.The parameters passed by the butler user, after checking them against the storage class and transforming
Noneinto an emptydict(dict).Default extension to use when writing a file.
The reader object that backs this formatter's read operations.
The numpy data type associated with the storage class.
Set of all extensions supported by this formatter.
Support all parameters.
Methods Summary
readComponent(component)Read a component dataset.
readFull()Read the full dataset (while still accounting for parameters).
read_from_local_file(path[, component, ...])Read a dataset from a URI guaranteed to refer to the local file system.
Attributes Documentation
- can_read_from_local_file: ClassVar[bool] = True#
Declare whether
read_from_local_fileis available to this formatter.
- checked_parameters#
The parameters passed by the butler user, after checking them against the storage class and transforming
Noneinto an emptydict(dict).This is computed on first use and then cached. It should never be accessed when writing. Subclasses that need additional checking should delegate to
superand then check the result before returning it.
- default_extension: ClassVar[str | None] = '.fits'#
Default extension to use when writing a file.
Can be
Noneif the extension is determined dynamically. Use theget_write_extensionmethod to get the actual extension to use.
- reader#
The reader object that backs this formatter’s read operations.
This is computed on first use and then cached. It should never be accessed when writing. Currently assumes a local file.
- storageClass_dtype#
The numpy data type associated with the storage class.
- supported_extensions: ClassVar[Set[str]] = frozenset({'.fit', '.fits', '.fits.fz', '.fits.gz', '.fz'})#
Set of all extensions supported by this formatter.
Any extension assigned to the
default_extensionproperty will be automatically included in the list of supported extensions.
- unsupported_parameters: ClassVar[Set[str]] = frozenset({})#
Support all parameters.
Methods Documentation
- abstract readComponent(component: str) Any#
Read a component dataset.
Parameters#
- component
str, optional Component to read from the file.
Returns#
- obj
typing.Any In-memory component object.
Raises#
- KeyError
Raised if the requested component cannot be handled.
- component
- abstract readFull() Any#
Read the full dataset (while still accounting for parameters).
Returns#
- obj
typing.Any In-memory component object.
- obj
- read_from_local_file(path: str, component: str | None = None, expected_size: int = -1) Any#
Read a dataset from a URI guaranteed to refer to the local file system.
Parameters#
- path
str Path to a local file that should be read.
- component
strorNone, optional The component to be read from the dataset.
- expected_size
int, optional If known, the expected size of the resource to read. This can be
-1indicates the file size is not known.
Returns#
- in_memory_dataset
objectorNotImplemented The Python object read from the resource or
NotImplemented.
Raises#
- lsst.daf.butler.FormatterNotImplementedError
Raised if there is no implementation written to read data from a local file.
Notes#
This method will only be called if the class property
can_read_from_local_fileisTrueand other options were not used.- path