-
Notifications
You must be signed in to change notification settings - Fork 15
Added calculation of critical distance #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Added calculation of critical distance #102
Conversation
JudithvE
left a comment
There was a problem hiding this 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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def critical_distance( | |
| def critical_distance(volume, reverberation_time): |
We would delete the enters here.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ;)
pyrato/parametric.py
Outdated
| References | ||
| ---------- | ||
| .. [#] https://en.wikipedia.org/wiki/Critical_distance | ||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
pyrato/parametric.py
Outdated
| References | ||
| ---------- | ||
| .. [#] https://en.wikipedia.org/wiki/Critical_distance |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed!
ilsuono
left a comment
There was a problem hiding this 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.
mjasins
left a comment
There was a problem hiding this 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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. | ||
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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.
JudithvE
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
ahms5
left a comment
There was a problem hiding this 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.
pyrato/parametric.py
Outdated
| Assumes the source directivity is 1 (omnidirectional source). | ||
| .. math:: | ||
| d_c = 0.057 \\sqrt{\\frac{V}{T_{60}}} |
There was a problem hiding this comment.
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
pyrato/parametric.py
Outdated
| r"""Calculate the critical distance of a room with | ||
| given volume and reverberation time [#kra]_. |
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed!
JudithvE
left a comment
There was a problem hiding this 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.
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