Skip to main content

A Pytorch dataset for Acoustic Wave Propagation

Project description

Logo

PyAWD: a Python acoustic wave propagation dataset using PyTorch and Devito

A package for generating Pytorch datasets containing simulations of the acoustic wave propagation in custom velocity fields.

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 PyAWD uses the Devito Python Library to solve the acoustic wave PDE from various random initial conditions.

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. They are presented in the examples directory. Those are readable online:

Getting started

Basic imports:

from pyawd import *

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 = VectorAcousticWaveDataset2D(2, nx=128, dt=2, t=10, velocity_model="Marmousi")
dataset.max_velocities[0] = 500

Then we plot the first simulation. The 🟀 character shows the interrogator position:

dataset.plot_item(0)

Which outputs the following figure:

Example

By default, the point (0, 0) contains an interrogator. This means that the continuous measurement on this position (at least with a $\Delta t=ddt$) can be plotted by:

dataset.plot_interrogators_response(0)
Example

More advanced usage

Using the VectorAcousticWaveDataset3D class allows producing simulations in 3D:

dataset_3d = VectorAcousticWaveDataset3D(1, nx=32, t=10, interrogators=[(0, 10, 15), (0, -10, 15)], velocity_model=300.)

For visualisation, the method

dataset_3d.generate_video(0, "VAWD3D", 300)

generates the following video:

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.

Source Distribution

pyawd-0.3.81.tar.gz (226.8 kB view details)

Uploaded Source

Built Distribution

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

pyawd-0.3.81-py3-none-any.whl (266.2 kB view details)

Uploaded Python 3

File details

Details for the file pyawd-0.3.81.tar.gz.

File metadata

  • Download URL: pyawd-0.3.81.tar.gz
  • Upload date:
  • Size: 226.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.6

File hashes

Hashes for pyawd-0.3.81.tar.gz
Algorithm Hash digest
SHA256 5ff0c9549d9a0b147f4c47dc9c59eb6c61549904aab8e70e0b465396749e7ae6
MD5 68a511f5e98a0d3e58b613310a2ebaac
BLAKE2b-256 b9588f1b303e1e8bfbd9fb7ca0f68282c356c03911c33fede6d15c44c2a98ead

See more details on using hashes here.

File details

Details for the file pyawd-0.3.81-py3-none-any.whl.

File metadata

  • Download URL: pyawd-0.3.81-py3-none-any.whl
  • Upload date:
  • Size: 266.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.6

File hashes

Hashes for pyawd-0.3.81-py3-none-any.whl
Algorithm Hash digest
SHA256 858487e753e5a2ab0a99bec0b2e9cd8985e1c5e5075f31a6e13a488ed8723fc5
MD5 ea5a7627ef98affad09a3905a95bed8f
BLAKE2b-256 6823a22ccf4011f7fa084ed3c4604fc42898d3ec6918092b4450488588a779f7

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