2.6.1.4. pycsamt.emtf.datatypes#
Registry of EMTF primary and derived electromagnetic data types.
The registry mirrors the semantic role of the DATATYPES directory in
EMTF FCU v4.1 while remaining independent of XML serialization. Entries are
Python value objects so future formats (including passive airborne EM) can
reuse the same scientific vocabulary without importing the XML reader.
Functions
|
Idempotently register definition, tolerating a compatible repeat. |
|
Return a registered definition by semantic tag, code, or alias. |
|
Return a copy of registered data types keyed by semantic tag. |
|
Register and return an EMTF data-type definition. |
Classes
|
Describe one electromagnetic transfer-function data type. |
- class pycsamt.emtf.datatypes.DataTypeDefinition(name, tag, data_kind, input_kind=None, output_kind=None, units=None, intention='primary', description='', derived_from=None, aliases=<factory>, see_also=<factory>)[source]
Bases:
PyCSAMTObjectDescribe one electromagnetic transfer-function data type.
- Parameters:
name (str) – Short EMTF/FCU code, for example
"Z"or"T".tag (str) – Stable semantic key, for example
"impedance".data_kind ({"real", "complex"}) – Numerical representation of the data.
input_kind (str or None) – Broad channel families used by EMTF (typically
"H"or"E"). Scalar derived products may omit these values.output_kind (str or None) – Broad channel families used by EMTF (typically
"H"or"E"). Scalar derived products may omit these values.units (str or None) – Native units recorded by the format definition.
intention ({"primary", "derived"}) – Whether the quantity is measured/estimated as a primary TF or derived from another response.
description (str) – Human-readable description.
derived_from (str or None) – Semantic tag of the parent quantity for derived products.
aliases (tuple of str) – Alternate historical codes accepted for lookup. These are useful because the 2020 EMTF paper and FCU v4.1 differ for a few names (for example Q/P versus ZI/TI).
- name: str
- tag: str
- data_kind: str
- intention: str = 'primary'
- description: str = ''
- pycsamt.emtf.datatypes.register_emtf_datatype(definition, *, overwrite=False)[source]
Register and return an EMTF data-type definition.
The semantic
tagis the unique registry identity. Short names can be shared by compatible variants (notably full and off-diagonal impedance), therefore the first short-name registration remains the default lookup unlessoverwrite=Trueis explicitly requested.- Parameters:
definition (DataTypeDefinition)
overwrite (bool)
- Return type:
- pycsamt.emtf.datatypes.ensure_emtf_datatype_registered(definition)[source]
Idempotently register definition, tolerating a compatible repeat.
register_emtf_datatype()raises whenever itstagis already registered, unless the caller passesoverwrite=True– a reasonable default for one-shot registration, but awkward for a technology adapter’s module-level registration function, which may legitimately run more than once in a process (a package re-import under test isolation, or more than one caller defensively calling the sameregister_<technology>_datatypes()). This helper treats a definition already registered under the sametag/namepair as a no-op and returns the existing (first- registered) instance unchanged, while a genuine collision – the sametagornameclaimed by a materially different definition – still raises rather than being silently papered over.pycsamt.airborne.mobilemtandpycsamt.airborne.afmagboth register their derived datatypes through this helper for exactly that reason.- Parameters:
definition (DataTypeDefinition) – Definition to register.
- Returns:
definition itself if newly registered, or the already-registered definition sharing its
tag.- Return type:
- Raises:
ValueError – If definition’s
tagis already registered under a differentname, or itsnameis already registered (as a primary code or alias) under a differenttag.
- pycsamt.emtf.datatypes.get_emtf_datatype(key)[source]
Return a registered definition by semantic tag, code, or alias.
- Parameters:
key (str)
- Return type:
DataTypeDefinition | None