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

Function to calculate the thermal bremsstrahlung spectrum #892

Merged
merged 18 commits into from
Sep 8, 2020

Conversation

pheuer
Copy link
Member

@pheuer pheuer commented Aug 25, 2020

I wrote a function to calculate the power spectrum of thermal bremsstrahlung emitted by a Maxwellian plasma using the equations given on the Wikipedia page. I also created the appropriate documentation (docstring, an ipynb example).

I wasn't sure where to put this: it doesn't fit into any of the existing Formulary categories so I created a new one for "Radiation". Alternate names could maybe be "EMradiation" or something?

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

Review Jupyter notebook visual diffs & provide feedback on notebooks.


Powered by ReviewNB

@pheuer pheuer added plasmapy.formulary Related to the plasmapy.formulary subpackage status: ready for review PRs that are ready for code review labels Aug 25, 2020
@pheuer pheuer self-assigned this Aug 25, 2020
@codecov
Copy link

codecov bot commented Aug 25, 2020

Codecov Report

Merging #892 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #892      +/-   ##
==========================================
+ Coverage   96.18%   96.20%   +0.02%     
==========================================
  Files          59       60       +1     
  Lines        5367     5397      +30     
==========================================
+ Hits         5162     5192      +30     
  Misses        205      205              
Impacted Files Coverage Δ
plasmapy/formulary/radiation.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 37120c7...25595e7. 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 for working on this! This will be a great addition to the formulary. I have a feel initial suggestions and will try to take another look at it later, but it's looking pretty close to done. The tentative suggestions I made shouldn't be accepted just by themselves, since variable name changes etc. will require changes elsewhere in the code too. Thank you again!

ne: u.m ** -3,
Te: u.K,
ni: u.m ** -3 = None,
ion_species: Union[str, Particle] = "H+",
Copy link
Member

Choose a reason for hiding this comment

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

Here we can use the @particle_input decorator from plasmapy.particles, which will automatically convert a string representation of a particle into a Particle object. If I remember correctly, the decorator will make sure that the particle is an ion if the argument is named ion.

Suggested change
ion_species: Union[str, Particle] = "H+",
ion: Particle = None,

I've also been thinking that we should avoid setting default particles, since lab plasma physicists may assume a different default particle than space plasma physicists.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea: I'll use the decorator. I see your point about the potential for confusion, but as a lab plasma physicist I think H+ would still be my assumption? The benefit of having a default is the ability to do a quick calculation without having to be familiar with the particle class.

plasmapy/formulary/radiation.py Outdated Show resolved Hide resolved
plasmapy/formulary/radiation.py Outdated Show resolved Hide resolved
plasmapy/formulary/radiation.py Outdated Show resolved Hide resolved
plasmapy/formulary/radiation.py Outdated Show resolved Hide resolved
plasmapy/formulary/radiation.py Show resolved Hide resolved
plasmapy/formulary/radiation.py Outdated Show resolved Hide resolved
Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

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

LGTM! 👍 Thanks for doing this!

plasmapy/formulary/radiation.py Outdated Show resolved Hide resolved
@StanczakDominik
Copy link
Member

The py36_minimal_conda [linux] failure is unrelated (#894 attempted a fix), so let's merge it 🎉 Thanks!

@StanczakDominik
Copy link
Member

Wrong button!

@StanczakDominik StanczakDominik merged commit 582c7c6 into PlasmaPy:master Sep 8, 2020
@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.

3 participants