Skip to main content

SKHASH

Python package for earthquake focal mechanism inversions.

Author: Robert Skoumal, U.S. Geological Survey | rskoumal@usgs.gov

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).

How to Use

1. Install the latest release in your virtual environment:

# If you don't want to create beachball plots:
pip install -U SKHASH

# If you do want to create beachball plots:
pip install -U 'SKHASH[plot]'

Python 3.8+ versions are supported.

2. Run SKHASH with your desired control file:

SKHASH path_to/control_file.txt

More information

Running examples

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.

  1. Download the examples folder available HERE.
  2. Unzip the folder.
  3. Navigate to the examples folder you just downloaded, e.g.: cd examples
  4. Run SKHASH with the example of your choice, e.g.: SKHASH hash1/control_file.txt

Manual

Refer to the manual or the wiki for additional information about running the code.

Fortran subroutine (completely optional)

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.

To use this Fortran routine, add the following lines to your control file:

$use_fortran
True

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:

# macOS Homebrew example
brew install gcc

# Ubuntu example
apt install gfortran

If you're using Python 3.12+, the meson and ninja packages are also needed.

pip3 install meson ninja

Note that if you are using macOS and receive an error, you may be missing the Command Line Tools package. To install:

xcode-select --install

Citation

Please cite our paper if you use anything in this project:

  • 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

Significant portions of this algorithm are based on HASH:

  • 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

  • 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

License and Disclaimer

License: This project is in the public domain.

Disclaimer: This software is preliminary or provisional and is subject to revision.

Metadata

Release files for SKHASH 1.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SKHASH 1.1.5
File Size Uploaded
skhash-1.1.5.tar.gz 58.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SKHASH 1.1.5
File Interpreter ABI Platform
skhash-1.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 123.0 kB

Release files / skhash-1.1.5.tar.gz

Download URL skhash-1.1.5.tar.gz
Size 58.6 kB
Tags Source
SHA-256 checksum
How to use checksums
309a6c768772b1ef237056154dce56ff4c87f69f014555d196942986b2553d05
BLAKE2b-256 checksum
How to use checksums
8558cea997ff5cacdbdf371d21912fde5c4943d0141e078a1e5fde3e9e97a7fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / skhash-1.1.5-py3-none-any.whl

Download URL skhash-1.1.5-py3-none-any.whl
Size 64.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e63181c02ddabf283b185c756be3aa05e6770f820fd71b609215f98eb3b019e
BLAKE2b-256 checksum
How to use checksums
143b230ec046fa38660debc431c265bce671a8a3784567056f0f86ef51c3018c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

1.1.5 This release

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page