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

DOC: drastic rewrite of constants documentation #11682

Closed
wants to merge 28 commits into from
Closed

DOC: drastic rewrite of constants documentation #11682

wants to merge 28 commits into from

Conversation

jakobjakobson13
Copy link
Contributor

If this rewrite is too drastic, let me know.

Reference issue

Fixes #11173

What does this implement/fix?

It is an overhaul of the constants documentation.

Related pull requests

#11343 and #11345 are also concerning the constants module however with a different focus.

If this rewrite is too drastic, let me know.
@pv pv changed the title Pretty drastic rewrite of constants init DOC: drastic rewrite of constants documentation Mar 18, 2020
@miladsade96 miladsade96 added Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.constants labels Mar 18, 2020
@ilayn
Copy link
Member

ilayn commented Mar 19, 2020

@jakobjakobson13 Thanks a lot for doing this. Is it possible that you work on this file offline such that it doesn't choke the CI/CD pipeline? Because you are placing a commit each time you make a change it is firing up a new trigger for all the tools as you can see below.

@jakobjakobson13
Copy link
Contributor Author

@jakobjakobson13 Thanks a lot for doing this. Is it possible that you work on this file offline such that it doesn't choke the CI/CD pipeline? Because you are placing a commit each time you make a change it is firing up a new trigger for all the tools as you can see below.

I did not manage to compile the documentation at my laptop but I'll try it for the next commits. For the moment I would wait anyway for any comments of you guys before I push/make any further commits.


Force
-----
or via the dictionaries stored in :mod:`scipy.constants.physical_constants`
Copy link
Member

Choose a reason for hiding this comment

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

This is the cause of the doc build warnings, there is no module physical_constants. Shouldn't this just be scipy.constants?

Copy link
Member

Choose a reason for hiding this comment

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

Ah no, you are wanting to refer to physical_constants, which is simply a dictionary not a module (so both the :mod: is wrong and the sentence may need a tweak:

In [3]: type(constants.physical_constants)                                                     
Out[3]: dict

@rgommers
Copy link
Member

You can see the rendered version in the build_docs_artifact CI link. There's still some issues with links.

I like the restructure, first a sensible explanation and the huge list at the end makes sense.

==================
In 2019 seven système international d’unités (SI) base units were (re)defined to
serve as a basis for all physical quantities by the bureau
international des poids et mesures (BIPM) [SIunits]_. They can be summarized as followed
Copy link
Member

Choose a reason for hiding this comment

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

the [ ] brackets need removing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, here I wanted to provide the link with background information. Should I delete it anyway or change its label into "Introduction" or something similar?

Copy link
Member

Choose a reason for hiding this comment

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

No the link is fine, it's just the brackets that are now part of the link and look weird, also SIunits isn't the most informative name. How about simply:

(see [1])

``u`` atomic mass constant (in kg)
``atomic_mass`` atomic mass constant (in kg)
================= ============================================================
- The ampere :math:`\mathrm{A}` as the SI unit of electric current is derived
Copy link
Member

Choose a reason for hiding this comment

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

This would read better as ampere (A) rather than ampere A. And same for next lines.

@jakobjakobson13
Copy link
Contributor Author

Okay, so CircleCI fails due to release/0.18.0-notes.rst:215: WARNING: py:obj reference target not found: scipy.constants.convert_temperature and TravisCI fails due to ERROR: objects in scipy.constants.__all__ but not in refguide::. The other failures are, as far as I understand, however unrelated to my pull request.

So, how should this be handled?

@rgommers
Copy link
Member

rgommers commented Mar 19, 2020

The convert_temperature one is straightforward, just putting double backticks around that in the 0.18.0 release notes.

For the refguide check, one possible fix is to add all those objects to the skiplist at https://github.com/scipy/scipy/blob/master/tools/refguide_check.py#L127 (in an efficient way, using a list comprehension and a string join, rather than repeating r'scipy\.constants\. over and over).

The argument for the skiplist fix would be that constants don't need separate pages - they don't have docstrings. However, that runs the risk of the list being/becoming incomplete. So probably the more robust fix is to make sure the long listing you have is of the right form (typeset as links rather than code). I'll comment on the diff for the fix.

EDIT: never mind, there's already a special-casing of those constants, the issue was the listing in this PR is incomplete (e.g. constants.c went missing).

@rgommers
Copy link
Member

This looks a little weird:

image

the first three lines shouldn't have line breaks between them I think.


=========================== =================================================================
``c`` speed of light in vacuum
Copy link
Member

Choose a reason for hiding this comment

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

Actually, this you removed and didn't put back. Same for the other ones - that explains the CI failure

@ilayn
Copy link
Member

ilayn commented Mar 20, 2020

@jakobjakobson13 Friendly nudge about online changes. You can still push your changes all at once at one go via git commits. Then you don't need to save things and trigger CI/CD pipelines with which we don't want to be throttled.

If you need help with offline builds please ask for help.

@jakobjakobson13
Copy link
Contributor Author

@jakobjakobson13 Friendly nudge about online changes. You can still push your changes all at once at one go via git commits. Then you don't need to save things and trigger CI/CD pipelines with which we don't want to be throttled.

If you need help with offline builds please ask for help.

Okay, got it.

@jakobjakobson13
Copy link
Contributor Author

Before you push this comment to the master branch, I have the following comments:

  • I also reduced to constants.py file by deleting all constants from that file. So this would break compatibility of scripts that used something like scipy.constants.c for the speed of light. Also the cleanup leaves only the auxiliary functions and so the filename gets misleading. I also deleted the prefixes even though I thought about putting them into a new file called prefixes.py.
  • As the seven constants for the seven base units should have fixed values for the next years, I wanted to test them by hard coding their values to the test module. My local tests failed however as I could not test as the constants hyperfine coupling constant of casium-133 could not be found.
  • I would find a function that simplifies the units of a calculation quite convenient. To implement this however, you would have to convert all derived units into SI units (that would be easy), convert them to sympy variables (quite easy), simplify the resulting term (easy) and possibly reconvert them into a SI derived unit (quite tricky). But it would definitely be handy.


About the SI units
Copy link
Member

Choose a reason for hiding this comment

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

This is reference documentation, so background material would better go to the bottom of the page, as people are mainly going to be looking for variable/function names etc. (except maybe the first time when reading this).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll do it later.

# functions for conversions that are not linear

from .codata import value
import numpy as np
Copy link
Member

@pv pv Apr 10, 2020

Choose a reason for hiding this comment

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

This is no-go, the constants in this file can't be just removed without breaking backward compat.

I'd recommend to stick with documentation changes in this PR, other unrelated changes should go to separate PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is no-go, the constants in this file can't be just removed without breaking backward compat.

Okay, I'll revert it later.

I'd recommend to stick with documentation changes in this PR, other unrelated changes should go to separate PRs.

Should I go for it anyway as it breaks backwards compatibility?

Copy link
Member

@pv pv Apr 10, 2020

Choose a reason for hiding this comment

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

Should I go for it anyway as it breaks backwards compatibility?

I think not, as we can't remove them (and deprecation etc. does not seem warranted, and hard to do for constants). But as a general comment, it's better to stick to one topic in one PR.

@jakobjakobson13
Copy link
Contributor Author

As I deleted my scipy repository and the specific branch, I'm closing this pull request.

@tupui
Copy link
Member

tupui commented Dec 9, 2022

@jakobjakobson13 do you still plan to work on this?

@jakobjakobson13
Copy link
Contributor Author

jakobjakobson13 commented Dec 9, 2022

@jakobjakobson13 do you still plan to work on this?

That´s up to you.

However, if I work on it, I´ll slim it down drastically with the main page consisting of the following information:

  1. The seven SI defining constants of the SI [1]
  2. The CODATA contants given in [2, 3] (as Scipy currently provides them).

And a subpage giving the following background:

  1. The SI base units [1]
  2. Base quantities and dimensions used in the SI [1]
  3. SI prefixes [1]
  4. The 22 SI units with special names and symbols [1]
  5. Examples of coherent derived units in the SI expressed in terms of base
    units [1]
  6. Examples of SI coherent derived units whose names and symbols
    include SI coherent derived units with special names and symbols [1]
  7. Non-SI units accepted for use with the SI Units [1]

[1] The International System of Units – 9th edition – Complete text in English and French (2019)
[2] E. Tiesinga, P. J. Mohr, D. B. Newell, and B. N. Taylor, J. Phys. Chem. Ref. Data 50, 033105 (2021)
[3] E. Tiesinga, P. J. Mohr, D. B. Newell, and B. N. Taylor, Rev. Mod. Phys. 93, 025010 (2021)

@jakobjakobson13
Copy link
Contributor Author

Also, I deleted my fork on my hard drive and on Github. Does this mean, I would have to restart from scratch?

@tupui
Copy link
Member

tupui commented Dec 9, 2022

You seems to be the reference for this module so I would trust your judgment.

Also, I deleted my fork on my hard drive and on Github. Does this mean, I would have to restart from scratch?

No 😃 The changes are still available here and you can use for instance GitHub's CLI to pull it with gh pr checkout 11682

@jakobjakobson13
Copy link
Contributor Author

After second thoughts, I would defer this pull request to some time later. Feel free to take over.

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 this pull request may close these issues.

DOC: Major overhaul of scipy.constants documentation?
6 participants