Testing
The automated test suite is intentionally deterministic and lightweight. It focuses on numerical behaviour, validation logic, and public interfaces that can usually be exercised without a full Stone Soup runtime.
Most external tooling is mocked, but the suite also includes a small number of rtrs smoke tests when the tool is available locally.
There are currently 293 tests across 18 test modules under tests/.
How the suite is structured
The tests are primarily unit tests with a few light integration-style checks.
tests/support.pyprovides small Stone Soup and Blue Pebble stubs so modules can be imported in isolation.Optional external dependencies are usually mocked rather than executed.
The tests prefer explicit expected values and deterministic assertions over broad random coverage.
Coverage by area
Current module counts:
tests/test_package_api.py: 4 teststests/test_signal_utils.py: 7 teststests/test_signal_base.py: 11 teststests/test_signal_models.py: 8 teststests/test_signal_anthropogenic.py: 15 teststests/test_signal_biological.py: 48 teststests/test_seed.py: 28 teststests/test_beamformer.py: 16 teststests/test_environment_models.py: 5 teststests/test_detector_algorithms.py: 15 teststests/test_detector_metrics.py: 7 teststests/test_detector_passive.py: 18 teststests/test_plotter.py: 27 teststests/test_propagation_models.py: 15 teststests/test_simulator_acoustic.py: 14 teststests/test_simulator_modules.py: 13 teststests/test_towedarray_models.py: 39 teststests/test_types_sensordata.py: 3 tests
Package API
tests/test_package_api.py
public names exposed by
bluepebblelazy submodule import and caching through
__getattr__rejection of unknown public attributes
Signal models and utilities
tests/test_signal_utils.py, tests/test_signal_base.py, tests/test_signal_models.py, tests/test_signal_anthropogenic.py, tests/test_signal_biological.py
STFT utilities, inverse-STFT round-trip behaviour, and fade helpers
Signal.generatevalidation and attenuation/delay application branchesambient-noise and effects helpers
tonal and broadband anthropogenic model validation, caching, and reset behaviour
biological signal generation, call template construction, and snapping shrimp models
Seed management
tests/test_seed.py
set_seedandget_rngbehaviour and accessibility viabluepebblereproducibility of independent RNG streams spawned from a global seed
per-instance seed override and non-deterministic default behaviour
cross-signal-type reproducibility from a single
set_seedcall
Beamforming
tests/test_beamformer.py
delay-and-sum domain validation and input-shape checks
time-domain and frequency-domain zero-delay beamforming behaviour
shading normalisation and rejection of zero-sum shading
broadband power behaviour when no frequency bins are active
STFT short-input and overlap edge cases
time-domain cropping behaviour under large integer delays
MVDR validation and finite-output checks on deterministic inputs
MVDR zero-power behaviour when the selected band excludes all bins
steering-delay calculation for simple horizontal array geometry
Environment models
tests/test_environment_models.py
sound-speed profile handling for negative depths
gridded sound-speed profile generation
flat bathymetry validation
wedge bathymetry surface clamping
seamount interpolation behaviour
Detection
tests/test_detector_algorithms.py, tests/test_detector_metrics.py, tests/test_detector_passive.py
threshold, peak, CA-CFAR, and OS-CFAR behaviour
wrapped-bearing timestep metrics and parameter-sweep helpers
passive detector chain wiring from beamformer outputs to detections
Plotting helpers
tests/test_plotter.py
axis-scaling and layout helper functions
spectrogram validation and figure construction
ROC/PR plotting and combined subplot behaviour
BTR validation, wrapped bearings, detection/track/truth overlays, and legend grouping
world plotting validation and stationary-platform rendering
Propagation models
tests/test_propagation_models.py
analytic cylindrical and spherical propagation formulas
sensor delay calculation
rejection of invalid attenuation factors
rtrsoption validation, missing-package behaviour, single-frequency and per-frequency transmission loss, and spectrum transfer-function shapingreal
rtrssmoke tests for scalar TL, per-frequency TL, and broadband transfer functions
Simulators
tests/test_simulator_acoustic.py, tests/test_simulator_modules.py
compatibility-focused behavioural checks for passive and broadband simulator outputs
simulator base-class helpers for model resolution, target lookup, noise shaping, beamforming, and sensor payload construction
discrete simulator source-signal resolution and timestep validation
continuous simulator interpolation, fading, and reconstruction helper branches
Towed-array models
tests/test_towedarray_models.py
follower geometry behaviour for overlapping and separated platform states
horizontal offset handling and depth consistency
platform construction, sensor initialisation, and state capture
host and sensor path retrieval
Types
tests/test_types_sensordata.py
PassiveSonarSensorDataconstruction and default valuestypes package public API exports
Current gaps
The main areas not yet covered well are:
real end-to-end integration with a full Stone Soup installation
deeper beamformer coverage, especially non-trivial steering cases and stronger MVDR numerical assertions
higher-level passive detector pipelines beyond the algorithm primitives and metrics helpers
packaging/build checks and documentation notebook coherence as part of the default test suite
Running the tests
From a configured development environment:
pytest
To run with coverage reporting:
pytest --cov=bluepebble --cov-report=term-missing --cov-report=xml
To inspect the currently collected test inventory:
pytest --collect-only -q
Useful targeted runs:
pytest tests/test_signal_base.py
pytest tests/test_signal_anthropogenic.py
pytest tests/test_detector_algorithms.py
pytest tests/test_propagation_models.py
pytest tests/test_simulator_acoustic.py
pytest tests/test_simulator_modules.py