Serialization#
lsst.images.serialization Package#
The OutputArchive and InputArchive classes, which abstract over
different file formats, and various related utilities.
These archive interfaces are designed with two specific implementations in mind:
FITS augmented with a JSON block in a special BINTABLE HDU (see the
fitsmodule for details), inspired by the now-defunct ASDF-in-FITS concept.ASDF (just hypothetical for now).
The base classes make some concessions to both FITS and ASDF in order to make the representations in those formats conform to their respective expectations.
For ASDF, this is simple: we use ASDF schemas whenever possible to represent
primitive types, from units and times to multidimensional arrays. While the
archive interfaces use Pydantic, which maps to JSON, not YAML, the expectation
is that by encoding YAML tag information in the JSON Schema (which Pydantic
allows us to customize), it should be straightforward for an ASDF archive
implementation to have Pydantic dump to a Python dict (etc) tree, and then
convert that to tagged YAML by walking the tree along with its schema.
For FITS, the challenge is primarily to populate standard FITS header cards
when writing, despite the fact that FITS headers are generally too limiting to
be our preferred way of round-tripping any information. To do this, the
archive interfaces accept update_header and strip_header callback
arguments that are only called by FITS implementations.
An implementation that writes HDF5 while embedding JSON should also be possible with these interfaces, but is not something we’ve designed around. A more natural HDF5 implementation might be possible by translating the JSON tree into a binary HDF5 hierarchy as well, but this would be considerably more effort at best.
Functions#
|
Test whether a |
|
Do not make any modifications to the given FITS header. |
Classes#
Exception raised when the contents of an archive cannot be read. |
|
|
An intermediate base class of |
|
Model for the subset of the ASDF 'ndarray' schema, in the case where the array data is stored elsewhere. |
|
Model for a subset of the ASDF 'quantity' schema for external arrays. |
|
Information about a butler dataset. |
|
A model that describes a column in a table. |
|
Model for the subset of the ASDF 'ndarray' schema, in the case where the array data is stored inline. |
|
Model for a subset of the ASDF 'quantity' schema for inline arrays. |
Abstract interface for reading from a file format. |
|
|
A proxy output archive that joins a root path into all names before delegating back to its parent archive. |
|
Enumeration of array values types supported by the library. |
|
Interface for opaque archive metadata. |
Abstract interface for writing to a file format. |
|
|
Model for a subset of the ASDF 'quantity' schema for scalars. |
|
A model that acts as a pointer to data in a table cell. |
|
Placeholder for an ASDF-like model for referencing binary tabular data. |
|
Model for a subset of the ASDF 'time' schema. |
Exception raised if a table object has column types or structure that are not supported by this library. |
Variables#
Type alias. |
|
Type alias. |
|
Type alias. |
|
Type alias. |