Skip to main content

Wave propagation modules for PyTorch

Project description

Deepwave

DOI

Deepwave provides wave propagation modules for PyTorch, for applications such as seismic imaging/inversion. You can use it to perform forward modelling and backpropagation, so it can simulate wave propagation to generate synthetic data, invert for the scattering potential (RTM/LSRTM), other model parameters (FWI), initial wavefields, or source wavelets. You can use it to integrate wave propagation into a larger chain of operations with end-to-end forward and backpropagation. Deepwave enables you to easily experiment with your own objective functions or functions that generate the inputs to the propagator, letting PyTorch's automatic differentiation do the hard work of calculating how to backpropagate through them.

To install it, I recommend first installing PyTorch using the instructions on the PyTorch website. Deepwave can then be installed using

    pip install deepwave

The documentation contains examples and instructions on how to install and use Deepwave. You might also like to watch a video summary of Deepwave.

Features

  • Supports the 1D, 2D, and 3D constant density acoustic / scalar wave equation (regular and Born modelling), variable density acoustic, and elastic wave equation
  • Runs on CPUs and appropriate GPUs
  • The gradient of all outputs (final wavefields and receiver data) can be calculated with respect to the model parameters (wavespeed, scattering potential, etc.), initial wavefields, and source amplitudes
  • Uses the Pasalic and McGarry PML for accurate absorbing boundaries in the scalar wave propagator
  • Uses C-PML with the improved vacuum method free-surface method for the elastic wave propagator
  • The PML width for each edge can be set independently, allowing a reflective surface (no PML) on any side
  • Finite difference accuracy can be set by the user
  • A region of the model around the sources and receivers currently being propagated can be automatically extracted to avoid the unnecessary computation of propagation in distant parts of the model
  • Double backpropagation through the regular scalar propagator, including calculating the Hessian

Quick Example

In a few lines you can make a velocity model, propagate a wave from a source in the top left corner to a receiver in the top right, calculate an objective function, and backpropagate to obtain its gradient with respect to the velocity.

import torch
import deepwave
import matplotlib.pyplot as plt

v = 1500 * torch.ones(100, 100)
v[50:] = 2000
v.requires_grad_()

out = deepwave.scalar(
    v, grid_spacing=4, dt=0.004,
    source_amplitudes=deepwave.wavelets.ricker(25, 200, 0.004, 0.06).reshape(1, 1, -1),
    source_locations=torch.tensor([[[0, 0]]]),
    receiver_locations=torch.tensor([[[0, 99]]])
)

(out[-1]**2).sum().backward()

_, ax = plt.subplots(1, 3, figsize=(9, 3))
ax[0].imshow(v.detach())
ax[0].set_title("Velocity model")
ax[1].plot(out[-1].detach().flatten())
ax[1].set_title("Receiver data")
ax[2].imshow(v.grad.detach(), vmin=-1e-5, vmax=1e-5)
ax[2].set_title("Gradient")
plt.show()

Output from quick example

There are more examples in the documentation.

Citing

If you would like to cite Deepwave, I suggest:

@software{richardson_alan_2026,
  author       = {Richardson, Alan},
  title        = {Deepwave},
  month        = jan,
  year         = 2026,
  publisher    = {Zenodo},
  version      = {v0.0.26},
  doi          = {10.5281/zenodo.3829886},
  url          = {https://doi.org/10.5281/zenodo.3829886}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepwave-0.0.26.tar.gz (174.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

deepwave-0.0.26-py3-none-win_amd64.whl (23.0 MB view details)

Uploaded Python 3Windows x86-64

deepwave-0.0.26-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (48.0 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

deepwave-0.0.26-py3-none-macosx_11_0_arm64.whl (7.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

deepwave-0.0.26-py3-none-macosx_10_9_x86_64.whl (14.6 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

Details for the file deepwave-0.0.26.tar.gz.

File metadata

  • Download URL: deepwave-0.0.26.tar.gz
  • Upload date:
  • Size: 174.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for deepwave-0.0.26.tar.gz
Algorithm Hash digest
SHA256 19f68eddc7160ff44f766c9c49d3a505a5ed4e4b25b88abd15f84ccf9030739a
MD5 a9ff48ad1fcd2857db7ab1183e3d4d22
BLAKE2b-256 cb18d1b8dac114a0f21aa01f357bf358d9b80441bce88efbf88cd7fb8e83e43b

See more details on using hashes here.

File details

Details for the file deepwave-0.0.26-py3-none-win_amd64.whl.

File metadata

  • Download URL: deepwave-0.0.26-py3-none-win_amd64.whl
  • Upload date:
  • Size: 23.0 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for deepwave-0.0.26-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 7be9f1a902112b8ee5c13172afcecd238def8d97a7d6b08785b6cf879a59cdf0
MD5 77097caddf098abceee11c7669dafb65
BLAKE2b-256 ffa08f44e287bb5858d7e9786de44af30e0164cb78b3542f22101ebc154b8848

See more details on using hashes here.

File details

Details for the file deepwave-0.0.26-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for deepwave-0.0.26-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dbcda9b71b8bed9dfa13ef6376946d91676cfc339ed4819d6b1136d31d759b28
MD5 9ca85430db8a58df6ba4ac32996673aa
BLAKE2b-256 b98a745d3693eccde2f67911714709f91ef8fc0c38da8d143aee699339992e9a

See more details on using hashes here.

File details

Details for the file deepwave-0.0.26-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for deepwave-0.0.26-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b0bc1bf553f090a5719795f77c59d6387345408d7ba4e4def092831f8e74b758
MD5 1c75c124c25438c37f51fa134fefc5b7
BLAKE2b-256 781980868e75d92932759ca9cb47fd71a392f99a92d84ef31f765b396cdc9a43

See more details on using hashes here.

File details

Details for the file deepwave-0.0.26-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for deepwave-0.0.26-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b4e698eb432c1cad7bbdc312a495eeb405273fd912bdf9d3332f73bbb350552d
MD5 b646051f55fccd62c565f13f0d9309ad
BLAKE2b-256 07448ef9b4d06fc45eacbacf8f75689e0784dfdf7720458a9e37d4a98754adac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page