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/loggerto 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
|
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,MetadataMixinUnified TEM file reader with format auto-detection.
TEMReaderis a thin orchestration layer over the individual format functions inpycsamt.tdem.io. It adds:Auto-detection —
read(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 namedread_*methods always take priority over instance defaults.Verbose / logger — set
verbose=1for INFO messages orverbose=2for DEBUG. Pass a customlogging.Loggervia theloggerparameter.Result cache — set
store=Trueto accumulate all results inresultskeyed 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
resultswhenTrue. DefaultFalse.verbose (int) – Verbosity level: 0 = silent, 1 = INFO, 2 = DEBUG.
logger (logging.Logger or None) – Custom logger. If
Nonea 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 results: dict[str, Any][source]#
Mapping of path → read result (populated when
store=True).
- read(path, *, fmt=None, **kwargs)[source]#
Read a TEM file, auto-detecting its format when fmt is omitted.
- Parameters:
fmt (str or None) – Explicit format key. One of
"xyz","temavg","tem_z","tem_log","geosoft","amira","zonge","walkttem". WhenNonethe 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, alistofTEMSounding, aTEMAVG, etc.- Return type:
- Raises:
ValueError – If fmt is given but not in
formats.
- read_xyz(path, **kwargs)[source]#
Read a generic XYZ / CSV TEM sounding.
See
pycsamt.tdem.io.read_xyz()for parameter details.- Parameters:
- Return type:
- read_temavg(path, **kwargs)[source]#
Read a Zonge TEMAVG processed
.AVGfile.See
pycsamt.tdem.io.read_temavg()for parameter details.
- read_tem_z(path, **kwargs)[source]#
Read a Zonge TEMAVG contour
.Zfile.See
pycsamt.tdem.io.read_tem_z()for parameter details.
- read_tem_log(path, **kwargs)[source]#
Read a Zonge TEMAVG processing
.LOGfile.See
pycsamt.tdem.io.read_tem_log()for parameter details.
- read_geosoft_dat(path, **kwargs)[source]#
Read a Geosoft Oasis Montaj
.datfile.See
pycsamt.tdem.io.read_geosoft_dat()for parameter details.- Parameters:
- Return type:
- read_amira(path, **kwargs)[source]#
Read an AMIRA / EMIT
.temfile.See
pycsamt.tdem.io.read_amira()for parameter details.- Parameters:
- Return type:
- read_zonge(path, **kwargs)[source]#
Read a Zonge GDP
.avg/.temsounding file.See
pycsamt.tdem.io.read_zonge()for parameter details.- Parameters:
- Return type:
- read_walkttem(path, **kwargs)[source]#
Read a WalkTEM / Aarhus Workbench
.temfile.See
pycsamt.tdem.io.read_walkttem()for parameter details.- Parameters:
- Return type:
- read_batch(paths, *, fmt=None, **kwargs)[source]#
Read multiple files and return a mapping of path → result.