write#

lsst.images.ndf.write(obj, filename=None, *, metadata=None, butler_info=None, compression_options=None)#

Write a serializable object to an NDF (HDS-on-HDF5) file.

Parameters:
  • obj (Any) – Object with a serialize method. May carry an _opaque_metadata attribute (a FitsOpaqueMetadata) whose primary-HDU header gets written to /MORE/FITS. This preserves FITS cards on objects that originated from a FITS read; butler provenance is conveyed through butler_info instead.

  • filename (str | Path | None, default: None) – Path to write to. Must not already exist. If None, an in-memory HDF5 file is used and the on-disk artefact is discarded; the returned tree still reflects all the writes the archive made (useful for tests).

  • metadata (dict[str, TypeAliasType] | None, default: None) – Optional caller-supplied entries that are written into the returned ArchiveTree.

  • butler_info (ButlerInfo | None, default: None) – Optional caller-supplied entries that are written into the returned ArchiveTree.

  • compression_options (Mapping[str, Any] | None, default: None) – Optional dict forwarded to the archive constructor for h5py dataset compression.

Returns:

The Pydantic tree the object’s serialize produced (with metadata/butler_info applied).

Return type:

ArchiveTree

This page was last modified on .