-
Notifications
You must be signed in to change notification settings - Fork 15
Feature/speed_of_sound #100
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?
Conversation
SitChri
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.
Thanky you for your kind contribution.
Please see the atteched suggestions for minor changes of your pull request.
We are looking forward to your changed pull request.
Greetings
ASSA 2025 Teamn
pyrato/parametric.py
Outdated
| c=343.2*sqrt((temperature-t0)/(20-t0))\n | ||
| t0=-273.15°C | ||
| """ | ||
| speed_of_sound = 343.2 * np.sqrt((temperature + 273.15)/(20+ 273.15)) |
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.
maybe add reference temperature as a variable t_0? same for reference of speed of sound...
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.
Not maybe, definitely :)
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 have carefully discussed your comment with our team, however, we prefer doing it our way, respectfully.
pyrato/parametric.py
Outdated
| Equations | ||
| --------- | ||
| .. math:: | ||
| c=343.2*sqrt((temperature-t0)/(20-t0))\n |
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.
it would look nicer if latex syntax is used for the formula =)
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.
You are completely right, we will change our code correspondingly asap!
TimSchellekensLAV
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.
Request some latex formatting and restructuring of docstring
pyrato/parametric.py
Outdated
| ---------- | ||
| ISO 9613-1 (Formula A.5) | ||
| Equations |
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.
Incorporate equations in head of docstring
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.
Accoring to the numpy convention, which are referd in the pyfar guidelines the Equations can be added in a Notes section instead of an dedicated Equation section.
https://numpydoc.readthedocs.io/en/stable/format.html#notes
pyrato/parametric.py
Outdated
| Equations | ||
| --------- | ||
| .. math:: | ||
| c=343.2*sqrt((temperature-t0)/(20-t0))\n |
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.
| c=343.2*sqrt((temperature-t0)/(20-t0))\n | |
| c=343.2\sqrt((temperature-t_0)/(20-t_0))\n |
pyrato/parametric.py
Outdated
| c=343.2*sqrt((temperature-t0)/(20-t0))\n | ||
| t0=-273.15°C | ||
| """ | ||
| speed_of_sound = 343.2 * np.sqrt((temperature + 273.15)/(20+ 273.15)) |
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.
Not maybe, definitely :)
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 for Your contribution, please consider our suggestions.
| ---------- | ||
| temperature : double | ||
| Temperature in degrees Celsius. | ||
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 explicit formula and cite properly the source, according to pyfar convention
pyrato/parametric.py
Outdated
| Equations | ||
| --------- | ||
| .. math:: | ||
| c=343.2*sqrt((temperature-t0)/(20-t0))\n |
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 more descriptive variable names for t0 and use another variables for "hard-coded" 343.2 m/s and 20 Celsius temperature
pyrato/parametric.py
Outdated
| c=343.2*sqrt((temperature-t0)/(20-t0))\n | ||
| t0=-273.15°C | ||
| """ | ||
| speed_of_sound = 343.2 * np.sqrt((temperature + 273.15)/(20+ 273.15)) |
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.
Also consider adding variables for hard-coded exact values to be more understandable.
mberz
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. I've added a minor comment on how to cite the reference.
Feel free to include it.
|
|
||
| def calculate_speed_of_sound(temperature): | ||
| r"""Calculate the speed of sound in air depending on the temperature. | ||
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.
| The implementation is based on [#]_ . |
Co-authored-by: Marco Berzborn <mberz@users.noreply.github.com>
TimSchellekensLAV
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 additional changes. Minor improvement
pyrato/parametric.py
Outdated
| Equations | ||
| --------- | ||
| .. math:: | ||
| c = c_0 \sqrt{\frac{temperature - T_0}{20 - T_0}} |
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.
| c = c_0 \sqrt{\frac{temperature - T_0}{20 - T_0}} | |
| c = c_0 \sqrt{\frac{T - T_0}{20 - T_0}} |
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 you contribution, it looks already very good, I just have a few suggestions.
pyrato/parametric.py
Outdated
| ---------- | ||
| ISO 9613-1 (Formula A.5) | ||
| Equations |
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.
Accoring to the numpy convention, which are referd in the pyfar guidelines the Equations can be added in a Notes section instead of an dedicated Equation section.
https://numpydoc.readthedocs.io/en/stable/format.html#notes
pyrato/parametric.py
Outdated
| T_0=-273.15 | ||
| .. math:: | ||
| c_0 = 343.2 |
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.
It might make sence to add a unit here or explain the exact meaning in an additional text
|
parametric.py does not pass ruff check |
|
test_documentation_build-3.13 failed |
TimSchellekensLAV
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.
Small comment on test.
| @pytest.mark.parametrize('T',[0,20,1000]) | ||
| def test_speed_of_sound(T): | ||
| speed=ra.parametric.calculate_speed_of_sound(T) | ||
| assert isinstance(T, (int, float)) |
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.
redundant? Implicit in specification of param
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.
Can you specify?
| import pyrato as ra | ||
| import pytest | ||
|
|
||
| @pytest.mark.parametrize('T',[0,20,1000]) |
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.
Testing 2 situations in this statement: those who work (20, 1000) and those who fail (0). Extract?
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.
No the zero should also work.
Which issue(s) are closed by this pull request?
Closes #95
Changes proposed in this pull request: