2.2.3.15. pycsamt.api.section#
Global section-view controls for pyCSAMT figures.
This module centralizes layout choices used by 2-D section-like plots:
pseudo-sections, inversion sections, model slices, and compact dashboard
panels. It complements pycsamt.api.style,
pycsamt.api.station, pycsamt.api.control, and
pycsamt.api.plot.
Examples
Apply a publication section preset temporarily:
from pycsamt.api.section import PYCSAMT_SECTION
from pycsamt.tdem import plot_temavg_section
with PYCSAMT_SECTION.context("publication"):
ax = plot_temavg_section(avg, section="publication")
Use the data-aware dynamic layout for many stations:
ax = plot_temavg_section(avg, section="dynamic")
Customize one preset globally:
from pycsamt.api import configure_section
configure_section(
dynamic__figure__max_width=16.0,
dynamic__colorbar__max_ticks=5,
)
Functions
|
Configure |
|
Reset |
Classes
Package-wide section-view control container. |
|
|
Axis behavior for section-like plots. |
|
Colorbar geometry and tick-density controls. |
|
Figure geometry for section-like plots. |
|
Complete visual-control bundle for one section preset. |
- class pycsamt.api.section.PyCSAMTSection[source]
Bases:
objectPackage-wide section-view control container.
- style_for(preset='pseudosection')[source]
Return the section style associated with
preset.- Parameters:
preset (str)
- Return type:
- configure(**kw)[source]
Configure section styles using
section__attributepaths.- Parameters:
kw (Any)
- Return type:
None
- context(preset=None, **kw)[source]
Temporarily override section styles, then restore them.
- Parameters:
- Return type:
Generator[PyCSAMTSection, None, None]
- use_preset(preset)[source]
Copy one preset into the pseudosection slot.
- Parameters:
preset (str)
- Return type:
None
- reset()[source]
Reset section controls to package defaults.
- Return type:
None
- class pycsamt.api.section.SectionAxisStyle(xlabel='Station', ylabel=None, y_direction='down', aspect='auto', grid=False, station_side='top', title=True, xlabel_pad=None, ylabel_pad=None, y_type='depth')[source]
Bases:
objectAxis behavior for section-like plots.
- Parameters:
- xlabel: str = 'Station'
- y_direction: str = 'down'
- grid: bool = False
- station_side: str = 'top'
- title: bool = True
- y_type: str = 'depth'
- class pycsamt.api.section.SectionColorbarStyle(show=True, side='right', size='3.5%', pad=0.04, max_ticks=6, tick_format=None)[source]
Bases:
objectColorbar geometry and tick-density controls.
- Parameters:
- show: bool = True
- side: str = 'right'
- size: str = '3.5%'
- pad: float = 0.04
- class pycsamt.api.section.SectionFigureStyle(figsize=(9.5, 4.4), tight=True, constrained=False, title=True, min_width=7.0, max_width=14.0, min_height=3.2, max_height=7.5, station_width=0.16, y_sample_height=0.03, label_width=0.055, colorbar_width=0.55)[source]
Bases:
objectFigure geometry for section-like plots.
- Parameters:
- tight: bool = True
- constrained: bool = False
- title: bool = True
- min_width: float = 7.0
- max_width: float = 14.0
- min_height: float = 3.2
- max_height: float = 7.5
- station_width: float = 0.16
- y_sample_height: float = 0.03
- label_width: float = 0.055
- colorbar_width: float = 0.55
- class pycsamt.api.section.SectionStyle(figure=<factory>, axis=<factory>, colorbar=<factory>, station_preset='pseudosection')[source]
Bases:
objectComplete visual-control bundle for one section preset.
- Parameters:
figure (SectionFigureStyle)
axis (SectionAxisStyle)
colorbar (SectionColorbarStyle)
station_preset (str)
- figure: SectionFigureStyle
- axis: SectionAxisStyle
- colorbar: SectionColorbarStyle
- station_preset: str = 'pseudosection'
- topo_active()[source]
Return True when the global topo config applies to this section.
Checks
PYCSAMT_TOPOagainstself.axis.y_type. Period / frequency sections return False even when topo is globally enabled, because they carry no real elevation information.- Return type:
- copy(**kw)[source]
Return a modified deep copy of this section style.
- Parameters:
kw (Any)
- Return type:
- figsize_for(*, n_stations=None, n_y=None, labels=None, colorbar=True)[source]
Return a concrete figure size for this section.
- apply_axis(ax, **kw)[source]
Apply this style’s axis policy to
ax.
- add_colorbar(mappable, ax, *, label=None, **kw)[source]
Attach a colorbar using this style’s colorbar policy.
- apply_stations(ax, positions, labels=None, *, station_style=None, xlim=None)[source]
Apply station rendering for this section style.
- pycsamt.api.section.configure_section(**kw)[source]
Configure
PYCSAMT_SECTION.- Parameters:
kw (Any)
- Return type:
None
- pycsamt.api.section.reset_section()[source]
Reset
PYCSAMT_SECTIONto package defaults.- Return type:
None