Skip to content

Add NaN check to prevent raising a false relativity error #1681

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

Merged
merged 12 commits into from
Aug 22, 2022

Conversation

TrestanSimon
Copy link
Contributor

@TrestanSimon TrestanSimon commented Aug 19, 2022

This PR adds an additional check in plasmapy.formulary.relativity.Lorentz_factor to prevent input of np.nan from raising utils.RelativityError. Closes #1672.

  • I have added a changelog entry for this pull request.

  • If adding new functionality, I have added tests and
    docstrings.

  • I have fixed any newly failing tests.

@github-actions github-actions bot added the plasmapy.formulary Related to the plasmapy.formulary subpackage label Aug 19, 2022
@TrestanSimon
Copy link
Contributor Author

pre-commit.ci autofix

@codecov
Copy link

codecov bot commented Aug 19, 2022

Codecov Report

Merging #1681 (bf92298) into main (4342b08) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1681      +/-   ##
==========================================
+ Coverage   97.21%   97.23%   +0.02%     
==========================================
  Files          83       85       +2     
  Lines        7961     8020      +59     
==========================================
+ Hits         7739     7798      +59     
  Misses        222      222              
Impacted Files Coverage Δ
plasmapy/formulary/relativity.py 100.00% <100.00%> (ø)
plasmapy/particles/ionization_state.py 94.06% <0.00%> (-0.14%) ⬇️
plasmapy/particles/particle_class.py 98.99% <0.00%> (-0.01%) ⬇️
plasmapy/particles/atomic.py 100.00% <0.00%> (ø)
plasmapy/formulary/__init__.py 100.00% <0.00%> (ø)
plasmapy/particles/__init__.py 95.83% <0.00%> (ø)
plasmapy/formulary/dimensionless.py 100.00% <0.00%> (ø)
plasmapy/dispersion/numerical/hollweg_.py 100.00% <0.00%> (ø)
plasmapy/analysis/swept_langmuir/helpers.py 100.00% <0.00%> (ø)
plasmapy/simulation/particle_integrators.py 100.00% <0.00%> (ø)
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

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

At a first, early-morning and insufficiently-caffeinated glance (so I might be way off!), it doesn't look like this change will do the trick... Which is why it'd be great to add some tests here, to convince even the most sleepy maintainer ;) ! You can find some inspiration in the ones I listed at #1672 (comment) :)

@TrestanSimon
Copy link
Contributor Author

At a first, early-morning and insufficiently-caffeinated glance (so I might be way off!), it doesn't look like this change will do the trick... Which is why it'd be great to add some tests here, to convince even the most sleepy maintainer ;) ! You can find some inspiration in the ones I listed at #1672 (comment) :)

It works on my machine and passes the suggested tests (51ee531). Maybe I am missing something...

Copy link
Member

@namurphy namurphy 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 submitting this pull request! This is definitely going to make my life easier in #1539, so I very much appreciate it!

I added some minor suggestions related to formatting and test organization. Overall it looks good and we should be able to merge this pretty soon.

Thank you again!

TrestanSimon and others added 2 commits August 22, 2022 14:43
Co-authored-by: Nick Murphy <namurphy@cfa.harvard.edu>
Co-authored-by: Nick Murphy <namurphy@cfa.harvard.edu>
@TrestanSimon
Copy link
Contributor Author

pre-commit.ci autofix

@TrestanSimon
Copy link
Contributor Author

pre-commit.ci autofix

Copy link
Contributor Author

@TrestanSimon TrestanSimon left a comment

Choose a reason for hiding this comment

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

At a first, early-morning and insufficiently-caffeinated glance (so I might be way off!), it doesn't look like this change will do the trick... Which is why it'd be great to add some tests here, to convince even the most sleepy maintainer ;) ! You can find some inspiration in the ones I listed at #1672 (comment) :)

@StanczakDominik it appears to work properly and passes all tests. No changes necessary to the new code.

Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

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

Yeah, since it passes the tests, I'm a-okay with it! Sorry for the confusion earlier!

@namurphy namurphy enabled auto-merge (squash) August 22, 2022 16:39
@namurphy namurphy merged commit 84e5a38 into PlasmaPy:main Aug 22, 2022
namurphy added a commit to namurphy/PlasmaPy that referenced this pull request Oct 25, 2022
@TrestanSimon TrestanSimon deleted the Lorentz_factor_NaN branch June 9, 2023 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plasmapy.formulary Related to the plasmapy.formulary subpackage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Lorentz_factor accept & return NaN values
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy