Skip to content

Commit 5247081

Browse files
committed
Initial commit
0 parents  commit 5247081

29 files changed

+8561
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
.DS_Store
2+
.idea/
3+
4+
### Local dir stuff
5+
article_figures/
6+
dev/
7+
notes/
8+
my_tests/
9+
10+
11+
# Created by https://www.toptal.com/developers/gitignore/api/python
12+
# Edit at https://www.toptal.com/developers/gitignore?templates=python
13+
14+
### Python ###
15+
# Byte-compiled / optimized / DLL files
16+
__pycache__/
17+
*.py[cod]
18+
*$py.class
19+
20+
# C extensions
21+
*.so
22+
23+
# Distribution / packaging
24+
.Python
25+
build/
26+
develop-eggs/
27+
dist/
28+
downloads/
29+
eggs/
30+
.eggs/
31+
lib/
32+
lib64/
33+
parts/
34+
sdist/
35+
var/
36+
wheels/
37+
share/python-wheels/
38+
*.egg-info/
39+
.installed.cfg
40+
*.egg
41+
MANIFEST
42+
43+
# PyInstaller
44+
# Usually these files are written by a python script from a template
45+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
46+
*.manifest
47+
*.spec
48+
49+
# Installer logs
50+
pip-log.txt
51+
pip-delete-this-directory.txt
52+
53+
# Unit test / coverage reports
54+
htmlcov/
55+
.tox/
56+
.nox/
57+
.coverage
58+
.coverage.*
59+
.cache
60+
nosetests.xml
61+
coverage.xml
62+
*.cover
63+
*.py,cover
64+
.hypothesis/
65+
.pytest_cache/
66+
cover/
67+
68+
# Translations
69+
*.mo
70+
*.pot
71+
72+
# Django stuff:
73+
*.log
74+
local_settings.py
75+
db.sqlite3
76+
db.sqlite3-journal
77+
78+
# Flask stuff:
79+
instance/
80+
.webassets-cache
81+
82+
# Scrapy stuff:
83+
.scrapy
84+
85+
# Sphinx documentation
86+
docs/_build/
87+
88+
# PyBuilder
89+
.pybuilder/
90+
target/
91+
92+
# Jupyter Notebook
93+
.ipynb_checkpoints
94+
95+
# IPython
96+
profile_default/
97+
ipython_config.py
98+
99+
# pyenv
100+
# For a library or package, you might want to ignore these files since the code is
101+
# intended to run in multiple environments; otherwise, check them in:
102+
# .python-version
103+
104+
# pipenv
105+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
106+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
107+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
108+
# install all needed dependencies.
109+
#Pipfile.lock
110+
111+
# poetry
112+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
113+
# This is especially recommended for binary packages to ensure reproducibility, and is more
114+
# commonly ignored for libraries.
115+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
116+
#poetry.lock
117+
118+
# pdm
119+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
120+
#pdm.lock
121+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
122+
# in version control.
123+
# https://pdm.fming.dev/#use-with-ide
124+
.pdm.toml
125+
126+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
127+
__pypackages__/
128+
129+
# Celery stuff
130+
celerybeat-schedule
131+
celerybeat.pid
132+
133+
# SageMath parsed files
134+
*.sage.py
135+
136+
# Environments
137+
.env
138+
.venv
139+
env/
140+
venv/
141+
ENV/
142+
env.bak/
143+
venv.bak/
144+
145+
# Spyder project settings
146+
.spyderproject
147+
.spyproject
148+
149+
# Rope project settings
150+
.ropeproject
151+
152+
# mkdocs documentation
153+
/site
154+
155+
# mypy
156+
.mypy_cache/
157+
.dmypy.json
158+
dmypy.json
159+
160+
# Pyre type checker
161+
.pyre/
162+
163+
# pytype static type analyzer
164+
.pytype/
165+
166+
# Cython debug symbols
167+
cython_debug/
168+
169+

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Timothy Pollard
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include *.py
2+
include *.txt
3+
recursive-include src *.py

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Pysoplot
2+
3+
**Pysoplot** is a Python library that contains basic functions and routines
4+
for geochronology. It implements some of the core functionality
5+
of the popular (and now defunct) Isoplot/Ex. software, but also
6+
includes new algorithms and routines. Pysoplot is intended to be
7+
used to build custom scripts and data processing
8+
routines in order to meet individual requirements.
9+
10+
Pysoplot includes functions for:
11+
* regressing 2-D data using the model 1, 2 and 3 algorithms popularised by Isoplot/Ex.
12+
* regressing 2-D data using the robust spine algorithm of Powell et al. (2020) and a new robust model 2 algorithm
13+
* computing weighted averages using algorithms based on classical and robust statistics
14+
* computing classical isochron and U-Pb concordia-intercept ages
15+
* plotting isochron diagrams
16+
* computing disequilibrium U-Pb ages
17+
* plotting equilibrium and disequilibriam concordia curves, age ellipses, and uncertainty envelopes
18+
19+
* computing age uncertainties using Monte Carlo methods
20+
21+
Full code documentation is coming soon!
22+
23+
## Installation
24+
25+
Run the following to install:
26+
27+
```python
28+
pip install pysoplot
29+
```
30+
31+
## Example usage
32+
```python
33+
import pysoplot as pp
34+
35+
# get Tera-Wasserburg test dataset
36+
dp = pp.data.LA0708
37+
# transform data point errors from 2 sigma to 1 sigma absolute
38+
dp = pp.transform.dp_errors(dp, 'abs2s')
39+
40+
# regress data
41+
fit = pp.regression.robust_fit(*dp, plot=True, diagram='tw')
42+
pp.misc.print_result(fit, 'Regression results')
43+
fit['fig'].show()
44+
45+
# compute Tera-Wasserburg concordia-intercept age
46+
result = pp.upb.concint_age(fit, method='Powell')
47+
print(f"age: {result['age']:.2f} +/- {result['age_95pm']:.2f}")
48+
```
49+
50+
## Acknowledgements
51+
52+
Acknowledgement of all third-party algorithms implemented in Pysoplot with links to
53+
publications will be added here very soon...
54+
55+
## License
56+
57+
Pysoplot is distributed under the MIT license.
58+
59+
## Contact
60+
61+
Timothy Pollard - [email protected]
62+
63+
64+
65+
66+

setup.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from setuptools import setup
2+
3+
with open("README.md", "r") as fh:
4+
long_description = fh.read()
5+
6+
setup(
7+
name='pysoplot',
8+
version='0.0.1',
9+
description='a Python geochronology library',
10+
license='MIT',
11+
packages=['pysoplot', 'pysoplot.uxpb'],
12+
package_dir={'': 'src'},
13+
url="https://github.com/timpol/pysoplot",
14+
author="Timothy Pollard",
15+
author_email="[email protected]",
16+
platforms="all",
17+
classifiers=[
18+
"Development Status :: 4 - Beta",
19+
"Intended Audience :: Science/Research",
20+
"License :: OSI Approved :: MIT License",
21+
"Operating System :: OS Independent",
22+
"Operating System :: MacOS :: MacOS X",
23+
"Operating System :: Microsoft :: Windows",
24+
"Operating System :: POSIX :: Linux",
25+
"Programming Language :: Python :: 3",
26+
"Programming Language :: Python :: 3 :: Only",
27+
"Programming Language :: Python :: 3.7",
28+
"Programming Language :: Python :: 3.8",
29+
"Programming Language :: Python :: 3.9",
30+
"Programming Language :: Python :: 3.10",
31+
],
32+
long_description=long_description,
33+
long_description_content_type="text/markdown",
34+
install_requires=[
35+
"numpy",
36+
"scipy",
37+
"matplotlib"
38+
],
39+
extras_require={
40+
"dev": []
41+
}
42+
)

src/pysoplot/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
A Python library for geochronology.
3+
4+
"""
5+
6+
from . import uxpb
7+
from .exceptions import ConvergenceError
8+
from . import cfg
9+
from . import concordia
10+
from . import isochron
11+
from . import misc
12+
from . import monte_carlo
13+
from . import plotting
14+
from . import regression
15+
from . import stats
16+
from . import transform
17+
from . import upb
18+
from . import useries
19+
from . import wtd_average
20+
21+
22+

0 commit comments

Comments
 (0)