Asdf
DEFAULT_ASDF_DATA_OBJECT_TYPES
module-attribute
DEFAULT_ASDF_DATA_OBJECT_TYPES = (astropy.table.Table, asdf.tags.core.NDArrayType, np.ndarray, pd.DataFrame, pyarrow.lib.Table)
Types we by default recognize as 'data' in an ASDF file.
asdfopen_generic
asdfopen_generic(key: str, bucket: Bucket | str | None = None, blocksize: int = DEFAULT_CHUNK_SIZE) -> asdf._asdf.AsdfFile
Open an S3 object or local file as an AsdfFile.
Parameters:
-
key(str) –path or S3 key
-
bucket(Bucket | str | None, default:None) –Bucket object or bucket name if this is an S3 object; None if a local file
-
blocksize(int, default:DEFAULT_CHUNK_SIZE) –block size for read operation, relevant only for S3
Returns:
an AsdfFile object created from key
extract_objects
extract_objects(asdf_file: AsdfFile, datatypes: tuple[type] = DEFAULT_ASDF_DATA_OBJECT_TYPES, *, autoload: bool = False, use_full_paths: bool = True) -> tuple[dict[str | bool | int, Any] | dict[tuple[str | bool | int, ...], Any], dict[str | bool | int, Any] | dict[tuple[str | bool | int, ...], Any]]
Search for and return the "data" objects in an AsdfFile, as defined by DEFAULT_ASDF_DATA_OBJECT_TYPE.
Returns a tuple like: ({path: object}, {path: schema description or None if no description}) for each identified object.
If use_full_paths is True, uses full object paths as keys; otherwise, uses last element of path (and logs a warning if any duplicated keys are discarded).
sanitize_data_tag
sanitize_data_tag(node: Any, *, autoload: bool = False) -> Any
Get the array from a lazy NDArrayType node; otherwise return the node.
sanitize_schema_descr
sanitize_schema_descr(descr: dict) -> str | dict | None
Pull the "real" description from an ASDF schema description.
unnest_to_pathkeys
unnest_to_pathkeys(nested: Mapping) -> dict[tuple[Hashable, ...], Any]
Flatten a mapping to a list like
[ {(key level 1, key level 2, ...): value}, ... ]