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, dat_idx=None, idx_in_lattice=-1, lattice=-1, section=-1, **kwargs)[source]
Bases:
InstructionGeneric element.
- Parameters:
base_name – Short name for the element according to TraceWin. Should be overriden.
increment_elt_idx – If the element should be considered when counting the elements. If False,
elt_idxwill keep its default value of-1. As for now, there is no element with this attribute set to False.increment_lattice_idx – 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.line (
DatLine)idx_in_lattice (
int, default:-1)lattice (
int, default:-1)section (
int, default:-1)
- base_name = 'ELT'
- increment_elt_idx = True
- increment_lattice_idx = True
- is_implemented: bool = True
- __init__(line, dat_idx=None, idx_in_lattice=-1, lattice=-1, section=-1, **kwargs)[source]
Init parameters common to all elements.
- Parameters:
line (
DatLine) – A line of theDATfile. 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|None, default:None) – Position in theDATfile.name – 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.idx_in_lattice (
int, default:-1)lattice (
int, default:-1)section (
int, default:-1)
- get(*keys, to_numpy=True, **kwargs)[source]
Shorthand to get attributes from this class or its attributes.
- Parameters:
*keys (
Literal['dat_idx','elt_idx','idx','idx_in_lattice','lattice','length_m','nature','section'] |Literal['abs_mesh','d_z','n_steps','rel_mesh','s_in','s_out','transf_mat_function']) – Name of the desired attributes.to_numpy (
bool, default:True) – If you want the list output to be converted to a np.ndarray.**kwargs (
bool|str|None) – Other arguments passed to recursive getter.
- Returns:
out – Attribute(s) value(s).
- Return type:
Any
- keep_rf_field(*args, **kwargs)[source]
Save data calculated by
BeamCalculator.run_with_this(). :rtype:NoneDeprecated since version 0.6.16: Prefer
keep_cavity_settings()
- keep_cavity_settings(cavity_settings)[source]
Save data calculated by
BeamCalculator.run_with_this().- Parameters:
cavity_settings (
CavitySettings)- Return type:
- 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 0x73dcb1fa8080>