Skip to content

Conversation

@mjasins
Copy link

@mjasins mjasins commented Nov 5, 2025

Which issue(s) are closed by this pull request?

Closes #84

Changes proposed in this pull request:

  • adding a function that calculates reverberation time with the use of Sabine's equation

@ahms5 ahms5 changed the base branch from main to develop November 5, 2025 13:36
@sikersten sikersten requested a review from a team November 5, 2025 13:54
Copy link

@TimSchellekensLAV TimSchellekensLAV left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.
Only missing some units.

alphas : ndarray, double
Absorption coefficients corresponding to each surface
volume : double
Room volume

Choose a reason for hiding this comment

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

Units are missing

Copy link
Author

Choose a reason for hiding this comment

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

We agree and provide changes. Thank You!

Returns
-------
reverberation_time_sabine : double
The value of calculated reverberation time

Choose a reason for hiding this comment

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

Missing unit

Copy link
Author

Choose a reason for hiding this comment

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

We agree and wil provide changes. Thank You!

@ahms5 ahms5 added the ASSA 2025 Issues and PRs related to the Open Source Software school at ASSA 2025 label Nov 5, 2025
Copy link
Member

@mberz mberz left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.
I have realized that there is no check if the length of the input arrays match. The line calculating the absorption area however will crash if users don't account for it.
I think this needs to be addressed.

Comment on lines 180 to 181
alphas = np.asarray(alphas)
surfaces = np.asarray(surfaces)
Copy link
Member

Choose a reason for hiding this comment

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

Here it may be beneficial to check if the size of both arrays are equal to catch potential user input errors.

Suggested change
alphas = np.asarray(alphas)
surfaces = np.asarray(surfaces)
alphas = np.asarray(alphas)
surfaces = np.asarray(surfaces)
if surfaces.shape != alphas.shape:
raise ValueError("The shapes of alphas and surfaces do not match.")

This information also would be good to have in the docstring..

Co-authored-by: Marco Berzborn <mberz@users.noreply.github.com>
Copy link
Member

@mberz mberz left a comment

Choose a reason for hiding this comment

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

Thanks for the update. Looking quite good already.

Copy link

@TimSchellekensLAV TimSchellekensLAV left a comment

Choose a reason for hiding this comment

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

Approved

@mjasins
Copy link
Author

mjasins commented Nov 5, 2025

@mberz, @ahms5 - do You think the name of the function should include the word "calculate"? or sabine_reverberation_time is enough?

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.

Thank you for your contribution. Look very nice, I just have some suggestions on docs.

alphas = np.asarray(alphas)

if alphas.shape != surfaces.shape:
raise ValueError("Size of alphas and surfaces ndarray sizes must match.")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe sth like shapes of alphas and surfaces must match.

Comment on lines 187 to 192
if np.any(alphas < 0) or np.any(alphas > 1):
raise ValueError(f"Absorption coefficient values must be in range [0, 1]. Got {alphas}.")
if np.any(surfaces < 0):
raise ValueError(f"Surface areas cannot be negative. Got {surfaces}.")
if volume < 0:
raise ValueError(f"Volume cannot be negative. Got {volume}.")
Copy link
Member

Choose a reason for hiding this comment

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

nice

@mjasins mjasins requested a review from mberz November 6, 2025 08:29
mjasins and others added 2 commits November 6, 2025 09:29
Co-authored-by: Anne Heimes <64446926+ahms5@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ASSA 2025 Issues and PRs related to the Open Source Software school at ASSA 2025

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] Implement Sabine's equation

4 participants