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, cavities_settings, is_accelerating, dat_idx, idx_in_lattice, lattice, section, field_maps, **kwargs)[source]

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.

Parameters:
n_attributes: int | range | Collection = range(0, 100)
__init__(line, cavities_settings, is_accelerating, dat_idx, idx_in_lattice, lattice, section, field_maps, **kwargs)[source]

Save length of the superposed field maps.

Parameters:
Return type:

None

classmethod from_field_maps(field_maps_n_superpose, dat_idx, total_length_m, z_0s)[source]

Instantiate object from several field maps.

This is the only way this object should be instantiated; called by SuperposeMap.

Parameters:
Return type:

Self

classmethod from_args(dat_idx, total_length_m, original_line, *args, **kwargs)[source]

Insantiate object from his properties.

Parameters:
  • dat_idx (int)

  • total_length_m (float)

  • original_line (str)

Return type:

Self

classmethod _args_to_line(total_length_m, *args, **kwargs)[source]

Generate hypothetical line.

Parameters:

total_length_m (float)

Return type:

str

classmethod _extract_args_from_field_maps(field_maps)[source]

Go over the field maps to gather essential arguments.

Parameters:

field_maps (Collection[FieldMap])

Return type:

tuple[list[CavitySettings], bool]

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)[source]

Raise an error.

Return type:

None

to_line(*args, **kwargs)[source]

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

Return type:

list[str]

_abc_impl = <_abc._abc_data object at 0x7318fb9610c0>
class SuperposedPlaceHolderElt(line, idx_in_lattice, lattice, dat_idx=None, **kwargs)[source]

Bases: DummyElement

Inserted in place of field maps and superpose map commands.

Parameters:
increment_lattice_idx = False
__init__(line, idx_in_lattice, lattice, dat_idx=None, **kwargs)[source]

Instantiate object, with lattice information.

Parameters:
Return type:

None

to_line(*args, **kwargs)[source]

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

Return type:

list[str]

_abc_impl = <_abc._abc_data object at 0x7318fb34d7c0>
class SuperposedPlaceHolderCmd(line, dat_idx=None, **kwargs)[source]

Bases: DummyCommand

Inserted in place of field maps and superpose map commands.

Parameters:
to_line(*args, **kwargs)[source]

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

Return type:

list[str]

_abc_impl = <_abc._abc_data object at 0x7318fb36f8c0>
unpack_superposed(packed)[source]

Extract the FieldMap from SuperposedFieldMap.

Parameters:

packed (Collection[FieldMap | SuperposedFieldMap])

Return type:

list[FieldMap]