Skip to content

Asdf

Description of ASDF files

assign_unordered_stemgroups

assign_unordered_stemgroups(tree: list[dict], stems: list[str]) -> str | None

Heuristically group object names by stemming likely 'repeated' object names (suffixed with numbers).

chunk_repeated_unordered_objects

chunk_repeated_unordered_objects(trees: list[list[dict]]) -> tuple[list[list[dict]], str | None]

Find groups of 'repeated' unordered objects (notionally ASDF nodes) shared among all elements of trees. Limited to finding 'repetitions' defined by variable numeric / underscore patterns suffixed to some stem, performing stemming only on the final element of the path (which is a tuple of str | int | bool).

Unlike rules for FITS HDULs and table schemata, consistent ordering is not required with respect to other nodes across all elements of trees -- this would make no sense, as there is no canonical ordering on ASDF trees.

describe_asdf_object

describe_asdf_object(obj: Any) -> dict[str, str | list[dict] | int]

Generate a description of an ndarray or table-like object.

describe_asdf_table

describe_asdf_table(table: ndarray | Table | Table | DataFrame) -> dict[Literal['schema'], list[dict]]

Generate description of an ASDF table-like object.

describe_file

describe_file(fn: str | Path, bucket: Bucket | None = None) -> list[dict]

Describe objects in an individual ASDF file.

describe_ndarray

describe_ndarray(arr: ndarray) -> dict[Literal['ndim', 'dtype'], int | str]

Generate a description of an ndarray.

describe_structured_dtype

describe_structured_dtype(dtype: dtype) -> list[dict]

Generate a table schema description from a structured dtype.

unify_descriptions

unify_descriptions(descriptions: Collection[FileDescription]) -> tuple[list[dict] | None, str | None]

Attempt to unify a collection of ASDF file descriptions into a list of dicts suitable for use as the DataObjects of a Filetype.

Parameters:

  • descriptions (Collection[FileDescription]) –

    collection of FileDescriptions populated with describe_file()

Returns:

  • objects ( list[dict] | None ) –

    if unification succeeded, a list of dicts that can be used to initialize DataObjects; if it didn't, None

  • failure ( str | None ) –

    if unification failed, a string describing the failure; if it succeeded, None

unify_tree_descriptions

unify_tree_descriptions(object_descriptions: list[list[dict]]) -> tuple[dict | None, str | None]