Skip to content

Conversation

@JudithvE
Copy link

@JudithvE JudithvE commented Nov 5, 2025

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

Closes #95

Changes proposed in this pull request:

  • Added function to calculate speed of sound based on temperature

Copy link

@SitChri SitChri left a 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

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))
Copy link

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...

Choose a reason for hiding this comment

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

Not maybe, definitely :)

Copy link
Author

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.

Equations
---------
.. math::
c=343.2*sqrt((temperature-t0)/(20-t0))\n
Copy link

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 =)

Copy link
Author

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!

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.
Request some latex formatting and restructuring of docstring

----------
ISO 9613-1 (Formula A.5)
Equations

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

Copy link
Member

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

Equations
---------
.. math::
c=343.2*sqrt((temperature-t0)/(20-t0))\n

Choose a reason for hiding this comment

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

Suggested change
c=343.2*sqrt((temperature-t0)/(20-t0))\n
c=343.2\sqrt((temperature-t_0)/(20-t_0))\n

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))

Choose a reason for hiding this comment

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

Not maybe, definitely :)

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 for Your contribution, please consider our suggestions.

----------
temperature : double
Temperature in degrees Celsius.
Copy link

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

Equations
---------
.. math::
c=343.2*sqrt((temperature-t0)/(20-t0))\n
Copy link

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

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))
Copy link

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.

@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. 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.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The implementation is based on [#]_ .

Co-authored-by: Marco Berzborn <mberz@users.noreply.github.com>
@JudithvE JudithvE requested a review from mberz November 5, 2025 15:04
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.

Thanks for the additional changes. Minor improvement

Equations
---------
.. math::
c = c_0 \sqrt{\frac{temperature - T_0}{20 - T_0}}

Choose a reason for hiding this comment

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

Suggested change
c = c_0 \sqrt{\frac{temperature - T_0}{20 - T_0}}
c = c_0 \sqrt{\frac{T - T_0}{20 - T_0}}

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 you contribution, it looks already very good, I just have a few suggestions.

----------
ISO 9613-1 (Formula A.5)
Equations
Copy link
Member

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

Comment on lines 30 to 32
T_0=-273.15
.. math::
c_0 = 343.2
Copy link
Member

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

@TimSchellekensLAV
Copy link

parametric.py does not pass ruff check

@TimSchellekensLAV
Copy link

test_documentation_build-3.13 failed

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.
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))

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

Copy link
Author

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])

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?

Copy link
Author

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.

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