-
Notifications
You must be signed in to change notification settings - Fork 306
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
Added Tests for Verify correctness in MaxwellianCollisionFrequencies #2614
Added Tests for Verify correctness in MaxwellianCollisionFrequencies #2614
Conversation
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:
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 ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2614 +/- ##
==========================================
- Coverage 95.18% 95.17% -0.02%
==========================================
Files 104 104
Lines 9415 9415
Branches 2154 2154
==========================================
- Hits 8962 8961 -1
Misses 276 276
- Partials 177 178 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! I think the test looks good - one minor comment below.
I think the failing test might be because of an increase of coverage on main
, so if you merge main
into this branch that might be resolved?
@@ -708,7 +753,7 @@ def test_fail1(self) -> None: | |||
""" | |||
fail1 = self.True1 * (1 + 1e-15) | |||
with pytest.warns(PhysicsWarning, match="strong coupling effects"): | |||
methodVal = collision_frequency( | |||
methodVal: u.Quantity = collision_frequency( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this type hinting necessary? It looks like collision_frequency has its own type hint that inidicates that it returns a Quantity.
def collision_frequency(
T: u.Quantity[u.K],
n: u.Quantity[u.m**-3],
species,
z_mean: float = np.nan,
V: u.Quantity[u.m / u.s] = np.nan * u.m / u.s,
method="classical",
) -> u.Quantity[u.Hz]:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how that was modified; I have removed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One possibility is that this was an automated refactoring by an IDE. 🤔 I've infrequently had unintentional changes from IDEs sneak in to pull requests before, like removing imports. In any case, thanks for removing it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍🏻 Thank you again for doing this! 🚀
It's good to see that Codecov appears to be working again. The problem was that this PR was being compared against a commit that was two months old because of a problem with the Codecov token not being recognized.
I have some slight edits to the changelog which I'll merge, and then set this PR to auto-merge once tests pass again.
Thank you again!
], | ||
) | ||
@pytest.mark.filterwarnings("ignore::plasmapy.utils.exceptions.RelativityWarning") | ||
def test_correctness_collision_freq_values( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@namurphy Isn't there a name for when you test software to see if it reproduces a previously recorded output?
I'd suggest we change the name here to test_collision_freq_values_match_previous_evaluation
or something, since correctness
implies that the actual physics is being tested here? Unless these numbers are coming from a by-hand calculation, in which case this test is an independent verification of the physics in code?
Edit: This is pretty minor point, so I don't want to hold up the merge, just something for discussion.
Description
Added Tests to verify correctness of for the following two properties in
MaxwellianCollisionFrequencies
:Maxwellian_avg_ei_collision_freq
Maxwellian_avg_ii_collision_freq
Motivation and context
Related issues
PR for the Issue
Closes #2333