hashpy 1.1.4.post1__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.
@@ -0,0 +1,133 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ cover/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+ local_settings.py
59
+ db.sqlite3
60
+ db.sqlite3-journal
61
+
62
+ # Flask stuff:
63
+ instance/
64
+ .webassets-cache
65
+
66
+ # Scrapy stuff:
67
+ .scrapy
68
+
69
+ # Sphinx documentation
70
+ docs/_build/
71
+
72
+ # PyBuilder
73
+ .pybuilder/
74
+ target/
75
+
76
+ # Jupyter Notebook
77
+ .ipynb_checkpoints
78
+
79
+ # IPython
80
+ #profile_default/
81
+ #ipython_config.py
82
+
83
+ # PEP 582
84
+ __pypackages__/
85
+
86
+ # Celery stuff
87
+ celerybeat-schedule
88
+ celerybeat.pid
89
+
90
+ # SageMath parsed files
91
+ *.sage.py
92
+
93
+ # Environments
94
+ .env
95
+ .venv
96
+ env/
97
+ venv/
98
+ ENV/
99
+ env.bak/
100
+ venv.bak/
101
+
102
+ # Spyder project settings
103
+ .spyderproject
104
+ .spyproject
105
+
106
+ # Rope project settings
107
+ .ropeproject
108
+
109
+ # mkdocs documentation
110
+ /site
111
+
112
+ # mypy
113
+ .mypy_cache/
114
+ .dmypy.json
115
+ dmypy.json
116
+
117
+ # Pyre type checker
118
+ .pyre/
119
+
120
+ # pytype static type analyzer
121
+ .pytype/
122
+
123
+ # Cython debug symbols
124
+ cython_debug/
125
+
126
+ # Mac DS_Store
127
+ .DS_Store
128
+
129
+ # VSCode workspace
130
+ *.code-workspace
131
+
132
+ # Saved velocity models
133
+ velocity_models/*.npz
@@ -0,0 +1,7 @@
1
+ Code of Conduct
2
+ ===============
3
+
4
+ All contributions to - and interactions surrounding - this project will abide by
5
+ the [USGS Code of Scientific Conduct][1].
6
+
7
+ [1]: https://www.usgs.gov/about/organization/science-support/science-quality-and-integrity/code-scientific-conduct
@@ -0,0 +1,16 @@
1
+ Contributing
2
+ ============
3
+
4
+ Contributions are welcome from the community. Questions can be asked on the
5
+ [issues page][1]. Before creating a new issue, please take a moment to search
6
+ and make sure a similar issue does not already exist. If one does exist, you
7
+ can comment (most simply even with just a `:+1:`) to show your support for that
8
+ issue.
9
+
10
+ If you have direct contributions you would like considered for incorporation
11
+ into the project you can [fork this repository][2] and
12
+ [submit a pull request][3] for review.
13
+
14
+ [1]: https://code.usgs.gov/esc/SKHASH/issues
15
+ [2]: https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html#create-a-fork
16
+ [3]: https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html
@@ -0,0 +1,12 @@
1
+ # Contributors
2
+
3
+ * Alicia Hotovec-Ellis
4
+
5
+ ### A special thanks to the following people for reporting bugs!
6
+
7
+ * Armaan Bhargava-Shah
8
+ * Alex Dzubay
9
+ * Tomáš Fischer
10
+ * Junhao Song
11
+
12
+ (Did I forget to add you to the list? Let me know: rskoumal@usgs.gov)
@@ -0,0 +1,11 @@
1
+ Disclaimer
2
+ ==========
3
+
4
+ This software is preliminary or provisional and is subject to revision. It is
5
+ being provided to meet the need for timely best science. The software has not
6
+ received final approval by the U.S. Geological Survey (USGS). No warranty,
7
+ expressed or implied, is made by the USGS or the U.S. Government as to the
8
+ functionality of the software and related material nor shall the fact of release
9
+ constitute any such warranty. The software is provided on the condition that
10
+ neither the USGS nor the U.S. Government shall be held liable for any damages
11
+ resulting from the authorized or unauthorized use of the software.
@@ -0,0 +1,46 @@
1
+ License
2
+ =======
3
+
4
+ Unless otherwise noted, This project is in the public domain in the United
5
+ States because it contains materials that originally came from the United
6
+ States Geological Survey, an agency of the United States Department of
7
+ Interior. For more information, see the official USGS copyright policy at
8
+ https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits
9
+
10
+ Additionally, we waive copyright and related rights in the work
11
+ worldwide through the CC0 1.0 Universal public domain dedication.
12
+
13
+
14
+ CC0 1.0 Universal Summary
15
+ -------------------------
16
+
17
+ This is a human-readable summary of the
18
+ [Legal Code (read the full text)][1].
19
+
20
+
21
+ ### No Copyright
22
+
23
+ The person who associated a work with this deed has dedicated the work to
24
+ the public domain by waiving all of his or her rights to the work worldwide
25
+ under copyright law, including all related and neighboring rights, to the
26
+ extent allowed by law.
27
+
28
+ You can copy, modify, distribute and perform the work, even for commercial
29
+ purposes, all without asking permission.
30
+
31
+
32
+ ### Other Information
33
+
34
+ In no way are the patent or trademark rights of any person affected by CC0,
35
+ nor are the rights that other persons may have in the work or in how the
36
+ work is used, such as publicity or privacy rights.
37
+
38
+ Unless expressly stated otherwise, the person who associated a work with
39
+ this deed makes no warranties about the work, and disclaims liability for
40
+ all uses of the work, to the fullest extent permitted by applicable law.
41
+ When using or citing the work, you should not imply endorsement by the
42
+ author or the affirmer.
43
+
44
+
45
+
46
+ [1]: https://creativecommons.org/publicdomain/zero/1.0/legalcode
@@ -0,0 +1,116 @@
1
+ Metadata-Version: 2.5
2
+ Name: hashpy
3
+ Version: 1.1.4.post1
4
+ Summary: SKHASH (USGS) for earthquake focal mechanism inversions, packaged with NumPy 2 support
5
+ Project-URL: Homepage, https://code.usgs.gov/esc/SKHASH
6
+ Project-URL: Issues, https://code.usgs.gov/esc/SKHASH/-/issues
7
+ Author-email: "Robert J. Skoumal" <rskoumal@usgs.gov>
8
+ Maintainer: AI4EPS
9
+ License-Expression: CC0-1.0
10
+ License-File: LICENSE.md
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.8
14
+ Requires-Dist: meson; python_version >= '3.12'
15
+ Requires-Dist: ninja; python_version >= '3.12'
16
+ Requires-Dist: numpy
17
+ Requires-Dist: pandas
18
+ Provides-Extra: plot
19
+ Requires-Dist: matplotlib; extra == 'plot'
20
+ Description-Content-Type: text/markdown
21
+
22
+ # hashpy
23
+
24
+ `hashpy` is [SKHASH](https://code.usgs.gov/esc/SKHASH) 1.1.4 by Robert J. Skoumal (U.S. Geological Survey), packaged unchanged except for NumPy 2 support (two lines: size-1 arrays to scalars in `mech_probability`, `np.isin` for `np.in1d`; the `numpy<2.0` pin lifted). All nine bundled examples give the same output under NumPy 1.26 and 2.x.
25
+
26
+ ```
27
+ pip install hashpy
28
+ hashpy path_to/control_file.txt
29
+ ```
30
+
31
+ It imports as `hashpy`, so it does not clash with the official `SKHASH` package; use the original for anything else. Please cite Skoumal, Hardebeck & Shearer (2024). Public domain (CC0), as the original.
32
+
33
+ ---
34
+
35
+ # SKHASH
36
+
37
+ Python package for earthquake focal mechanism inversions.
38
+
39
+ Author: Robert Skoumal, U.S. Geological Survey | rskoumal@usgs.gov
40
+
41
+ This project contains Python code to compute focal mechanism solutions using first-motion polarities (traditional, consensus, and/or imputed) and S/P ratios (traditional and/or consensus).
42
+
43
+ ## How to Use
44
+ #### 1. Install the latest release in your virtual environment:
45
+ <pre>
46
+ # If you <i><b>don't</b></i> want to create beachball plots:
47
+ pip install -U SKHASH
48
+
49
+ # If you <i><b>do</b></i> want to create beachball plots:
50
+ pip install -U 'SKHASH[plot]'
51
+ </pre>
52
+ Python 3.8+ versions are supported.
53
+
54
+ #### 2. Run SKHASH with your desired control file:
55
+ ```
56
+ SKHASH path_to/control_file.txt
57
+ ```
58
+
59
+ ## More information
60
+ ### Running examples
61
+ A variety of examples are provided in the repository. It's recommended you play around with these examples to learn about some of the features.
62
+ 1. Download the examples folder available [HERE](https://code.usgs.gov/esc/SKHASH/-/archive/main/SKHASH-main.zip?path=examples).
63
+ 2. Unzip the folder.
64
+ 3. Navigate to the examples folder you just downloaded, e.g.:
65
+ `
66
+ cd examples
67
+ `
68
+ 4. Run SKHASH with the example of your choice, e.g.:
69
+ `SKHASH hash1/control_file.txt`
70
+
71
+ ### Manual
72
+ Refer to the [manual](https://code.usgs.gov/esc/SKHASH/-/blob/main/SKHASH_manual.pdf) or the [wiki](https://code.usgs.gov/esc/SKHASH/-/wikis/home) for additional information about running the code.
73
+
74
+ ## Fortran subroutine (completely optional)
75
+ By default, SKHASH will compute mechanisms using the Python routine. However, to speed up the grid search, you can choose to take advantage of an included Fortran subroutine. If the Python C/API wrapper does not already exist, SKHASH will automatically create the wrapper with the user's permission when the Fortran subroutine is used.
76
+
77
+ To use this Fortran routine, add the following lines to your control file:
78
+ ```
79
+ $use_fortran
80
+ True
81
+ ```
82
+
83
+ A fortran compiler will be needed on the user's machine. If one does not exist, here are some examples on how to get one:
84
+ ```
85
+ # macOS Homebrew example
86
+ brew install gcc
87
+
88
+ # Ubuntu example
89
+ apt install gfortran
90
+ ```
91
+
92
+ If you're using Python 3.12+, the [meson](https://pypi.org/project/meson-python) and [ninja](https://pypi.org/project/ninja) packages are also needed.
93
+ ```
94
+ pip3 install meson ninja
95
+ ```
96
+
97
+ Note that if you are using macOS and receive an error, you may be missing the Command Line Tools package. To install:
98
+ ```
99
+ xcode-select --install
100
+ ```
101
+
102
+ ## Citation
103
+ Please cite our paper if you use anything in this project:
104
+
105
+ - Skoumal, R.J., Hardebeck, J.L., Shearer, P.M. (2024). SKHASH: A Python package for computing earthquake focal mechanisms. _Seismological Research Letters_, 95(4), 2519-2526. https://doi.org/10.1785/0220230329
106
+
107
+ Significant portions of this algorithm are based on [HASH](https://www.usgs.gov/node/279393):
108
+
109
+ - Hardebeck, J.L., & Shearer, P.M. (2002). A new method for determining first-motion focal mechanisms. _Bulletin of the Seismological Society of America_, 92(6), 2264-2276. https://doi.org/10.1785/0120010200
110
+
111
+ - Hardebeck, J.L., & Shearer, P.M. (2003). Using S/P amplitude ratios to constrain the focal mechanisms of small earthquakes. _Bulletin of the Seismological Society of America_, 93(6), 2434-2444. https://doi.org/10.1785/0120020236
112
+
113
+ ## License and Disclaimer
114
+ [License](https://code.usgs.gov/esc/SKHASH/-/blob/main/LICENSE.md): This project is in the public domain.
115
+
116
+ [Disclaimer](https://code.usgs.gov/esc/SKHASH/-/blob/main/DISCLAIMER.md): This software is preliminary or provisional and is subject to revision.
@@ -0,0 +1,95 @@
1
+ # hashpy
2
+
3
+ `hashpy` is [SKHASH](https://code.usgs.gov/esc/SKHASH) 1.1.4 by Robert J. Skoumal (U.S. Geological Survey), packaged unchanged except for NumPy 2 support (two lines: size-1 arrays to scalars in `mech_probability`, `np.isin` for `np.in1d`; the `numpy<2.0` pin lifted). All nine bundled examples give the same output under NumPy 1.26 and 2.x.
4
+
5
+ ```
6
+ pip install hashpy
7
+ hashpy path_to/control_file.txt
8
+ ```
9
+
10
+ It imports as `hashpy`, so it does not clash with the official `SKHASH` package; use the original for anything else. Please cite Skoumal, Hardebeck & Shearer (2024). Public domain (CC0), as the original.
11
+
12
+ ---
13
+
14
+ # SKHASH
15
+
16
+ Python package for earthquake focal mechanism inversions.
17
+
18
+ Author: Robert Skoumal, U.S. Geological Survey | rskoumal@usgs.gov
19
+
20
+ This project contains Python code to compute focal mechanism solutions using first-motion polarities (traditional, consensus, and/or imputed) and S/P ratios (traditional and/or consensus).
21
+
22
+ ## How to Use
23
+ #### 1. Install the latest release in your virtual environment:
24
+ <pre>
25
+ # If you <i><b>don't</b></i> want to create beachball plots:
26
+ pip install -U SKHASH
27
+
28
+ # If you <i><b>do</b></i> want to create beachball plots:
29
+ pip install -U 'SKHASH[plot]'
30
+ </pre>
31
+ Python 3.8+ versions are supported.
32
+
33
+ #### 2. Run SKHASH with your desired control file:
34
+ ```
35
+ SKHASH path_to/control_file.txt
36
+ ```
37
+
38
+ ## More information
39
+ ### Running examples
40
+ A variety of examples are provided in the repository. It's recommended you play around with these examples to learn about some of the features.
41
+ 1. Download the examples folder available [HERE](https://code.usgs.gov/esc/SKHASH/-/archive/main/SKHASH-main.zip?path=examples).
42
+ 2. Unzip the folder.
43
+ 3. Navigate to the examples folder you just downloaded, e.g.:
44
+ `
45
+ cd examples
46
+ `
47
+ 4. Run SKHASH with the example of your choice, e.g.:
48
+ `SKHASH hash1/control_file.txt`
49
+
50
+ ### Manual
51
+ Refer to the [manual](https://code.usgs.gov/esc/SKHASH/-/blob/main/SKHASH_manual.pdf) or the [wiki](https://code.usgs.gov/esc/SKHASH/-/wikis/home) for additional information about running the code.
52
+
53
+ ## Fortran subroutine (completely optional)
54
+ By default, SKHASH will compute mechanisms using the Python routine. However, to speed up the grid search, you can choose to take advantage of an included Fortran subroutine. If the Python C/API wrapper does not already exist, SKHASH will automatically create the wrapper with the user's permission when the Fortran subroutine is used.
55
+
56
+ To use this Fortran routine, add the following lines to your control file:
57
+ ```
58
+ $use_fortran
59
+ True
60
+ ```
61
+
62
+ A fortran compiler will be needed on the user's machine. If one does not exist, here are some examples on how to get one:
63
+ ```
64
+ # macOS Homebrew example
65
+ brew install gcc
66
+
67
+ # Ubuntu example
68
+ apt install gfortran
69
+ ```
70
+
71
+ If you're using Python 3.12+, the [meson](https://pypi.org/project/meson-python) and [ninja](https://pypi.org/project/ninja) packages are also needed.
72
+ ```
73
+ pip3 install meson ninja
74
+ ```
75
+
76
+ Note that if you are using macOS and receive an error, you may be missing the Command Line Tools package. To install:
77
+ ```
78
+ xcode-select --install
79
+ ```
80
+
81
+ ## Citation
82
+ Please cite our paper if you use anything in this project:
83
+
84
+ - Skoumal, R.J., Hardebeck, J.L., Shearer, P.M. (2024). SKHASH: A Python package for computing earthquake focal mechanisms. _Seismological Research Letters_, 95(4), 2519-2526. https://doi.org/10.1785/0220230329
85
+
86
+ Significant portions of this algorithm are based on [HASH](https://www.usgs.gov/node/279393):
87
+
88
+ - Hardebeck, J.L., & Shearer, P.M. (2002). A new method for determining first-motion focal mechanisms. _Bulletin of the Seismological Society of America_, 92(6), 2264-2276. https://doi.org/10.1785/0120010200
89
+
90
+ - Hardebeck, J.L., & Shearer, P.M. (2003). Using S/P amplitude ratios to constrain the focal mechanisms of small earthquakes. _Bulletin of the Seismological Society of America_, 93(6), 2434-2444. https://doi.org/10.1785/0120020236
91
+
92
+ ## License and Disclaimer
93
+ [License](https://code.usgs.gov/esc/SKHASH/-/blob/main/LICENSE.md): This project is in the public domain.
94
+
95
+ [Disclaimer](https://code.usgs.gov/esc/SKHASH/-/blob/main/DISCLAIMER.md): This software is preliminary or provisional and is subject to revision.
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "hashpy"
7
+ version = "1.1.4.post1"
8
+ authors = [
9
+ { name="Robert J. Skoumal", email="rskoumal@usgs.gov" },
10
+ ]
11
+ maintainers = [
12
+ { name="AI4EPS" },
13
+ ]
14
+ description = "SKHASH (USGS) for earthquake focal mechanism inversions, packaged with NumPy 2 support"
15
+ readme = "README.md"
16
+ requires-python = ">=3.8"
17
+ dependencies = [
18
+ "numpy",
19
+ "pandas",
20
+ "meson; python_version>='3.12'",
21
+ "ninja; python_version>='3.12'",
22
+ ]
23
+ classifiers = [
24
+ "Programming Language :: Python :: 3",
25
+ "Operating System :: OS Independent",
26
+ ]
27
+ license = "CC0-1.0"
28
+ license-files = ["LICENSE.md"]
29
+
30
+ [project.optional-dependencies]
31
+ plot=[
32
+ "matplotlib",
33
+ ]
34
+
35
+ [tool.hatch.build]
36
+ exclude = [
37
+ "examples",
38
+ "code.json",
39
+ "requirements.txt",
40
+ "*.pdf",
41
+ "*.so",
42
+ ]
43
+
44
+ [project.scripts]
45
+ hashpy = "hashpy.SKHASH:main"
46
+
47
+ [project.urls]
48
+ Homepage = "https://code.usgs.gov/esc/SKHASH" # the original
49
+ Issues = "https://code.usgs.gov/esc/SKHASH/-/issues"