Skip to content

Conversation

@TimSchellekensLAV
Copy link

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

Closes issue #87

Changes proposed in this pull request:

-Added calculation critical distance based on volume and reverberation time

Copy link

@JudithvE JudithvE left a comment

Choose a reason for hiding this comment

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

Thanks a bunch!! We really appreciate you requesting a pull. All in all we are satisfied, however, we would like you to add an equation to the documentation. 👍


return air_abs_coeff

def critical_distance(
Copy link

Choose a reason for hiding this comment

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

Suggested change
def critical_distance(
def critical_distance(volume, reverberation_time):

We would delete the enters here.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry we disagree, it is part of the pyfar coding guidelines to add these enters

Copy link
Member

Choose a reason for hiding this comment

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

Both formatting with the new line and indent, as well as everything on one line are equally valid in pyfar ;)

References
----------
.. [#] https://en.wikipedia.org/wiki/Critical_distance
Copy link

Choose a reason for hiding this comment

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

Could you add the equation for the critical distance here?

Copy link
Author

Choose a reason for hiding this comment

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

Yes

References
----------
.. [#] https://en.wikipedia.org/wiki/Critical_distance
Copy link

Choose a reason for hiding this comment

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

This is not very scientific 👎

"""
if reverberation_time <= 0:
raise ValueError("Reverberation time must be greater than zero.")
Copy link

Choose a reason for hiding this comment

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

Good job 👍

Copy link
Member

Choose a reason for hiding this comment

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

agreed!

Copy link

@ilsuono ilsuono 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 contribs.

The functionalities are perfect, would be great if you can run ruff check and refer to CI checks to make sure the formattings are there and all the tests pass.

Copy link

@mjasins mjasins 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, please include our minor comments.

raise ValueError("Reverberation time must be greater than zero.")
if volume <= 0:
raise ValueError("Volume must be greater than zero.")
critical_dist = 0.057 * np.sqrt(volume / reverberation_time)
Copy link

Choose a reason for hiding this comment

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

A minor comment: please name the return critical_distance to match pyfar convention

Copy link
Author

Choose a reason for hiding this comment

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

Function name is also called critical_distance, so this would cause a conflict with this name.

Copy link

Choose a reason for hiding this comment

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

@TimSchellekensLAV Please consider renaming the function to calculate_critical_distance(), according to pyfar similar functions

Copy link
Author

Choose a reason for hiding this comment

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

We are aware of this convention, though other functions in the parametric module do not follow this guideline either. To keep the module "coherent", we choose to join not following the guideline.

reverberation_time
):
"""Calculate the critical distance of a room with given volume and reverberation time.
Copy link

Choose a reason for hiding this comment

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

Please add the reference, as the link to the citation is not included and choose another source from Wikipedia :)

Copy link
Author

Choose a reason for hiding this comment

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

Is this okay now? If yes, the conversation will be resolved.

@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

@JudithvE JudithvE left a comment

Choose a reason for hiding this comment

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

👍

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, looks great. I added a few suggestions.

Assumes the source directivity is 1 (omnidirectional source).
.. math::
d_c = 0.057 \\sqrt{\\frac{V}{T_{60}}}
Copy link
Member

Choose a reason for hiding this comment

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

eather use r""" as a raw docstring or use \ infront of special characters. Both together will not solve the problem

Comment on lines 158 to 159
r"""Calculate the critical distance of a room with
given volume and reverberation time [#kra]_.
Copy link
Member

Choose a reason for hiding this comment

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

please try to avoid using references in the first sentence of the summary. This will break the autoreferencing in the documentation.

reverberation_time):
r"""Calculate the critical distance of a room with
given volume and reverberation time [#kra]_.
Assumes the source directivity is 1 (omnidirectional source).
Copy link
Member

Choose a reason for hiding this comment

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

I would be good practice, but not manorytory, to have a short summary in the first line and than more details to in a new paragraph like e.g. this:

"""
This is a short summary.

Give more details and even references here _[#].

"""
if reverberation_time <= 0:
raise ValueError("Reverberation time must be greater than zero.")
Copy link
Member

Choose a reason for hiding this comment

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

agreed!

Copy link

@JudithvE JudithvE 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 contribution!
No remarks on this, looks good.

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.

6 participants