pycsamt.tdem.reader#

pycsamt.tdem.reader#

Unified TEM file reader.

TEMReader wraps every format-specific function in pycsamt.tdem.io behind a single, consistent interface:

  • Auto-detect the file format from its extension and magic bytes.

  • Carry shared acquisition defaults (current, loop geometry, …) so you only set them once.

  • Propagate verbose / logger to every call.

  • Optionally cache results for later inspection.

The individual read_xyz(), read_geosoft_dat(), … functions remain available for direct use; TEMReader just calls them — no logic is duplicated.

Quick start#

from pycsamt.tdem import TEMReader

# configure once
reader = TEMReader(
    current=8.0,
    loop_side=200.0,
    data_unit="nV/Am2",
    verbose=1,
)

# auto-detect format
soundings = reader.read("survey.dat")           # Geosoft DAT
soundings = reader.read("profile.tem")          # AMIRA or WalkTEM
soundings = reader.read("sounding.avg")         # Zonge GDP

# explicit format
soundings = reader.read("myfile.txt", fmt="xyz",
                         time_unit="ms", data_unit="nT/s")

# named method (same as read with fmt="geosoft")
soundings = reader.read_geosoft_dat("survey.dat")

# inspect cached results
print(reader.results)

Classes

TEMReader(*[, current, tx_area, loop_side, ...])

Unified TEM file reader with format auto-detection.

class pycsamt.tdem.reader.TEMReader(*, current=None, tx_area=None, loop_side=None, loop_radius=None, rx_area=1.0, rx_turns=1, data_unit='nV/Am2', data_type='dBdt', gate_times_unit='ms', store=False, verbose=0, logger=None)[source]#

Bases: PyCSAMTObject, MetadataMixin

Unified TEM file reader with format auto-detection.

TEMReader is a thin orchestration layer over the individual format functions in pycsamt.tdem.io. It adds:

  • Auto-detectionread(path) infers the file format from the extension and magic bytes.

  • Shared defaults — acquisition parameters set on the instance (current, tx_area, …) are injected into every call so you only specify them once.

  • Per-call override — keyword arguments passed to read() or the named read_* methods always take priority over instance defaults.

  • Verbose / logger — set verbose=1 for INFO messages or verbose=2 for DEBUG. Pass a custom logging.Logger via the logger parameter.

  • Result cache — set store=True to accumulate all results in results keyed by file path.

Parameters:
  • current (float or None) – Transmitter current in Amperes.

  • tx_area (float or None) – Transmitter loop area in m².

  • loop_side (float or None) – Side of a square transmitter loop in m.

  • loop_radius (float or None) – Radius of a circular transmitter loop in m.

  • rx_area (float) – Receiver coil area in m². Default 1.0.

  • rx_turns (int) – Receiver coil turns. Default 1.

  • data_unit (str) – Default data column units. Default "nV/Am2".

  • data_type (str) – Default data type. Default "dBdt".

  • gate_times_unit (str) – Default gate-time unit. Default "ms".

  • store (bool) – Accumulate results in results when True. Default False.

  • verbose (int) – Verbosity level: 0 = silent, 1 = INFO, 2 = DEBUG.

  • logger (logging.Logger or None) – Custom logger. If None a module-level logger is used.

Examples

>>> from pycsamt.tdem import TEMReader
>>> reader = TEMReader(current=8.0, loop_side=200.0, verbose=1)
>>> soundings = reader.read("survey.dat")     # Geosoft DAT
>>> soundings = reader.read("profile.tem")    # AMIRA / WalkTEM
>>> soundings = reader.read_zonge("run.avg")  # explicit format
property formats: list[str][source]#

Return the list of recognised format names.

property results: dict[str, Any][source]#

Mapping of path → read result (populated when store=True).

clear()[source]#

Clear the result cache.

Return type:

None

read(path, *, fmt=None, **kwargs)[source]#

Read a TEM file, auto-detecting its format when fmt is omitted.

Parameters:
  • path (str or Path) – Path to the TEM data file.

  • fmt (str or None) – Explicit format key. One of "xyz", "temavg", "tem_z", "tem_log", "geosoft", "amira", "zonge", "walkttem". When None the format is inferred automatically.

  • **kwargs – Passed to the underlying reader function after merging with instance defaults (per-call values win).

Returns:

Whatever the underlying reader returns: a single TEMSounding, a list of TEMSounding, a TEMAVG, etc.

Return type:

Any

Raises:
read_xyz(path, **kwargs)[source]#

Read a generic XYZ / CSV TEM sounding.

See pycsamt.tdem.io.read_xyz() for parameter details.

Parameters:
Return type:

TEMSounding

read_temavg(path, **kwargs)[source]#

Read a Zonge TEMAVG processed .AVG file.

See pycsamt.tdem.io.read_temavg() for parameter details.

Parameters:
read_tem_z(path, **kwargs)[source]#

Read a Zonge TEMAVG contour .Z file.

See pycsamt.tdem.io.read_tem_z() for parameter details.

Parameters:
read_tem_log(path, **kwargs)[source]#

Read a Zonge TEMAVG processing .LOG file.

See pycsamt.tdem.io.read_tem_log() for parameter details.

Parameters:
read_geosoft_dat(path, **kwargs)[source]#

Read a Geosoft Oasis Montaj .dat file.

See pycsamt.tdem.io.read_geosoft_dat() for parameter details.

Parameters:
Return type:

list[TEMSounding]

read_amira(path, **kwargs)[source]#

Read an AMIRA / EMIT .tem file.

See pycsamt.tdem.io.read_amira() for parameter details.

Parameters:
Return type:

list[TEMSounding]

read_zonge(path, **kwargs)[source]#

Read a Zonge GDP .avg / .tem sounding file.

See pycsamt.tdem.io.read_zonge() for parameter details.

Parameters:
Return type:

list[TEMSounding]

read_walkttem(path, **kwargs)[source]#

Read a WalkTEM / Aarhus Workbench .tem file.

See pycsamt.tdem.io.read_walkttem() for parameter details.

Parameters:
Return type:

list[TEMSounding]

read_batch(paths, *, fmt=None, **kwargs)[source]#

Read multiple files and return a mapping of path → result.

Parameters:
  • paths (list of path-like) – File paths to read.

  • fmt (str or None) – Force a single format for all files. None → per-file auto-detection.

  • **kwargs – Forwarded to every read() call.

Returns:

Mapping from str(path) to the read result.

Return type:

dict[str, Any]

configure(**kwargs)[source]#

Update acquisition defaults in-place.

Returns self for chaining:

reader.configure(current=6.6, loop_side=40.0).read("file.tem")
Parameters:

**kwargs (Any) – Any writable TEMReader attribute.

Return type:

TEMReader

summary(**kw)[source]#

Return a short one-line object summary.

Return type:

str