Skip to content

Conversation

@JaydenR2305
Copy link
Member

@JaydenR2305 JaydenR2305 commented Aug 9, 2022

Resolves PlasmaPy/hack-week#26

  • 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 9, 2022
Copy link

@github-actions github-actions bot 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 making your first contribution to PlasmaPy! The project's future depends on contributors like you, so we deeply appreciate it! 🌱
To make sure that you get credit for this pull request (PR), please add yourself to the list of contributors in docs/about/credits.rst.
We encourage you to check out our contributor guide, which discusses topics like adding changelog entries. If you'd like to talk with us in real time, the easiest way is via our chat room. We also invite you to stop by our weekly community meeting or office hours.
The bottom of this page includes several checks that are run for every PR. Don't worry if something broke! We break stuff all the time. Eventually we'll want to get checks on this PR to pass before merging it. Clicking on Details next to the check will show the results of the test, including error messages. Please feel free to ask for help if you're having trouble (we do that all the time, as well).
Our testing guide describes these checks in more detail, as well as how to write and run tests. We recommend trying out test-driven development: write tests first, and then write code to make tests pass. Remember to run tests often!
As described in our documentation guide, PlasmaPy's documentation is written in reStructuredText using the numpydoc docstring standard. To see a preview of the documentation from this PR, click on Details next to the docs/readthedocs.org:plasmapy check.
To automagically fix most linter problems, comment on this PR with pre-commit.ci autofix, followed by a git pullto bring the changes home to your own computer.
A code maintainer should come by soon to begin a code review. This step often includes suggestions for fixing bugs, adding tests, or simplifying the implementation. After that you'll have a chance to make changes. If you'd like more time before a code review happens, you can convert this PR to a draft now and mark it as ready for review later.
Finally, we try to be the best community we can be. We have a Code of Conduct to foster a community of care and appreciation.
We thank you once again! ✨

@github-actions github-actions bot added the docs PlasmaPy Docs at http://docs.plasmapy.org label Aug 9, 2022
@codecov
Copy link

codecov bot commented Aug 11, 2022

Codecov Report

Merging #1664 (984c336) into main (5a51592) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1664      +/-   ##
==========================================
- Coverage   97.23%   97.22%   -0.01%     
==========================================
  Files          84       85       +1     
  Lines        8016     8012       -4     
==========================================
- Hits         7794     7790       -4     
  Misses        222      222              
Impacted Files Coverage Δ
plasmapy/formulary/__init__.py 100.00% <100.00%> (ø)
plasmapy/formulary/densities.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/particles/__init__.py 95.83% <0.00%> (ø)
plasmapy/simulation/particle_integrators.py 100.00% <0.00%> (ø)

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

@pheuer pheuer left a comment

Choose a reason for hiding this comment

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

Nice start! I've left some comments on the code. The next step (after creating the densities.py file) will be to create tests using Pytest. You should create a /formulary/tests/test_densities.py file (look at test_frequenices or test_speeds for ideas). Some ideas for tests would be:

  • Use pytest.raises() and pytest.warns() to check that invalid inputs raise the correct exceptions and warnings.
  • Manually compute 1-2 values of n_c and write an assert test that checks that your function returns the correct value. That would look something like:
    assert np.isclose(n_c, true_value)

Add `densities.py` & move `plasma_critical_density()` from `frequencies.py` to `densities.py`
Revise changelog entry
@JaydenR2305 JaydenR2305 marked this pull request as ready for review August 11, 2022 18:36
@pheuer
Copy link
Member

pheuer commented Aug 12, 2022

So you're getting a CI error for the new module:

/home/runner/work/PlasmaPy/PlasmaPy/docs/formulary/densities.rst: WARNING: document isn't included in any toctree

(you can see that by clicking 'details' next to the failing test)

I think you need to also add a link to this file in \docs\formulary\index.rst. That tells autodoc where to include this file's information in the overall structure of the documentation.

Separate tests
Add `densities` to toctree
@JaydenR2305 JaydenR2305 marked this pull request as draft August 12, 2022 19:02
@JaydenR2305 JaydenR2305 marked this pull request as ready for review August 12, 2022 19:17
Copy link
Member

@pheuer pheuer left a comment

Choose a reason for hiding this comment

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

Very nice! Just a couple more minor comments and I think this is ready to merge.

@JaydenR2305 JaydenR2305 requested a review from pheuer August 13, 2022 20:19
Copy link
Member

@pheuer pheuer left a comment

Choose a reason for hiding this comment

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

Thanks @JaydenR2305 ! This is really close - just a couple more notes and I think it's ready to go.

@JaydenR2305 JaydenR2305 changed the title Add plasma_critical_density Add critical_density Aug 16, 2022
@JaydenR2305 JaydenR2305 requested a review from pheuer August 16, 2022 18:28
Copy link
Member

@pheuer pheuer left a comment

Choose a reason for hiding this comment

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

Looks good to me: thanks for putting this together!

I've approved the changes - you can now squash and merge your commits onto the main branch below.

@JaydenR2305
Copy link
Member Author

Looks good to me: thanks for putting this together!

I've approved the changes - you can now squash and merge your commits onto the main branch below.

Hey Peter, I need someone with write access to merge my pull request. Thank you for your patience throughout this process!

@pheuer pheuer merged commit 5dbaf3a into PlasmaPy:main Aug 16, 2022
@pheuer
Copy link
Member

pheuer commented Aug 16, 2022

@JaydenR2305 oops, yes I guess so. Ok, merged!

@pheuer
Copy link
Member

pheuer commented Aug 16, 2022

And no problem at all - this was an excellent first contribution and I'm happy to help you with any more you wish to work on in the future!



class TestCriticalDensity:
"""Test the plasma_critical_density function in densities.py."""
Copy link
Member Author

Choose a reason for hiding this comment

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

missed a spot

@JaydenR2305 JaydenR2305 deleted the plasma-critical-density branch August 17, 2022 12:09
namurphy added a commit to namurphy/PlasmaPy that referenced this pull request Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the plasma critical density in the formulary

3 participants