-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fix Aperture
vectorisation issue
#268
base: master
Are you sure you want to change the base?
Conversation
We kind of already talked about this a little bit, but I think this will basically require that the Correct? Am I missing something? |
Yes, the properties of the beam should be calculated only w.r.t. Then we need to think of how other elements handle the tracking. I would suggest adding another property like |
So, I think we should possibly approach this PR slightly differently. A mask and the way apertures currently work are not gradient-friendly, because it's all step functions. Maybe we should instead consider a survival probability for each function. And then consider beam properties as survival probability-weighted. Another handy thing about this would be that we could leave the masked implementation of |
This sounds good for me. I guess we'll see how this scales with collective effects later... @jank324 will you finish this PR? |
I actually think it will scale very nicely. Masking always flattens tensors, so you have to run a bunch of reshaping with Python operations. Multiplying with probabilities is one multiplication operation that can completely run concurrently and in machine code, so should be super fast. I meant to finish it myself, but right now I'm not on top enough of my submission schedule to dedicate time to Cheetah development. So if you want to work on this, go right ahead. |
Description
Add
particle_survival
attribute to theParticleBeam
. The particles blocked by theAperture
will be marked with0
and surviving particles will have1
.Right now
Aperture
still blocks differentiability, but can be addressed later using a sigmoid function for a smoothed blocking.Motivation and Context
Fixes #241.
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.