Coverage for python / lsst / images / serialization / __init__.py: 100%
6 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-22 09:12 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-22 09:12 +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"""The `OutputArchive` and `InputArchive` classes, which abstract over
13different file formats, and various related utilities.
15These archive interfaces are designed with two specific implementations in
16mind:
18- FITS augmented with a JSON block in a special BINTABLE HDU (see the `.fits`
19 module for details), inspired by the now-defunct ASDF-in-FITS concept.
21- ASDF (just hypothetical for now).
23The base classes make some concessions to both FITS and ASDF in order to make
24the representations in those formats conform to their respective expectations.
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.
40An implementation that writes HDF5 while embedding JSON should also be possible
41with these interfaces, but is not something we've designed around. A more
42natural HDF5 implementation might be possible by translating the JSON tree into
43a binary HDF5 hierarchy as well, but this would be considerably more effort at
44best.
45"""
47from ._asdf_utils import *
48from ._common import *
49from ._dtypes import *
50from ._output_archive import *
51from ._input_archive import *
52from ._tables import *