-
-
Notifications
You must be signed in to change notification settings - Fork 15
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 fractional_split method #84
Conversation
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.
Some adjustments after the removal of int
handling and this looks good to me. Could use a unit test though.
pmd_beamphysics/particles.py
Outdated
|
||
Parameters: | ||
----------- | ||
fractions : float, int, or list of float/int |
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.
If all values have to be between 0 and 1 (exclusive), then fractions
can't be int
(or list of int
)
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.
fixed
Co-authored-by: Ken Lauer <[email protected]>
Co-authored-by: Ken Lauer <[email protected]>
Co-authored-by: Ken Lauer <[email protected]>
Co-authored-by: Ken Lauer <[email protected]>
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.
This looks good, but would you consider adding even a smoke test to the suite (i.e., one that ensures the code itself runs without crashing)?
Fractional split will use weights to partition the particles:
This is useful for splitting particles into head, core, and tail parts. Here, the 5% of the charge is in the tail, 90% is in the core, and 5 % is in the head: