phasehunter
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.1%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: crimeacs
- License: gpl-3.0
- Language: Jupyter Notebook
- Default Branch: main
- Size: 401 KB
Statistics
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
PhaseHunter: Quickstart Guide

Talk to PhaseHunter
Before you begin, we suggest you to talk to PhaseHunter - a friendly assistant that can answer any of your questions about this code as well as write code snippets. E.g. try asking it:
text
How to detect earthquakes in the radius of 1 mile from 35N -117S on 2019-05-01 from 2 am to 4 am.
How to install?
1. Install Anaconda or Miniconda: If you haven't installed Anaconda or Miniconda, download and install it from [Anaconda's official website](https://www.anaconda.com/download) or [Miniconda's official website](https://docs.conda.io/projects/miniconda/en/latest/) respectively.
2. Create a New Environment: Open a terminal or Anaconda prompt and run the following command to create a new environment named phasehunter (you can choose a different name if you want):
```bash
conda create --name phasehunter python=3.10
```
3. Activate the New Environment:
```bash
conda activate phasehunter
```
4. Install PyTorch and torchvision: Based on your system and CUDA version, install PyTorch and torchvision. Instructions can be found on the [PyTorch official site](https://pytorch.org/get-started/locally/). For example, for Linux use:
```bash
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
```
5. Install Required Libraries:
```bash
conda install numpy pandas scikit-learn scipy tqdm
pip install obspy pytorch-lightning lightning wandb
pip install git+https://github.com/nikitadurasov/masksembles
```
6. Install PhaseHunter
```bash
pip install git+https://github.com/crimeacs/PhaseHunter
```
7. Final Notes:
* Remember to activate your environment (`conda activate phasehunter`) every time you work on this project.
* It's a good idea to periodically update the packages to get the latest bug fixes and improvements.
* If you encounter any compatibility issues or errors during installation, they might be due to version conflicts. In that case, you'll need to identify the versions that are compatible and specify them during installation.
You should now have a working conda environment with the necessary packages for your project!
How to use PhaseHunter
PhaseHunter is designed to be straightforward to use, even for those new to seismic data processing. Here's a step-by-step guide:
- Load the Pre-trained Model:
First, import PhaseHunter
python import torch from phasehunter.model import PhaseHunter
Then load the pre-trained PhaseHunter model from a checkpoint (if on Linux):
```python
Auto select device, note that PhaseHunter works best on GPU
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = PhaseHunter.loadfromcheckpoint('ckpts/30sSTEADdecay-epoch=196.ckpt') model = model.eval().to(device) ```
If on Mac, please use:
```python device = torch.device("mps") model = PhaseHunter.load_from_checkpoint('ckpts/30s_STEAD_decay-epoch=196.ckpt') model = model.eval().float().to(device) ```At this time, 2 pre-trained models are available:
ckpts/30s_STEAD_decay-epoch=196.ckpt- 30s version of PhaseHunter trained on STEAD dataset for 200 epochsckpts/30s_ETHZ_decay-epoch=187.ckpt- 30s version of PhaseHunter trained on ETHZ dataset for 200 epochs
Please download them from HuggingFace Hub
- Download or use your own waveform data, e.g.:
python
from obspy import read
st = read('path_to_your_waveform_data')
predictions = model.process_continuous_waveform(st)
print(predictions)
process_continuous_waveform works with 3 channel Obspy streams of any length
For a more comprehansive tutorial try PhaseHunter in Google Colab
How to train PhaseHunter
For training your own version of PhaseHunter on e.g. STEAD dataset, please follow following steps:
- Download data of your interest (e.g. from SeisBench)
- Convert it to the format required by PhaseHunter using
training/convert_STEAD.pyscript - Train on converted data using
training/train_STEAD.pyscript
Evaluation
We provide evaluation pipeline used for the JGR paper in a separate notebook notebooks/PhaseHunter_EVAL.ipynb
Contact
Send me an email if you tryied Google Colab and already talked with a Bot and still need help: anovosel@stanford.edu
Owner
- Name: Artemii Novoselov
- Login: crimeacs
- Kind: user
- Location: Stanford
- Company: Stanford
- Website: https://t.me/nn_for_science
- Twitter: EarthML1
- Repositories: 3
- Profile: https://github.com/crimeacs
Postdoctoral Researcher @ Stanford University
Citation (CITATION.cff)
cff-version: 1.1.0 message: "If you use this software, please cite it as below." authors: - family-names: Artemii given-names: Novoselov orcid: https://orcid.org/0000-0002-4079-0807 title: PhaseHunter - deep learning tool for onset phase time picking with uncertainties version: v0.2 date-released: 2023-10-13