APSG is the Python toolbox for structural geologists. Turn lineations, foliations, faults and stress tensors into beautiful stereonets, rose diagrams and fabric plots in a few lines of code. Back every interpretation with solid statistics: fit and simulate orientation distributions, split data into fracture sets, correct sampling bias, draw confidence regions and test your hypotheses. From a field CSV, a pandas table or your structural database to publication-ready figures and answers, in minutes.
Check CHANGELOG.md for recent updates.
Quick example
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()
StereoNet supports both equal-area (Schmidt, default) and equal-angle (Wulff) projections,
lower and upper hemisphere, and rotating the whole net independently of the plotted data.
See the stereonet tutorial for examples.
Requirements
APSG requires Python 3.12 or later. It depends on NumPy, SciPy, Matplotlib, SQLAlchemy, pandas, pygeomag. The installers below take care of these.
Installation
Install APSG into a separate environment. Pick one of the options below. uv is the default and the fastest; pip and conda/mamba are alternatives.
With uv (recommended)
Install uv, then create a virtual environment and install APSG into it:
uv venv
uv pip install apsg
Activate the environment on Linux and macOS:
source .venv/bin/activate
On Windows (Command Prompt or PowerShell):
.venv\Scripts\activate
To include JupyterLab and openpyxl (needed to read Excel files), use the lab extra:
uv pip install "apsg[lab]"
In an existing project with a pyproject.toml, add APSG as a dependency instead:
uv add apsg
To use APSG from the command line, install it as a tool. This puts an isolated copy of APSG
on your PATH, without activating an environment:
uv tool install apsg
Then start the interactive APSG shell, which runs from apsg import * for you:
iapsg
To try the shell without installing, run uvx --from apsg iapsg. Add the lab extra with
uv tool install "apsg[lab]" to include JupyterLab.
Development install
To work on APSG itself, clone the repository and install it in editable mode with all extras and development tools:
git clone https://github.com/ondrolexa/apsg.git
cd apsg
uv sync --all-extras --dev
Run the test suite with uv run pytest.
With pip
Create and activate a virtual environment. On Linux and macOS:
python -m venv .venv
source .venv/bin/activate
On Windows (Command Prompt or PowerShell):
python -m venv .venv
.venv\Scripts\activate
Note: On Windows, PowerShell may refuse to run the activation script. To allow it for the current user, run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Install the latest stable release from PyPI:
pip install apsg
To include JupyterLab and openpyxl (needed to read Excel files), use the lab extra:
pip install "apsg[lab]"
To upgrade an existing installation without touching its dependencies:
pip install --upgrade --no-deps apsg
To install the master branch from GitHub:
pip install git+https://github.com/ondrolexa/apsg.git
With conda or mamba
If you already use conda or mamba, add the conda-forge channel and create an environment
with APSG:
conda config --add channels conda-forge
conda create -n apsg python apsg jupyterlab
or with mamba:
mamba create -n apsg python apsg jupyterlab
To install APSG into an existing environment, run conda install apsg (or
mamba install apsg).
Current release
| Name | Downloads | Version | Platforms |
|---|---|---|---|
Documentation
Explore all features of APSG in the documentation, with tutorials and the API reference.
Contributing
Most discussion happens on GitHub. Feel free to open an issue or comment on any open issue or pull request. See CONTRIBUTING.md for more details.
Donate
APSG is an open-source project, available for free. It took a lot of time and resources to build this software. If you find it useful and want to support its future development, please consider donating.
License
APSG is free software: you can redistribute it and/or modify it under the terms of the MIT License. A copy of this license is provided in the LICENSE file.
Metadata
Release files for apsg 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| apsg-2.1.0.tar.gz | 564.0 kB | Without provenance | Details for apsg-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| apsg-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for apsg-2.1.0-py3-none-any.whl |
Total release size: 1.0 MB
Release files / apsg-2.1.0.tar.gz
| Download URL | apsg-2.1.0.tar.gz |
|---|---|
| Size | 564.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15c61965978b814e81fe9bbca2ea8195178855f8c5afbbb6d190b9fe8cf860d0
|
|
BLAKE2b-256 checksum How to use checksums |
5799d5a06e09dc1d66036d1ed9db9c3692a618947571807fea9a110896736c65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / apsg-2.1.0-py3-none-any.whl
| Download URL | apsg-2.1.0-py3-none-any.whl |
|---|---|
| Size | 442.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b12a660eeaf2d557737971787961316969e814dae3011b85753c83ede4c1f7c8
|
|
BLAKE2b-256 checksum How to use checksums |
485bb0943a11383ec875b0a82276ea3fbeb8dc4c64b85311c8b7ee16db59fdd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for apsg 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.