superposed_field_map module
Define a SuperposedFieldMap.
Note
The initialisation of this class is particular, as it does not correspond
to a specific line of the .dat file.
Todo
Could be cleaned and simplified.
- class SuperposedFieldMap(line: DatLine, cavities_settings: Collection[CavitySettings], is_accelerating: bool, dat_idx: int, idx_in_lattice: int, lattice: int, section: int, field_maps: Collection[FieldMap], rf_fields: Collection[RfField], **kwargs)
Bases:
ElementA single element holding several field maps.
We override its type to make Python believe it is a
FieldMap, while is is just anElement. So take care of keeping their methods consistent!Todo
Remove idx in lattice, lattice, section arguments. can take this from new attribute:
field_maps.- __init__(line: DatLine, cavities_settings: Collection[CavitySettings], is_accelerating: bool, dat_idx: int, idx_in_lattice: int, lattice: int, section: int, field_maps: Collection[FieldMap], rf_fields: Collection[RfField], **kwargs) None
Save length of the superposed field maps.
- classmethod from_field_maps(field_maps_n_superpose: Collection[Instruction], dat_idx: int, total_length: float, starting_positions: Collection[float]) Self
Instantiate object from several field maps.
This is the only way this object should be instantiated; called by
SuperposeMap.
- classmethod from_args(dat_idx: int, total_length: float, *args, **kwargs) Self
Insantiate object from his properties.
- classmethod _extract_args_from_field_maps(field_maps: Collection[FieldMap]) tuple[list[CavitySettings], list[RfField], bool]
Go over the field maps to gather essential arguments.
- to_line(*args, **kwargs)
Convert the object back into a line in the
.datfile.
- _abc_impl = <_abc._abc_data object at 0x7f36f985a640>
- class SuperposedPlaceHolderElt(line: DatLine, idx_in_lattice: int, lattice: int, dat_idx: int | None = None, **kwargs)
Bases:
DummyElementInserted in place of field maps and superpose map commands.
- increment_lattice_idx = False
- __init__(line: DatLine, idx_in_lattice: int, lattice: int, dat_idx: int | None = None, **kwargs) None
Instantiate object, with lattice information.
- _abc_impl = <_abc._abc_data object at 0x7f36f985a740>