File size: 2,475 Bytes
d66eb4b
0f47e44
 
 
 
8d5a487
 
d66eb4b
 
0f47e44
 
d66eb4b
 
0f47e44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8d5a487
 
 
 
0f47e44
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
title: Vs From Dispersion Curve
emoji: 🌍
colorFrom: blue
colorTo: red
sdk: gradio
sdk_version: "5.24.0"
app_file: app.py
pinned: false
license: mit
short_description: 1-D shear-wave velocity from a Rayleigh phase-velocity curve
---

# Shear-wave velocity from a phase-velocity dispersion curve

Inverts a fundamental-mode Rayleigh **phase-velocity** dispersion curve (the
SASW/MASW observable) for a 70-layer 1-D Vs profile in a single forward pass —
no initial model, no iterative inversion.

The model is a physically-coded transformer encoder–decoder (2.44 M
parameters): each dispersion pick is a token carrying its physical period, and
each output depth is a query token carrying its physical depth, reading the
period tokens by masked cross-attention. Band-limited and gappy curves are
handled natively, with no interpolation.

Trained on **OpenSWI-shallow** (22 M curve/profile pairs). Test accuracy:
0.151 km/s full-profile RMSE / 6.0 % MAPE / R² 0.949 on 50 k held-out samples;
38 m/s MAE versus the tomographic reference on 5,297 real Long Beach curves.

## Usage

- Pick a built-in example, upload a CSV (period **or** frequency + phase
  velocity), or paste values in the sidebar.
- **Site scale factor k**: the elastodynamic problem is scale-invariant, so a
  high-frequency engineering curve (e.g. MASW at a 30 m site) is inverted by
  multiplying its periods by k into the model's 0.2–10 s training band and
  dividing the output depths by k. Velocities are never rescaled — the
  ≈ 0.3–4.5 km/s support applies at every scale.
- Gray bands in the profile plot mark depths outside the range the input band
  physically constrains (wavelength heuristic ≈ ⅓·λ_min to ½·λ_max); treat the
  profile there as extrapolation.
- The predicted profile can be downloaded as CSV.

## Scope

Trained on 0.2–10 s periods, 0–2.76 km depth, Vs ≈ 0.3–4.5 km/s. Curves
outside this envelope — e.g. soft-soil sites with Vs < 0.3 km/s — are out of
distribution.

## Files

- `app.py` — Gradio interface (Gradio SDK; also compatible with ZeroGPU
  hardware, though the model runs on CPU — it needs no GPU)
- `app_streamlit.py` — equivalent Streamlit interface, kept for local use
  (`streamlit run app_streamlit.py`)
- `model.py` — standalone model definition (depth-query encoder–decoder)
- `checkpoints/best_model.pth` — trained weights (v4 finalist)
- `assets/` — period/depth grids and example curves from the test split