Skip to main content

Ray tracing acoustic propagation model

Project description

rtrs

3D Underwater acoustic ray tracing with arbitrary Cartesian receiver coordinates, geometry independent broadband beam tracing, and Python bindings.

Features

  • Exclusively 3D ray / beam tracing
  • Efficient wideband beam tracing using Gaussian beams (ray geometry is traced as frequency independent, then the beam influence is calculated at receiver coordinates for each frequency)
  • Python bindings via pyo3 (No IO files)
  • Cartesian receiver representation for grids and arrays
  • Surface (vacuum) and bottom (rigid, lossy acoustic, lossy elastic) reflections
  • 3D sound speed profiles ( $c(x,y,z)$ )
  • 2D bathymetry ( $b(x,y)$ )
  • Optional IO with json files
  • Parallel processing over the number of rays / beams with rayon
  • Optional no-ray-path mode to reduce memory and output size
  • Euler and RK2 integration methods
  • Input validation

Installing, Building, and Running

There are 3 main ways to use rtrs: directly with Rust and Cargo, with Python bindings, or using CLI with the pre-built binary and JSON input files (Not covered here). The first step is to clone the repository and navigate to the project directory:

git clone https://github.com/fincb/rtrs.git
cd rtrs

Rust, Cargo, and are required for all methods, Python is also required for the Python bindings. The recommended way (for linux and macos) to install Rust and Cargo is with rustup:

curl https://sh.rustup.rs -sSf | sh

Then check:

rustc --version
cargo --version
rustup --version

Building the Docs

  • Primary docs via cargo doc (guides and API together)
  • JSON schema: docs/schema/simulation-config.schema.json

The primary documentation is built with cargo doc (guides and API together). To build the docs locally, run:

cargo doc --no-deps --features python

Or to open the docs in the browser after building:

cargo doc --no-deps --features python --open

The generated docs include user-facing guide pages under rtrs::guides:

  • rtrs::guides::install_and_build
  • rtrs::guides::input_reference
  • rtrs::guides::output_reference
  • rtrs::guides::python_usage

The json schema can be found here docs/schema/simulation-config.schema.json.

Rust & Cargo Build and Run

Build with cargo (the resulting binary will be in target/release/):

cargo build --release

Run with a JSON input file (compiles and runs in release mode):

cargo run --release <path_to_input_file>.json

Python Bindings Normal Build and Run

Set up a virtual environment and install dependencies:

python -m venv --prompt rtrs .venv
source .venv/bin/activate
pip install -e .

or with conda:

conda activate <env_name>
pip install -e .

Then in a Python script the package can be imported and used:

import rtrs

env = # <Dictionary with environment parameters>
result = rtrs.run_simulation(env)

Python Bindings with plotting for examples

For running the examples with plotting, install the viz extra dependencies:

python -m venv --prompt rtrs .venv
source .venv/bin/activate
pip install -e ".[viz]"

or with conda:

conda activate <env_name>
pip install -e ".[viz]"

Python Bindings with Development Mode

Useful for testing changes to the Rust code without needing to reinstall the package after every change. The dev extra also includes maturin as a dependency for building the Rust extension.

Set up a virtual environment and install dependencies:

python -m venv --prompt rtrs .venv
source .venv/bin/activate
pip install -e ".[dev]"

or with conda:

conda activate <env_name>
pip install -e ".[dev]"

For plotting and development, install both extras:

pip install -e ".[dev,viz]"

Build the Rust extension into the active environment and to rebuild after any changes to the Rust code:

maturin develop --release

See examples/ for usage with and without python bindings. Note that in the examples which do not use the python bindings, the program is compiled and run in release mode with cargo from within a python script.

Future PyPI Release

When published to PyPI, the package can be installed with:

pip install rtrs

Hopefully, pre-built wheels are distributed per platform and Python version via GitHub Actions using maturin-action, so no Rust toolchain is required.

Possible Future Features

  • Low frequency correction
  • Performance improvements
  • Multiple sources and Source directivity patterns
  • Delay and amplitude output

Name

The name "rtrs" means ray tracing rust (rs after the rust file extension .rs). The name in text is always all in lower case matching the name in code rtrs.

License

MIT License. See LICENSE file for details.

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

rtrs-0.2.3.tar.gz (6.9 MB view details)

Uploaded Source

Built Distributions

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

rtrs-0.2.3-cp314-cp314-macosx_11_0_arm64.whl (484.5 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

rtrs-0.2.3-cp314-cp314-macosx_10_12_x86_64.whl (503.5 kB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

rtrs-0.2.3-cp312-cp312-win_amd64.whl (377.5 kB view details)

Uploaded CPython 3.12Windows x86-64

rtrs-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (563.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file rtrs-0.2.3.tar.gz.

File metadata

  • Download URL: rtrs-0.2.3.tar.gz
  • Upload date:
  • Size: 6.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rtrs-0.2.3.tar.gz
Algorithm Hash digest
SHA256 57b370d62a3ea367fb2eebf0ce32ed29ae1d5997d3e9633a1ba4856679cc3571
MD5 b7919f68dc466a233d4d38688c6628c3
BLAKE2b-256 af928e09bb863dea3b90d1d0daa42ac014031dc25a228be371e66df7e7189ee5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rtrs-0.2.3.tar.gz:

Publisher: release.yml on UoL-SignalProcessingGroup/rtrs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rtrs-0.2.3-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

  • Download URL: rtrs-0.2.3-cp314-cp314-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 484.5 kB
  • Tags: CPython 3.14, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rtrs-0.2.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 73a6445176cd5ce8231e7d2ea3d733921158ab9327caea477b48224ea071afe7
MD5 1773e657d5ce0a775e519e6d433c6a84
BLAKE2b-256 ac651ba8b985e357697e685bbbcd31ae9ac85b777c24c61f3f058968dd8c6aa1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rtrs-0.2.3-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on UoL-SignalProcessingGroup/rtrs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rtrs-0.2.3-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rtrs-0.2.3-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7d0babf9be5b068c6bb1b24db13f77d76be58c985fcbf755426ea473662e9de5
MD5 6e02500bd06505acd6daa51cfe1e6a5e
BLAKE2b-256 42cb6ee83fb259c1c72631f55868f9243471c4587eb5e7b739712b6347726b58

See more details on using hashes here.

Provenance

The following attestation bundles were made for rtrs-0.2.3-cp314-cp314-macosx_10_12_x86_64.whl:

Publisher: release.yml on UoL-SignalProcessingGroup/rtrs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rtrs-0.2.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rtrs-0.2.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 377.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rtrs-0.2.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a639dfa2f714618371dff55ceb91797284eddac3e333cd8fe8ebe823ac2c442f
MD5 542376ad02f87965385d40a7aae3b654
BLAKE2b-256 49fa3f18a9d87c2cb90cc725bcd30b498542459d5c9e6b4fcd8062cd94c4aad8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rtrs-0.2.3-cp312-cp312-win_amd64.whl:

Publisher: release.yml on UoL-SignalProcessingGroup/rtrs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rtrs-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtrs-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fff13ac7986c693fa02043512569c763cef932225823a5098716e166d294dc81
MD5 73e843c97566e4a130a41139f0c6bbcb
BLAKE2b-256 b967cc440a25be3b200abfb2b502c196ab80a57bb0ca947808c044d2f93181f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rtrs-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on UoL-SignalProcessingGroup/rtrs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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