config module

The apsg.config module provides a hierarchical configuration system based on dataclasses with a Mapping mixin. The global instance apsg_conf is used throughout APSG to control defaults for notation, rounding, figure properties, and plotting defaults.

Usage

Access configuration values using dot notation:

>>> from apsg.config import apsg_conf
>>> apsg_conf.ndigits
3
>>> apsg_conf.stereonet.kind
'equal-area'
>>> apsg_conf.stereonet_point.mfc
>>> apsg_conf.roseplot.bins
36

Modify values in-place:

>>> apsg_conf.ndigits = 5
>>> apsg_conf.stereonet.kind = 'equal-angle'
>>> apsg_conf.roseplot_bars.ec = 'gray'

The Mapping interface enables dict-like access:

>>> apsg_conf['figsize']
(8, 6)
>>> dict(apsg_conf.stereonet)
{...}

Use update() for bulk updates from a dictionary. Nested configs are updated recursively:

>>> apsg_conf.update({'ndigits': 4, 'stereonet': {'kind': 'equal-area'}})

To obtain a plain dictionary (e.g. to pass as **kwargs), call copy():

>>> kwargs = apsg_conf.stereonet_point.copy()
>>> kwargs['mfc'] = 'red'

Classes

Classes:

BaseConfig()

StereonetMarkerConfig([alpha, color, mec, ...])

StereonetConfig(kind, overlay_position, ...)

StereonetPointConfig([alpha, color, mec, ...])

StereonetVectorConfig([alpha, color, mec, ...])

StereonetGreatCircleConfig([alpha, color, ...])

StereonetArcConfig([alpha, color, ls, lw])

StereonetScatterConfig([alpha, s, c, ...])

StereonetConeConfig([alpha, color, ls, lw])

StereonetPairConfig([alpha, color, ls, lw, ...])

StereonetFaultConfig([alpha, color, ls, lw])

StereonetHoeppnerConfig([alpha, color, mec, ...])

StereonetArrowConfig([color, width, ...])

StereonetTensorConfig([planes, alpha, ...])

StereonetStressConfig([alpha, color, ls, ...])

StereonetContourConfig(alpha, antialiased, ...)

RoseplotConfig(bins, density, arrowness, ...)

RoseplotBarConfig([alpha, color, ec, fc, ...])

RoseplotPdfConfig([alpha, color, ec, fc, ...])

RoseplotMuciConfig([confidence_level, ...])

FabricplotConfig(ticks, n_ticks, tick_size, ...)

FabricplotPointConfig([alpha, color, mec, ...])

FabricplotPathConfig([alpha, color, ls, lw, ...])

AppConfig(notation, vec2geo, ndigits, ...)

class apsg.config.BaseConfig

Bases: Mapping

class apsg.config.StereonetMarkerConfig(alpha: Any = None, color: Any = None, mec: Any = None, mfc: Any = None, ls: str = 'none', marker: str = 'o', mew: int = 1, ms: int = 6)

Bases: BaseConfig

class apsg.config.StereonetConfig(kind: str = 'equal-area', overlay_position: tuple[float, float, float, float]=(0, 0, 0, 0), rotate_data: bool = False, minor_ticks: Any = None, major_ticks: Any = None, overlay: bool = True, overlay_step: int = 15, overlay_resolution: int = 181, clip_pole: int = 15, hemisphere: str = 'lower', grid_type: str = 'gss', grid_n: int = 3000, tight_layout: bool = False, title_kws: dict = <factory>)

Bases: BaseConfig

class apsg.config.StereonetPointConfig(alpha: Any = None, color: Any = None, mec: Any = None, mfc: Any = None, ls: str = 'none', marker: str = 'o', mew: int = 1, ms: int = 6)

Bases: StereonetMarkerConfig

class apsg.config.StereonetVectorConfig(alpha: Any = None, color: Any = None, mec: Any = None, mfc: Any = None, ls: str = 'none', marker: str = 'o', mew: int = 2, ms: int = 6)

Bases: StereonetMarkerConfig

class apsg.config.StereonetGreatCircleConfig(alpha: Any = None, color: Any = None, ls: str = '-', lw: float = 1.5)

Bases: BaseConfig

class apsg.config.StereonetArcConfig(alpha: Any = None, color: Any = None, ls: str = '-', lw: float = 1.5)

Bases: BaseConfig

class apsg.config.StereonetScatterConfig(alpha: Any = None, s: Any = None, c: Any = None, linewidths: float = 1.5, marker: str = 'o', cmap: Any = None, legend: bool = False, num: str = 'auto')

Bases: BaseConfig

class apsg.config.StereonetConeConfig(alpha: Any = None, color: Any = None, ls: str = '-', lw: float = 1.5)

Bases: BaseConfig

class apsg.config.StereonetPairConfig(alpha: Any = None, color: Any = None, ls: str = '-', lw: float = 1.5, line_marker: str = 'o')

Bases: BaseConfig

class apsg.config.StereonetFaultConfig(alpha: Any = None, color: Any = None, ls: str = '-', lw: float = 1.5)

Bases: BaseConfig

class apsg.config.StereonetHoeppnerConfig(alpha: Any = None, color: Any = None, mec: Any = None, mfc: Any = None, ls: str = 'none', marker: str = 'o', mew: int = 1, ms: int = 5)

Bases: StereonetMarkerConfig

class apsg.config.StereonetArrowConfig(color: Any = None, width: int = 2, headwidth: int = 5, pivot: str = 'mid', units: str = 'dots')

Bases: BaseConfig

class apsg.config.StereonetTensorConfig(planes: bool = True, alpha: Any = None, color: Any = None, ls: str = '-', lw: float = 1.5, marker: str = 'o', mew: int = 1, ms: int = 9)

Bases: BaseConfig

class apsg.config.StereonetStressConfig(alpha: Any = None, color: Any = None, ls: str = 'none', marker: str = '*', mew: int = 1, ms: int = 12)

Bases: BaseConfig

class apsg.config.StereonetContourConfig(alpha: Any = None, antialiased: bool = True, method: str = 'sph', n_max: int = 6, cmap: str = 'Greys', levels: int = 6, clines: bool = True, linewidths: float = 1, linestyles: Any = None, colorbar: bool = False, trimzero: bool = True, sigma: Any = None, sigmanorm: bool = True, show_data: bool = False, data_kws: dict = <factory>)

Bases: BaseConfig

class apsg.config.RoseplotConfig(bins: int = 36, density: bool = True, arrowness: float = 0.95, rwidth: float = 1, scaled: bool = False, kappa: int = 250, pdf_res: int = 901, title: Any = None, grid: bool = True, grid_kws: dict = <factory>, tight_layout: bool = False, title_kws: dict = <factory>)

Bases: BaseConfig

class apsg.config.RoseplotBarConfig(alpha: Any = None, color: Any = None, ec: Any = None, fc: Any = None, ls: str = '-', lw: float = 1.5, legend: bool = False)

Bases: BaseConfig

class apsg.config.RoseplotPdfConfig(alpha: Any = None, color: Any = None, ec: Any = None, fc: Any = None, ls: str = '-', lw: float = 1.5, legend: bool = False)

Bases: BaseConfig

class apsg.config.RoseplotMuciConfig(confidence_level: int = 95, alpha: Any = None, color: str = 'r', ls: str = '-', lw: float = 1.5, n_resamples: int = 9999)

Bases: BaseConfig

class apsg.config.FabricplotConfig(ticks: bool = True, n_ticks: int = 10, tick_size: float = 0.2, margin: float = 0.05, grid: bool = True, grid_color: str = 'k', grid_style: str = ':', title: Any = None, tight_layout: bool = False, title_kws: dict = <factory>)

Bases: BaseConfig

class apsg.config.FabricplotPointConfig(alpha: Any = None, color: Any = None, mec: Any = None, mfc: Any = None, ls: str = 'none', marker: str = 'o', mew: int = 1, ms: int = 8)

Bases: BaseConfig

class apsg.config.FabricplotPathConfig(alpha: Any = None, color: Any = None, ls: str = '-', lw: float = 1.5, marker: Any = None, mec: Any = None, mew: int = 1, mfc: Any = None, ms: int = 6)

Bases: BaseConfig

class apsg.config.AppConfig(notation: str = 'dd', vec2geo: bool = False, ndigits: int = 3, figsize: tuple = (8, 6), dpi: int = 100, facecolor: str = 'white', stereonet: apsg.config.StereonetConfig = <factory>, stereonet_point: apsg.config.StereonetPointConfig = <factory>, stereonet_vector: apsg.config.StereonetVectorConfig = <factory>, stereonet_great_circle: apsg.config.StereonetGreatCircleConfig = <factory>, stereonet_arc: apsg.config.StereonetArcConfig = <factory>, stereonet_scatter: apsg.config.StereonetScatterConfig = <factory>, stereonet_cone: apsg.config.StereonetConeConfig = <factory>, stereonet_pair: apsg.config.StereonetPairConfig = <factory>, stereonet_fault: apsg.config.StereonetFaultConfig = <factory>, stereonet_hoeppner: apsg.config.StereonetHoeppnerConfig = <factory>, stereonet_arrow: apsg.config.StereonetArrowConfig = <factory>, stereonet_tensor: apsg.config.StereonetTensorConfig = <factory>, stereonet_stress: apsg.config.StereonetStressConfig = <factory>, stereonet_contour: apsg.config.StereonetContourConfig = <factory>, roseplot: apsg.config.RoseplotConfig = <factory>, roseplot_bar: apsg.config.RoseplotBarConfig = <factory>, roseplot_pdf: apsg.config.RoseplotPdfConfig = <factory>, roseplot_muci: apsg.config.RoseplotMuciConfig = <factory>, fabricplot: apsg.config.FabricplotConfig = <factory>, fabricplot_point: apsg.config.FabricplotPointConfig = <factory>, fabricplot_path: apsg.config.FabricplotPathConfig = <factory>)

Bases: BaseConfig

Default values

AppConfig

Field

Default

Description

notation

"dd"

Notation for geological measurements ("dd" or "rhr")

vec2geo

False

Represent Vector3 using geological notation

ndigits

3

Rounding precision in __repr__

figsize

(8, 6)

Default figure size (width, height)

dpi

100

Default figure DPI

facecolor

"white"

Default figure facecolor

stereonet

StereonetConfig()

Stereonet projection parameters

stereonet_point

StereonetPointConfig()

Default kwargs for point markers

stereonet_pole

StereonetPoleConfig()

Default kwargs for pole markers

stereonet_vector

StereonetVectorConfig()

Default kwargs for vector markers

stereonet_great_circle

StereonetGreatCircleConfig()

Default kwargs for great circles

stereonet_arc

StereonetArcConfig()

Default kwargs for arcs

stereonet_scatter

StereonetScatterConfig()

Default kwargs for scatter plots

stereonet_cone

StereonetConeConfig()

Default kwargs for cones

stereonet_pair

StereonetPairConfig()

Default kwargs for pairs

stereonet_fault

StereonetFaultConfig()

Default kwargs for faults

stereonet_hoeppner

StereonetHoeppnerConfig()

Default kwargs for Hoeppner plots

stereonet_arrow

StereonetArrowConfig()

Default kwargs for arrows

stereonet_tensor

StereonetTensorConfig()

Default kwargs for tensor plots

stereonet_stress

StereonetStressConfig()

Default kwargs for stress plots

stereonet_contour

StereonetContourConfig()

Default kwargs for contour plots

roseplot

RoseplotConfig()

Roseplot global parameters

roseplot_bar

RoseplotBarConfig()

Default kwargs for roseplot bars

roseplot_pdf

RoseplotPdfConfig()

Default kwargs for roseplot PDF

roseplot_muci

RoseplotMuciConfig()

Default kwargs for roseplot confidence interval

fabricplot

FabricplotConfig()

Fabricplot global parameters

fabricplot_point

FabricplotPointConfig()

Default kwargs for fabric plot points

fabricplot_path

FabricplotPathConfig()

Default kwargs for fabric plot paths

StereonetConfig

Field

Default

Description

kind

"equal-area"

Projection type ("equal-area" / "equal-angle")

overlay_position

(0, 0, 0, 0)

Overlay position as (x, y, z, sense)

rotate_data

False

Rotate data together with overlay

minor_ticks

None

Minor tick spacing (None to disable)

major_ticks

None

Major tick spacing (None to disable)

overlay

True

Show grid overlay

overlay_step

15

Grid step in degrees

overlay_resolution

181

Grid resolution

clip_pole

15

Clipped cone around poles (degrees)

hemisphere

"lower"

Hemisphere ("lower" or "upper")

grid_type

"gss"

Contouring grid type ("gss" / "sfs")

grid_n

3000

Number of counting points in grid

tight_layout

False

Matplotlib tight layout

title_kws

{}

Keyword arguments for suptitle

Marker sub-configs

These classes control the appearance of point-like markers on stereonet plots. They all inherit from StereonetMarkerConfig.

Field

StereonetPointConfig

StereonetPoleConfig

StereonetVectorConfig

StereonetHoeppnerConfig

FabricplotPointConfig

FabricplotPathConfig

alpha

None

None

None

None

None

None

color

None

None

None

None

None

None

mec

None

None

None

None

None

None

mfc

None

None

None

None

None

None

ls

"none"

"none"

"none"

"none"

"none"

"-"

marker

"o"

"o"

"o"

"o"

"o"

None

mew

1

1

2

1

1

1

ms

6

6

6

5

8

6

Line sub-configs

These classes control the appearance of lines on stereonet plots.

Field

StereonetGreatCircleConfig

StereonetArcConfig

StereonetConeConfig

StereonetFaultConfig

StereonetPairConfig

alpha

None

None

None

None

None

color

None

None

None

None

None

ls

"-"

"-"

"-"

"-"

"-"

lw

1.5

1.5

1.5

1.5

1.5

line_marker

 

 

 

 

"o"

StereonetScatterConfig

Field

Default

Description

alpha

None

Transparency

s

None

Marker size

c

None

Marker color

linewidths

1.5

Edge line width

marker

"o"

Marker style

cmap

None

Colormap

legend

False

Show legend

num

"auto"

Number of features shown

StereonetArrowConfig

Field

Default

Description

color

None

Arrow color

width

2

Arrow width (dots)

headwidth

5

Arrow head width

pivot

"mid"

Pivot point ("mid", "tail", etc.)

units

"dots"

Arrow units

StereonetTensorConfig

Field

Default

Description

planes

True

Plot planes

alpha

None

Transparency

color

None

Color

ls

"-"

Line style

lw

1.5

Line width

marker

"o"

Marker style

mew

1

Marker edge width

ms

9

Marker size

StereonetStressConfig

Field

Default

Description

alpha

None

Transparency

color

None

Color

ls

"none"

Line style

marker

"*"

Marker style (star)

mew

1

Marker edge width

ms

12

Marker size

StereonetContourConfig

Field

Default

Description

alpha

None

Transparency

antialiased

True

Antialiasing

method

"sph"

Contouring method ("sph", "kamb", "schmidt")

n_max

6

Max contour level

cmap

"Greys"

Colormap

levels

6

Number of contour levels

clines

True

Show contour lines

linewidths

1

Contour line width

linestyles

None

Contour line styles

colorbar

False

Show colorbar

trimzero

True

Trim zero contours

sigma

None

Sigma value for Kamb method

sigmanorm

True

Sigma normalization

show_data

False

Show data points

data_kws

{}

Keyword arguments for data points

RoseplotConfig

Field

Default

Description

bins

36

Number of bins

density

True

Use density instead of counts

arrowness

0.95

Arrow shape factor

rwidth

1

Bar relative width

scaled

False

Bins scaled by area

kappa

250

Von Mises shape parameter

pdf_res

901

PDF resolution

title

None

Plot title

grid

True

Show grid lines

grid_kws

{}

Keyword arguments for Axes.grid

tight_layout

False

Matplotlib tight layout

title_kws

{}

Keyword arguments for suptitle

RoseplotBarConfig / RoseplotPdfConfig

Field

Default

Description

alpha

None

Transparency

color

None

Color

ec

None

Edge color

fc

None

Face color

ls

"-"

Line style

lw

1.5

Line width

legend

False

Show legend

RoseplotMuciConfig

Field

Default

Description

confidence_level

95

Confidence level (percent)

alpha

None

Transparency

color

"r"

Color (red)

ls

"-"

Line style

lw

1.5

Line width

n_resamples

9999

Number of resamples

FabricplotConfig

Field

Default

Description

ticks

True

Show ticks

n_ticks

10

Number of ticks per axis

tick_size

0.2

Tick size

margin

0.05

Plot margin

grid

True

Show grid

grid_color

"k"

Grid line color

grid_style

":"

Grid line style (dotted)

title

None

Plot title

tight_layout

False

Matplotlib tight layout

title_kws

{}

Keyword arguments for suptitle