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: Element

A single element holding several field maps.

We override its type to make Python believe it is a FieldMap, while is is just an Element. So take care of keeping their methods consistent!

Todo

Remove idx in lattice, lattice, section arguments. can take this from new attribute: field_maps.

is_implemented: bool = True
n_attributes: int | range | Collection = range(0, 100)
__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 _args_to_line(total_length: float, *args, **kwargs) str

Generate hypothetical line.

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.

property status: str

Tell that everything is working, always (for now).

property is_accelerating: bool

Indicate if this element has a longitudinal effect.

property can_be_retuned: bool

Tell if we can modify the element’s tuning.

set_full_path(*args, **kwargs) None

Raise an error.

to_line(*args, **kwargs)

Convert the object back into a line in the .dat file.

_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: DummyElement

Inserted 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>
class SuperposedPlaceHolderCmd(line: DatLine, dat_idx: int | None = None, **kwargs: str)

Bases: DummyCommand

Inserted in place of field maps and superpose map commands.

_abc_impl = <_abc._abc_data object at 0x7f36f985a800>