Skip to main content

anEMone logo

anEMone

PyPI Python License: MIT

Fast, readable 1D transient electromagnetic (TEM) forward modelling in Python, built on PyTorch.

Anemone simulates the gated dB/dt response of layered-earth models for real TEM systems. After a few lines of setup for your instrument, a forward call looks like this:

dbdt = fwr(resistivity, thickness)

The same code runs on CPUs and GPUs, and evaluates thousands of models in a single batched call.

Why anemone?

  • Fast. Anemone uses digital-filter Hankel and Fourier transforms, geometric operators for the loop integration, and a matrix form of the waveform convolution and gating. Combined with batched PyTorch tensors, it runs about 30× faster than AarhusInv on the CPU for large batches, with a further 2–3× on a GPU.
  • Realistic systems. It supports arbitrary horizontal polygonal or circular transmitter loops, finite receiver areas, offset and elevated receivers, piecewise-linear waveforms, Butterworth receiver filters, gating, multi-moment systems, and import of AarhusInv .gex system files.
  • Induced polarisation. It includes Cole-Cole and Maximum Phase Angle (MPA) parameterisations for frequency-dependent conductivity.
  • Accurate. Responses agree with analytic halfspace solutions to within 3% (mostly below 1%) for times from 1 ns to 1 s, and with AarhusInv for realistic ground-based and airborne systems.
  • Readable. The code follows the mathematics of the forward problem, and docstrings cite the corresponding equations in Ward & Hohmann (1988), so it also works as a teaching resource.

Installation

pip install anemone-core

The package is published on PyPI as anemone-core but is imported as anemone:

import anemone

Python 3.9 or newer is required. If you want GPU support, install PyTorch for your CUDA version from pytorch.org before installing anemone. Otherwise pip installs the default (usually CPU-only) build.

To install from source for development:

git clone https://github.com/hydrogeophysicsgroup/anemone.git
cd anemone
pip install -e ".[dev]"

Quick start

import torch
from anemone.system import Loop, Receiver, Waveform
from anemone.forwards import Forward

tx = Loop.square(40)              # 40 m x 40 m transmitter loop at z = 0
rx = Receiver()                   # dipole receiver at the origin (central loop)
wv = Waveform.example()           # trapezoidal example waveform

t = torch.logspace(-5, -3, 32)    # times [s] at which dB/dt is evaluated

fwr = Forward(tx, rx, t, waveform=wv)

rho   = torch.tensor([40., 80., 40.])   # layer resistivities [Ohm m]
thick = torch.tensor([20., 30.])        # layer thicknesses [m]; the last layer is a halfspace

dbdt = fwr(rho, thick)                  # shape: (32,)

Setting up a Forward does the expensive work once: it trims filter coefficients, builds geometric operators, and assembles waveform and gating matrices. Every later call is cheap.

Many models at once

Layers go along the first dimension and models along the second. One call evaluates the whole batch:

n_models = 1000
rho   = 10**(0.5 + 2*torch.rand(3, n_models))   # (n_layers, n_models)
thick = torch.full((2, n_models), 20.)          # (n_layers - 1, n_models)

dbdt = fwr(rho, thick)                          # shape: (n_models, n_times)

Realistic and dual-moment systems

Define the geometry, waveforms and gates for each moment, then add the forwards together:

tx = Loop.square(3, z=0.97)        # elevated 3 m x 3 m transmitter
rx = Receiver(x=-9, z=0.43)        # offset receiver (tTEM-like geometry)

lm_fwr = Forward(tx, rx, lm_gate_times, waveform=Waveform(lm_wv_time, lm_wv_amp))
hm_fwr = Forward(tx, rx, hm_gate_times, waveform=Waveform(hm_wv_time, hm_wv_amp))

dual_fwr = lm_fwr + hm_fwr
dbdt = dual_fwr(rho, thick)

Receiver filters are passed with filterfunc= (for example ButterworthFilter or FilterChain from anemone.system), and gate start and end times with times= and t_end=. You can also build the whole system from an AarhusInv .gex file:

dual_fwr = Forward.from_gex("examples/TX11_3x3_1_turn.gex")

Induced polarisation

t   = torch.logspace(-6, -2, 62)
fwr = Forward.colecole(Loop.square(40), Receiver(), t)

rho = torch.tensor([200., 80., 300.])
m   = torch.tensor([0.6, 0.6, 0.6])     # chargeability
tau = torch.tensor([1e-2, 1e-2, 1e-2])  # time constant [s]
C   = torch.tensor([0.6, 0.6, 0.6])     # frequency exponent
thk = torch.tensor([20., 20.])

dbdt = fwr(rho, m, tau, C, thk)

Forward.mpa(...) works the same way, with (rho, phi_max, tau_phi, C, thickness).

Running on a GPU

Forward uses the device of the times tensor you give it. To run on a GPU, create the times there and pass your model tensors on the same device:

device = "cuda"
t   = torch.logspace(-5, -3, 32, device=device)
fwr = Forward(tx, rx, t, waveform=wv)
dbdt = fwr(rho.to(device), thick.to(device))

The GPU pays off for large batches (hundreds of models or more). For small batches the CPU is usually faster.

Package layout

Module Contents
anemone.physics Wavenumbers, TE reflection coefficients and their derivatives, Cole-Cole and MPA conductivity models
anemone.transforms Hankel transform, (inverse) Fourier transform, inverse Laplace transform (Gaver-Stehfest), cubic spline integration
anemone.system Loop, Receiver, Waveform, ButterworthFilter, FilterChain, plus waveform and gating matrices
anemone.forwards Forward (fast, for production), BaseForward (a slow version that mirrors the equations, for learning), plus IP and dual-moment variants
anemone.inversion Inversion models and Inversion, LCI and SCI inversion classes

Functions in physics broadcast over their inputs, so they can be written much like their mathematical form:

from anemone.physics import calc_wavenumber

sigma = torch.logspace(0, 3, 100)
omega = torch.logspace(-6, 6, 601)
k = calc_wavenumber(sigma[:, None], omega[None, :])   # shape: (100, 601)

Examples

The examples/ folder contains Jupyter notebooks:

  • compare_TEM_forwards_with_analytic_responses.ipynb: validation against analytic halfspace solutions
  • sensitivity_analysis_for_tTEM.ipynb: sensitivity analysis for a tTEM-style system
  • import_usf_and_invert_it.ipynb: loading field data and inverting it

Testing

Every module has a test suite. Many of the tests compare numerical results against analytic solutions:

pip install -e ".[dev]"
pytest tests

Documentation

The documentation is built from the markdown files in docs/ with MkDocs:

pip install -e ".[docs]"
mkdocs serve      # preview locally
mkdocs build      # build the static site

To render curated Jupyter notebooks with mkdocs-jupyter, place them under docs/ and add them to mkdocs.yml.

Citing

A paper describing Anemone is under review. Until it is published, please cite this conference abstract:

Griffiths, M.P., E. Möller, I. Vela, A.V. Christiansen and D. Grombacher (2025) anEMone: A Python package for parallelized 1-dimensional transient electromagnetic forward modelling. EAGE Near-surface Geoscience Conference, Naples, Italy

The waveform and gating formulation is described in:

Griffiths, M. P. (2026). Convolution-free electromagnetic system response in the time domain. Geophysics, 91(1), A1–A5.

Key references

  • Ward, S. H., & Hohmann, G. W. (1988). Electromagnetic theory for geophysical applications. In Electromagnetic Methods in Applied Geophysics, Vol. 1, 130–311. doi:10.1190/1.9781560802631.ch4
  • Johansen, H. K., & Sørensen, K. (1979). Fast Hankel transforms. Geophysical Prospecting, 27(4), 876–901. doi:10.1111/j.1365-2478.1979.tb01005.x
  • Christensen, N. B. (1990). Optimized fast Hankel transform filters. Geophysical Prospecting, 38(5), 545–568. doi:10.1111/j.1365-2478.1990.tb01861.x
  • Boerner, D. E., & West, G. F. (1989). A generalized representation of the electromagnetic fields in a layered earth. Geophysical Journal International, 97(3), 529–547.
  • Stehfest, H. (1970). Algorithm 368: Numerical inversion of Laplace transforms. Communications of the ACM, 13(1), 47–49. doi:10.1145/361953.361969

License

Anemone is released under the MIT License.

Metadata

Release files for anemone-core 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anemone-core 0.1.1
File Size Uploaded Provenance Actions
anemone_core-0.1.1.tar.gz 66.5 kB With provenance Details for anemone_core-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for anemone-core 0.1.1
File Interpreter ABI Platform Actions
anemone_core-0.1.1-py3-none-any.whl Python 3 none any Details for anemone_core-0.1.1-py3-none-any.whl

Total release size: 113.0 kB

Release files / anemone_core-0.1.1.tar.gz

Download URL anemone_core-0.1.1.tar.gz
Size 66.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0390bdc00b17bb62b728b6f5fa9f2468ab50321381207e067d78306ad9d2dfe7
BLAKE2b-256 checksum
How to use checksums
4f841085fe606ea5293216ba4c0712047c5c854dd703399ad0c2399b1de6eb04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / anemone_core-0.1.1-py3-none-any.whl

Download URL anemone_core-0.1.1-py3-none-any.whl
Size 46.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fcf8fff7ffd6caedc6883ec3f29f1f3a0da32914f75128364cebbed82a826c4
BLAKE2b-256 checksum
How to use checksums
08eece288e8c4a27df35a6c20f768eac7e3b1da2c51d130af3511871e62eb45a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for anemone-core 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for anemone_core-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page