Skip to main content

PhaseNet-PyTorch

PyTorch implementation of PhaseNet for seismic and DAS phase picking, event detection, and polarity classification.

Models

Model Features Data Type
phasenet Phase (P/S) picking Seismic 3-component
phasenet_tf Phase picking + STFT spectrogram Seismic 3-component
phasenet_plus Phase + polarity + event detection Seismic 3-component
phasenet_tf_plus Phase + polarity + event detection + STFT Seismic 3-component
phasenet_das Phase picking DAS single-channel
phasenet_das_plus Phase + event detection DAS single-channel

The _tf variants add a Short-Time Fourier Transform (STFT) branch that extracts frequency features alongside the temporal waveform, improving performance on noisy data.

Prediction

CEED (Seismic) Prediction

# Demo: process a few events with plots
python scripts/predict_ceed.py --n-events 5

# Process all days for a year (saves parquets to results/ceed/)
python scripts/predict_ceed.py --all --year 2025 --output-dir results/ceed

Output: one parquet per day file in results/ceed/{region}/, with columns: event_id, station_id, waveform_index, origin_id, origin_index, origin_time, phase_index, phase_time, phase_score, phase_type, phase_polarity

DAS Prediction

# Predict with base PhaseNet on a HuggingFace subset
python scripts/predict_das.py --subset arcata --plot

# Predict with a trained DAS model on local data
python scripts/predict_das.py \
    --data-dir data/quakeflow_das/arcata/data \
    --model-type phasenet_das_plus \
    --checkpoint output/train_das_arcata/checkpoint.pth \
    --output-dir results/das/train_das_arcata/arcata \
    --no-ema --plot

# Predict from a file list
python scripts/predict_das.py \
    --file-list file_list.txt \
    --model-type phasenet_das_plus \
    --checkpoint output/model.pth \
    --plot

# Multi-GPU prediction
bash scripts/predict_das.sh phasenet_das_plus arcata 8 output/model.pth

Output: one parquet per event in results/das/{model_name}/{subset}/, with columns: event_id, channel_index, origin_id, origin_index, origin_time, phase_index, phase_time, phase_score, phase_type, dt_s, ps_center, ps_interval

By default, picks are associated using P-S pairing. Use --use-event-head to associate via the model's event detection head instead.

Training

CEED (Seismic) Training

python train.py \
    --model phasenet_plus \
    --dataset-type ceed \
    --label-path results/ceed \
    --nx 16 \
    --max-iters 100000 \
    --batch-size 8 \
    --workers 4 \
    --lr 3e-4 \
    --eval-interval 5000 \
    --output-dir output/train_ceed

DAS Training

# Using the training script
bash scripts/train_das.sh 0 arcata v26

# Or directly
python train.py \
    --model phasenet_das_plus \
    --dataset-type das \
    --data-path data/quakeflow_das/arcata/data \
    --label-path results/das/phasenet/arcata/picks \
    --label-list results/das/phasenet/arcata/labels.txt \
    --nx 2048 --nt 4096 \
    --num-patch 16 \
    --max-iters 50000 \
    --batch-size 2 --workers 8 \
    --lr 1e-4 --weight-decay 0.01 \
    --model-ema --model-ema-decay 0.999 \
    --eval-interval 1000 --save-interval 1000 \
    --output-dir output/train_das_arcata_v26

Key Training Options

Option Description Default
--num-patch N Random crops per DAS sample (amortizes IO) 2
--model-ema Enable exponential moving average off
--gradient-accumulation-steps N Accumulate gradients for larger effective batch 1
--clip-grad-norm V Gradient clipping 1.0
--compile Enable torch.compile off
--resume --checkpoint PATH Resume from checkpoint -
--reset-lr Reset LR schedule when resuming off

Semi-supervised Training

Iterative self-training pipeline for DAS: predict → train on predictions → predict with new model → repeat.

# Start from PhaseNet (train DAS model from scratch)
bash scripts/semisupervised_das.sh arcata 5 0

# Start from a pretrained DAS model
bash scripts/semisupervised_das.sh arcata 5 0 phasenet_das output/train_das_v26/checkpoint.pth

Arguments: [subset] [num_iterations] [gpu] [start_from] [checkpoint]

  • From phasenet: iteration 0 predicts with PhaseNet, iteration 1 trains from scratch (10k steps, warmup), iterations 2+ continue (1k steps, no warmup)
  • From phasenet_das: iteration 0 predicts with pretrained DAS model, iterations 1+ continue (1k steps, no warmup)

Results are saved to results/semisupervised_das/ and checkpoints to output/semisupervised_das_v{N}/.

Metadata

Release files for phasenet 0.2.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 phasenet 0.2.5
File Size Uploaded Provenance Actions
phasenet-0.2.5.tar.gz 174.2 kB Without provenance Details for phasenet-0.2.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for phasenet 0.2.5
File Interpreter ABI Platform Actions
phasenet-0.2.5-py3-none-any.whl Python 3 none any Details for phasenet-0.2.5-py3-none-any.whl

Total release size: 308.9 kB

Release files / phasenet-0.2.5.tar.gz

Download URL phasenet-0.2.5.tar.gz
Size 174.2 kB
Tags Source
SHA-256 checksum
How to use checksums
efaeb31b11d9416678d7b50da73b83182e90c8d125fffb99e7b696c86d31ad4f
BLAKE2b-256 checksum
How to use checksums
d8e76f93f5f3390736d1ef6dc53892abda069fbe0f68479bf4f08dc9feaa4a85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / phasenet-0.2.5-py3-none-any.whl

Download URL phasenet-0.2.5-py3-none-any.whl
Size 134.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a053dcea952f40e96d9acbb9ea0f3592430192d8402e03c53d3dcdc452b8b3a5
BLAKE2b-256 checksum
How to use checksums
884c363ff5f0d2dea4c358874d0a736f3e474f6e6a0c101b5100c791232db0eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Security for phasenet 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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