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

Update parameters.thermal_speed #850

Merged
merged 21 commits into from
Jun 17, 2020

Conversation

pheuer
Copy link
Member

@pheuer pheuer commented Jun 9, 2020

Scrolling through the issue log, I saw #427 and thought it was an easy addition. However, while making the example I thought that since 1D, 2D, and 3D Maxwellians are included in the distribution.py module, thermal speeds for different dimensionalities should also be supported (if for no other reason than to remind people to use the right one). Does everyone agree this is worthwhile functionality?

In this PR I've added this functionality and wrote appropriate tests. I also created a thermal_speed example notebook that contains the plot originally requested in #427 and have added this example to the documentation.

Closes #427

@pep8speaks
Copy link

pep8speaks commented Jun 9, 2020

Hello @pheuer! Thanks for updating your pull request.

Congratulations! There are no PEP8 issues in this pull request. 😸

Comment last updated at 2020-06-09 20:36:58 UTC

@codecov
Copy link

codecov bot commented Jun 9, 2020

Codecov Report

Merging #850 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #850   +/-   ##
=======================================
  Coverage   95.94%   95.94%           
=======================================
  Files          56       56           
  Lines        5126     5128    +2     
=======================================
+ Hits         4918     4920    +2     
  Misses        208      208           
Impacted Files Coverage Δ
plasmapy/formulary/parameters.py 98.89% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8e358f...09639db. Read the comment docs.

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.

The changes and the notebook look great!

  • I'm getting some warnings from doc build (see CircleCI), which my suggestions might address
  • I see a possible simplifying refactor for the function without resorting to the Gamma function
  • and the newly added style checks are complaining. You should be able to apply style linting automatically by using
pip install pre-commit
cd $PLASMAPY_CLONED_REPO
pre-commit install
pre-commit run --all-files

It's freshly refreshed functionality, so I'd appreciate feedback on how that ends up working! 🙂

docs/formulary/distribution.rst Outdated Show resolved Hide resolved
docs/formulary/parameters.rst Outdated Show resolved Hide resolved
plasmapy/formulary/parameters.py Show resolved Hide resolved
plasmapy/formulary/parameters.py Outdated Show resolved Hide resolved
plasmapy/formulary/parameters.py Outdated Show resolved Hide resolved
@pheuer
Copy link
Member Author

pheuer commented Jun 15, 2020

@StanczakDominik Thanks for the suggestions! I've implemented the dictionary refactor: that's very elegant. A few other changes:

  • I ran pre-commit and it worked well (once I updated the fork to the current master: before that it wanted to fix lots of files).

  • I updated the example notebook to have a thumbnail. I ran into the same problem here as I did with the Thomson notebook where multi-figure plots are required but make bad thumbnails, so a single plot must also be included. Maybe theres a better way to handle this through a more sophisticated use of nbsphinx?

@StanczakDominik
Copy link
Member

I updated the example notebook to have a thumbnail. I ran into the same problem here as I did with the Thomson notebook where multi-figure plots are required but make bad thumbnails, so a single plot must also be included. Maybe theres a better way to handle this through a more sophisticated use of nbsphinx?

I don't think there is, or at least I'm not aware of it yet :(

I'll give this a quick once-over again and merge it, most likely :)

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.

Accepted with minor revisions! ;)

plasmapy/formulary/parameters.py Outdated Show resolved Hide resolved
plasmapy/formulary/parameters.py Outdated Show resolved Hide resolved
plasmapy/formulary/tests/test_parameters.py Show resolved Hide resolved
@pheuer
Copy link
Member Author

pheuer commented Jun 16, 2020

@StanczakDominik Looks good - most of the tests I've written for both this and the Thomson module have been known value comparisons: I can see the potential problems with this approach but I can't think of a better way to ensure the physics equations haven't been modified?

@StanczakDominik
Copy link
Member

@StanczakDominik Looks good - most of the tests I've written for both this and the Thomson module have been known value comparisons: I can see the potential problems with this approach but I can't think of a better way to ensure the physics equations haven't been modified?

Me neither, unless the original derivation provided value samples... Which they usually don't. Oh well.

@StanczakDominik
Copy link
Member

We could potentially try property based testing one of these days... I'd have to pick it up from scratch though.

No matter! Merging :)

@StanczakDominik StanczakDominik merged commit 6b9fb25 into PlasmaPy:master Jun 17, 2020
@rocco8773 rocco8773 added the plasmapy.formulary Related to the plasmapy.formulary subpackage label Jul 9, 2020
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.

1D Maxwellian example update
4 participants