Skip to content
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

ENH: Add units to scipy.constants description #17571

Open
BenediktBurger opened this issue Dec 9, 2022 · 9 comments · May be fixed by #18979
Open

ENH: Add units to scipy.constants description #17571

BenediktBurger opened this issue Dec 9, 2022 · 9 comments · May be fixed by #18979
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.constants

Comments

@BenediktBurger
Copy link

Is your feature request related to a problem? Please describe.

I could not find out, in which units the constants of scipy.constants are.
I guess they are in SI notation, but I'd like to be sure, before I use these numbers.

Describe the solution you'd like.

Could you add either a general note, that all the constants are given in base units of the SI system, or add to every constant the relavant units (e.g. speed of light in vacuum in meters/second).

Describe alternatives you've considered.

No response

Additional context (e.g. screenshots, GIFs)

No response

@BenediktBurger BenediktBurger added the enhancement A new feature or improvement label Dec 9, 2022
@tupui
Copy link
Member

tupui commented Dec 9, 2022

Hi @bmoneke, thank you for reporting. Units are in the doc here https://docs.scipy.org/doc/scipy/reference/constants.html

Is there something missing? (scroll down). Otherwise yes, everything is in SI and yes maybe we can add a note at the beginning to make it clear. Would you like to do it?

@tupui tupui added Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.constants and removed enhancement A new feature or improvement labels Dec 9, 2022
@BenediktBurger
Copy link
Author

Below are the constants with units, but the "base constants" are not labelled.

I can do it.

I'll add a general note at the beginning.

What do you think about writing to every constant (in that list) the unit as well? Just as a reminder for the readers.

@tupui
Copy link
Member

tupui commented Dec 9, 2022

Spelling out all constants, as done for the rest, is a good idea 👍

(If you are looking into making changes to this doc. There is a stalled PR that wanted to change the organisation etc #11682. If you are interested, it would be great to pick up 😃)

Thanks!

@tupui
Copy link
Member

tupui commented Dec 9, 2022

@bmoneke maybe hold on a bit here. As you can see in #11682 some work might start again. In any case, thank you for raising this as it helped move things!

@BenediktBurger
Copy link
Author

I saw that other point, when I searched for open/closed issues before opening my own one.

Thanks for your fast responses.

@jakobjakobson13
Copy link
Contributor

@bmoneke : Could you answer me two questions for clarification?

Below are the constants with units, but the "base constants" are not labelled.

The base constants are included in the CODATA constants provided by scipy but the base constants are not emphasized explicitly. So you are right, they can be easily overlooked.
Do you want to list the base constants in an dedicated section or do you want to just emphasize them? In the first case they would be listed twice (which I would neither consider ideal) whereas the second case will not be easy to implement.

@BenediktBurger
Copy link
Author

@jakobjakobson13 , thanks for the question.

I just want to know the units next to the name. They don't have to be emphasized.

Here my problem: I imported the package and found c = 3e8 (approximately). Then I try to figure out, what the unit of that c is and I don't find anything in the documentation.
The documentation regarding CODATA did not help either, as the same constant is included several times (e.g. Boltzmann constant), albeit in different units. Which of these is now the directly imported value?

I cannot use a constant without knowing, that the units fit.

Maybe a (bold) remark, that these base constants are the numbers in the SI system might be enough and a small change. However, being explicit about the units is better, I think.

I hope I succeeded in showing my problem.

@jakobjakobson13
Copy link
Contributor

Congratulations, you picked a nice corner case here :)
By loading the scipy.constants module some constants are currently imported automatically.

from ._constants import *

Among these constants is c or the speed of light in vacuum.
c = speed_of_light = _cd('speed of light in vacuum')

The problem now is however that _cd only imports the value but not the unit.
from ._codata import value as _cd

def value(key: str) -> float:

If you had imported the constant via scipy.constants.physical_constants you would have had the constant with its value AND its unit. I hope that helps to your understanding.

@BenediktBurger
Copy link
Author

Thanks for your explanation. Maybe you can use my experience during your adjustments, in order to make it more understandable, how to use it.

AlexSzatmary added a commit to AlexSzatmary/scipy that referenced this issue Jul 27, 2023
As noted in issue scipy#17571, while most constants have units indicated, the
"Physical constants" at the top of the documentation do not. I copied
the unit symbols from _codata.py. This should close the issue.

[skip actions] [skip cirrus]
@AlexSzatmary AlexSzatmary linked a pull request Jul 27, 2023 that will close this issue
AlexSzatmary added a commit to AlexSzatmary/scipy that referenced this issue Jul 28, 2023
As noted in issue scipy#17571, while most constants have units indicated, the
"Physical constants" at the top of the documentation do not. I copied
the unit symbols from _codata.py. This should close the issue.

[skip actions] [skip cirrus]
AlexSzatmary added a commit to AlexSzatmary/scipy that referenced this issue Jul 28, 2023
As noted in issue scipy#17571, while most constants have units indicated, the
"Physical constants" at the top of the documentation do not. I copied
the unit symbols from _codata.py. This should close the issue.

[skip actions] [skip cirrus]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.constants
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants