-
Notifications
You must be signed in to change notification settings - Fork 17
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 particle generation for 3D uniform ellispoid distribution #146
Conversation
I think this should be a |
cheetah/utils.py
Outdated
|
||
|
||
def generate_3d_uniform_ellipsoid( | ||
num_particles: torch.Tensor, r_x: torch.Tensor, r_y: torch.Tensor, r_z: torch.Tensor |
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.
I think the arguments should be called radius_x
and so on. It's not too long and this way I don't have to look at the documentation to figure out what r_x
is ... i.e. it's much more readable.
Yes, that could be a solution. I don't know if it will become very crowded in the future, as particle distributions can be quite arbitrary. E.g. transverse 2D + longitudinal 1D with different distributions; |
Thanks for adding this! |
I'm not too worried that it would get too crowded. I think beam = ParticleBeam.3d_uniform_elipsoid() makes for a very intuitive interface. If I were to look for the distribution code, I would also immediately look where the Also, I think that at some point |
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.
@cr-xu I reviewed the code by breaking and refactoring it to be more readable. I think it can be merged as it is now.
Description
Add a preliminary 3d uniform ellispoidal generation routine.
Motivation and Context
This addresses #145
Right now the code is lying in
utils
but we can think of moving it later.To get a waterbag bunch, right now one can generate the distribution first and input it into
ParticleBeam
Types of changes
Checklist
flake8
(required).pytest
tests pass (required).pytest
on a machine with a CUDA GPU and made sure all tests pass (required).Note: We are using a maximum length of 88 characters per line