Skip to content

Labels

A MAST 'label' describes a data set that is, or will be, archived at MAST as a single logical entity. It is roughly comparable to a PDS (Planetary Data System) label, but at a higher level of abstraction and with different emphasis.

Labels are stored on disk in YAML format.

SUPPORTED_DTYPE_NAMES module-attribute

SUPPORTED_DTYPE_NAMES = ('f2', 'f4', 'f8', 'u1', 'u2', 'u4', 'u8', 'i1', 'i2', 'i4', 'i8', 'c8', 'c16', 'O', 'b1', 'M8\\[(?:[1-9][0-9]*)?(?:[YMWDhms]|[munpfa]s)\\]', 'm8\\[(?:[1-9][0-9]*)?(?:[YMWDhms]|[munpfa]s)\\]', 'V[1-9][0-9]*')

Data types we support.

SUPPORTED_DTYPE_RE module-attribute

SUPPORTED_DTYPE_RE = re.compile('\\A(?:' + '|'.join(SUPPORTED_DTYPE_NAMES) + ')\\Z')

Regex for data types we support.

ASDFDataObject dataclass

ASDFDataObject(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: DataObject

ASDFObjectMetadata dataclass

ASDFObjectMetadata(lpath: str = '/', _errors: list[tuple[str, str]] = list())

ColumnObject dataclass

ColumnObject(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: LabelElement

Contacts dataclass

Contacts(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: LabelElement

DataObject dataclass

DataObject(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: LabelElement

Represents a single data object -- an array, table, etc. -- in a filetype.

DeliveryMeta dataclass

DeliveryMeta(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: LabelElement

FITSColumnObject dataclass

FITSColumnObject(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: ColumnObject

FITSDataObject dataclass

FITSDataObject(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: DataObject

FITSObjectMetadata dataclass

FITSObjectMetadata(lpath: str = '/', _errors: list[tuple[str, str]] = list())

FilePattern dataclass

FilePattern(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: LabelElement

Filetype dataclass

Filetype(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: LabelElement

covers_file

covers_file(path: str | Path) -> bool

True if this Filetype applies to the file at 'path'.

FiletypeValidationOptions dataclass

FiletypeValidationOptions(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: LabelElement

GlobalValidationOptions dataclass

GlobalValidationOptions(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: LabelElement

Label dataclass

Label(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: LabelElement

covered_files_local

covered_files_local(dir: Path) -> Iterable[tuple[Path, list[Filetype]]]

Yield Path objects for all of the files below DIR. Each is paired with a list of all the Filetype objects that can apply to it. DIR must be a directory on disk.

filetypes_for_filename

filetypes_for_filename(fn: Path | str) -> dict[str, Filetype]

Return a list of all Filetypes defined in this label that cover a file of name FN.

from_file classmethod

from_file(fname: Path, *, missing_ok: bool = False) -> Self

Parse a label from the contents of the file FNAME. If FNAME does not exist and missing_ok is True, returns a vacuous label.

serialize_to_file

serialize_to_file(fp: TextIOBase) -> None

Serialize self to the file handle FP.

ObjectMetadata dataclass

ObjectMetadata(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: LabelElement

ParquetColumnObject dataclass

ParquetColumnObject(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: ColumnObject

ParquetDataObject dataclass

ParquetDataObject(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: DataObject

TimeInfo dataclass

TimeInfo(lpath: str = '/', _errors: list[tuple[str, str]] = list())

Bases: LabelElement

decode_as_filepattern

decode_as_filepattern(val: FieldNode, lpath: str) -> FilePattern

decode_as_filepatterns

decode_as_filepatterns(val: FieldNode, lpath: str) -> list[FilePattern]

decode_columnobject_name

decode_columnobject_name(val: FieldNode, lpath: str, spec: dict[str, Any]) -> str | re.Pattern[str]

Decode ColumnObject.name as string(s) or regex(es) depending on the name_regex and repeated flags.

decode_dataobject_name

decode_dataobject_name(val: FieldNode, lpath: str, spec: dict[str, Any]) -> Any

Decode DataObject.name as string(s) or regex(es) depending on the name_regex and repeated flags.

decode_objects_with_std

decode_objects_with_std(val: FieldNode, lpath: str, spec: dict[str, Any]) -> list[DataObject]

Decode Filetype.objects as the appropriate DataObject subclass based on Filetype.standard.