core.commands.superpose_map module
Define a useless command to serve as place holder.
- class SuperposeMap(line: list[str], dat_idx: int, **kwargs: str)
Bases:
Command
Command to merge several field maps.
- z_0
Position at which the next field map should be inserted.
- Type:
float
- __init__(line: list[str], dat_idx: int, **kwargs: str) None
Save position as attribute.
- _abc_impl = <_abc._abc_data object>
- _decrement_lattice_indexes(elts_after_self: Sequence[Element], number_of_superposed: int) None
Decrement some lattice numbers to take removed elts into account.
Todo
Check if this still works, as lattice and idx_in_lattice are now initialized with -1 instead of None.
- _total_length(instructions_to_merge: list[Instruction]) float
Compute length of the superposed field maps.
- _update_class(instructions_to_merge: list[Instruction], total_length: float) tuple[list[Instruction], int]
Replace elements and commands by dummies, except first field map.
- apply(instructions: list[Instruction], **kwargs: float) list[Instruction]
Apply the command.
Only the first
SuperposeMap
of a bunch of field maps should be applied. In order to avoid messing with indexes in the.dat
file, all Commands are replaced by dummy commands. All field maps are replaced by dummy elements of length 0, except the first field_map that is replaced by a SuperposedFieldMap.
- is_implemented: bool = True
- n_attributes: int | range | Collection = (1, 6)
- set_influenced_elements(instructions: list[Instruction], **kwargs: float) None
Determine the index of the elements concerned by
apply()
.It spans from the current
SUPERPOSE_MAP
command, up to the next element that is not a field map. It allows to consider situations where we field_map is not directly after theSUPERPOSE_MAP
command.Example
` SUPERPOSE_MAP STEERER FIELD_MAP `
Only the first of the
SUPERPOSE_MAP
command will have the entire valid range of elements.