rtrs
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.
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_buildrtrs::guides::input_referencertrs::guides::output_referencertrs::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.
PyPI Release
Pre-built python wheels can be downloaded from pypi:
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.
Citation
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}
}
License
MIT License. See LICENSE file for details.
Release files for rtrs 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rtrs-0.2.4.tar.gz | 6.9 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| rtrs-0.2.4-cp314-cp314-macosx_11_0_arm64.whl | CPython 3.14 | CPython 3.14 | macOS 11.0+ ARM64 | Details |
| rtrs-0.2.4-cp314-cp314-macosx_10_12_x86_64.whl | CPython 3.14 | CPython 3.14 | macOS 10.12+ x86-64 | Details |
| rtrs-0.2.4-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| rtrs-0.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.17+ x86-64 | Details |
Total release size: 8.9 MB
Release files / rtrs-0.2.4.tar.gz
| Download URL | rtrs-0.2.4.tar.gz |
|---|---|
| Size | 6.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22c82c673b9ffa975aa235145eb140dbbf4e428292682d30928d869e07a8f350
|
|
BLAKE2b-256 checksum How to use checksums |
23aed70dcce710529eaaff6163d346b4800d6a18340aed6947016944cbec6ec6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency logRelease files / rtrs-0.2.4-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | rtrs-0.2.4-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 484.7 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
10cd15d0166f7a401c45371eabb7ca552f28ba843ac596e424d3298d64163ce4
|
|
BLAKE2b-256 checksum How to use checksums |
6704db05534a74a0674773aa9e26e75940a850433d4da9d05ded2a2dc06516c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency logRelease files / rtrs-0.2.4-cp314-cp314-macosx_10_12_x86_64.whl
| Download URL | rtrs-0.2.4-cp314-cp314-macosx_10_12_x86_64.whl |
|---|---|
| Size | 503.9 kB |
| Tags | CPython 3.14 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
fae3025bb0c7a7ca4426ed364d9f77c7a760e5231cec0a73955baa618cc5bc65
|
|
BLAKE2b-256 checksum How to use checksums |
5bf4f0d766b7157548a78c20eaf9587e80d26765808cc3599347a71064cf0662
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency logRelease files / rtrs-0.2.4-cp312-cp312-win_amd64.whl
| Download URL | rtrs-0.2.4-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 377.8 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2d8f7b4f0c9ca3f8e5c52d1e507ad4d53f7e4888abfeb5dd0a0758fc5b4e7cae
|
|
BLAKE2b-256 checksum How to use checksums |
2a5583b3bc973a200d4237d0d2ba557e2fbbbb222660981d69e094e19367523d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency logRelease files / rtrs-0.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rtrs-0.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 563.9 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
3355e2c5b1651bee66de3e64238fdcbd43623953f8073e5fd5107e4b960cf45e
|
|
BLAKE2b-256 checksum How to use checksums |
50a93c0d1077284af22f5c5bd3717a3934f1d22268f78c0f1a35787b684fd4d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency log