pycsamt.metadata.instrument.InstrumentMeta#

class pycsamt.metadata.instrument.InstrumentMeta(system='', serial=None, magnetic_sensor=None, electric_sensor=None, software_version='', notes='')[source]#

Bases: object

Structured descriptor for an EM acquisition system.

Parameters:
  • system (str) – Human-readable system name, e.g. "Phoenix V8" or "Metronix ADU-07e".

  • serial (str or None) – Logger serial number or site-specific tag.

  • magnetic_sensor (SensorSpec or None) – Magnetic-field transducer (H field) specification.

  • electric_sensor (SensorSpec or None) – Electric-field transducer (E field) specification.

  • software_version (str) – Processing / acquisition software version string.

  • notes (str) – Free-text annotation (calibration date, operator remarks, …).

Notes

The class deliberately stays thin — only fields that appear (or could appear) in a standard EDI >HEAD block or in a compact YAML survey manifest are stored here. Calibration tables belong in separate files referenced by notes.

Examples

>>> from pycsamt.metadata.instrument import InstrumentMeta
>>> inst = InstrumentMeta(system="Phoenix V8", serial="V8-00123")
>>> inst.to_head_fields()
{'acqby': 'Phoenix V8 / V8-00123', 'progvers': 'pyCSAMT'}
__init__(system='', serial=None, magnetic_sensor=None, electric_sensor=None, software_version='', notes='')#
Parameters:
Return type:

None

Methods

__init__([system, serial, magnetic_sensor, ...])

from_head(head)

Construct from a Head object.

from_json(s)

Deserialise from a JSON string.

from_preset(name)

Build from a named preset in KNOWN_SYSTEMS.

from_yaml(s)

Deserialise from a YAML string (requires PyYAML).

load(path)

Load from a JSON or YAML file (format detected by extension).

save(path[, fmt])

Write to path as JSON or YAML.

summary()

Return a multi-line human-readable summary.

to_dict()

Serialise to a plain dict (JSON-safe).

to_head_fields()

Return a dict of EDI >HEAD key-value pairs.

to_json([indent])

Serialise to a JSON string.

to_yaml()

Serialise to a YAML string (requires PyYAML).

Attributes

electric_sensor

label

"<system> / <serial>" or just system.

magnetic_sensor

notes

serial

software_version

system

system: str = ''#
serial: str | None = None#
magnetic_sensor: SensorSpec | None = None#
electric_sensor: SensorSpec | None = None#
software_version: str = ''#
notes: str = ''#
property label: str[source]#

"<system> / <serial>" or just system.

Type:

Short identifier

summary()[source]#

Return a multi-line human-readable summary.

Return type:

str

to_head_fields()[source]#

Return a dict of EDI >HEAD key-value pairs.

The mapping is:

acqby    ← system / serial  (or just system)
progvers ← software_version (or the package default)
Returns:

Ready to pass to update().

Return type:

dict

classmethod from_head(head)[source]#

Construct from a Head object.

Only acqby and progvers are extracted; sensor details cannot be inferred from the EDI header alone.

Parameters:

head (Any) – A pycsamt.seg.heads.Head instance (or any object with acqby and progvers string attributes).

Return type:

InstrumentMeta

classmethod from_preset(name)[source]#

Build from a named preset in KNOWN_SYSTEMS.

Parameters:

name (str) – Case-insensitive preset key, e.g. "phoenix_v8".

Return type:

InstrumentMeta

Raises:

KeyError – If name is not in KNOWN_SYSTEMS.

Examples

>>> inst = InstrumentMeta.from_preset("lemi_424")
>>> inst.system
'LEMI-424'
to_dict()[source]#

Serialise to a plain dict (JSON-safe).

Return type:

dict[str, Any]

to_json(indent=2)[source]#

Serialise to a JSON string.

Parameters:

indent (int)

Return type:

str

classmethod from_json(s)[source]#

Deserialise from a JSON string.

Parameters:

s (str)

Return type:

InstrumentMeta

to_yaml()[source]#

Serialise to a YAML string (requires PyYAML).

Return type:

str

classmethod from_yaml(s)[source]#

Deserialise from a YAML string (requires PyYAML).

Parameters:

s (str)

Return type:

InstrumentMeta

save(path, fmt='json')[source]#

Write to path as JSON or YAML.

Parameters:
  • path (str) – Destination file path.

  • fmt ({"json", "yaml"})

Return type:

None

classmethod load(path)[source]#

Load from a JSON or YAML file (format detected by extension).

Parameters:

path (str)

Return type:

InstrumentMeta