-
Notifications
You must be signed in to change notification settings - Fork 308
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1358 +/- ##
=======================================
Coverage 97.09% 97.10%
=======================================
Files 82 82
Lines 7671 7697 +26
=======================================
+ Hits 7448 7474 +26
Misses 223 223
Continue to review full report at Codecov.
|
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.
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.
changelog/1358.feature.rst
Outdated
@@ -0,0 +1 @@ | |||
Added a function to calculate the mean ionization state using the Thomas-Fermi average atom model |
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.
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.
plasmapy/formulary/ionization.py
Outdated
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). |
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.
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.
plasmapy/formulary/ionization.py
Outdated
n_e : `~astropy.units.Quantity` | ||
Electron number density in 1/m**3 |
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.
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).
plasmapy/formulary/ionization.py
Outdated
Electron number density in 1/m**3 | ||
|
||
T_e : `~astropy.units.Quantity` | ||
Electon temperature in K |
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.
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.
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) |
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.
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.
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 there a specific rule for naming multiple tests of the same function?
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.
It's generally helpful to end test names with a description of what is being tested, like test_atomic_number_exceptions
.
plasmapy/formulary/ionization.py
Outdated
|
||
Returns | ||
------- | ||
Z : `~astropy.units.Quantity` |
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.
Z : `~astropy.units.Quantity` | |
TF_Z : `~astropy.units.Quantity` |
And perhaps return a float instead of a Quantity
?
…ransport Merging updates from release 0.7
I have fixed all the conflicts. The PR is ready for review |
Add Thomas-Fermi ionization state calculation
docstrings.