apsg 2.0.1__tar.gz → 2.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. {apsg-2.0.1/src/apsg.egg-info → apsg-2.0.3}/PKG-INFO +126 -58
  2. apsg-2.0.3/README.md +196 -0
  3. {apsg-2.0.1 → apsg-2.0.3}/pyproject.toml +10 -3
  4. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/__init__.py +1 -1
  5. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/config.py +21 -0
  6. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/feature/__init__.py +8 -0
  7. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/feature/_container.py +102 -11
  8. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/feature/_tensor2.py +111 -36
  9. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/feature/_tensor3.py +139 -40
  10. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/math/_matrix.py +48 -30
  11. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_plot_artists.py +2 -2
  12. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_roseplot.py +7 -1
  13. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_stereonet.py +32 -15
  14. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_styles.py +1 -1
  15. {apsg-2.0.1 → apsg-2.0.3/src/apsg.egg-info}/PKG-INFO +126 -58
  16. {apsg-2.0.1 → apsg-2.0.3}/src/apsg.egg-info/requires.txt +2 -0
  17. {apsg-2.0.1 → apsg-2.0.3}/tests/test_containers.py +89 -4
  18. {apsg-2.0.1 → apsg-2.0.3}/tests/test_plotting.py +132 -27
  19. {apsg-2.0.1 → apsg-2.0.3}/tests/test_tensors.py +191 -1
  20. apsg-2.0.1/README.md +0 -130
  21. {apsg-2.0.1 → apsg-2.0.3}/LICENSE +0 -0
  22. {apsg-2.0.1 → apsg-2.0.3}/setup.cfg +0 -0
  23. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/database/__init__.py +0 -0
  24. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/database/_sdbmodels.py +0 -0
  25. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/database/_sdbsession.py +0 -0
  26. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/database/_websdbsession.py +0 -0
  27. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/database/_webtransport.py +0 -0
  28. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/feature/_geodata.py +0 -0
  29. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/feature/_paleomag.py +0 -0
  30. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/feature/_statistics.py +0 -0
  31. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/helpers/__init__.py +0 -0
  32. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/helpers/_helper.py +0 -0
  33. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/helpers/_math.py +0 -0
  34. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/helpers/_notation.py +0 -0
  35. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/math/__init__.py +0 -0
  36. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/math/_vector.py +0 -0
  37. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/pandas/__init__.py +0 -0
  38. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/pandas/_accessors.py +0 -0
  39. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/pandas/_gbfunctions.py +0 -0
  40. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/pandas/_pandas_api.py +0 -0
  41. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/__init__.py +0 -0
  42. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_fabricplot.py +0 -0
  43. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_paleomagplots.py +0 -0
  44. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_stereo_engine/__init__.py +0 -0
  45. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_stereo_engine/_axes.py +0 -0
  46. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_stereo_engine/_stereogrid.py +0 -0
  47. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_stereo_engine/_transforms.py +0 -0
  48. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_stereo_engine/_utils.py +0 -0
  49. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/plotting/_stereogrid.py +0 -0
  50. {apsg-2.0.1 → apsg-2.0.3}/src/apsg/shell.py +0 -0
  51. {apsg-2.0.1 → apsg-2.0.3}/src/apsg.egg-info/SOURCES.txt +0 -0
  52. {apsg-2.0.1 → apsg-2.0.3}/src/apsg.egg-info/dependency_links.txt +0 -0
  53. {apsg-2.0.1 → apsg-2.0.3}/src/apsg.egg-info/entry_points.txt +0 -0
  54. {apsg-2.0.1 → apsg-2.0.3}/src/apsg.egg-info/top_level.txt +0 -0
  55. {apsg-2.0.1 → apsg-2.0.3}/tests/test_apsg.py +0 -0
  56. {apsg-2.0.1 → apsg-2.0.3}/tests/test_pandas.py +0 -0
  57. {apsg-2.0.1 → apsg-2.0.3}/tests/test_websdb.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apsg
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: APSG - The package for structural geologists
5
5
  Author-email: Ondrej Lexa <lexa.ondrej@gmail.com>
6
6
  Maintainer-email: Ondrej Lexa <lexa.ondrej@gmail.com>
@@ -26,9 +26,11 @@ Requires-Dist: pandas
26
26
  Requires-Dist: pygeomag
27
27
  Provides-Extra: lab
28
28
  Requires-Dist: jupyterlab; extra == "lab"
29
+ Requires-Dist: openpyxl; extra == "lab"
29
30
  Provides-Extra: tests
30
31
  Requires-Dist: pytest; extra == "tests"
31
32
  Requires-Dist: pytest-cov; extra == "tests"
33
+ Requires-Dist: pytest-xdist; extra == "tests"
32
34
  Provides-Extra: docs
33
35
  Requires-Dist: sphinx>=7.0; extra == "docs"
34
36
  Requires-Dist: shibuya; extra == "docs"
@@ -54,13 +56,11 @@ Dynamic: license-file
54
56
  [![codecov](https://codecov.io/gh/ondrolexa/apsg/graph/badge.svg?token=YKXWmJJHw3)](https://codecov.io/gh/ondrolexa/apsg)
55
57
  [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.593586-blue)](https://doi.org/10.5281/zenodo.593586)
56
58
 
57
- ## 🤔 What is APSG?
58
-
59
- APSG is the package for structural geologists. It defines several new python classes to easily manage, analyze and visualize orientation structural geology data.
59
+ APSG is the package for structural geologists. It defines several new Python classes to easily manage, analyze and visualize orientation structural geology data.
60
60
 
61
61
  Check [CHANGELOG.md](https://github.com/ondrolexa/apsg/blob/master/CHANGELOG.md) for recent updates.
62
62
 
63
- ## 📈 Quick example
63
+ ## Quick example
64
64
 
65
65
  ```python
66
66
  from apsg import *
@@ -73,100 +73,168 @@ s.contour(f)
73
73
  s.show()
74
74
  ```
75
75
 
76
- ``StereoNet`` supports both equal-area (Schmidt, default) and equal-angle (Wulff) projections,
77
- lower and upper hemisphere, and rotating the whole net independently of the plotted data --
78
- see the stereonet tutorial in the [documentation](https://apsg.readthedocs.org) for examples.
76
+ `StereoNet` supports both equal-area (Schmidt, default) and equal-angle (Wulff) projections,
77
+ lower and upper hemisphere, and rotating the whole net independently of the plotted data.
78
+ See the stereonet tutorial in the [documentation](https://apsg.readthedocs.org) for examples.
79
79
 
80
- ## 🛠️ Requirements
80
+ ## Requirements
81
81
 
82
- You need Python 3.12 or later to run APSG. The package requires [NumPy](https://numpy.org/),
83
- [SciPy](https://scipy.org/), [Matplotlib](https://matplotlib.org/), [SQLAlchemy](https://www.sqlalchemy.org/),
84
- [pandas](https://pandas.pydata.org/) and [pygeomag](https://github.com/boxpet/pygeomag).
82
+ APSG requires Python 3.12 or later. It depends on [NumPy](https://numpy.org/),
83
+ [SciPy](https://scipy.org/), [Matplotlib](https://matplotlib.org/),
84
+ [SQLAlchemy](https://www.sqlalchemy.org/), [pandas](https://pandas.pydata.org/),
85
+ [pygeomag](https://github.com/boxpet/pygeomag). The installers below take care of these.
85
86
 
86
- ## 🚀 How to install
87
+ ## Installation
87
88
 
88
- It is strongly suggested to install **apsg** into separate environment. You can create
89
- Python virtual environment. For Linux and macOS use:
89
+ Install APSG into a separate environment. Pick one of the options below. uv is the default
90
+ and the fastest; pip and conda/mamba are alternatives.
90
91
 
91
- python -m venv .venv
92
- source .venv/bin/activate
92
+ ### With uv (recommended)
93
93
 
94
- for Windows use Command Prompt or PowerShell:
94
+ Install [uv](https://docs.astral.sh/uv/), then create a virtual environment and install APSG
95
+ into it:
95
96
 
96
- python -m venv .venv
97
- .venv\Scripts\activate
97
+ ```sh
98
+ uv venv
99
+ uv pip install apsg
100
+ ```
98
101
 
99
- > **Note:** On Microsoft Windows, it may be required to set the execution policy in PowerShell for the user.
100
- > You can do this by issuing the following PowerShell command:
101
- > ```
102
- > Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
103
- > ```
102
+ Activate the environment on Linux and macOS:
103
+
104
+ ```sh
105
+ source .venv/bin/activate
106
+ ```
107
+
108
+ On Windows (Command Prompt or PowerShell):
109
+
110
+ ```powershell
111
+ .venv\Scripts\activate
112
+ ```
113
+
114
+ To include JupyterLab and [openpyxl](https://openpyxl.readthedocs.io/) (needed to read Excel files), use the `lab` extra:
115
+
116
+ ```sh
117
+ uv pip install "apsg[lab]"
118
+ ```
119
+
120
+ In an existing project with a `pyproject.toml`, add APSG as a dependency instead:
121
+
122
+ ```sh
123
+ uv add apsg
124
+ ```
125
+
126
+ To use APSG from the command line, install it as a tool. This puts an isolated copy of APSG
127
+ on your `PATH`, without activating an environment:
128
+
129
+ ```sh
130
+ uv tool install apsg
131
+ ```
132
+
133
+ Then start the interactive APSG shell, which runs `from apsg import *` for you:
104
134
 
105
- and install latest stable version of **apsg** using pip within the environment:
135
+ ```sh
136
+ iapsg
137
+ ```
106
138
 
107
- pip install apsg
139
+ To try the shell without installing, run `uvx --from apsg iapsg`. Add the `lab` extra with
140
+ `uv tool install "apsg[lab]"` to include JupyterLab.
108
141
 
109
- To include jupyterlab in installation, use `lab` extra:
142
+ ### Development install
110
143
 
111
- pip install apsg[lab]
144
+ To work on APSG itself, clone the repository and install it in editable mode with all extras
145
+ and development tools:
146
+
147
+ ```sh
148
+ git clone https://github.com/ondrolexa/apsg.git
149
+ cd apsg
150
+ uv sync --all-extras --dev
151
+ ```
112
152
 
113
- Or install **master** with:
153
+ Run the test suite with `uv run pytest`.
154
+
155
+ ### With pip
156
+
157
+ Create and activate a virtual environment. On Linux and macOS:
158
+
159
+ ```sh
160
+ python -m venv .venv
161
+ source .venv/bin/activate
162
+ ```
114
163
 
115
- pip install git+https://github.com/ondrolexa/apsg.git
164
+ On Windows (Command Prompt or PowerShell):
116
165
 
117
- Alternatively, you can clone the repository and do a local install with [uv](https://docs.astral.sh/uv/) (recommended for dev):
166
+ ```powershell
167
+ python -m venv .venv
168
+ .venv\Scripts\activate
169
+ ```
118
170
 
119
- git clone https://github.com/ondrolexa/apsg.git
120
- cd apsg
121
- uv sync --all-extras --dev
171
+ > **Note:** On Windows, PowerShell may refuse to run the activation script. To allow it for
172
+ > the current user, run:
173
+ >
174
+ > ```powershell
175
+ > Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
176
+ > ```
122
177
 
123
- #### Upgrading via pip
178
+ Install the latest stable release from PyPI:
124
179
 
125
- To upgrade an existing version of APSG from PyPI, execute:
180
+ ```sh
181
+ pip install apsg
182
+ ```
126
183
 
127
- pip install apsg --upgrade --no-deps
184
+ To include JupyterLab and [openpyxl](https://openpyxl.readthedocs.io/) (needed to read Excel files), use the `lab` extra:
128
185
 
129
- #### Comments on system-wide installations on Debian systems
186
+ ```sh
187
+ pip install "apsg[lab]"
188
+ ```
130
189
 
131
- Latest Debian-based systems do not allow installing non-Debian packages system-wide.
132
- However, installing all requirements allows to force install APSG system-wide without troubles.
190
+ To upgrade an existing installation without touching its dependencies:
133
191
 
134
- Install requirements using apt:
192
+ ```sh
193
+ pip install --upgrade --no-deps apsg
194
+ ```
135
195
 
136
- sudo apt install python3-numpy python3-matplotlib python3-scipy python3-sqlalchemy python3-pandas
196
+ To install the master branch from GitHub:
137
197
 
138
- and then install apsg using pip:
198
+ ```sh
199
+ pip install git+https://github.com/ondrolexa/apsg.git
200
+ ```
139
201
 
140
- pip install --break-system-packages apsg
202
+ ### With conda or mamba
141
203
 
142
- ### I'm using conda or mamba to manage environments
204
+ If you already use conda or mamba, add the `conda-forge` channel and create an environment
205
+ with APSG:
143
206
 
144
- If you already have conda or mamba installed, you can create environment with:
207
+ ```sh
208
+ conda config --add channels conda-forge
209
+ conda create -n apsg python apsg jupyterlab
210
+ ```
145
211
 
146
- conda config --add channels conda-forge
147
- conda create -n apsg python apsg jupyterlab
212
+ or with mamba:
148
213
 
149
- or using mamba
214
+ ```sh
215
+ mamba create -n apsg python apsg jupyterlab
216
+ ```
150
217
 
151
- mamba create -n apsg python apsg jupyterlab
218
+ To install APSG into an existing environment, run `conda install apsg` (or
219
+ `mamba install apsg`).
152
220
 
153
- #### Current release info
221
+ ### Current release
154
222
 
155
223
  | Name | Downloads | Version | Platforms |
156
224
  | --- | --- | --- | --- |
157
225
  | [![Conda Recipe](https://img.shields.io/badge/recipe-apsg-green.svg)](https://anaconda.org/conda-forge/apsg) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/apsg.svg)](https://anaconda.org/conda-forge/apsg) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/apsg.svg)](https://anaconda.org/conda-forge/apsg) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/apsg.svg)](https://anaconda.org/conda-forge/apsg) |
158
226
 
159
- ## 📘 Documentation
227
+ ## Documentation
160
228
 
161
- You can explore all the features of APSG in [documentation](https://apsg.readthedocs.org).
229
+ Explore all features of APSG in the [documentation](https://apsg.readthedocs.org).
162
230
 
163
- ## 💻 Contributing
231
+ ## Contributing
164
232
 
165
- Most discussion happens on [Github](https://github.com/ondrolexa/apsg). Feel free to open [an issue](https://github.com/ondrolexa/apsg/issues/new) or comment on any open issue or pull request. Check [CONTRIBUTING.md](https://github.com/ondrolexa/apsg/blob/master/CONTRIBUTING.md) for more details.
233
+ Most discussion happens on [GitHub](https://github.com/ondrolexa/apsg). Feel free to open [an issue](https://github.com/ondrolexa/apsg/issues/new) or comment on any open issue or pull request. See [CONTRIBUTING.md](https://github.com/ondrolexa/apsg/blob/master/CONTRIBUTING.md) for more details.
166
234
 
167
- ## 🪙 Donate
235
+ ## Donate
168
236
 
169
- APSG is an open-source project, available for you for free. It took a lot of time and resources to build this software. If you find this software useful and want to support its future development please consider donating to me.
237
+ 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.
170
238
 
171
239
  [![Donate via PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=QTYZWVUNDUAH8&item_name=APSG+development+donation&currency_code=EUR&source=url)
172
240
 
apsg-2.0.3/README.md ADDED
@@ -0,0 +1,196 @@
1
+ <picture>
2
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ondrolexa/apsg/master/docs/images/apsg_banner_dark.svg">
3
+ <img alt="APSG logo" src="https://raw.githubusercontent.com/ondrolexa/apsg/master/docs/images/apsg_banner_light.svg">
4
+ </picture>
5
+
6
+ [![PyPI - Version](https://img.shields.io/pypi/v/apsg)](https://pypi.org/project/apsg)
7
+ [![Conda](https://img.shields.io/conda/v/conda-forge/apsg)](https://anaconda.org/conda-forge/apsg)
8
+ [![Documentation Status](https://readthedocs.org/projects/apsg/badge/?version=stable)](https://apsg.readthedocs.io/en/stable/?badge=stable)
9
+ [![codecov](https://codecov.io/gh/ondrolexa/apsg/graph/badge.svg?token=YKXWmJJHw3)](https://codecov.io/gh/ondrolexa/apsg)
10
+ [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.593586-blue)](https://doi.org/10.5281/zenodo.593586)
11
+
12
+ APSG is the package for structural geologists. It defines several new Python classes to easily manage, analyze and visualize orientation structural geology data.
13
+
14
+ Check [CHANGELOG.md](https://github.com/ondrolexa/apsg/blob/master/CHANGELOG.md) for recent updates.
15
+
16
+ ## Quick example
17
+
18
+ ```python
19
+ from apsg import *
20
+
21
+ f = folset.random_fisher(position=fol(130, 60))
22
+ s = StereoNet()
23
+ s.great_circle(f)
24
+ s.point(f)
25
+ s.contour(f)
26
+ s.show()
27
+ ```
28
+
29
+ `StereoNet` supports both equal-area (Schmidt, default) and equal-angle (Wulff) projections,
30
+ lower and upper hemisphere, and rotating the whole net independently of the plotted data.
31
+ See the stereonet tutorial in the [documentation](https://apsg.readthedocs.org) for examples.
32
+
33
+ ## Requirements
34
+
35
+ APSG requires Python 3.12 or later. It depends on [NumPy](https://numpy.org/),
36
+ [SciPy](https://scipy.org/), [Matplotlib](https://matplotlib.org/),
37
+ [SQLAlchemy](https://www.sqlalchemy.org/), [pandas](https://pandas.pydata.org/),
38
+ [pygeomag](https://github.com/boxpet/pygeomag). The installers below take care of these.
39
+
40
+ ## Installation
41
+
42
+ Install APSG into a separate environment. Pick one of the options below. uv is the default
43
+ and the fastest; pip and conda/mamba are alternatives.
44
+
45
+ ### With uv (recommended)
46
+
47
+ Install [uv](https://docs.astral.sh/uv/), then create a virtual environment and install APSG
48
+ into it:
49
+
50
+ ```sh
51
+ uv venv
52
+ uv pip install apsg
53
+ ```
54
+
55
+ Activate the environment on Linux and macOS:
56
+
57
+ ```sh
58
+ source .venv/bin/activate
59
+ ```
60
+
61
+ On Windows (Command Prompt or PowerShell):
62
+
63
+ ```powershell
64
+ .venv\Scripts\activate
65
+ ```
66
+
67
+ To include JupyterLab and [openpyxl](https://openpyxl.readthedocs.io/) (needed to read Excel files), use the `lab` extra:
68
+
69
+ ```sh
70
+ uv pip install "apsg[lab]"
71
+ ```
72
+
73
+ In an existing project with a `pyproject.toml`, add APSG as a dependency instead:
74
+
75
+ ```sh
76
+ uv add apsg
77
+ ```
78
+
79
+ To use APSG from the command line, install it as a tool. This puts an isolated copy of APSG
80
+ on your `PATH`, without activating an environment:
81
+
82
+ ```sh
83
+ uv tool install apsg
84
+ ```
85
+
86
+ Then start the interactive APSG shell, which runs `from apsg import *` for you:
87
+
88
+ ```sh
89
+ iapsg
90
+ ```
91
+
92
+ To try the shell without installing, run `uvx --from apsg iapsg`. Add the `lab` extra with
93
+ `uv tool install "apsg[lab]"` to include JupyterLab.
94
+
95
+ ### Development install
96
+
97
+ To work on APSG itself, clone the repository and install it in editable mode with all extras
98
+ and development tools:
99
+
100
+ ```sh
101
+ git clone https://github.com/ondrolexa/apsg.git
102
+ cd apsg
103
+ uv sync --all-extras --dev
104
+ ```
105
+
106
+ Run the test suite with `uv run pytest`.
107
+
108
+ ### With pip
109
+
110
+ Create and activate a virtual environment. On Linux and macOS:
111
+
112
+ ```sh
113
+ python -m venv .venv
114
+ source .venv/bin/activate
115
+ ```
116
+
117
+ On Windows (Command Prompt or PowerShell):
118
+
119
+ ```powershell
120
+ python -m venv .venv
121
+ .venv\Scripts\activate
122
+ ```
123
+
124
+ > **Note:** On Windows, PowerShell may refuse to run the activation script. To allow it for
125
+ > the current user, run:
126
+ >
127
+ > ```powershell
128
+ > Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
129
+ > ```
130
+
131
+ Install the latest stable release from PyPI:
132
+
133
+ ```sh
134
+ pip install apsg
135
+ ```
136
+
137
+ To include JupyterLab and [openpyxl](https://openpyxl.readthedocs.io/) (needed to read Excel files), use the `lab` extra:
138
+
139
+ ```sh
140
+ pip install "apsg[lab]"
141
+ ```
142
+
143
+ To upgrade an existing installation without touching its dependencies:
144
+
145
+ ```sh
146
+ pip install --upgrade --no-deps apsg
147
+ ```
148
+
149
+ To install the master branch from GitHub:
150
+
151
+ ```sh
152
+ pip install git+https://github.com/ondrolexa/apsg.git
153
+ ```
154
+
155
+ ### With conda or mamba
156
+
157
+ If you already use conda or mamba, add the `conda-forge` channel and create an environment
158
+ with APSG:
159
+
160
+ ```sh
161
+ conda config --add channels conda-forge
162
+ conda create -n apsg python apsg jupyterlab
163
+ ```
164
+
165
+ or with mamba:
166
+
167
+ ```sh
168
+ mamba create -n apsg python apsg jupyterlab
169
+ ```
170
+
171
+ To install APSG into an existing environment, run `conda install apsg` (or
172
+ `mamba install apsg`).
173
+
174
+ ### Current release
175
+
176
+ | Name | Downloads | Version | Platforms |
177
+ | --- | --- | --- | --- |
178
+ | [![Conda Recipe](https://img.shields.io/badge/recipe-apsg-green.svg)](https://anaconda.org/conda-forge/apsg) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/apsg.svg)](https://anaconda.org/conda-forge/apsg) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/apsg.svg)](https://anaconda.org/conda-forge/apsg) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/apsg.svg)](https://anaconda.org/conda-forge/apsg) |
179
+
180
+ ## Documentation
181
+
182
+ Explore all features of APSG in the [documentation](https://apsg.readthedocs.org).
183
+
184
+ ## Contributing
185
+
186
+ Most discussion happens on [GitHub](https://github.com/ondrolexa/apsg). Feel free to open [an issue](https://github.com/ondrolexa/apsg/issues/new) or comment on any open issue or pull request. See [CONTRIBUTING.md](https://github.com/ondrolexa/apsg/blob/master/CONTRIBUTING.md) for more details.
187
+
188
+ ## Donate
189
+
190
+ 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.
191
+
192
+ [![Donate via PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=QTYZWVUNDUAH8&item_name=APSG+development+donation&currency_code=EUR&source=url)
193
+
194
+ ## License
195
+
196
+ 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](https://github.com/ondrolexa/apsg/blob/master/LICENSE) file.
@@ -18,8 +18,8 @@ classifiers = [
18
18
  dependencies = ["numpy", "matplotlib>=3.9", "scipy", "sqlalchemy", "pandas", "pygeomag"]
19
19
 
20
20
  [project.optional-dependencies]
21
- lab = ["jupyterlab"]
22
- tests = ["pytest", "pytest-cov"]
21
+ lab = ["jupyterlab", "openpyxl"]
22
+ tests = ["pytest", "pytest-cov", "pytest-xdist"]
23
23
  docs = [
24
24
  "sphinx>=7.0",
25
25
  "shibuya",
@@ -49,9 +49,14 @@ build-backend = "setuptools.build_meta"
49
49
  [tool.setuptools.dynamic]
50
50
  version = { attr = "apsg.__version__" }
51
51
 
52
+ [tool.pytest.ini_options]
53
+ # parallel by default (pytest-xdist); use `-p no:xdist` or `-n0` to fall back to a single
54
+ # process for interactive debugging (--pdb, -s with breakpoints don't work under a worker)
55
+ addopts = ["-n", "auto"]
56
+
52
57
  [tool.ruff]
53
58
  line-length = 88
54
- target-version = "py310"
59
+ target-version = "py312"
55
60
  exclude = [".venv", "docs", ".git"]
56
61
 
57
62
  [tool.ruff.lint]
@@ -59,6 +64,8 @@ ignore = ["E731", "E741"]
59
64
 
60
65
  [tool.ruff.lint.per-file-ignores]
61
66
  "__init__.py" = ["F401"]
67
+ "src/apsg/math/_matrix.py" = ["E743"] # Matrix.I: numpy-style inverse property
68
+ "src/apsg/shell.py" = ["F403"] # from apsg import * populates the interactive shell
62
69
 
63
70
  [tool.ruff.format]
64
71
  quote-style = "double"
@@ -195,6 +195,6 @@ __all__ = (
195
195
  "velgrad2",
196
196
  )
197
197
 
198
- __version__ = "2.0.1"
198
+ __version__ = "2.0.3"
199
199
  __author__ = "Ondrej Lexa"
200
200
  __email__ = "lexa.ondrej@gmail.com"
@@ -388,6 +388,7 @@ class AppConfig(BaseConfig):
388
388
  """Top-level application configuration."""
389
389
 
390
390
  notation: str = "dd"
391
+ stress_convention: str = "geological"
391
392
  vec2geo: bool = False
392
393
  ndigits: int = 3
393
394
  figsize: tuple = (8, 6)
@@ -444,6 +445,26 @@ class AppConfig(BaseConfig):
444
445
 
445
446
  apsg_conf = AppConfig()
446
447
 
448
+ STRESS_CONVENTIONS = ("geological", "mechanical")
449
+
450
+
451
+ def stress_sign():
452
+ """Sign that maps the canonical (mechanical, tension-positive) stress matrix
453
+ to the active ``apsg_conf.stress_convention``.
454
+
455
+ Returns:
456
+ float: -1.0 for ``"geological"`` (compression positive), +1.0 for
457
+ ``"mechanical"`` (tension positive). The mapping is its own inverse.
458
+ """
459
+ convention = apsg_conf.stress_convention
460
+ if convention == "geological":
461
+ return -1.0
462
+ if convention == "mechanical":
463
+ return 1.0
464
+ raise ValueError(
465
+ f"Unknown stress_convention {convention!r}, expected one of {STRESS_CONVENTIONS}"
466
+ )
467
+
447
468
 
448
469
  @contextmanager
449
470
  def apsg_conf_context(**kwargs):
@@ -1,5 +1,7 @@
1
1
  import sys
2
2
 
3
+ import numpy as np
4
+
3
5
  from apsg.feature._container import (
4
6
  ArcSet,
5
7
  ClusterSet,
@@ -106,4 +108,10 @@ def feature_from_json(obj_json):
106
108
  else:
107
109
  args.append(arg)
108
110
  kwargs = obj_json.get("kwargs", {})
111
+ if dtype_cls in (Stress2, Stress3):
112
+ coefs = args[0]
113
+ if "stress_convention" not in obj_json:
114
+ # files written before the mechanical storage hold the geological matrix
115
+ coefs = (-np.asarray(coefs, dtype=float)).tolist()
116
+ return dtype_cls._from_canonical(coefs, **kwargs)
109
117
  return dtype_cls(*args, **kwargs)