Skip to content

Welcome to APSG

APSG logo APSG logo

APSG brings the essential analytical toolkit of structural geology directly into Python. From processing raw field measurements and performing directional statistics to simplified stress and strain tensor analysis and creating publication-ready stereonets and fabric diagrams, APSG handles the underlying mathematics while keeping every step transparent, documented, and reproducible. It provides an intuitive pythonic bridge between field observations, quantitative analysis, and tectonic interpretation — all seamlessly integrated into your Jupyter notebook.

  • Structural features


    Lineations, foliations, faults, pairs, cones and arcs behave like proper geological objects, with degree-based angles and RHR/dip-direction notation built in.

  • Feature sets


    Group any feature into a set for vectorized statistics, filtering, rotation and resampling — no manual loops over measurements.

  • Tensors & fabric analysis


    Deformation gradients, orientation and stress tensors, with Vollmer, Ramsay, Flinn and Hsu fabric plots ready to go.

  • Stereonets & rose diagrams


    Publication-ready equal-area/equal-angle stereonets, contouring and rose diagrams, styled through a single configuration object.

  • Pandas integration


    APSG features live directly inside a DataFrame column via a pandas extension type, so your existing pandas workflow just works.

  • Database support


    Read and write field data from legacy PySDB .sdb files or a remote websdb project with the same feature-based API.

Usage

To use APSG in a project:

import apsg

To use APSG interactively it is easier to import into current namespace:

from apsg import *

A quick stereonet of random Fisher-distributed foliations:

from apsg import *

f = folset.random_fisher(mean=fol(130, 60))
s = StereoNet()
s.great_circle(f)
s.point(f)
s.contour(f)
s.show()

Install APSG Tutorials API reference