2.7.3.1. pycsamt.airborne.registry#
Technology and native-format registries for airborne EM data.
The registry separates two concepts deliberately:
a technology describes scientific semantics (MobileMT, ZTEM, AFMAG);
a format describes a concrete native delivery that can be read/written.
The built-in technologies are registered immediately because their scientific contracts are stable. No native vendor format is registered until a genuine sample or authoritative format specification is available.
The two definition dataclasses (AirborneTechnologyDefinition,
AirborneFormatDefinition) are lightweight value objects, so they
inherit PyCSAMTObject rather than
CoreObject or
MTBase – the same choice already made for
the analogous DataTypeDefinition in the
sibling pycsamt.emtf registry. The bookkeeping itself (alias
collisions, detector-then-extension matching) is not reimplemented here;
it is delegated to NamedRegistry,
which both this module and pycsamt.io.formats share.
Functions
|
Detect a registered native format using detectors, then extensions. |
|
Return one canonical technology, or report/ignore mixed content. |
|
Return a native format definition by name or alias, or |
|
Return a technology definition by canonical name or alias. |
|
Return canonical technologies explicitly or safely identified. |
|
Return registered native formats, optionally for one technology. |
|
Return registered technologies in registration order. |
|
Register a concrete native airborne file/delivery format. |
|
Register one scientific technology definition. |
Classes
|
Describe one concrete native airborne delivery format. |
|
Describe one scientific airborne-EM technology contract. |
Exceptions
Raised when native airborne format detection is ambiguous. |
|
Base exception for airborne technology/format registry errors. |
|
Raised when an object contains more than one airborne technology. |
- class pycsamt.airborne.registry.AirborneTechnologyDefinition(name, label, family, aliases=<factory>, primary_tf_names=<factory>, reference_required=False, infer_from_tf=False, description='')[source]
Bases:
PyCSAMTObjectDescribe one scientific airborne-EM technology contract.
A technology definition is intentionally free of file-format knowledge: it only records how to recognize the technology from an already-built
AirborneEMDataset/EMTFobject. A concrete native delivery is described separately byAirborneFormatDefinition.- Parameters:
name (str) – Canonical technology key, for example
"mobilemt". Passed throughnormalize_key().label (str) – Human-readable display name, for example
"MobileMT".family (str) – Broad measurement family shared by related technologies, for example
"natural_field_airborne_em". Also normalized.aliases (tuple of str, optional) – Alternate keys accepted for lookup, for example
("mobile_mt",).primary_tf_names (tuple of str, optional) – Transfer-function names that are unique enough to this technology to justify inference; see
infer_from_tf.reference_required (bool, default False) – Whether a fixed ground reference station is scientifically required for this technology’s response. Used by
assess_airborne_qc()to decide whether a missing reference-station is a QC issue.infer_from_tf (bool, default False) – Whether
identify_airborne_technologies()may infer this technology purely from a matching entry ofprimary_tf_names, when nothing else identifies it. DeliberatelyFalsefor tipper-only technologies (ZTEM), because standard tipperTis not unique to one technology.description (str, default "") – Short human-readable description.
- Raises:
ValueError – If
name,label, orfamilyis empty after normalization/stripping.
- name: str
- label: str
- family: str
- reference_required: bool = False
- infer_from_tf: bool = False
- description: str = ''
- class pycsamt.airborne.registry.AirborneFormatDefinition(name, technology, reader=None, writer=None, detector=None, extensions=<factory>, aliases=<factory>, description='')[source]
Bases:
PyCSAMTObjectDescribe one concrete native airborne delivery format.
A format definition binds one technology to a concrete on-disk (or stream) representation. It stays empty of
reader/writeruntil a genuine sample or authoritative specification exists to validate against; see the module-level docstring andregister_airborne_format().- Parameters:
name (str) – Canonical format key, unique across all technologies.
technology (str) – Owning technology key; must already be registered via
register_airborne_technology()before this format is registered.reader (callable, optional) –
reader(source, **kwargs) -> AirborneEMDataset.Nonemeans the format is not yet readable.writer (callable, optional) –
writer(dataset, target, **kwargs) -> Any.Nonemeans the format is not yet writable.detector (callable, optional) –
detector(source) -> boolused for content-aware format detection, ahead of extension-based matching.extensions (tuple of str, optional) – File extensions used as a detection hint when no detector matches; normalized to a leading dot and lowercased.
aliases (tuple of str, optional) – Alternate keys accepted for lookup.
description (str, default "") – Short human-readable description.
- Raises:
ValueError – If
nameortechnologyis empty after normalization.
- name: str
- technology: str
- description: str = ''
- exception pycsamt.airborne.registry.AirborneRegistryError[source]
Bases:
ValueErrorBase exception for airborne technology/format registry errors.
- exception pycsamt.airborne.registry.AirborneTechnologyAmbiguityError[source]
Bases:
AirborneRegistryErrorRaised when an object contains more than one airborne technology.
- exception pycsamt.airborne.registry.AirborneFormatDetectionError[source]
Bases:
AirborneRegistryErrorRaised when native airborne format detection is ambiguous.
- pycsamt.airborne.registry.register_airborne_technology(definition, *, replace=False)[source]
Register one scientific technology definition.
- Parameters:
definition (AirborneTechnologyDefinition) – Technology contract to register.
replace (bool, default False) – Whether to overwrite an existing registration under the same canonical name, forwarded to
register().
- Returns:
The same definition instance, for convenient chaining.
- Return type:
- Raises:
TypeError – If definition is not an
AirborneTechnologyDefinition.AirborneRegistryError – If the canonical name or an alias is already registered and
replaceisFalse.
- pycsamt.airborne.registry.get_airborne_technology(name)[source]
Return a technology definition by canonical name or alias.
Returns
Nonerather than raising when name is unregistered, since callers such as_technology_from_text()use this for best-effort inference over untrustedattrs/subtypevalues.- Parameters:
name (str)
- Return type:
AirborneTechnologyDefinition | None
- pycsamt.airborne.registry.list_airborne_technologies()[source]
Return registered technologies in registration order.
- Return type:
- pycsamt.airborne.registry.identify_airborne_technologies(obj)[source]
Return canonical technologies explicitly or safely identified.
- Parameters:
obj (AirborneEMDataset, AirborneEMLine, AirborneEMRecord, or EMTF) – Object to inspect; see
_collect_object_technologies()for exactly what is walked and in what priority.- Returns:
Zero or more canonical technology names, in registration order. Zero means obj carries no explicit or safely inferable technology tag; more than one means obj genuinely mixes technologies (see
detect_airborne_technology()to turn that into an error instead).- Return type:
Notes
Only response types that are unique to one technology are inferred from transfer-function names. Standard tipper
Tand interstationTIare intentionally not enough by themselves to identify ZTEM or AirMt.
- pycsamt.airborne.registry.detect_airborne_technology(obj, *, strict=True)[source]
Return one canonical technology, or report/ignore mixed content.
- Parameters:
obj (AirborneEMDataset, AirborneEMLine, AirborneEMRecord, or EMTF) – Object to inspect; forwarded to
identify_airborne_technologies().strict (bool, default True) – Whether more than one identified technology is an error (
True) or is reported asNone(False).
- Returns:
The single identified technology;
Noneif none was identified, or if more than one was identified andstrictisFalse.- Return type:
str or None
- Raises:
AirborneTechnologyAmbiguityError – If more than one technology is identified and
strictisTrue.
- pycsamt.airborne.registry.register_airborne_format(definition, *, replace=False)[source]
Register a concrete native airborne file/delivery format.
- Parameters:
definition (AirborneFormatDefinition) – Format to register. Its
technologymust already be registered viaregister_airborne_technology().replace (bool, default False) – Whether to overwrite an existing registration under the same canonical name instead of raising.
- Returns:
The registered definition. This may be a new instance with technology rewritten to the owning definition’s canonical name when definition was constructed with an alias.
- Return type:
- Raises:
TypeError – If definition is not an
AirborneFormatDefinition.AirborneRegistryError – If
definition.technologyis not a registered technology, or if the canonical name/an alias collides andreplaceisFalse.
- pycsamt.airborne.registry.get_airborne_format(name)[source]
Return a native format definition by name or alias, or
None.- Parameters:
name (str)
- Return type:
AirborneFormatDefinition | None
- pycsamt.airborne.registry.list_airborne_formats(*, technology=None)[source]
Return registered native formats, optionally for one technology.
- Parameters:
technology (str, optional) – Canonical name or alias to filter by.
Nonereturns every registered format across all technologies.- Returns:
Matching formats in registration order.
- Return type:
- Raises:
AirborneRegistryError – If technology is supplied and is not registered.
- pycsamt.airborne.registry.detect_airborne_format(source)[source]
Detect a registered native format using detectors, then extensions.
- Parameters:
source (Any) – Candidate to identify, typically a path or an open stream. Passed to each registered detector, and to
_extension_of()when no detector matches.- Returns:
The canonical format name, or
Noneif nothing matched.- Return type:
str or None
- Raises:
AirborneFormatDetectionError – If more than one registered format matches source, whether by detector or by extension.
Notes
Detectors have priority. Extensions are only hints and are used when they map to exactly one registered format. No built-in vendor formats are registered merely from published system descriptions.