Skip to content

Refactor the parametric energy decay curve function#74

Merged
mberz merged 9 commits intodevelopfrom
refactor/parametric_edc
Mar 18, 2026
Merged

Refactor the parametric energy decay curve function#74
mberz merged 9 commits intodevelopfrom
refactor/parametric_edc

Conversation

@mberz
Copy link
Member

@mberz mberz commented Sep 11, 2025

Changes to the function

  • uses reverbation time as input instead of geometry
  • returns pf.TimeData object
  • independent of sabine/eyring equations

We should also remove support for Python < 3.11 in a different PR

@mberz mberz moved this from Backlog to Drafting Phase in Weekly Planning Sep 11, 2025
@mberz mberz added this to the v1.0.0 milestone Sep 11, 2025
Copy link
Member

@ahms5 ahms5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this PR called refactor if a new method is added?

@github-project-automation github-project-automation bot moved this from Drafting Phase to Require review in Weekly Planning Oct 10, 2025
@mberz
Copy link
Member Author

mberz commented Oct 17, 2025

why is this PR called refactor if a new method is added?

This PR was not ready for review, yet ;)

When it's ready it will replace the function energy_decay_curve_analytic

@ahms5 ahms5 marked this pull request as draft October 17, 2025 10:17
@ahms5 ahms5 deleted the branch develop October 24, 2025 13:36
@ahms5 ahms5 closed this Oct 24, 2025
@github-project-automation github-project-automation bot moved this from Require review to Done in Weekly Planning Oct 24, 2025
@ahms5 ahms5 reopened this Oct 24, 2025
@github-project-automation github-project-automation bot moved this from Done to Backlog in Weekly Planning Oct 24, 2025
@ahms5 ahms5 changed the base branch from develop_1.0.0 to develop October 24, 2025 13:46
@mberz mberz added the enhancement New feature or request label Nov 5, 2025
@mberz mberz self-assigned this Nov 5, 2025
@mberz mberz moved this from Backlog to Drafting Phase in Weekly Planning Nov 5, 2025
@mberz mberz marked this pull request as ready for review March 18, 2026 08:36
@mberz mberz moved this from Drafting Phase to Require review in Weekly Planning Mar 18, 2026
Copy link
Member

@f-brinkmann f-brinkmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a suggestion to improve the docs and simplify the computation (not tested if the latter works)

Comment on lines +72 to +78
shape = np.broadcast_shapes(energy.shape, reverberation_time.shape)
try:
energy = np.broadcast_to(energy, shape)
except ValueError as error:
raise ValueError(
"Reverberation time and energy must have the same shape.",
) from error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this only works one way. How about using

Suggested change
shape = np.broadcast_shapes(energy.shape, reverberation_time.shape)
try:
energy = np.broadcast_to(energy, shape)
except ValueError as error:
raise ValueError(
"Reverberation time and energy must have the same shape.",
) from error
try:
shape = np.broadcast_shapes(energy.shape, reverberation_time.shape)
except ValueError as error:
raise ValueError(
"Reverberation time and energy must be broadcastable to the same shape.",
) from error

If we then do

times = np.broadcast_to(times, shape + (times.size, ))

the reshaping and transposing below might not be requried anymore because of exploting automatic broadcasting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to not work like that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've adapted your suggestion, though

Comment on lines +29 to +32
reverberation_time : float | numpy.ndarray[float]
The reverberation time in seconds.
energy : float | numpy.ndarray[float], optional
The initial energy of the sound field, by default 1.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a little while to figure out

  • that mulriple EDCs will be computed if one of these is array like and
  • that they must be broadcastable (I also made a note below that might make things more flexible)

Can you please add a note on this here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@mberz mberz requested a review from f-brinkmann March 18, 2026 10:09
Copy link
Member

@f-brinkmann f-brinkmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Only docstring suggestions left. Approved otherwise.

times : numpy.ndarray[float]
The times at which the energy decay curve is evaluated.
reverberation_time : float | numpy.ndarray[float]
The reverberation time in seconds. If an array is passed, a energy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

teeny tiny typo

Suggested change
The reverberation time in seconds. If an array is passed, a energy
The reverberation time in seconds. If an array is passed, an energy

Comment on lines +34 to +36
``reverberation_time`` is an array, the shape of ``energy`` is required
to match the shape or be broadcastable to the shape of
``reverberation_time``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we agreed to have parameters in italics:

Suggested change
``reverberation_time`` is an array, the shape of ``energy`` is required
to match the shape or be broadcastable to the shape of
``reverberation_time``.
`reverberation_time` is an array, the shape of `energy` is required
to match the shape or be broadcastable to the shape of
`reverberation_time`.

@mberz mberz requested a review from hoyer-a March 18, 2026 11:50
Copy link
Member

@hoyer-a hoyer-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@mberz mberz force-pushed the refactor/parametric_edc branch from d9f11b5 to 7f72db0 Compare March 18, 2026 12:00
mberz and others added 9 commits March 18, 2026 13:01
- uses reverbation time as input instead of geometry
- returns pf.TimeData object
- independent of sabine/eyring equations
Co-authored-by: Anton Hoyer <156099087+hoyer-a@users.noreply.github.com>
@mberz mberz force-pushed the refactor/parametric_edc branch from 7f72db0 to f6ce872 Compare March 18, 2026 12:01
@mberz mberz merged commit 050dd1e into develop Mar 18, 2026
12 checks passed
@github-project-automation github-project-automation bot moved this from Require review to Done in Weekly Planning Mar 18, 2026
@mberz mberz deleted the refactor/parametric_edc branch March 18, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants