pyunitwizard.storage.asdf.from_tree#

pyunitwizard.storage.asdf.from_tree(tree, *, field=None, unit=None, dimensionality=None, kind=None)[source]#

Verify a complete native ASDF tree and explicit receiver expectations.

Parameters:
  • tree (mapping) – Complete binding produced by to_tree or actual ASDF deserialization.

  • field (optional) – Existing qrec handshake; unit or dimensionality is required. Kind is checked when supplied and never inferred from the native unit.

  • unit (optional) – Existing qrec handshake; unit or dimensionality is required. Kind is checked when supplied and never inferred from the native unit.

  • dimensionality (optional) – Existing qrec handshake; unit or dimensionality is required. Kind is checked when supplied and never inferred from the native unit.

  • kind (optional) – Existing qrec handshake; unit or dimensionality is required. Kind is checked when supplied and never inferred from the native unit.

Returns:

Original sealed snapshot, independent of the tree and file lifetime.

Return type:

QuantityRecord

Raises:
  • RecordError – For missing/corrupt binding, changed values, dtype, shape or native unit, or failed receiver expectations. Seals are integrity, not authentication.

  • ModuleNotFoundError – If an optional provider is absent.

Examples

>>> restored = from_tree(tree, unit='nanometer')