Skip to content

xtyangpsp/SRNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SRNet

HVSR site response-based shear-wave velocity estimation.

plot1

Package Components

Python package modules

  • srnet/synthetics.py: synthetic HVSR generation
  • srnet/train.py: model training
  • srnet/infer.py: inference on synthetic or real HVSR curves
  • srnet/metrics.py: validation metrics
  • srnet/plotting.py: plotting utilities
  • srnet/convert.py: conversion from HVSRData to SRNet NPZ input format
  • srnet/utils.py: common utility functions.

Command-line wrappers/interface

  • srnet/cli/srnet_synthetics.py
  • srnet/cli/srnet_train_mlp.py
  • srnet/cli/srnet_infer.py
  • srnet/cli/srnet_evaluate.py
  • srnet/cli/hvsrdata_to_srnet_npz.py

Example notebooks

  • examples/srnet_workflow.ipynb: end-to-end workflow
  • examples/srnet_metrics_viz.ipynb: post-training metrics and proposal figures

Installation

1. Create a conda environment

From the SRNet repository root:

conda create -n srnet python=3.12 jupyter
conda activate srnet

2. Install the package

Upgrade packaging tools and install SRNet in editable mode (SRNetRoot is the root directory where this package is located after downloading or cloning):

cd $SRNetRoot
pip install -e .

This installs the srnet Python package. The command-line scripts are installed as console commands from srnet.cli.

Core dependencies installed by the package include:

  • numpy
  • matplotlib
  • scipy
  • disba
  • torch
  • jupyter
  • ipykernel

You can create jupyter kernel, after activating the conda environment:

$ pip install --user ipykernel
$ python -m ipykernel install --user --name=srnet

Simple Test Run

A minimal smoke test is to generate a small synthetic dataset, train a short MLP run, and confirm that validation outputs are created.

Step 1. Generate a small synthetic dataset

srnet-synthetics \
  --n-samples 1000 \
  --n-layers 1 \
  --outfile examples/test_synthetics.npz \
  --qc-figure examples/test_synthetics_qc.png

Step 2. Train a short test model

srnet-train-mlp \
  --data examples/test_synthetics.npz \
  --epochs 5 \
  --batch-size 128 \
  --outdir examples/test_mlp_results

Step 3. Check expected outputs

After the test run, you should see files such as:

  • examples/test_mlp_results/best_model.pt
  • examples/test_mlp_results/loss_curve.png
  • examples/test_mlp_results/validation_predictions.npz
  • examples/test_mlp_results/validation_profiles.png
  • examples/test_mlp_results/validation_profile_metrics.npz

About

Characterize seismic site responses with deep learning

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors