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
[DRAFT] Add Particle scattering and stopping to the charged particle radiography class #1875
base: main
Are you sure you want to change the base?
Conversation
Thank you for contributing to PlasmaPy! The project's future depends deeply on contributors like you, so we deeply appreciate it! 🌱 The following checklist will be used by the code reviewer to help guide the code review process.
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1875 +/- ##
==========================================
- Coverage 98.31% 98.21% -0.11%
==========================================
Files 95 95
Lines 8383 8471 +88
==========================================
+ Hits 8242 8320 +78
- Misses 141 151 +10
☔ View full report in Codecov by Sentry. |
1799 is merged, did you mean another PR there, or...? |
#1802 is the one I'm replacing: this PR needed to be refactored after 1799 got merged and, after ending up in a bit of a git tangle, I ended up just making a new branch from main and copying over the changes. |
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.
A couple quick fixes for now:
@njit | ||
def draw_from_normal(sigmas): | ||
""" | ||
Draw samples from a set of normal distributions where each | ||
distribution has a different standard deviation. | ||
""" | ||
output = np.zeros(sigmas.size) | ||
for i in range(sigmas.size): | ||
output[i] = np.random.normal(loc=0, scale=sigmas[i]) | ||
return output | ||
|
||
|
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.
@njit | |
def draw_from_normal(sigmas): | |
""" | |
Draw samples from a set of normal distributions where each | |
distribution has a different standard deviation. | |
""" | |
output = np.zeros(sigmas.size) | |
for i in range(sigmas.size): | |
output[i] = np.random.normal(loc=0, scale=sigmas[i]) | |
return output |
You can actually just use np.random.normal(scale=sigmas)
!
Tabluated radiation lengths can be found here: | ||
https://pdg.lbl.gov/2022/AtomicNuclearProperties/index.html | ||
|
||
Tablulated proton and electron stopping power curves can be found here: |
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.
Tabluated radiation lengths can be found here: | |
https://pdg.lbl.gov/2022/AtomicNuclearProperties/index.html | |
Tablulated proton and electron stopping power curves can be found here: | |
Tabulated radiation lengths can be found here: | |
https://pdg.lbl.gov/2022/AtomicNuclearProperties/index.html | |
Tabulated proton and electron stopping power curves can be found here: |
* np.sqrt(L_m / L_rad[:, i].to(u.m).value) | ||
) | ||
|
||
thetas = draw_from_normal(sigmas) # polar angle |
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.
thetas = draw_from_normal(sigmas) # polar angle | |
thetas = np.random.normal(scale=sigmas) # polar angle |
This PR adds particle scattering and stopping in dense matter to the charged particle radiography Tracker class. This capability is important for charged particle radiography in dense plasmas where these effects significantly affect the radiograph.
Builds on #1799, so merge that first.
Note: should compare this implementation of scattering + stopping to the MPRAD code described here: https://aip.scitation.org/doi/full/10.1063/1.5123392
Replaces a previous PR (#1802) because I needed to completely refactor after #1799