1.1. API configuration#
pycsamt.api is the front door of the package. It is a single import
point that gathers three things every workflow needs:
Readers that turn field data into survey objects —
read_edis(),read_edi(),read_sites().Views that present tabular results for interactive work — the opt-in
APIFrame/APIResultlayer behindapi=True.Configuration for every runtime behaviour of the package — output directories, plot styles, axis conventions, CLI defaults, agent budgets — through one consistent
configure_*/reset_*pattern.
Everything documented here is importable directly from pycsamt.api:
>>> from pycsamt.api import (
... read_edis, # data in
... configure_api_view, # what api=True returns
... configure_pipe, # where pipeline outputs go
... configure_ordering, # how survey stations are ordered
... use_style, # how figures look
... )
>>> configure_api_view(backend="pycsamt")
>>> _ = configure_pipe(output_root="results/run01", plot_dpi=200)
>>> _ = configure_ordering(mode="auto")
>>> use_style("publication")
>>> survey = read_edis("data/AMT/WILLY_DATA/L18PLT", progress="auto")
>>> print(survey.summary()) # APIFrame: compact, metadata-rich
APIFrame: edi_survey_summary
kind: edi.summary
shape: 28 rows x 6 columns
columns: station, path, n_freq, tipper, spectra, ts
numeric: 1 columns
missing: 0.0%
source: data/AMT/WILLY_DATA/L18PLT
1.1.1. One Pattern Everywhere#
Each behaviour family follows the same contract, so learning one family teaches you all of them:
Entry point |
Role |
|---|---|
|
Module-level singleton holding the current settings. Print it to see the active configuration. |
|
Update settings with dotted-path keywords, e.g.
|
|
Restore package defaults for the current session. |
|
Where presets exist (styles, interpretation), apply a named preset in
one call, e.g. |
1.1.2. Configuration Families#
Family |
Entry points |
Controls |
|---|---|---|
View layer |
|
What |
Pipeline |
|
Output roots, plot DPI/format, progress display, step-error policy. |
Site ordering |
|
Package-wide station order: validated coordinate chainage, input, natural station name, latitude, or longitude. |
CLI |
|
Logging level, output format and directory, parallel build jobs. |
Plot styles |
|
MT component colours, multiline gradients, correction, rose, and
phase-tensor ellipse styles. Presets: |
Figure output |
|
Global figure saving defaults: DPI, formats, output directory. |
View controls |
|
Apparent-resistivity and phase axis behaviour, frequency-axis direction, phase wrapping. |
Sections |
|
Resistivity-section figure, axis, and colourbar styling. |
Station rendering |
|
Station map markers and axis styling. |
Interpretation |
|
Hydrogeological profile and section styles. |
Topography |
|
Topography handling and depth/frequency y-axis conventions. |
Mesh display |
|
Rectilinear and triangular mesh rendering: filled, reviewed (fill + edges), or diagram (edges only) presets, shared by both mesh families. |
Agents |
|
LLM provider selection and spending budget for AI agents. |
Besides the families above, pycsamt.api also exposes shared axis-label
constants (STATION_LABEL, FREQUENCY_LABEL, PERIOD_LABEL, …) and
the base objects (PyCSAMTObject,
MetadataMixin) that carry metadata through workflows.
To build your own classes on these bases — and inherit the MT math and
EDI interop that come with them — see Extending pyCSAMT.
1.1.3. In This Section#
- API Views
The opt-in view layer:
api=True,APIFrame, multi-tableAPIResultcontainers, global backend policy, custom wrappers, and the public readers.- Mesh Display
Rendering computational and inversion meshes: the shared
"filled"/"review"/"diagram"preset system, rectilinear vs. triangular mesh drawing, and dotted-path style configuration.- Plot Styles
Plot styles in depth: MT component colours, multiline gradients, correction pairs, raw-data style, phase-tensor ellipses, rose diagrams, and the four named presets.
- Interpretation Plot Styles
Hydrogeophysical plot styles: section and profile colours, the four presets, and why these plot classes track live configuration changes without an explicit style hand-off.
- Agent Configuration
AGENT_CONFIGin the family lineup, with a fast quick-reference; points to Agent And LLM Configuration for the full guide.- Section Plot Layout
Section-plot figure sizing, axis direction, and the topography- awareness gate shared by every pseudosection and inversion section.
- Station Rendering
Station tick marks, the adaptive label-thinning algorithm, and terrain-following marker placement.
- View Controls
Apparent-resistivity scale, phase wrapping, and the frequency/period axis convention read by most
pycsamt.emtoolsplotting functions.- Configuration
The configuration system in depth: the dotted-path convention, worked examples for each family, recommended setups, environment variables, and how to reset everything.
See also
- Configure a first session
First-session setup: the settings most users touch on day one.
- pycsamt.api
Auto-generated reference for every
pycsamt.apifunction and class.