Coverage for python/lsst/images/serialization/__init__.py: 0%
10 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-23 07:45 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-23 07:45 +0000
1# This file is part of lsst-images.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# Use of this source code is governed by a 3-clause BSD-style
10# license that can be found in the LICENSE file.
12"""Base classes and utilities for the serialization framework.
14This includes the `read_archive` and `write_archive` functions, which provide
15the highest-level interfaces for reading arbitrary objects from and writing
16them to storage, respectively (for a concrete `.GeneralizedImage` subclass,
17prefer its `~.GeneralizedImage.read` and `~.GeneralizedImage.write` methods).
19`InputArchive` and `OutputArchive` are the abstract interfaces for
20implementing serialization for a new file format.
22The base classes make some concessions to both FITS and ASDF in order to make
23the (potential) representations in those formats conform to their respective
24expectations.
26For ASDF, this is simple: we use ASDF schemas whenever possible to represent
27primitive types, from units and times to multidimensional arrays. While the
28archive interfaces use Pydantic, which maps to JSON, not YAML, the expectation
29is that by encoding YAML tag information in the JSON Schema (which Pydantic
30allows us to customize), it should be straightforward for an ASDF archive
31implementation to have Pydantic dump to a Python `dict` (etc) tree, and then
32convert that to tagged YAML by walking the tree along with its schema.
34For FITS, the challenge is primarily to populate standard FITS header cards
35when writing, despite the fact that FITS headers are generally too limiting to
36be our preferred way of round-tripping any information. To do this, the
37archive interfaces accept ``update_header`` and ``strip_header`` callback
38arguments that are only called by FITS implementations.
39"""
41from ._asdf_utils import *
42from ._backends import *
43from ._common import *
44from ._dtypes import *
45from ._frozen_schemas import *
46from ._input_archive import *
47from ._io import *
48from ._output_archive import *
49from ._reader import *
50from ._tables import *