pycsamt.forward.plot#
Visualisation for pyCSAMT 1-D and 2-D forward models and responses.
All plot functions read visual parameters from the package-wide API singletons
at call time, so a single configure_style() or
use_style() call propagates to every figure.
Functions#
1-D forward
|
Plot 1-D MT/CSAMT apparent resistivity and phase vs period (or frequency). |
|
Plot one or more 1-D layered earth models as resistivity-depth profiles. |
|
3-panel figure combining model depth profile, ρ_a, and phase. |
2-D forward
|
Plot the 2-D resistivity model on a colour map. |
|
Plot a 2-D MT pseudo-section (period × station distance). |
|
Plot ρ_a (or phase) vs station distance at selected frequencies. |
Quick start#
Single 1-D sounding:
from pycsamt.forward import MT1DForward, LayeredModel
from pycsamt.forward.plot import plot_response_and_model_1d
import numpy as np
model = LayeredModel([100, 10, 500], [300, 800])
resp = MT1DForward(np.logspace(-3, 3, 30)).run(model)
fig = plot_response_and_model_1d(resp, model, title="My 1-D model")
fig.savefig("model_1d.png", dpi=150, bbox_inches="tight")
2-D pseudo-section:
from pycsamt.forward.plot import plot_pseudosection_2d, plot_model_2d
fig1 = plot_model_2d(grid)
fig2 = plot_pseudosection_2d(resp2d, mode="both")
Functions
|
Plot one or more 1-D layered earth models as resistivity-depth profiles. |
|
Plot the 2-D resistivity model on a colour map. |
|
Three orthogonal slice panels for a 3-D resistivity model. |
|
Plot a 2-D MT pseudo-section (period × station distance). |
|
Plot 1-D MT/CSAMT apparent resistivity and phase vs period (or frequency). |
|
3-panel figure combining model depth profile, ρ_a, and phase. |
|
Map-view scatter of ρ_a or phase at one frequency. |
|
Plot ρ_a (or phase) vs station distance at selected frequencies. |
|
Period × station pseudo-section for one 3-D response component. |
|
2 × 2 map panel showing all four impedance tensor components. |
- pycsamt.forward.plot.plot_response_1d(response, *, modes='both', show_te=<object object>, show_tm=<object object>, color_te=<object object>, color_tm=<object object>, lw=<object object>, marker_te=<object object>, marker_tm=<object object>, ms=<object object>, label_te=<object object>, label_tm=<object object>, title='', figsize=(7, 5.5), axes=None)[source]#
Plot 1-D MT/CSAMT apparent resistivity and phase vs period (or frequency).
Reads visual defaults from
PYCSAMT_STYLEand axis behaviour fromPYCSAMT_CONTROL.- Parameters:
response (ForwardResponse) – Output of
MT1DForwardorCSAMT1DForward.modes ({'te', 'tm', 'both'}) – Which modes to plot. For a 1-D response
response.rho_aandresponse.phasehold a single polarisation; pass'both'to show both ρ_a curves with TE/TM styling on the same axes.show_te (bool) – Override visibility of each mode independently.
show_tm (bool) – Override visibility of each mode independently.
color_te (colour spec) – Line colours. Default:
PYCSAMT_STYLE.mt.te.color/PYCSAMT_STYLE.mt.tm.color.color_tm (colour spec) – Line colours. Default:
PYCSAMT_STYLE.mt.te.color/PYCSAMT_STYLE.mt.tm.color.lw (float) – Line width.
marker_te (str) – Marker styles.
marker_tm (str) – Marker styles.
ms (float) – Marker size.
label_te (str) – Legend labels.
label_tm (str) – Legend labels.
title (str) – Figure suptitle.
axes (array-like of Axes or None) – Two pre-existing axes (rho, phase). Created when not given.
- Returns:
axes –
[ax_rho, ax_phase]- Return type:
ndarray of Axes, shape (2,)
- pycsamt.forward.plot.plot_model_1d(models, labels=None, *, log_rho=True, depth_max=None, lw=<object object>, alpha=<object object>, title='', figsize=(3.8, 5.5), ax=None)[source]#
Plot one or more 1-D layered earth models as resistivity-depth profiles.
Multiple models are coloured with
PYCSAMT_STYLE.multilineso the gradient or cycle palette matches all other multi-model plots.- Parameters:
models (LayeredModel or list of LayeredModel) – One model or a list to overlay.
labels (list of str, optional) – Legend labels; defaults to model name attributes.
log_rho (bool) – Use log₁₀ scale on the resistivity axis.
depth_max (float or None) – Maximum depth shown [m]. Defaults to the deepest interface × 1.2.
lw (float) – Line width. Default:
PYCSAMT_STYLE.multiline.lw.alpha (float) – Line alpha. Default:
PYCSAMT_STYLE.multiline.alpha.title (str)
ax (Axes or None)
- Returns:
ax
- Return type:
Axes
- pycsamt.forward.plot.plot_response_and_model_1d(response, model=None, *, title='', figsize=(10, 5), gridspec_kw=None)[source]#
3-panel figure combining model depth profile, ρ_a, and phase.
This is the canonical “validate and save” view for a 1-D forward run.
- Parameters:
response (ForwardResponse)
model (LayeredModel or None) – If given, plotted in the left panel. When
None, only the two response panels are shown.title (str) – Figure suptitle.
gridspec_kw (dict or None) – Passed to
subplots().
- Return type:
Figure
- pycsamt.forward.plot.plot_model_2d(grid, *, cmap='jet_r', log_scale=True, clip_core=True, vmin=None, vmax=None, show_stations=True, station_preset='inversion', title='', figsize=(11, 4), ax=None)[source]#
Plot the 2-D resistivity model on a colour map.
Station markers and labels are rendered using
PYCSAMT_STATION_RENDERING.- Parameters:
grid (Grid2D)
cmap (str) – Colourmap name.
"jet_r"is the geophysical convention (blue = conductive, red = resistive).log_scale (bool) – Display log₁₀(ρ) rather than ρ.
clip_core (bool) – Clip to the non-padding core region.
vmin (float or None) – Colour limits in log₁₀(Ω·m) when log_scale is True.
vmax (float or None) – Colour limits in log₁₀(Ω·m) when log_scale is True.
show_stations (bool) – Render station markers and labels on the surface.
station_preset (str) –
"inversion"or"pseudosection"or"survey".title (str)
ax (Axes or None)
- Returns:
ax
- Return type:
Axes
- pycsamt.forward.plot.plot_pseudosection_2d(response, *, mode='te', quantity='rho_a', cmap=<object object>, vmin=None, vmax=None, n_contours=0, show_stations=True, station_preset='pseudosection', title='', figsize=(11, 5), ax=None)[source]#
Plot a 2-D MT pseudo-section (period × station distance).
The colour shows log₁₀(ρ_a) or phase at each (period, station) point. Station markers are rendered via
PYCSAMT_STATION_RENDERING.- Parameters:
response (ForwardResponse2D)
mode ({'te', 'tm'}) – Which polarisation mode to display.
quantity ({'rho_a', 'phase'}) – Quantity to colour.
cmap (str) – Colour map. Defaults to
"jet_r"for ρ_a and"RdBu_r"for phase.vmin (float or None) – Colour limits.
vmax (float or None) – Colour limits.
n_contours (int) – Number of contour lines overlaid on the colour map (0 = none).
show_stations (bool) – Add station axis with markers.
station_preset (str)
title (str)
ax (Axes or None)
- Returns:
ax
- Return type:
Axes
- pycsamt.forward.plot.plot_response_profiles(response, *, mode='te', quantity='rho_a', freq_indices=None, n_freqs_shown=5, lw=<object object>, alpha=<object object>, title='', figsize=(9, 4), ax=None)[source]#
Plot ρ_a (or phase) vs station distance at selected frequencies.
Each frequency is a separate line coloured by
PYCSAMT_STYLE.multiline, making it easy to see how the lateral anomaly signature changes with depth (period).- Parameters:
response (ForwardResponse2D)
mode ({'te', 'tm'})
quantity ({'rho_a', 'phase'})
freq_indices (sequence of int or None) – Indices into
response.freqsto display. WhenNone, n_freqs_shown equally spaced indices are chosen automatically.n_freqs_shown (int) – Number of frequency curves when freq_indices is
None.lw (float) – Line width. Default:
PYCSAMT_STYLE.multiline.lw.alpha (float) – Line alpha. Default:
PYCSAMT_STYLE.multiline.alpha.title (str)
ax (Axes or None)
- Returns:
ax
- Return type:
Axes
- pycsamt.forward.plot.plot_model_3d(grid3d, *, cmap='jet_r', log_scale=True, clip_core=True, vmin=None, vmax=None, show_stations=True, title='', figsize=(13, 4.5))[source]#
Three orthogonal slice panels for a 3-D resistivity model.
Displays the XZ (mid-y), YZ (mid-x), and XY (mid-z) cross-sections of grid3d as colour maps. Station positions are overlaid on the XY (map-view) panel.
- Parameters:
- Returns:
axes –
[ax_xz, ax_yz, ax_xy]- Return type:
ndarray of Axes, shape (3,)
- pycsamt.forward.plot.plot_response_map_3d(response3d, *, freq_idx=0, component='xy', quantity='rho_a', cmap=<object object>, vmin=None, vmax=None, show_labels=True, marker_size=120.0, title='', figsize=(7, 6), ax=None)[source]#
Map-view scatter of ρ_a or phase at one frequency.
Each station is drawn as a coloured symbol at its (x, y) surface position.
- Parameters:
- Returns:
ax
- Return type:
Axes
- pycsamt.forward.plot.plot_response_section_3d(response3d, *, component='xy', quantity='rho_a', y_row=None, cmap=<object object>, vmin=None, vmax=None, n_contours=0, show_stations=True, station_preset='pseudosection', title='', figsize=(11, 5), ax=None)[source]#
Period × station pseudo-section for one 3-D response component.
Stations are sorted along x and projected onto a profile at a selected y-row (default: mid-y row).
- Parameters:
response3d (ForwardResponse3D)
component ({'xy', 'yx', 'xx', 'yy'})
quantity ({'rho_a', 'phase'})
y_row (int or None) – Index of the y-row.
None→ midpoint row.cmap (str or _UNSET)
vmin (float or None)
vmax (float or None)
n_contours (int)
show_stations (bool)
station_preset (str)
title (str)
ax (Axes or None)
- Returns:
ax
- Return type:
Axes
- pycsamt.forward.plot.plot_tensor_components_3d(response3d, *, freq_idx=0, quantity='rho_a', cmap=<object object>, vmin=None, vmax=None, marker_size=100.0, title='', figsize=(12, 10))[source]#
2 × 2 map panel showing all four impedance tensor components.
Panels are arranged as:
[[Z_xx, Z_xy], [Z_yx, Z_yy]]