Port intensity measure calculations to rust code#199
Conversation
- pSA now calculated with either linear or constant newmark according to stability. - rotd calculation in parallel
- use `select_nth_unstable` instead of sorting to reduce post-processing. - use branchless absmax to speed up rotd fold
- clippy + cargo test
There was a problem hiding this comment.
Pull request overview
This PR ports intensity measure calculations from Python (numba/numexpr) to Rust to improve performance, remove problematic dependencies, enable better parallelization, reduce memory overhead, and provide 64-bit floating point precision. The PR includes new Rust modules for parallel processing utilities, numerical integration (trapezoid rule with zero-crossing correction), significant duration calculations, RotD calculations, and physical constants.
Changes:
- Implemented core intensity measure calculations in Rust with parallel processing support
- Migrated from 32-bit to 64-bit floating point for waveform data
- Updated test suite to work with new Rust implementations and float64 precision
- Added comprehensive unit tests in Rust code
- Updated benchmark CSV files to reflect float64 precision changes
Reviewed changes
Copilot reviewed 35 out of 52 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src-rust/utils.rs |
New parallel processing utilities for row-wise operations on 2D arrays |
src-rust/trapz.rs |
Numerical integration using trapezoid rule with zero-crossing correction |
src-rust/significant_duration.rs |
Significant duration calculations using binary search |
src-rust/rotd.rs |
RotD180 calculations for component rotation |
src-rust/constants.rs |
Physical constants (gravitational acceleration) |
tests/test_ims.py |
Updated test suite for Rust implementations with float64 |
tests/resources/*/im_benchmark.csv |
Updated benchmark data for float64 precision |
IM/waveform_reading.py |
Changed dtype from float32 to float64 |
MANIFEST.in |
Excluded additional files from distribution |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AndrewRidden-Harper
left a comment
There was a problem hiding this comment.
One minor comment
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 52 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… into rust_calculations
This PR ports the majority of the intensity measures to rust including:
The primary motivations for this are: