3D Underwater acoustic ray tracing with arbitrary Cartesian receiver coordinates, geometry independent broadband beam tracing, and Python bindings. It is used in Blue Pebble: sonar signal processing plugin for Stone Soup.
- 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
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 rtrsRust, 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 | shThen check:
rustc --version
cargo --version
rustup --version- 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 pythonOr to open the docs in the browser after building:
cargo doc --no-deps --features python --openThe generated docs include user-facing guide pages under rtrs::guides:
rtrs::guides::install_and_buildrtrs::guides::input_referencertrs::guides::output_referencertrs::guides::python_usage
The json schema can be found here docs/schema/simulation-config.schema.json.
Build with cargo (the resulting binary will be in target/release/):
cargo build --releaseRun with a JSON input file (compiles and runs in release mode):
cargo run --release <path_to_input_file>.jsonSet 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)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]"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 --releaseSee 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.
Pre-built python wheels can be downloaded from pypi:
pip install rtrsHopefully, pre-built wheels are distributed per platform and Python version via GitHub Actions using maturin-action, so no Rust toolchain is required.
- Low frequency correction
- Performance improvements
- Multiple sources and Source directivity patterns
- Delay and amplitude output
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.
If you use rtrs in academic work, please cite the associated conference paper and the software release (via DOI when available).
@inproceedings{wakefield2026sonar,
title={A Sonar Signal Processing Plugin for Stone Soup},
author={Wakefield, Joshua J and Boulton, Finley and Colquitt, Daniel J. and Ralph, Jason F. and Williams, Duncan P.},
booktitle={2026 29th International Conference on Information Fusion (FUSION)},
pages={1--8},
year={2026},
organization={IEEE}
}MIT License. See LICENSE file for details.