Skip to main content

License Stars Pyversions Version Downloads Code style: black Codacy Badge Codecov Build Travis Awesome DOI

disba is a computationally efficient Python library for the modeling of surface wave dispersion that implements a subset of codes from Computer Programs in Seismology (CPS) in Python compiled just-in-time with numba. Such implementation alleviates the usual prerequisite for a Fortran compiler needed by other libraries also based on CPS (e.g., pysurf96, srfpython and PyLayeredModel) which often leads to further installation troubleshooting, especially on Windows platform.

disba aims to be lightweight and portable without compromising on the performance. For both Rayleigh-wave and Love-wave, it is significantly faster than CPS’s surf96 program compiled with f2py, noticeably for large number of layers.

perf-rayleigh

perf-love

Features

Forward modeling:

  • Compute Rayleigh-wave phase or group dispersion curves using Dunkin’s matrix or fast delta matrix algorithms,

  • Compute Love-wave phase or group dispersion curves using Thomson-Haskell method,

  • Compute Rayleigh-wave ellipticity.

Eigenfunctions and sensitivity kernels:

  • Compute Rayleigh- and Love- wave eigenfunctions,

  • Compute Rayleigh- and Love- wave phase or group velocity, and Rayleigh-wave ellipticity sensitivity kernels with respect to layer thickness, P- and S- wave velocities, and density.

Installation

The recommended way to install disba and all its dependencies is through the Python Package Index:

pip install disba[full] --user

Otherwise, clone and extract the package, then run from the package location:

pip install .[full] --user

To test the integrity of the installed package, check out this repository and run:

pytest

Documentation

Refer to the online documentation for detailed description of the API and examples.

Alternatively, the documentation can be built using Sphinx:

pip install -r doc/requirements.txt
sphinx-build -b html doc/source doc/build

Usage

The following example computes the Rayleigh- and Love- wave phase velocity dispersion curves for the 3 first modes.

import numpy as np
from disba import PhaseDispersion

# Velocity model
# thickness, Vp, Vs, density
# km, km/s, km/s, g/cm3
velocity_model = np.array([
   [10.0, 7.00, 3.50, 2.00],
   [10.0, 6.80, 3.40, 2.00],
   [10.0, 7.00, 3.50, 2.00],
   [10.0, 7.60, 3.80, 2.00],
   [10.0, 8.40, 4.20, 2.00],
   [10.0, 9.00, 4.50, 2.00],
   [10.0, 9.40, 4.70, 2.00],
   [10.0, 9.60, 4.80, 2.00],
   [10.0, 9.50, 4.75, 2.00],
])

# Periods must be sorted starting with low periods
t = np.logspace(0.0, 3.0, 100)

# Compute the 3 first Rayleigh- and Love- wave modal dispersion curves
# Fundamental mode corresponds to mode 0
pd = PhaseDispersion(*velocity_model.T)
cpr = [pd(t, mode=i, wave="rayleigh") for i in range(3)]
cpl = [pd(t, mode=i, wave="love") for i in range(3)]

# pd returns a namedtuple (period, velocity, mode, wave, type)

sample-rayleigh

sample-love

Likewise, GroupDispersion can be used for group velocity.

disba’s API is consistent across all its classes which are initialized and called in the same fashion. Thus, eigenfunctions are calculated as follow:

from disba import EigenFunction

eigf = EigenFunction(*velocity_model.T)
eigr = eigf(20.0, mode=0, wave="rayleigh")
eigl = eigf(20.0, mode=0, wave="love")

# eigf returns a namedtuple
#  - (depth, ur, uz, tz, tr, period, mode) for Rayleigh-wave
#  - (depth, uu, tt, period, mode) for Love-wave

eigen-rayleigh

eigen-love

Phase velocity sensitivity kernels (GroupSensitivity for group velocity):

from disba import PhaseSensitivity

ps = PhaseSensitivity(*velocity_model.T)
parameters = ["thickness", "velocity_p", "velocity_s", "density"]
skr = [ps(20.0, mode=0, wave="rayleigh", parameter=parameter) for parameter in parameters]
skl = [ps(20.0, mode=0, wave="love", parameter=parameter) for parameter in parameters]

# ps returns a namedtuple (depth, kernel, period, velocity, mode,wave, type, parameter)

kernel-rayleigh

kernel-love

Ellipticity and ellipticity sensitivity kernels:

from disba import Ellipticity, EllipticitySensitivity

ell = Ellipticity(*velocity_model.T)
rel = ell(t, mode=0)

# ell returns a namedtuple (period, ellipticity, mode)

es = EllipticitySensitivity(*velocity_model.T)
ek = [es(20.0, mode=0, parameter=parameter) for parameter in parameters]

# es returns a namedtuple (depth, kernel, period, velocity, mode, wave, type, parameter)

sample-ellipticity

kernel-ellipticity

Contributing

Please refer to the Contributing Guidelines to see how you can help. This project is released with a Code of Conduct which you agree to abide by when contributing.

Release files for disba 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for disba 0.7.0
File Size Uploaded
disba-0.7.0.tar.gz 25.4 kB Details

Built distribution (wheel)

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

Total release size: 53.4 kB

Release files / disba-0.7.0.tar.gz

Download URL disba-0.7.0.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
06f925d6f08dc917d992257ae089c8a5fba229f12839d91b0ce152fbd5faeb1c
BLAKE2b-256 checksum
How to use checksums
3dc12e2fd15b910cb7a916a6a560ad9daf7376247aa25516849056ba68bdfd00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / disba-0.7.0-py3-none-any.whl

Download URL disba-0.7.0-py3-none-any.whl
Size 28.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17d09ab4ad5eabf55a5d55ee6feb15b74cffa238a29bb0ee1346f7605863f91d
BLAKE2b-256 checksum
How to use checksums
66cd493c94249b86e92389acec94078d782607cc5e0f81d060ea3b7b66305ccd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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