2.20.3.4. pycsamt.forward.em1d#

1-D electromagnetic forward solvers.

Three EM methods are provided, all using the same LayeredModel / ForwardResponse objects:

MT1DForward

Magnetotelluric (plane-wave source). Uses the exact recursive Wait (1954) impedance formula — the standard for generating MT/AMT/CSAMT far-field training data.

TEM1DForward

Central-loop time-domain EM (step-off waveform). Delegates the Hankel/Fourier transform to empymod’s validated digital linear filters rather than a hand-rolled quadrature.

CSAMT1DForward

Controlled-source AMT. In the far-field limit this reduces to MT. A near-field geometry correction factor is applied when source–receiver distance and frequencies are provided.

References

Wait, J.R. (1954). On the relation between telluric currents and the Earth’s magnetic field. Geophysics, 19(2), 281-289.

Nabighian, M.N. (1979). Quasi-static transient response of a conducting half-space. Geophysics, 44(10), 1700-1705.

Ward, S.H. & Hohmann, G.W. (1988). Electromagnetic theory for geophysical applications. In: Electromagnetic Methods in Applied Geophysics, 1, 130-311.

Puzyrev, V. et al. (2021). Inversion of 1D frequency- and time-domain EM data with CNNs. Computers & Geosciences, 149, 104681.

Classes

CSAMT1DForward(freqs[, source_offset, ...])

1-D controlled-source AMT forward solver.

ForwardResponse([method, freqs, times, z, ...])

Container for the output of a 1-D forward solver.

MT1DForward(freqs)

1-D magnetotelluric forward solver (plane-wave, isotropic earth).

TEM1DForward(times[, loop_radius, moment, ...])

1-D central-loop TEM forward solver (step-off waveform).

class pycsamt.forward.em1d.MT1DForward(freqs)[source]

Bases: _Base1DForward

1-D magnetotelluric forward solver (plane-wave, isotropic earth).

Uses the exact Wait (1954) recursive impedance algorithm. Runs in O(n_freq × n_layers) time — fast enough for generating millions of synthetic training samples.

Parameters:

freqs (array-like) – Frequencies [Hz] at which to evaluate the response. Typical range: 1e-4 – 1e5 Hz for MT/AMT.

Examples

>>> import numpy as np
>>> from pycsamt.forward.em1d import MT1DForward
>>> from pycsamt.forward.synthetic import LayeredModel
>>> freqs = np.logspace(-3, 4, 30)
>>> model = LayeredModel(resistivity=[100, 10, 500], thickness=[500, 1000])
>>> resp = MT1DForward(freqs).run(model)
>>> resp.rho_a.shape
(30,)
run(model)[source]

Compute the MT 1-D response for model.

Parameters:

model (LayeredModel) – Input earth model.

Returns:

Fields populated: z, rho_a, phase, freqs.

Return type:

ForwardResponse

class pycsamt.forward.em1d.TEM1DForward(times, loop_radius=50.0, moment=1.0, n_freqs=64, n_lam=100)[source]

Bases: _Base1DForward

1-D central-loop TEM forward solver (step-off waveform).

Computes the vertical magnetic field via empymod’s validated digital-linear-filter Hankel and Fourier transforms (Werthmüller, 2017), rather than a hand-rolled quadrature.

Note

An earlier from-scratch implementation (fixed-order Gauss-Legendre Hankel transform + naive trapezoidal cosine transform) did not converge at realistic time ranges – its own frequency-domain kernel grew unboundedly at high frequency instead of decaying, and refining either quadrature’s resolution changed the answer’s sign, not just its accuracy, at several requested times. That implementation is gone; empymod is a peer-reviewed, independently validated EM modelling library built specifically for this class of problem, and is verified byte-for-byte against Ward & Hohmann (1988)’s own closed-form half-space dBz/dt formula (their eq. 4.70) as part of this module’s test suite.

The loop itself is represented as a small tangential electric bipole at the loop radius, scaled by the loop’s circumference – the same “loop as a scaled dipole segment” construction empymod uses to reproduce Ward & Hohmann’s own central-loop figures (4.7-4.8), valid by the axisymmetry of a horizontal circular loop.

Parameters:
  • times (array-like) – Measurement times [s] for the step-off response. Typical range: 1e-6 – 1e-2 s.

  • loop_radius (float) – Transmitter loop radius [m]. Default 50 m.

  • moment (float) – Transmitter magnetic moment [A·m²]. Default 1 A·m².

  • n_freqs (int) – Unused. Accepted only so existing callers (e.g. pycsamt.inversion.backends.builtin.Builtin1DBackend, which threads backend_options straight through) do not break; empymod’s own filters pick their resolution automatically.

  • n_lam (int) – Unused. Accepted only so existing callers (e.g. pycsamt.inversion.backends.builtin.Builtin1DBackend, which threads backend_options straight through) do not break; empymod’s own filters pick their resolution automatically.

References

Ward & Hohmann (1988), Electromagnetic Methods in Applied Geophysics, Vol. 1.

Werthmüller, D. (2017). An open-source full 3D electromagnetic modeler for 1D VTI media in Python: empymod. Geophysics, 82(6), WB9-WB19.

run(model)[source]

Compute the TEM 1-D step-off response for model.

Parameters:

model (LayeredModel) – Input earth model.

Returns:

Fields populated: dBz_dt, hz_freq, times.

Return type:

ForwardResponse

class pycsamt.forward.em1d.CSAMT1DForward(freqs, source_offset=None, dipole_length=1000.0)[source]

Bases: _Base1DForward

1-D controlled-source AMT forward solver.

In the far-field (source–receiver offset r ≫ skin depth δ) the CSAMT response approximates the MT plane-wave response. A first- order near-field correction factor after Zonge & Hughes (1991) is applied when source_offset is supplied.

Parameters:
  • freqs (array-like) – Frequencies [Hz].

  • source_offset (float or None) – Source–receiver distance [m]. If None, the far-field approximation is used without correction.

  • dipole_length (float) – Electric dipole length [m]. Default 1000 m.

References

Zonge, K.L. & Hughes, L.J. (1991). Controlled source audio- frequency magnetotellurics. In Electromagnetic Methods in Applied Geophysics, 2B, 713-809.

run(model)[source]

Compute the CSAMT 1-D response for model.

Returns:

Fields populated: z, rho_a, phase.

Return type:

ForwardResponse

class pycsamt.forward.em1d.ForwardResponse(method='MT1D', freqs=None, times=None, z=None, rho_a=None, phase=None, dBz_dt=None, hz_freq=None, model=None)[source]

Bases: object

Container for the output of a 1-D forward solver.

Parameters:
  • method (str) – Solver identifier ('MT1D', 'TEM1D', 'CSAMT1D').

  • freqs (ndarray or None) – Frequencies in Hz (MT/CSAMT).

  • times (ndarray or None) – Times in seconds (TEM).

  • z (ndarray or None) – Complex surface impedance (n_freq,) for MT/CSAMT [V/A].

  • rho_a (ndarray or None) – Apparent resistivity (n_freq,) [Ω·m].

  • phase (ndarray or None) – Impedance phase (n_freq,) [degrees, 0–90° for normal models].

  • dBz_dt (ndarray or None) – dBz/dt step-off response (n_times,) [T/s] for TEM.

  • hz_freq (ndarray or None) – Complex frequency-domain H_z (n_freq,) for TEM.

  • model (LayeredModel or None) – The input model that produced this response.

method: str = 'MT1D'
freqs: ndarray | None = None
times: ndarray | None = None
z: ndarray | None = None
rho_a: ndarray | None = None
phase: ndarray | None = None
dBz_dt: ndarray | None = None
hz_freq: ndarray | None = None
model: object = None
to_array(*, log_rho=True, include_phase=True)[source]

Flatten to a 1-D feature vector for ML input.

For MT/CSAMT returns [log10(rho_a), phase_deg] concatenated (length 2 × n_freq); for TEM returns log10(|dBz_dt|) (length n_times).

Parameters:
  • log_rho (bool) – Apply log₁₀ to apparent resistivity (recommended).

  • include_phase (bool) – Include phase alongside ρ_a (MT only).

Return type:

ndarray

plot(ax=None, **kwargs)[source]

Quick diagnostic plot. Returns the Axes used.