FitsOpaqueMetadata#

final class lsst.images.fits.FitsOpaqueMetadata(headers: dict[~lsst.images.fits._common.ExtensionKey, ~astropy.io.fits.header.Header] = <factory>, precompressed: dict[str, ~lsst.images.fits._common.PrecompressedImage] = <factory>)#

Bases: OpaqueArchiveMetadata

Opaque metadata that may be carried around by a serializable type to propagate serialization options and opaque information without that type knowing how it was serialized.

Methods Summary

add_cutdown_primary_header(header)

Add the primary header of a cut-down lsst.images FITS file as opaque metadata.

add_header(header[, name, ver, key])

Add a header to the opaque metadata if it is not already present, and strip EXTNAME, EXTVER, and DATE if present.

copy()

Copy, reference, or discard metadata when its holding object is copied.

extract_legacy_primary_header(header)

Update the opaque metadata with the header of the primary HDU of a legacy (lsst.afw.image) FITS file, stripping cards we know we don't need and extracting any LSST IMAGES ... cards into a dictionary we return.

get_instrumental_unit()

Extract the LSST ISR UNIT key from the primary header (if it exists) and wrap it with Astropy.

maybe_use_precompressed(name)

Look up the given EXTNAME to see if there is a tile compressed image HDU that should be used directly, instead of requantizing.

subset(bbox)

Copy, reference, or discard metadata when a subset of its its holding object is extracted.

Methods Documentation

add_cutdown_primary_header(header: Header) None#

Add the primary header of a cut-down lsst.images FITS file as opaque metadata.

A cut-down file is one whose JSON-tree, index, and nested-archive HDUs have been dropped, leaving only the primary, image, mask, and variance HDUs (e.g. as written by dax_images_cutout). Only the container-layout cards that would be misleading after re-serialization are stripped; all other cards are retained so they survive the round trip.

Parameters#

header

Primary header to read. Not modified.

add_header(header: Header, name: str | None = None, ver: int | None = None, key: ExtensionKey | None = None) None#

Add a header to the opaque metadata if it is not already present, and strip EXTNAME, EXTVER, and DATE if present.

Parameters#

header

Header to add. May be modified in place.

name

EXTNAME (all caps). If not provided, the EXTNAME card must be present in the header. Use "" for the primary header.

ver

EXTVER. If not provided and the EXTVER card is not present, defaults to 1.

key

Combination of EXTNAME and EXTVER; used instead of both name and ver if provided.

copy() FitsOpaqueMetadata#

Copy, reference, or discard metadata when its holding object is copied.

extract_legacy_primary_header(header: Header) dict[str, Any]#

Update the opaque metadata with the header of the primary HDU of a legacy (lsst.afw.image) FITS file, stripping cards we know we don’t need and extracting any LSST IMAGES ... cards into a dictionary we return.

get_instrumental_unit() UnitBase | None#

Extract the LSST ISR UNIT key from the primary header (if it exists) and wrap it with Astropy.

maybe_use_precompressed(name: str) BinTableHDU | None#

Look up the given EXTNAME to see if there is a tile compressed image HDU that should be used directly, instead of requantizing.

Parameters#

name

EXTNAME (all caps).

Returns#

astropy.io.fits.BinTableHDU | None

An already-compressed HDU, in binary table form, or None if there is no precompressed HDU for this EXTNAME.

subset(bbox: Box) FitsOpaqueMetadata#

Copy, reference, or discard metadata when a subset of its its holding object is extracted.