anemone_forward¶
anemone (PyTorch) 1D TDEM forward modelling backend. Requires the optional
anemone package; see Installation.
anemone (PyTorch) 1D TDEM forward modelling as an alternative to GA-AEM.
Public API mirrors forward_gaaem / prior_data_gaaem in
integrate.integrate. anemone and torch are imported lazily so
importing integrate never requires them.
See docs/superpowers/specs/2026-09-10-anemone-forward-backend-design.md
- integrate.anemone_forward.forward_anemone(M=array([], dtype=float64), thickness=array([], dtype=float64), file_gex=None, GEX=None, tx_height=array([], dtype=float64), altitude_bin_width=1.0, is_log=False, device='cpu', calibration='auto', calibration_reference=None, calibration_factor=None, calibration_tol=0.05, doCompress=True, showtime=False, showInfo=0, progress_callback=None, batch_size=1000, file_sr2=None, sr_filters=False, n_previous_pulses=0, rx_coil_filter='two_pole', gate_integration='centre', tolerance=1e-06, rescale_height=False, **kwargs)¶
Forward TDEM data for one or more resistivity models with anemone.
- rescale_heightbool, optional
Only used when
tx_heightvaries between soundings (default False). anemone bakes the flight height into its setup, which takes about 1 s per distinct height, so the default (one setup peraltitude_bin_widthbin) is slow for a wide height range. Withrescale_height=Trueone setup is made at the lowest height and the kernel is rescaled to each model’s exact height (exp(-2*dh*lmb)), soaltitude_bin_widthis ignored. This is an approximation whose error grows with the height spread: small for a spread of a few metres, a few percent of the peak signal at 45 m; aUserWarningis given above 30 m. The reference setup usestolerance / 10(about 20% more kernel terms) to keep the rescaling accurate. Has no effect for a fixed height.- batch_sizeint, optional
Number of soundings sent through anemone per call (default 1000). Bounds peak (GPU) memory;
0/Noneforwards everything at once.- file_sr2, sr_filters, n_previous_pulses
System-response / pulse options, see
gex_to_anemone_system(). A GEX withSystemResponseConvolution=1picks up<gex stem>.sr2automatically.- rx_coil_filter, gate_integration
Receiver-coil filter model and gate integration, see
gex_to_anemone_system().- tolerancefloat or None
Kernel pruning tolerance (default
1e-6); larger is faster and less accurate, seegex_to_anemone_system().
- integrate.anemone_forward.gex_to_anemone_system(gex, showInfo=0, file_sr2=None, sr_filters=False, n_previous_pulses=0, rx_coil_filter='two_pole', gate_integration='centre', tolerance=1e-06)¶
Build the anemone system description from a GEX (+ optional SR2).
- rx_coil_filter{‘two_pole’, ‘damped2’, ‘cascade’}
How the GEX
RxCoilLPFilterentries are modelled. All readings but'cascade'use only the entry of the channel’sRxCoilNumber,zeta fcut, as the second-order coil response1/(1 + 2 zeta s + s^2)(seeISSUE_rx_coil_filter.md):'two_pole'(default): two first-order poles atfcut/zeta(rx_coil_lowpassinintegrate.em_system), the same filters GA-AEM and SimPEG use;'damped2': the exact second-order response;'cascade': the earlier reading, every entry as a Butterworth filter of orderround(first value); kept for comparisons.
- gate_integration{‘centre’, ‘boxcar’}
'centre'(default) evaluates dB/dt at the gate centre time;'boxcar'averages it over the gate (open to close), using anemone’s built-in gating.- tolerancefloat or None
anemone’s kernel pruning (default
1e-6). At setup, for each gate the (frequency, wavenumber) terms are ranked by their contribution for a 100 ohm-m half-space, and the smallest terms adding up to at mosttoleranceof the gate’s total absolute contribution are dropped. Fewer terms = faster evaluation (tTEM GEX, GPU:1e-5~1.4x,1e-4~1.7x faster than1e-6). On rough random 8-layer models, the share of gates within 1 % of the unpruned result is 99.4 % for1e-6, 96 % for1e-5, 86 % for1e-4and 76 % for1e-3; the large errors are on gates far below the sounding’s peak.Nonekeeps all terms (~70x more; needs a smallbatch_sizeon GPU). SeeFORWARD_MODELS.md.- file_sr2str, optional
Workbench
.sr2system-response file. If omitted and the GEX setsSystemResponseConvolution=1,<gex stem>.sr2next to the GEX is used (error if missing). Channels with an SR block use it instead of the GEX waveform.- sr_filtersbool
Also apply the GEX Butterworth low-pass filters to SR channels. Off by default: the measured system response already contains the system’s filtering.
- n_previous_pulsesint
Number of earlier bipolar pulses (
RepFreq/SignPatternfrom the GEX channel) superposed on the waveform (default 0 = single pulse).
- integrate.anemone_forward.prior_data_anemone(f_prior_h5, file_gex=None, N=0, doMakePriorCopy=True, im=1, id=1, im_height=0, is_log=False, altitude_bin_width=1.0, device='cpu', calibration='auto', calibration_reference=None, calibration_factor=None, calibration_tol=0.05, doCompress=True, force_replace=False, f_prior_data_h5='', batch_size=1000, randomize=True, file_sr2=None, sr_filters=False, n_previous_pulses=0, rx_coil_filter='two_pole', gate_integration='centre', tolerance=1e-06, rescale_height=False, **kwargs)¶
Generate prior data
/D{id}for the anemone TDEM forward backend.Mirrors
integrate.gaaem_forward.prior_data_gaaem()but loadsM{im}as resistivity (no1/) and forwards it throughforward_anemone().batch_sizesoundings are forwarded per anemone call (bounds peak GPU memory;0forwards allNat once).randomizecontrols whether a copy withN < N_indrawsNrandom realizations (default) or the firstNsequentially.rx_coil_filter,gate_integrationandtoleranceare passed toforward_anemone().rescale_height=True(varyingM{im_height}only) does one anemone setup and rescales it to each model’s height instead of one setup peraltitude_bin_widthbin; much faster for varying flight height, seeforward_anemone(). Returns the path to the prior-data h5 (always the return value).
- integrate.anemone_forward.read_sr2(file_sr2)¶
Read a Workbench/AarhusInv
.sr2system-response file.Format:
//comment lines, then one or more blocks of a header linechannel# #repetitions #npts t_begin(yyyy mm dd hh nn ss zzz) t_end(...)followed bynptsrowstime [s] dSR/dt. The samples are the second time-derivative of the (unit-current) transmitter waveform with the system’s own filtering folded in, i.e. they take the place of anemone’sWaveform.d2wdt2(after multiplying by the sample spacing).- Returns:
{channel: {"time", "dsrdt", "n_rep", "header"}}with numpy arrays.- Return type: