earthai-tech/pycsamt
À propos
Scientific Python for electromagnetic geophysics
Sciences et ingénierieWhat you can do
- 📥 Data I/O & QC — EDI, Zonge AVG, Jones J (BIRRP), TDEM, MARE2DEM, and airborne EMTF-XML (ZTEM, AFMAG, MobileMT) in one site model; frequency audits and noisy-station flagging.
- 📡 IoT-enabled field acquisition — station telemetry with edge QC (powerline harmonics, SNR, contact resistance), clock-synchronisation audit, power monitoring, pluggable transports, acquisition provenance, and dashboards — feeding directly into the processing pipeline.
- 🎚️ Processing & corrections — a catalogue of 25 methods in six categories: notch filtering, static-shift removal, tensor rotation, phase-tensor analysis, and more.
- 🧱 Forward modelling — synthetic layered-earth and 2-D models, forward responses, realistic noise, and datasets for survey design or training.
Progression mesurée des étoiles
- in 24h
- 0
- in 7 days
- Historique en cours
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalpyCSAMT v2 is a full-lifecycle toolkit for controlled-source and natural-source electromagnetic (EM) geophysics — CSAMT, AMT, MT, and TDEM. One coherent, scikit-learn-inspired API takes a survey from raw field files through quality control, corrections, and inversion to interpreted, publication-ready results.
✨ Highlights
- 📥 Data I/O & QC — EDI, Zonge AVG, Jones J (BIRRP), TDEM, MARE2DEM, and airborne EMTF-XML (ZTEM, AFMAG, MobileMT) in one site model; frequency audits and noisy-station flagging.
- 📡 IoT-enabled field acquisition — station telemetry with edge QC (powerline harmonics, SNR, contact resistance), clock-synchronisation audit, power monitoring, pluggable transports, acquisition provenance, and dashboards — feeding directly into the processing pipeline.
- 🎚️ Processing & corrections — a catalogue of 25 methods in six categories: notch filtering, static-shift removal, tensor rotation, phase-tensor analysis, and more.
- 🧱 Forward modelling — synthetic layered-earth and 2-D models, forward responses, realistic noise, and datasets for survey design or training.
- 🧠 AI-assisted processing & inversion — learned denoising, gap-filling, anomaly detection, and uncertainty tools; classical Occam2D/ModEM/MARE2DEM plus physics-informed (PINN) and hybrid deep-learning inverters.
- 🗺️ Interpretation & mapping — resistivity classification, pseudostratigraphic logs, an interactive 3-D MapView (PCSF format, boreholes, geology overlays), and publication-ready pseudosections.
- 🤖 Pipelines, agents & apps — reproducible YAML/JSON/Python workflows, LLM-driven agents (Anthropic, OpenAI, Gemini), a web dashboard, and a desktop GUI.
🚀 Installation
pip install pycsamt # core, minimal dependencies
pip install "pycsamt[full]" # + ML backends, apps, geospatial, docs
Requires Python 3.10+.
🖥️ Desktop app
Prefer point-and-click? Download the ready-made desktop suite (Profile, Map, QC, Correction, Forward, Inversion, Interpretation, Airborne EM, AI agents):
Watch the demo: installation, interface and a complete geophysical workflow.
| Platform | Download | Install |
|---|---|---|
| Windows 10/11 (64-bit) | pycsamt-desktop-setup.exe | Run the installer. SmartScreen warns on unsigned builds: More info → Run anyway. |
| Linux (x86-64) | pycsamt-desktop-linux-x86_64.sh | chmod +x pycsamt-desktop-linux-x86_64.sh && ./pycsamt-desktop-linux-x86_64.sh (no root needed) |
Every install starts a 30-day full-feature trial. Students and researchers then get a free one-year licence by entering their institutional email in the app; anyone else can request a key from the author. The app tells you when a new version is out and installs it when you choose. Checksums, older versions and details are on the releases page and in the desktop installation guide.
Optional extras & source install
| Extra | Installs |
|---|---|
torch |
PyTorch backend for PINN / hybrid inverters |
tensorflow |
TensorFlow / Keras backend |
geo |
pyproj, xarray, contextily for maps and reprojection |
agents |
Anthropic, OpenAI/DeepSeek, and Gemini SDKs for AI agents |
app |
Desktop GUI (PySide6) + Dash web dashboard |
docs |
Sphinx, PyData theme, numpydoc |
full |
All of the above (prefers the PyTorch backend) |
Track the active development branch:
git clone https://github.com/earthai-tech/pycsamt.git
cd pycsamt && git checkout v2
pip install -e ".[full]"
⚡ Quick start
Chain named processing steps into a repeatable pipeline — the result carries per-step outputs, a log, and an exportable manifest:
from pycsamt.pipeline import Pipeline, Step
pipe = Pipeline([
("notch", Step("NR001", mains_hz=50)),
("band", Step("FREQ001")),
("static_shift", Step("SS001")),
("rotate", Step("TZ001")),
])
result = pipe.run(sites, outdir="outputs/run01/")
print(result.summary())
Or hand the whole job to an AI agent in plain language:
from pycsamt.agents import AgentMaster
master = AgentMaster(provider="anthropic")
report = master.run(
"Load data/edi/, flag stations with RMS > 2, build an Occam2D input "
"for profile L22, launch inversion, and produce a PDF report."
)
More examples — inversion results, PINN, IoT, CLI
Load a MARE2DEM run directory and plot responses or the resistivity section:
from pycsamt.models.mare2dem import InversionResult, PlotResponse, PlotModel
result = InversionResult("runs/demo_mt/")
PlotResponse(result).plot(max_rx=6, savefig="response.pdf")
PlotModel(result).plot(cmap="turbo_r", savefig="section.pdf")
Physics-informed inversion of a profile, with each datum weighted by its error (needs PyTorch or TensorFlow):
from pycsamt.ai.inversion import PINNInverter2D
inv = PINNInverter2D("data/edi/", n_layers=12, depth_max=2000.0,
epochs=600, weighting="errors").fit()
section = inv.resistivity_section() # log10(rho), (n_layers, n_stations)
print(inv.normalized_rms()) # misfit in units of the data errors
Ingest IoT field telemetry, quality-control it at the edge, and hand it straight to processing — with a reproducible provenance manifest:
from pycsamt.iot import FieldSession, simulate_iot_network, plot_field_dashboard
# real edge telemetry, or a simulated network for demos/tests
packets = simulate_iot_network(n_stations=24, profiles=["L1", "L3"])
session = FieldSession("SSL2026")
session.add_packets(packets)
session.assess() # stream QC -> MonitoringStatus
session.to_pipeline_input() # hand-off for processing
session.export_manifest("field_manifest.json") # reproducible provenance
plot_field_dashboard(session, output_path="dashboard.png")
The full workflow is also scriptable from the terminal:
pycsamt survey set data/edi/
pycsamt invert build data/edi/ --solver occam2d --workdir runs/occam2d/
pycsamt pipe run --config pipeline.yaml --survey data/edi/ --out outputs/run01/
Working with MTpy v2 objects
pyCSAMT reads and writes MTpy v2 stations and surveys in memory — arrays
and station metadata are copied directly, with no intermediate EDI file —
and every pycsamt.emtools function accepts an MTData as it is
(pip install "pycsamt[mtpy]"):
from pathlib import Path
from mtpy import MT
from mtpy.core import MTData
from pycsamt import emtools
from pycsamt.site import Sites
from pycsamt.transformers import from_mtpy, to_mtpy
# One MTpy station -> pyCSAMT Site
mt = MT("data/MT/broken-hill/edis/BH_1_imp.edi")
mt.read()
site = from_mtpy(mt)
print(site.name, site.z.shape) # BH_1_imp (96, 2, 2)
# A whole MTpy survey ...
stations = []
for fn in sorted(Path("data/MT/broken-hill/edis").glob("BH_*.edi")):
m = MT(fn)
m.read()
m.station = fn.stem # EDI files without DATAID stay distinct
stations.append(m)
md = MTData()
md.add_station(stations, survey_id="broken_hill")
# ... goes straight into any pyCSAMT analysis function
skew = emtools.skew_table(md)
# ... or becomes pyCSAMT Sites, and returns to MTpy unchanged
sites = Sites.from_mtpy(md) # 21 sites
md_back = to_mtpy(sites) # MTData
mt_back = site.to_mtpy() # MT
Missing values, which MTpy stores as zeros, become NaN in pyCSAMT and zeros again on the way back. See the MTpy interoperability guide.
🖥️ Interfaces
| Python API | CLI | Web dashboard | Desktop GUI |
|---|---|---|---|
import pycsamt |
pycsamt --help |
pycsamt-web |
pycsamt-desktop |
The same engine drives all four — script it, automate it, or point and click. The desktop GUI also ships as a standalone installer — see Desktop app.
📖 Citation
If pyCSAMT contributes to published research, please cite the software version you used — v2.7.0 is archived as 10.5281/zenodo.24711821 (all versions) — and Kouadio et al. (2022), J. Applied Geophysics.
BibTeX
@software{pycsamt_v2_7_0,
author = {Kouadio, Kouao Laurent},
title = {pyCSAMT v2.7.0: an open framework for reproducible
electromagnetic geophysics},
year = {2026},
version = {2.7.0},
publisher = {Zenodo},
doi = {10.5281/zenodo.24711821},
url = {https://doi.org/10.5281/zenodo.24711821}
}
@article{Kouadio2022,
author = {Kouadio, K. L. and Liu, R. and Mi, B. and Liu, C.},
title = {pyCSAMT: An alternative Python toolbox for groundwater exploration
using controlled-source audio-frequency magnetotelluric},
journal = {Journal of Applied Geophysics},
year = {2022},
doi = {10.1016/j.jappgeo.2022.104647}
}
@article{Kouadio2023,
author = {Kouadio, K. L. and Liu, R. and Malory, A. O. and Liu, W. and Liu, C.},
title = {A novel approach for water reservoir mapping using
controlled-source audio-frequency magnetotelluric in Xingning area,
Hunan Province, China},
journal = {Geophysical Prospecting},
year = {2023},
doi = {10.1111/1365-2478.13385}
}
🤝 Contributing & license
Bug reports and feature requests are welcome on the
issue tracker; see the
developer guide
before opening a pull request. Participation is governed by our
Code of Conduct. Distributed under the
LGPL-3.0 or later — see
LICENSE.md.
Developed by earthai-tech — Lead developer: Laurent Kouadio 🌐
Explorer des projets similaires
Chargement…