element module
Define base Element, declined in Drift, FieldMap, etc.
Todo
clean the patch for the ‘name’. my has and get methods do not work with @property
- class Element(line: DatLine, dat_idx: int | None = None, idx_in_lattice: int = -1, lattice: int = -1, section: int = -1, **kwargs)
Bases:
InstructionGeneric element.
- Parameters:
base_name (str, optional) – Short name for the element according to TraceWin. Should be overriden. The default is
"ELT".increment_elt_idx (bool, optional) – If the element should be considered when counting the elements. If False,
elt_idxwill keep its default value of-1. The default is True. As for now, there is no element with this attribute set to False.increment_lattice_idx (bool, optional) – If the element should be considered when determining the lattice. Should be True for physical elements, such as
DRIFT, and False for other elements such asDIAGNOSTIC. The default is True.
- base_name = 'ELT'
- increment_elt_idx = True
- increment_lattice_idx = True
- __init__(line: DatLine, dat_idx: int | None = None, idx_in_lattice: int = -1, lattice: int = -1, section: int = -1, **kwargs) None
Init parameters common to all elements.
- Parameters:
line (list[str]) – A line of the
.datfile. If the element was given a name, it must not appear inlinebut rather inname. First element of the list must be inimplemented_elements.dat_idx (int) – Position in the
.datfile.name (str | None, optional) – Non-default name of the element, as given in the
.datfile. The default is None, in which case an automatic name will be given later.
- get(*keys: str, to_numpy: bool = True, **kwargs: bool | str | None) Any
Shorthand to get attributes from this class or its attributes.
- keep_rf_field(*args, **kwargs) None
Save data calculated by
BeamCalculator.run_with_this().Deprecated since version 0.6.16: Prefer
keep_cavity_settings()
- keep_cavity_settings(cavity_settings: CavitySettings) None
Save data calculated by
BeamCalculator.run_with_this().
- property is_accelerating: bool
Say if this element is accelerating or not.
Will return False by default.
- property can_be_retuned: bool
Tell if we can modify the element’s tuning.
Will return False by default.
- _abc_impl = <_abc._abc_data object at 0x7f3702f82ec0>