2.13.2.3. pycsamt.stratagem.process#
stratagem.process#
Data-processing classes for Stratagem AMT surveys.
StaticShiftCorrectorEstimates and removes the static-shift effect from apparent-resistivity curves using the Adaptive Moving-Average (AMA) spatial filter (Kouadio et al., 2024; Torres-Verdín & Bostick, 1992). Delegates to
estimate_ss_ama()andapply_ss_factors().NoiseRemoverMulti-stage noise-removal pipeline: powerline notch filter → Hampel outlier filter → optional log-frequency smoothing. Delegates to
pycsamt.emtools.remove_noise.
Both classes follow the fit() → out() pattern: fit() applies
corrections in-place on the Z arrays of the supplied EDIFile objects,
stores the result in edi_objects_, and returns self for
chaining. out() either returns the processed objects or writes them
to a directory.
Note
Because emtools processing functions modify impedance tensors in-place,
passing the same EDIFile list through multiple processors sequentially
is safe. If you need to preserve the originals, pass copy=True to
fit().
Classes
|
Multi-stage noise-removal pipeline for Stratagem AMT data. |
|
Estimate and remove static-shift from Stratagem AMT impedance data. |
- class pycsamt.stratagem.process.NoiseRemover(*, mains_hz=50.0, n_harm=30, tol_hz=0.08, notch_mode='interp', hampel_win=3, hampel_nsig=3.0, smooth=False, smooth_win=3, verbose=0)[source]
Bases:
PyCSAMTObjectMulti-stage noise-removal pipeline for Stratagem AMT data.
Applies three sequential filters to the impedance tensor:
Powerline notch — masks (interpolates) the mains frequency and its harmonics. Controlled by
mains_hzandn_harm.Hampel outlier filter — identifies and replaces frequency-domain spike outliers using a median-absolute-deviation test.
Log-frequency smoothing (optional) — applies a triangular or Gaussian kernel along the log-frequency axis.
All corrections are applied in-place on
EDIFile.Z.z.- Parameters:
mains_hz (float, default 50.0) – Mains frequency (Hz). Use 60.0 for North American data.
n_harm (int, default 30) – Number of powerline harmonics to notch.
tol_hz (float, default 0.08) – Frequency tolerance (Hz) around each harmonic for the notch filter.
notch_mode ({‘interp’, ‘zero’, ‘nan’}, default
'interp') – How to handle notched bins:'interp'interpolates across them (recommended),'nan'flags them as missing.hampel_win (int, default 3) – Half-window size for the Hampel outlier filter (in frequency bins).
hampel_nsig (float, default 3.0) – Outlier threshold in units of median absolute deviation.
smooth (bool, default False) – Enable log-frequency smoothing (stage 3).
smooth_win (int, default 3) – Smoothing half-window. Values above 4 may trigger a known shape issue in
smooth_logfreq()for short frequency vectors; keep ≤ 3 unless you have verified your data.verbose (int, default 0)
- Variables:
edi_objects (list of EDIFile) – Denoised EDI objects (in-place modified unless
copy=True).
Examples
>>> from pycsamt.stratagem.process import NoiseRemover >>> nr = NoiseRemover(mains_hz=50.0, smooth=True, smooth_win=3) >>> nr.fit(edis) >>> paths = nr.out("2/2EDID")
- fit(edi_objects, *, copy=False)[source]
Apply the noise-removal pipeline.
- class pycsamt.stratagem.process.StaticShiftCorrector(*, sort_by='lon', half_window=3, weights='tri', pband=None, max_skew=6.0, verbose=0)[source]
Bases:
PyCSAMTObject,MetadataMixinEstimate and remove static-shift from Stratagem AMT impedance data.
Implements the AMA (Adaptive Moving-Average) spatial filter to estimate per-station static-shift factors and correct the impedance tensor amplitudes accordingly.
The correction is applied in-place on
EDIFile.Z.z. Usecopy=Trueinfit()to preserve originals.- Parameters:
sort_by ({‘lon’, ‘lat’, ‘name’}, default
'lon') – Spatial ordering of stations for the AMA spatial average. Use'lon'for E-W profiles,'lat'for N-S profiles.half_window (int, default 3) – Number of neighbour stations on each side used in the AMA spatial average.
weights ({‘tri’, ‘gauss’, ‘uniform’}, default
'tri') – Distance-weighting scheme for AMA neighbours.pband (tuple of (float, float), optional) – Period range
(T_min, T_max)in seconds used when estimating the shift factor. Useful for restricting the estimation to a band free of near-surface distortion.max_skew (float or None, default 6.0) – Phase-tensor skew threshold: stations with median |β| above this are excluded from the spatial average (strong 3-D distortion). Set to
Noneto disable.verbose (int, default 0)
- Variables:
factors (pandas.DataFrame) – Per-station shift factors with columns
station,delta_log10_rho,fac_rho,fac_z,n_used.edi_objects (list of EDIFile) – Corrected EDI objects (in-place modified unless
copy=True).
Examples
>>> from pycsamt.stratagem.process import StaticShiftCorrector >>> sc = StaticShiftCorrector(sort_by="lon", half_window=3).fit(edis) >>> sc.factors_.head() >>> paths = sc.out("2/2EDISS")
- fit(edi_objects, *, copy=False)[source]
Estimate and apply static-shift corrections.
- out(savepath=None, *, overwrite=False)[source]
Return corrected EDI objects or write them to savepath.