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

Add Thomas Fermi ionization state function #1358

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

lucianogsilvestri
Copy link
Contributor

@lucianogsilvestri lucianogsilvestri commented Dec 15, 2021

Add Thomas-Fermi ionization state calculation

  • [ X] I have added a changelog entry for this pull request.
  • [X ] 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 Dec 15, 2021
@github-actions github-actions bot added the docs PlasmaPy Docs at http:https://docs.plasmapy.org label Dec 15, 2021
@codecov
Copy link

codecov bot commented Dec 15, 2021

Codecov Report

Merging #1358 (102357f) into main (2a13801) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1358   +/-   ##
=======================================
  Coverage   97.09%   97.10%           
=======================================
  Files          82       82           
  Lines        7671     7697   +26     
=======================================
+ Hits         7448     7474   +26     
  Misses        223      223           
Impacted Files Coverage Δ
plasmapy/formulary/ionization.py 100.00% <100.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 2a13801...102357f. 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.

Thank you again for working on this! This is going to be helpful functionality to have in PlasmaPy. I have a few mostly quick suggestions for the first round of review.

@@ -0,0 +1 @@
Added a function to calculate the mean ionization state using the Thomas-Fermi average atom model
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Added a function to calculate the mean ionization state using the Thomas-Fermi average atom model
Added a function to calculate the mean ionization state using the Thomas-Fermi average atom model.

Minor stylistic change.

Comment on lines 206 to 208
R.M. More, "Pressure Ionization, Resonances, and the
Continuity of Bound and Free States", Adv. in Atomic
Mol. Phys., Vol. 21, p. 332 (Table IV).
Copy link
Member

Choose a reason for hiding this comment

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

Here's a link to the bibliography section in the doc guide which I think I mentioned earlier today. It's a pretty new section of the doc guide, so I'd be happy to hear any suggestions on how that section in the doc guide could be improved.

Comment on lines 215 to 216
n_e : `~astropy.units.Quantity`
Electron number density in 1/m**3
Copy link
Member

@namurphy namurphy Dec 17, 2021

Choose a reason for hiding this comment

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

Suggested change
n_e : `~astropy.units.Quantity`
Electron number density in 1/m**3
n_e : `~astropy.units.Quantity`
Electron number density in units convertible to m\ :sup:`-3`\ .

I think I got the reST format correct, but it'd be worth checking in the documentation preview (after clicking on Details next to docs/readthedocs.org:plasmapy in the checks).

Electron number density in 1/m**3

T_e : `~astropy.units.Quantity`
Electon temperature in K
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Electon temperature in K
Electron temperature in K or energy per electron.

...since validate_quantities allows us to input temperature in eV per particle too.

Comment on lines 49 to 62
def test_thomas_fermi_ionization_state():
n = 1e29 * u.m ** -3
T_e = 11604518.12155008 * u.K
z = 6

val = thomas_fermi_ionization_state(z, n, T_e)
assert val.unit == u.dimensionless_unscaled
assert np.isclose(val.value, 5.849715866306117)

with pytest.warns(u.UnitsWarning):
thomas_fermi_ionization_state(z, 1e29, T_e)

with pytest.raises(u.UnitTypeError):
thomas_fermi_ionization_state(z, 1e29 * u.kg, T_e)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps split this test up into multiple smaller tests? Currently if one of the assert statements raises an exception, the tests of the warning and exception won't be run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a specific rule for naming multiple tests of the same function?

Copy link
Member

Choose a reason for hiding this comment

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

It's generally helpful to end test names with a description of what is being tested, like test_atomic_number_exceptions.


Returns
-------
Z : `~astropy.units.Quantity`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Z : `~astropy.units.Quantity`
TF_Z : `~astropy.units.Quantity`

And perhaps return a float instead of a Quantity?

@lucianogsilvestri lucianogsilvestri marked this pull request as ready for review May 3, 2022 20:06
@lucianogsilvestri
Copy link
Contributor Author

I have fixed all the conflicts. The PR is ready for review

@namurphy namurphy added the status: dormant PRs that are stalled label May 26, 2023
@namurphy namurphy added this to the Future milestone Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs PlasmaPy Docs at http:https://docs.plasmapy.org plasmapy.formulary Related to the plasmapy.formulary subpackage status: dormant PRs that are stalled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants