desy-ml / cheetah

Fast and differentiable particle accelerator optics simulation for reinforcement learning and optimisation applications.
https://cheetah-accelerator.readthedocs.io
GNU General Public License v3.0
33 stars 13 forks source link

Element BPM does not work when applied on a Parameter Beam. #20

Closed FelixTheilen closed 1 year ago

FelixTheilen commented 1 year ago

The Function call within the element BPM always returns a ParticleBeam, even in case it is fed a ParameterBeam.

def __call__(self, incoming):
    if incoming is Beam.empty:
        self.reading = (None, None)
        return Beam.empty
    else:
        self.reading = (incoming.mu_x, incoming.mu_y)
        return ParticleBeam(incoming.particles, incoming.energy, device=self.device)