A Pytorch dataset for Acoustic Wave Propagation
Project description
PyAWD: a Python acoustic wave propagation dataset using PyTorch and Devito
A package for generating a Pytorch dataset containing simulations of the acoustic wave propagation in the Marmousi velocity field. It uses the Devito Python Library to solve the acoustic wave PDE from various random initial conditions.
Acoustic Wave Equation
The equation of propagation of an acoustic wave is given by $\frac{d^2u}{dt^2} = c \nabla^2 u + f$, where
- $u(x, y, t)$ is the displacement field and can be either a scalar or a vector field
- $c(x, y, t)$ is the wave propagation speed
- $\nabla^2$ is the laplacian operator
- $f(x, y, t)$ is an external force applied on the system, for which the value can vary through time
Installation
The package (along with the dependencies) is accessible via PyPI:
pip install pyawd
Documentation
The API documentation is available here.
Basic help is provided for each class and function and is accessible via the Python help()
function.
We provide a bunch of Notebooks to start using the tool. Those are readable online:
ScalarAcousticWavePropagation.ipynb
: an introduction to PDE solving and simulation using Devito applied on the scalar acoustic wave propagationVectorAcousticWavePropagation.ipynb
: an introduction to PDE solving and simulation using Devito applied on the vector acoustic wave propagationVectorAcousticWaveDataset.ipynb
: an introduction to the VectorAcousticWaveDataset possibilitiesMarmousi.ipynb
: a visualisation of the Marmousi velocity field used in the simulationsInterrogators.ipynb
: an introduction to the PyAWD Interrogators usageGenerateVectorAcousticWaveDataset.ipynb
: how to generate dataset usingpyawd
SpatioTemporalVaryingWavePropagationSpeedField.ipynb
: how to create a spatio-temporal varying propagation field
Getting started
Basic imports:
import pyawd
from pyawd import ScalarAcousticWaveDataset
Let us generate a Dataset made of 10 simulations. Each simulation is run in a $250\times 250$ matrix. We store the field state every $2$ seconds and we run the simulation for $10$ seconds:
dataset = ScalarAcousticWaveDataset(2, nx=250, dt=2, t=10)
Then we plot the first simulation. The 🟀 character shows the interrogator position:
dataset.plot_item(0)
Which outputs the following figure:
Finally, we can generate a video of this simulation. We will use $200$ frames, which yields a final rate of $20 fps$:
dataset.generate_video(0, "example", 200)
This produces the following video (stored in the file example.mp4
):
By default, the point (0, 0)
contains an interrogator. This means that the continuous measurement on this position (at least with a $\Delta t=dt$) can be obtained by:
dataset.interrogate((0, 0))
More advanced usage
Using the VectorAcousticWaveDataset
class, you can produce simulations in 2D which are more realistic:
dataset = VectorAcousticWaveDataset(2, nx=250, dt=2, interrogators=[(-10, 0), (10, 0)], t=10)
Especially, the interrogate
method provides measurements along two orthogonal dimensions:
dataset.plot_item(0)
dataset.plot_interrogators_response(0)
Examples
Mutliple IPython notebooks are presented in the [examples directory. If Jupyter is installed, those examples can be explored by starting Jupyter:
jupyter-notebook
ScalarAcousticWavePropagation.ipynb
: an introduction to PDE solving and simulation using Devito applied on the scalar acoustic wave propagationVectorAcousticWavePropagation.ipynb
: an introduction to PDE solving and simulation using Devito applied on the vector acoustic wave propagationVectorAcousticWaveDataset.ipynb
: an introduction to the VectorAcousticWaveDataset possibilitiesMarmousi.ipynb
: a visualisation of the Marmousi velocity field used in the simulationsInterrogators.ipynb
: an introduction to the PyAWD Interrogators usageGenerateVectorAcousticWaveDataset.ipynb
: how to generate dataset usingpyawd
Marmousi velocity field
The Marmousi velocity field used in the simulation is a subset of the following:
Related Works:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.