Version 2.7.0#

pyCSAMT 2.7.0 Feature Enhancement Fix Breaking Docs Build Tests#

Released 2026-12-01.

pyCSAMT 2.7.0 exchanges station data with MTpy v2 in memory, adds field QC tools for noisy surveys, impedance frames, station tables and an ATEXHG time-series reader, shortens the imports of the most used objects, documents the standalone pcsf package behind pycsamt.format, applies the agent review safeguards in the Agent Master chat, and requires Python 3.10 or newer. It also corrects the physics-informed inverters, the TEM output scale and the research 3-D solver, as described below. Archived on Zenodo as DOI 10.5281/zenodo.24711821. See the full changelog entry for the complete list.

MTpy v2 interoperability Feature#

from_mtpy() turns an mtpy.MT station, a plain mt_metadata TF, an mtpy.MTData, an mtpy.MTCollection or a list of stations into a Site or Sites; to_mtpy() returns an MT or an MTData. Frequency, impedance, tipper, their errors, location, survey, declination and rotation angle are copied as arrays, so no EDI file is written and neither package’s EDI parser is involved. Both packages keep the impedance in EDI field units with the same phase convention, so apparent resistivity and phase agree without rescaling; an MTpy impedance labelled in SI units is converted. Because ensure_sites recognises MTpy objects, every pycsamt.emtools function accepts an MTData or MT directly.

Two differences between the packages are handled explicitly. MTpy leaves a station unnamed when the EDI DATAID is missing; pyCSAMT names it after its file, as its own EDI reader does, so stations never merge. MTpy marks missing values and errors with zeros; pyCSAMT turns them into NaN and writes zeros back in to_mtpy. On the 21 Broken Hill stations shipped with pyCSAMT, a station read by MTpy and converted matches the same file read by pyCSAMT exactly. MTpy is optional (pip install "pycsamt[mtpy]") and only to_mtpy needs it. The new MTpy v2 Interoperability page walks through the whole exchange.

Field QC, frames and station tables Feature#

pycsamt.emtools.fieldqc collects checks for noisy surveys: polarity detection and correction per mode, duplicate stations, Hampel spike masks, per-point QC flags and tables, band-break detection, and a static-shift estimate from neighbouring stations that is applied only when enough QC-good points support it. pycsamt.emtools.frames rotates impedance tensors to geographic, profile or strike frames; rotations by multiples of \(90^\circ\) are exact signed permutations, so per-element NaN masks follow their element, and the frame is recorded in ZROT. pycsamt.gis.stations reads station tables (CSV, TXT, XLS/XLSX), converts and compares coordinate reference systems, and writes coordinates into EDI headers matched by station name rather than file order. pycsamt.ts.atexhg reads the binary <ATEXHG> .atts time-series container with optional per-channel gain correction, and pycsamt.ts.calibrate removes a coil transfer function by water-levelled spectral division.

Shorter imports Enhancement#

Frequently used objects can now be imported from their second-level package: to_sites and Profile from pycsamt.site, EDICollection from pycsamt.seg, get_logger from pycsamt.log, the coordinate helpers (to_ll, to_utm, ll_to_utm, utm_to_ll and others) from pycsamt.gis, Tipper from pycsamt.z, the PINN inverters from pycsamt.ai, and the occam1d and modem subpackages from pycsamt.models. The additions to log, gis and models load on first use, so importing those packages is no slower than before. The long import paths keep working.

PCSF documentation Docs#

The format core is the standalone pcsf package (https://pcsf.readthedocs.io/). The PCSF user guide, API and CLI pages now explain what pcsf provides – the schema, .pcsf and .pcsm I/O, conformance checks, the pcsf command and PCSF Studio – and what pyCSAMT adds on top: solver adapters, companion formats, multi-line assembly, topography and the pycsamt format commands.

Agent Master chat review gate Fix#

The safeguards of the agent API now apply in the Agent Master chat. The orchestrator cross-check runs on the workflow the chat picks, a plan held at the review gate is shown with an Approve and run button that resends that exact plan with its approval hash, and catalogue corrections run through the orchestrator, so they are validated, gated and recorded. See Review Gate.

Scientific and I/O fixes Fix#

MTBase.phase_tensor_params returned the phase-tensor azimuth and skew swapped; \(\alpha\) and \(\beta\) now follow Caldwell et al. (2004), with \(\beta\) folded into \((-45^\circ, 45^\circ]\). The same folding in pycsamt.emtools stops out-of-quadrant phases from flagging nearly every station of a noisy AMT survey as high skew. plot_topo_section pairs elevations with stations by name; EDIFile.write keeps NFREQ and free-text >INFO lines consistent; ModEM 2-D models and 3-D custom grids are written the way Mod2DMT and Mod3DMT expect. to_sites and ensure_sites silently dropped the file paths of a list that mixed paths with Site or EDIFile objects, for example [path, Site(...)]; each item is now read on its own and the usual duplicate policy applies.

TEM forward units Fix Breaking#

TEM1DForward.dBz_dt returns the step-off \(\partial B_z/\partial t\) in T s-1, as documented. Earlier versions returned the switch-on derivative of the magnetic field \(H_z\) in A m-1 s-1, which differs by the factor \(-\mu_0\). Field TDEM data, which pycsamt.tdem converts to \(\partial B_z/\partial t\), were therefore compared with predictions about \(10^{6}\) times too large by the built-in TDEM inversion. The solver is now tested against the closed-form half-space response of Ward and Hohmann (1988). Synthetic TEM data sets and networks trained before 2.7.0, including the tem1d-fcn-5layer-v1 checkpoint, use the old scale and should be regenerated or retrained.

TEM1DForward also models a linear current turn-off: with ramp_time \(\tau\), the response is the step-off derivative averaged over the ramp, which lowers the early-time amplitude. It agrees with the integrated closed-form half-space response to \(10^{-4}\) for ramps up to 0.1 ms, and the built-in TDEM inversion reads the ramp from its backend_options.

Physics-informed inversion Fix Breaking Enhancement#

The differentiable 1-D MT recursion used by PINNInverter1D/2D/3D and the hybrid inverters evaluated \(\tanh(\mathrm{i}\gamma d)\) instead of \(\tanh(\gamma d)\) in every layer. Half-space responses were right, layered ones were not – by up to a factor 7 in apparent resistivity – so these inverters fitted data with the wrong physics. The PyTorch and TensorFlow kernels now reproduce MT1DForward to \(10^{-14}\); results computed with earlier versions should be recomputed.

The data loss of the same inverters now weights each apparent-resistivity and phase residual by its inverse variance, propagated from the impedance errors and floored at 5 % and 3 degrees like the deterministic backends. The weights have unit mean, so data with equal errors give the previous loss, and weighting="uniform" restores it for all data. On synthetic data with a third of the values corrupted and flagged by large errors, the weighted fit reproduces the clean response to 0.003 in \(\log_{10}\rho_a\), against 0.23 without weights.

3-D research solver Fix#

MT3DAdapter now adds air cells above the surface and imposes the plane wave at the top of the air, so galvanic charges at lateral contrasts can change the surface electric field. The previous version imposed the plane-wave field on the surface itself: exact over a 1-D earth, where both analytic benchmarks passed, but blind to most of the response of 3-D structure. Above a shallow conductive prism it now reproduces the galvanic response computed by compiled ModEM on the same grid.

Desktop licences and updates Feature#

The desktop application stays free for teaching and research. When the 30-day trial ends, a panel asks which situation fits the user and shows only that step. Students and researchers give their institutional email; the pyCSAMT licence service checks the domain, signs a one-year key and emails it. Anyone without an institutional address prepares a request to the author from the panel and receives a key within 48 hours. Each key is bound to the computer that requested it, so it cannot be shared; one address receives keys for at most two computers a year. Keys remain verified offline.

New releases are announced by a status-bar button. The installer downloads in the background, is checked against the published checksums, and installs only when the user chooses: at once, after the usual save prompts, or when the app is closed. See Licensing And Updates.

Compatibility Breaking Build#

Python 3.9 is no longer supported; pyCSAMT 2.7 needs Python 3.10 or newer and is tested on 3.10 to 3.13 (GitHub’s current Ubuntu runners no longer provide Python 3.9). Projects that must stay on Python 3.9 can keep using pyCSAMT 2.6.5. No public API was removed.