Skip to content

Update docstrings and annotations in formulary length calculations - #2356

Merged
namurphy merged 9 commits into
PlasmaPy:mainfrom
namurphy:fix-gyroradius-docstring
Oct 4, 2023
Merged

namurphy merged 9 commits into
PlasmaPy:mainfrom
namurphy:fix-gyroradius-docstring

Conversation

@namurphy

@namurphy namurphy commented Oct 3, 2023

Copy link
Copy Markdown
Member

Description

I'm updating the docstring of gyroradius, including some reorganization and more narrative examples.

Motivation and context

I was looking through the online documentation and noticed that some of the symbols in the docstring for gyroradius were specific to ions.

@github-actions github-actions Bot added the plasmapy.formulary Related to the plasmapy.formulary subpackage label Oct 3, 2023
@github-actions

github-actions Bot commented Oct 3, 2023

Copy link
Copy Markdown

Thank you for submitting a pull request (PR) to PlasmaPy! ✨ The future of the project depends on contributors like you, so we deeply appreciate it! 🌱

Our contributor guide has information on:

The bottom of this page shows several checks that are run for every PR. Don't worry if something broke! We break stuff all the time. 😺 Click on "Details" to learn why a check didn't pass. Please also feel free to ask for help. We do that all the time as well. 🌸 You can find us in our chat room or weekly community meeting & office hours. Here are some tips:

  • Try fixing CI / Python 3.11 test failures first.
  • Most pre-commit.ci - pr failures can be automagically fixed by commenting pre-commit.ci autofix below, followed by a git pull to bring the changes back to your computer.
  • If pre-commit.ci - pr says that a function is too long or complex, try breaking up that function into multiple short functions that each do one thing. See also these tips on writing clean scientific software.
  • If the CI / Documentation check ends with a cryptic error message, check out our documentation troubleshooting guide.
  • For a documentation preview, click on Details next to docs/readthedocs.org:plasmapy.

If this PR is marked as ready for review, someone should stop by to provide a code review and offer suggestions soon. ✅ If you don't get a review within a few days, please feel free to send us a reminder.

Please also use SI units within PlasmaPy, except when there is strong justification otherwise or in some examples.

We thank you once again!

@codecov

codecov Bot commented Oct 3, 2023 •

Copy link
Copy Markdown

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (99f905b) 98.35% compared to head (91270f0) 98.35%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2356   +/-   ##
=======================================
  Coverage   98.35%   98.35%           
=======================================
  Files         101      101           
  Lines        8580     8582    +2     
=======================================
+ Hits         8439     8441    +2     
  Misses        141      141           
Files Coverage Δ
plasmapy/diagnostics/thomson.py 97.95% <ø> (ø)
plasmapy/formulary/lengths.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions Bot added docs PlasmaPy Docs at http://docs.plasmapy.org contributor guide labels Oct 3, 2023
@github-actions github-actions Bot added the plasmapy.diagnostics Related to the plasmapy.diagnostics subpackage label Oct 3, 2023
@namurphy
namurphy requested a review from ejohnson-96 October 3, 2023 23:17
@namurphy
namurphy marked this pull request as ready for review October 3, 2023 23:17
@namurphy
namurphy requested review from a team and pheuer as code owners October 3, 2023 23:17
@namurphy
namurphy removed request for a team and pheuer October 3, 2023 23:17
Comment on lines +112 to +113
Vperp: u.Quantity[u.m / u.s] = np.nan * u.m / u.s,
T: u.Quantity[u.K] = None,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Excited that these Quantity annotations are working! Now these can be true type hints.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will these have to be altered in all other modules?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep! This is a first try to see if the new capability of @validate_quantities to deal with Quantity[Unit] style is working in action. I'm hoping to figure out a way to automate this...which might end up meaning I'll need to delve into regular expressions.

@ejohnson-96 ejohnson-96 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good

Comment thread plasmapy/diagnostics/thomson.py Resolved

@validate_quantities(
Vperp={"can_be_nan": True},
Vperp={"can_be_nan": True}, # none_shall_pass

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

Comment on lines +112 to +113
Vperp: u.Quantity[u.m / u.s] = np.nan * u.m / u.s,
T: u.Quantity[u.K] = None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will these have to be altered in all other modules?

@namurphy
namurphy merged commit 3b5340c into PlasmaPy:main Oct 4, 2023
@namurphy
namurphy deleted the fix-gyroradius-docstring branch October 4, 2023 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor guide docs PlasmaPy Docs at http://docs.plasmapy.org plasmapy.diagnostics Related to the plasmapy.diagnostics subpackage plasmapy.formulary Related to the plasmapy.formulary subpackage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants