ENH: Functions to calculate the average number of reflections and their density - #174
ENH: Functions to calculate the average number of reflections and their density#174mberz wants to merge 11 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds new parametric acoustics utilities to compute (under diffuse-field assumptions) the time-dependent average reflection density and the corresponding average cumulative number of reflections.
Changes:
- Added
average_reflection_density(...)to compute ( dN(t)/dt ) over time. - Added
average_number_of_reflections(...)to compute ( N(t) ) over time. - Added unit tests covering nominal behavior and basic input-validation errors for both functions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
pyrato/parametric.py |
Adds two new public parametric functions with docstrings and input validation. |
tests/test_parametric.py |
Adds tests validating the new formulas and expected error conditions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import pyrato.parametric as parametric | ||
| from pyrato.parametric import mean_free_path | ||
| import pyrato as ra | ||
| import pyrato |
There was a problem hiding this comment.
Importing as ra does not follow our conventions and should be replaced in the future.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
hoyer-a
left a comment
There was a problem hiding this comment.
Thanks, just some small comments on documentation
| The average number of reflections is calculated as the following ratio [#]_ | ||
|
|
||
| .. math:: | ||
| N(t) = \frac{4 \pi c^3 t^3}{3 V}, |
There was a problem hiding this comment.
Maybe we should mention that the average number of reflections is derived
from the average reflection density in our method:
.. math::
N(t) = \frac{4 \pi c^3 t^3}{3V} =
\frac{\mu(t)t}{3},
where :math:\mu(t) is the average reflection density obtained from `:func:`average_reflection_density.
There was a problem hiding this comment.
I'd say it's more the other way around (the density is the derivative of the total number). Anyhow, I'd not add this here.
Co-authored-by: Anton Hoyer <156099087+hoyer-a@users.noreply.github.com>
Changes proposed in this pull request:
The PR is partially inspired by pyfar/pyfar#782 by @ahms5, but implements the reflection density and total number of reflections separately from RIR synthesis.