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

Modify impact_parameter() to work with N-D arrays #1604

Merged
merged 7 commits into from Jun 30, 2022

Conversation

pheuer
Copy link
Member

@pheuer pheuer commented Jun 29, 2022

The impact_parameter function in collisions.py can currently handle a 1D array of densities or temperatures, but not arrays of higher dimension. This PR changes line that handles 1D arrays to work for any shape array.

impact_parameter is called by many of the other functions in the collisions module (for example, `collision_frequency'), so this change will also enable support for higher dimension arrays in some of those functions.

@pheuer pheuer added the plasmapy.formulary Related to the plasmapy.formulary subpackage label Jun 29, 2022
@pheuer pheuer requested a review from namurphy June 29, 2022 15:27
@pheuer pheuer added the status: ready for review PRs that are ready for code review label Jun 29, 2022
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, @pheuer! This looks really helpful.

Would you be able to add some tests of this capability? If this function gets revised in the future, I can imagine that this change could get accidentally/unknowingly reverted.

Thank you again!

changelog/1604.feature.rst Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 29, 2022

Codecov Report

Merging #1604 (72f0309) into main (eb4b66b) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1604   +/-   ##
=======================================
  Coverage   97.21%   97.21%           
=======================================
  Files          83       83           
  Lines        7961     7961           
=======================================
  Hits         7739     7739           
  Misses        222      222           
Impacted Files Coverage Δ
plasmapy/formulary/collisions.py 96.96% <100.00%> (ø)
plasmapy/utils/units_helpers.py
plasmapy/utils/units_definitions.py
plasmapy/utils/_units_helpers.py 100.00% <0.00%> (ø)
plasmapy/utils/_units_definitions.py 100.00% <0.00%> (ø)

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 eb4b66b...72f0309. Read the comment docs.

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.

It's looking close! I have a couple of minor suggestions, but we can probably merge this today.

plasmapy/formulary/tests/test_collisions.py Outdated Show resolved Hide resolved
plasmapy/formulary/tests/test_collisions.py Outdated Show resolved Hide resolved
Co-authored-by: Nick Murphy <namurphy@cfa.harvard.edu>
@pheuer
Copy link
Member Author

pheuer commented Jun 30, 2022

Those suggestions look good to me - thanks @namurphy !

@namurphy
Copy link
Member

Cool! Assuming everything passes, we can merge this just in time for the 0.8.0 release which may happen Friday we hope.

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.

I'll enable auto-merge since as long as tests pass then this will be ready. Thanks again for doing this!

@namurphy namurphy enabled auto-merge (squash) June 30, 2022 02:01
@namurphy namurphy merged commit ecb36b3 into PlasmaPy:main Jun 30, 2022
@namurphy namurphy removed the status: ready for review PRs that are ready for code review label Aug 15, 2022
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.

None yet

2 participants