A modular Python package for Multichannel Analysis of Surface Waves (MASW) β extracting dispersion curves from multichannel geophone recordings using four transform methods, with automatic peak picking and publication-quality visualization.
Author: Mersad Fathizadeh β Ph.D. Candidate, University of Arkansas
π§ mersadf@uark.edu Β· GitHub: @mersadfathizadeh1995
SW_Transform automates the complete MASW workflow β from reading SEG-2 field data through preprocessing, dispersion-curve extraction, and result export. It supports both impact (hammer) and vibrosis sources, provides an interactive GUI and a scriptable CLI, and exports results as CSV, NPZ, and PowerPoint reports.
| Module | Description |
|---|---|
| Transform Engine | Four dispersion-curve extraction methods (FK, FDBF, PS, SS) with a unified transform β analyze β plot interface |
| Preprocessing | Time-window slicing, channel reversal, downsampling, zero-padding, and result caching |
| Peak Picking | Automatic phase-velocity extraction with configurable velocity/frequency bounds and tolerance |
| MASW 2D | Sub-array extraction, shot classification, midpoint calculation, and batch processing for pseudo-2D Vs profiling |
| Data Export | Per-shot CSV, full-spectrum NPZ, combined multi-offset outputs, and optional PowerPoint reports |
| GUI | Interactive Tkinter application with array preview, waterfall plots, figure gallery, and one-click batch processing |
| CLI | single and compare subcommands for scripted/automated workflows with JSON parameter overrides |
| Method | Full Name | Approach |
|---|---|---|
| FK | FrequencyβWavenumber | Plane-wave beamforming in velocity-space via 2D FFT with automatic velocity conversion |
| FDBF | Frequency-Domain Beamformer | Cross-spectral matrix computation with optional vibrosis compensation and cylindrical steering |
| PS | Phase-Shift | Amplitude-normalized complex phase-shift summation across a velocity grid (Park et al., 1998) |
| SS | Slant-Stack (Οβp) | Time-domain linear stacking with trapezoidal integration and frequency-domain conversion (McMechan & Yedlin, 1981) |
Load SEG-2 data files, assign shot offsets, configure processing limits, and preview the array layout with normalized waterfall plots β all from a single interface.
Choose from four transform methods via a dropdown, select files to process, and launch single-method or four-method comparison runs with parallel worker support.
Fine-tune grid sizes, velocity spacing, vibrosis mode, cylindrical steering, downsampling, FFT size, and peak-picking thresholds through a dedicated settings dialog.
View frequencyβvelocity power spectra as contour plots with automatically picked dispersion curves overlaid. Browse, zoom, and export individual figures or generate PowerPoint reports.
Run all four transforms on the same shot in a single click. A 2Γ2 comparison grid highlights differences in resolution, spectral leakage, and peak-picking behavior across methods.
Configure sub-array sizes, sliding windows, and processing parameters for pseudo-2D shear-wave velocity profiling. The layout preview shows geophone positions, sub-array extent, and estimated investigation depth.
Sub-array layout visualization with midpoint marker and investigation depth estimate
- Python 3.10 or newer
- pip (included with Python)
git clone https://github.com/mersadfathizadeh1995/SW_Transform.git
cd SW_Transform# Windows
python -m venv .venv
.venv\Scripts\activate
# Linux / macOS
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtCore Dependencies
| Package | Purpose |
|---|---|
| NumPy β₯ 1.20 | Array operations and numerical computation |
| SciPy β₯ 1.7 | Signal processing and cross-spectral analysis |
| Matplotlib β₯ 3.5 | Plotting and contour visualization |
| Pillow β₯ 9.0 | Image processing for figure export and icons |
| tkinter | GUI framework (Python standard library) |
Optional
| Package | Purpose |
|---|---|
| python-pptx β₯ 0.6.21 | PowerPoint report generation |
Note:
tkinteris part of the Python standard library. On some Linux distributions you may need to install it separately:
Ubuntu/Debian:sudo apt-get install python3-tkΒ· Fedora:sudo dnf install python3-tkinterΒ· Arch:sudo pacman -S tk
python run.py- Load Data β open SEG-2
.datfiles and assign shot offsets - Configure β set velocity/frequency bounds, time window, and advanced parameters
- Preview β inspect array layout and normalized waterfall plots
- Process β run a single transform or compare all four methods
- Browse β view dispersion images in the figure gallery with zoom controls
- Export β save CSV picks, NPZ spectra, PNG figures, or PowerPoint reports
python -m sw_transform.cli.single path/to/shot.dat \
--key fk --outdir results/ --offset +5python -m sw_transform.cli.compare path/to/shot.dat \
--outdir results/ --offset +5Both CLI commands accept --source-type (hammer or vibrosis), --no-export-spectra to skip NPZ export, and --params '{...}' for JSON parameter overrides.
from sw_transform.core.service import run_single, run_compare
# Single-method processing
base, ok, fig_path = run_single({
"path": "data/shot_01.dat",
"key": "ps",
"outdir": "results/",
"offset": "+5",
"pick_vmin": 100, "pick_vmax": 2000,
"pick_fmin": 5, "pick_fmax": 80,
})
# Four-method comparison
base, ok, fig_path = run_compare({
"path": "data/shot_01.dat",
"outdir": "results/",
"offset": "+5",
}) SEG-2 Files βββΊ Preprocessing βββΊ Transform βββΊ Peak Picking βββΊ Export
(.dat) time-window FK / FDBF automatic CSV
downsample PS / SS dispersion NPZ
reverse shot curve picks PNG / PPT
- Data Collection β acquire surface-wave recordings with a geophone array; export as SEG-2
.datfiles - File Assignment β assign shot offsets and reverse flags (automatic 10-shot pattern detection or manual)
- Preprocessing β select time window, optionally reverse channels, downsample, and zero-pad
- Transform β choose one or more methods (FK, FDBF, PS, SS)
- Processing β
run_single(one method) orrun_compare(all four) orchestrates the full pipeline - Interpretation β view frequencyβvelocity contour plots with auto-picked dispersion curves
- Export β save per-shot CSVs, full spectra as NPZ, or combined multi-offset outputs
SW_Transform follows a layered, modular architecture with a central method registry:
| Layer | Location | Role |
|---|---|---|
| Core | core/ |
Orchestration API (run_single, run_compare), preprocessing cache |
| Processing | processing/ |
Transform implementations (FK, FDBF, PS, SS), method registry, SEG-2 reader |
| MASW 2D | masw2d/ |
Sub-array geometry, shot classification, batch dispersion-curve extraction |
| GUI | gui/ |
Component-based Tkinter application with modular panels |
| CLI | cli/ |
Command-line interfaces for scripted batch processing |
| IO | io/ |
File assignment, offset inference, reverse-flag detection |
| Workers | workers/ |
Async wrappers for backward compatibility |
New processing methods are added by writing a module with transform, analyze, and plot functions, then registering them in processing/registry.py:
METHODS["new_method"] = {
"label": "Display Name",
"transform": ("sw_transform.processing.new_method", "transform_func"),
"analyze": ("sw_transform.processing.new_method", "analyze_func"),
"plot": ("sw_transform.processing.new_method", "plot_func"),
"plot_kwargs": dict(cmap="jet", vmax_plot=5000),
}SW_Transform/
βββ run.py # GUI entry point
βββ requirements.txt # Python dependencies
βββ SW_Transform.bat # Windows launcher script
β
βββ SRC/
β βββ sw_transform/ # Main package
β βββ __init__.py
β βββ core/
β β βββ service.py # Central orchestration (run_single, run_compare)
β β βββ cache.py # Preprocessing cache (key generation, load/save)
β β βββ array_config.py # Array configuration utilities
β βββ processing/
β β βββ registry.py # Method registry (FK, FDBF, PS, SS)
β β βββ fk.py # FrequencyβWavenumber transform
β β βββ fdbf.py # Frequency-Domain Beamforming
β β βββ ps.py # Phase-Shift method
β β βββ ss.py # Slant-Stack (Οβp) method
β β βββ preprocess.py # Time-window, downsample, reverse, zero-pad
β β βββ seg2.py # Native SEG-2 binary reader
β β βββ vibrosis.py # Vibrosis source compensation
β βββ gui/
β β βββ simple_app.py # Main Tkinter GUI
β β βββ masw2d_tab.py # MASW 2D processing tab
β β βββ components/ # Reusable GUI panels (file tree, limits, gallery, β¦)
β β βββ utils/ # GUI helper utilities
β βββ cli/
β β βββ single.py # CLI: single-method processing
β β βββ compare.py # CLI: four-method comparison
β β βββ masw2d/ # CLI: MASW 2D commands
β βββ io/
β β βββ file_assignment.py # Shot offset and reverse-flag inference
β βββ masw2d/
β β βββ config/ # Configuration loading, validation, templates
β β βββ geometry/ # Shot classification, sub-arrays, midpoints
β β βββ extraction/ # Sub-array and vibrosis data extraction
β β βββ processing/ # Batch dispersion-curve processing
β β βββ workflows/ # Standard and vibrosis MASW workflows
β β βββ output/ # Result organization, merging, export
β βββ workers/ # Async worker wrappers (backward compatibility)
β
βββ assets/ # Application icons
βββ Pics/ # Screenshots for documentation
βββ Context/ # Repository context and design notes
| Format | Contents | Use Case |
|---|---|---|
| CSV | Frequency, phase velocity, wavelength picks | Numerical analysis, inversion input |
| NPZ | Full power spectrum + picks + metadata | Custom picking, higher-mode extraction, ML datasets |
| PNG | Dispersion contour plots with picked curves | Reports, publications |
| PowerPoint | Compiled figure report | Presentations, client deliverables |
Contributions are welcome! Please open an issue or submit a pull request.
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m "Add my feature") - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
- NumPy β numerical computation
- SciPy β signal processing and scientific computing
- Matplotlib β plotting and visualization
Copyright Β© 2025 Mersad Fathizadeh
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3.0 as published by the Free Software Foundation.
See the LICENSE file for details.






