core.elements.field_maps.field_map module
Hold a FIELD_MAP
.
Todo
Handle the different kind of field_maps…
Todo
Handle the SET_SYNCH_PHASE command
Todo
Hande phi_s fitting with beam_calculation.tracewin.Tracewin
Todo
when subclassing field_maps, do not forget to update the transfer matrix
selector in:
- Envelope3D
- SingleElementEnvelope3DParameters
- SetOfCavitySettings
- the run_with_this
methods
- class FieldMap(line: list[str], dat_idx: int, default_field_map_folder: Path, cavity_settings: CavitySettings, name: str | None = None, **kwargs)
Bases:
Element
A generic
FIELD_MAP
.- __init__(line: list[str], dat_idx: int, default_field_map_folder: Path, cavity_settings: CavitySettings, name: str | None = None, **kwargs) None
Set most of attributes defined in
TraceWin
.
- _abc_impl = <_abc._abc_data object>
- property _indexes_in_line: dict[str, int]
Give the position of the arguments in the ``FIELD_MAP ``command.
- _phase_for_line(which_phase: str) tuple[float, int]
Give the phase to put in
.dat
line, with abs phase flag.
- base_name = 'FM'
- property can_be_retuned: bool
Tell if we can modify the element’s tuning.
- get(*keys: str, to_numpy: bool = True, none_to_nan: bool = False, **kwargs: bool | str | None) Any
Shorthand to get attributes from this class or its attributes.
- Parameters:
*keys (str) – Name of the desired attributes.
to_numpy (bool, optional) – If you want the list output to be converted to a np.ndarray. The default is True.
**kwargs (bool | str | None) – Other arguments passed to recursive getter.
- Returns:
out – Attribute(s) value(s).
- Return type:
Any
- property is_accelerating: bool
Tell if the cavity is working.
- keep_cavity_settings(cavity_settings: CavitySettings) None
Keep the cavity settings that were found.
- n_attributes: int | range | Collection = 10
- set_full_path(extensions: dict[str, list[str]]) None
Set absolute paths with extensions of electromagnetic files.
- Parameters:
extensions (dict[str, list[str]]) – Keys are nature of the field, values are a list of extensions corresponding to it without a period.
See also
tracewin_utils.electromagnetic_fields.file_map_extensions()
- property status: str
Give the status from the
CavitySettings
.
- to_line(which_phase: str = 'phi_0_rel', *args, inplace: bool = False, **kwargs) list[str]
Convert the object back into a line in the
.dat
file.- Parameters:
which_phase ({'phi_0_abs', 'phi_0_rel', 'phi_s', 'as_in_settings',) – ‘as_in_original_dat’} Which phase should be putted in the output
.dat
.inplace (bool, optional) – To modify or not the
Element
inplace. If False, we return a modified copy. The default is False.
- Returns:
The line in the
.dat
, with updated amplitude and phase from current object.- Return type:
list[str]
- update_status(new_status: str) None
Change the status of the cavity.
We use
ElementBeamCalculatorParameters.re_set_for_broken_cavity()
method. Ifk_e
,phi_s
,v_cav_mv
are altered, this is performed inCavitySettings.status()
setter
.
- IMPLEMENTED_STATUS = ('nominal', 'rephased (in progress)', 'rephased (ok)', 'failed', 'compensate (in progress)', 'compensate (ok)', 'compensate (not ok)')