Implement __iadd__ on BeamBaseClass
Implements the option to do in-place addition on BeamBaseClass by adding magic __iadd__, along with related features elsewhere. First step towards re-implementation of multi-turn injection for #141.
Main changes:
- Add functions
__iadd__,add_beam,add_particlesand_append_to_selftoBeamBaseClass-
__iadd__takes either aBeamBaseClassobject or a 2DArrayLikeof[dt, dE]and then calls eitheradd_beamoradd_particlesas required -
add_beamandadd_particlesdo some sanity checks and then pass the coordinates of the new particles, and if aBeamBaseClassthe flags and intensity, to_append_to_self -
_append_to_selfjoins all the relevant parameters from the input beam/coordinates to the existing beam
-
- Add functions
unique,concatenateandmaxtobackend - Move
BeamFlagsfromblond.core.beam.basetoblond.core.beam.flagsto avoid circular import between backend and beam - Convert
ParticleTypeto a frozen dataclass to simplify equality comparison whilst keeping it hashable, also prevents attribute values changing, which avoids the need for wrapping everything in aproperty