field_map module
Hold a FIELD_MAP.
Todo
Hande phi_s fitting with TraceWin.
Note
When subclassing field_maps, do not forget to update the transfer matrix
selector in:
- Envelope3D
- ElementEnvelope3DParameters
- SetOfCavitySettings
- the run_with_this methods
- class FieldMap(line, default_field_map_folder, cavity_settings, dat_idx=None, **kwargs)[source]
Bases:
ElementA generic
FIELD_MAP.- Parameters:
line (
DatLine)default_field_map_folder (
Path)cavity_settings (
CavitySettings)
- base_name = 'FM'
- __init__(line, default_field_map_folder, cavity_settings, dat_idx=None, **kwargs)[source]
Set most of attributes defined in
TraceWin.- Parameters:
line (
DatLine)default_field_map_folder (
Path)cavity_settings (
CavitySettings)
- Return type:
None
- field_map_folder
Where all the field map files are to be found.
- filename
Base name of all field map files, without extension.
- cavity_settings
Stores the settings of the cavity, such as amplitude or phase.
- property status: Literal['compensate (in progress)', 'compensate (not ok)', 'compensate (ok)', 'failed', 'nominal', 'rephased (in progress)', 'rephased (ok)']
Give the status from the
CavitySettings.
- update_status(new_status)[source]
Change the status of the cavity.
We use
ElementBeamCalculatorParameters.re_set_for_broken_cavity()method. Ifk_e,phi_s,v_cav_mvare altered, this is performed inCavitySettings.status()setter.
- keep_cavity_settings(cavity_settings)[source]
Keep the cavity settings that were found.
- Parameters:
cavity_settings (
CavitySettings)- Return type:
- get(*keys, to_numpy=True, none_to_nan=False, **kwargs)[source]
Get attributes from this class or its attributes.
- Parameters:
*keys (
Literal['aperture_flag','field_map_filename','field_map_folder','geometry'] |Literal['dat_idx','elt_idx','idx','idx_in_lattice','lattice','length_m','name','nature','section'] |Literal['abs_mesh','d_z','n_steps','rel_mesh','s_in','s_out','transf_mat_function'] |Literal['acceptance_energy','acceptance_phi','field','freq_cavity_mhz','k_e','omega_0_rf','phi_ref','phi_rf','phi_s','reference','rf_field','status','v_cav_mv'] |Literal['phi_0_abs','phi_0_rel','phi_s']) – Name of the desired attributes.to_numpy (
bool, default:True) – If you want the list output to be converted to a np.ndarray.**kwargs (
Any) – Other arguments passed to recursive getter.none_to_nan (
bool, default:False)
- Return type:
- Returns:
Attribute(s) value(s).
- get_of_element_for_comparison(*keys, to_numpy=True, **kwargs)[source]
Get attributes from this class or its attributes.
- Parameters:
*keys (
Literal['aperture_flag','field_map_filename','field_map_folder','geometry'] |Literal['dat_idx','elt_idx','idx','idx_in_lattice','lattice','length_m','name','nature','section'] |Literal['abs_mesh','d_z','n_steps','rel_mesh','s_in','s_out','transf_mat_function'] |Literal['acceptance_energy','acceptance_phi','field','freq_cavity_mhz','k_e','omega_0_rf','phi_ref','phi_rf','phi_s','reference','rf_field','status','v_cav_mv'] |Literal['phi_0_abs','phi_0_rel','phi_s']) – 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.
- Return type:
- Returns:
Attribute(s) value(s).
- to_line(which_phase, *args, round=None, **kwargs)[source]
Convert the object back into a line in the
DATfile.- Parameters:
- Return type:
- Returns:
The line in the
DAT, with updated amplitude and phase from current object.
- property _indexes_in_line: dict[str, int]
Give the position of the arguments in the
FIELD_MAPcommand.
- _phase_for_line(which_phase)[source]
Give the phase to put in
DATline, with abs phase flag.- Parameters:
which_phase (
Literal['phi_0_abs','phi_0_rel','phi_s'] |Literal['as_in_original_dat'] |Literal['as_in_settings']) – Name of the phase we are trying to export.- Return type:
tuple[float,int,Literal['phi_0_abs','phi_0_rel','phi_s']]- Returns:
float – Phase to write in the
DATfile.int –
0forphi_0_rel,1forphi_0_abs. Unused forphi_s, aSET_SYNCH_PHASEcommand is added by :meth:` .FieldMap.to_line`.REFERENCE_PHASES_T – Actual name of the phase that is exported.
- _abc_impl = <_abc._abc_data object at 0x7318faa95740>