Open cr-xu opened 8 months ago
I implemented this at some point, maybe as a quick fix for some issue I had. I agree that an empty tensor makes more sense ... we could then have a property is_empty
to make checking for it nice and readable. With ParameterBeam
, we could add a variable is_empty
which would be set to True
by an active screen or such, i.e. the elements that obviously block the entire beam. Does that make sense?
I was just considering the empty beam as a placeholder for creating a beam object but with nothing filled. Hmm... It's true that it can actually be used to see if the beam survived tracking.
However, this makes things kind of complicated..? I would assume that one still likes to observe the beam simultaneously at multiple screens, as it's just a simulation.
Ah ... an empty constructor actually makes sense to have as well.
I see both use cases. At the time, I was imagining that RL agents may need to know about that they are blocking the beam with a screen. If we want both features, we could add an is_blocking
property to screens. Then maybe we would have a method with Segment
that would change the use case mode and adjust all is_blocking
properties accordingly.
In the
ParticleBeam
, there are some locations where it's checked whetherself is not Beam.empty
, e.g. https://github.com/desy-ml/cheetah/blob/b92502966f01797889697f1dcba46a2667328f8c/cheetah/particles.py#L1023But this is never the case, since one cannot initialize the ParticleBeam without any argument. Also, the
Beam.empty
is simply a str, rather than an actual empty Beam object. This is very confusing: