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        = jun,
  year         = 2026,
  publisher    = {Zenodo},
  version      = {v0.0.27},
  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.27.tar.gz (174.4 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.27-py3-none-win_amd64.whl (23.0 MB view details)

Uploaded Python 3Windows x86-64

deepwave-0.0.27-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.27-py3-none-macosx_11_0_arm64.whl (7.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

deepwave-0.0.27-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.27.tar.gz.

File metadata

  • Download URL: deepwave-0.0.27.tar.gz
  • Upload date:
  • Size: 174.4 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.27.tar.gz
Algorithm Hash digest
SHA256 e8eb798bcb25503ccf1bfb8c9ae42beddfab2cc6afe7632290c1e71d131fe4df
MD5 a8a001c49cdda24d1d7bb15f56c926c8
BLAKE2b-256 9171387fd0091edf8d48b6268ee4ab05b6d8829437e5bea98e5d45cc5da42a03

See more details on using hashes here.

File details

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

File metadata

  • Download URL: deepwave-0.0.27-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.27-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 857edf430192b2640e1f418ed64ee59f1b1dd2be9b16909bec0a0a20cebdf85c
MD5 63ce60dc1a449d7ed7db18fa20af1523
BLAKE2b-256 238f9f0885db2668f7c2951841c60f22ca1e937eba8450ffd86dea887356bed9

See more details on using hashes here.

File details

Details for the file deepwave-0.0.27-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.27-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f8a54e593ea7003af091d08cda932ab2fcaaac19ab88aa8c7f0f790a3f04d79c
MD5 53e1c1b83e6b53d65fc275cd6a45acc6
BLAKE2b-256 f96bf75ab345f3edc2b74b894317ef18aae05938f8b7ff1493ee67582b54e1f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deepwave-0.0.27-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d390d6e30f28181eb31ccccfc507c1d60c1841d9e9a7f4cc54e267c6794d475e
MD5 20314ceacdab88e514fe38b8020863ac
BLAKE2b-256 216b34aa1b8928210c848259a77627ba44d7b8f057f661e062a1d019ff63eb4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deepwave-0.0.27-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ed59539fb61c75359fff3582205f88ae0c83534c2dab5e494cb29a840f5d6882
MD5 58a0c484d90f8ce75a62b17b9546955d
BLAKE2b-256 6f914e9c657657bb01b800e1ebba9e3ebf48439d19c976397d7e61190c665c83

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