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

ensure_emtf_datatype_registered(definition)

Idempotently register definition, tolerating a compatible repeat.

get_emtf_datatype(key)

Return a registered definition by semantic tag, code, or alias.

list_emtf_datatypes(*[, intention])

Return a copy of registered data types keyed by semantic tag.

register_emtf_datatype(definition, *[, ...])

Register and return an EMTF data-type definition.

Classes

DataTypeDefinition(name, tag, data_kind[, ...])

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: PyCSAMTObject

Describe 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).

  • see_also (tuple of str) – Related semantic tags.

name: str
tag: str
data_kind: str
input_kind: str | None = None
output_kind: str | None = None
units: str | None = None
intention: str = 'primary'
description: str = ''
derived_from: str | None = None
aliases: tuple[str, ...]
see_also: tuple[str, ...]
property is_primary: bool[source]

Return True for a primary transfer-function type.

property is_derived: bool[source]

Return True for a derived data type.

pycsamt.emtf.datatypes.register_emtf_datatype(definition, *, overwrite=False)[source]

Register and return an EMTF data-type definition.

The semantic tag is 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 unless overwrite=True is explicitly requested.

Parameters:
Return type:

DataTypeDefinition

pycsamt.emtf.datatypes.ensure_emtf_datatype_registered(definition)[source]

Idempotently register definition, tolerating a compatible repeat.

register_emtf_datatype() raises whenever its tag is already registered, unless the caller passes overwrite=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 same register_<technology>_datatypes()). This helper treats a definition already registered under the same tag/name pair as a no-op and returns the existing (first- registered) instance unchanged, while a genuine collision – the same tag or name claimed by a materially different definition – still raises rather than being silently papered over. pycsamt.airborne.mobilemt and pycsamt.airborne.afmag both 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:

DataTypeDefinition

Raises:

ValueError – If definition’s tag is already registered under a different name, or its name is already registered (as a primary code or alias) under a different tag.

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

pycsamt.emtf.datatypes.list_emtf_datatypes(*, intention=None)[source]

Return a copy of registered data types keyed by semantic tag.

Parameters:

intention (str | None)

Return type:

dict[str, DataTypeDefinition]