electric_field module
Hold parameters that are shared by all cavities of same type.
See also
- compute_param_cav(integrated_field: complex) dict[str, float]
Compute synchronous phase and accelerating field.
- class RfField(k_e: float = nan, absolute_phase_flag: bool = False, phi_0: float | None = None)
Bases:
objectCos-like RF field.
Deprecated since version 0.6.16: Will be separated into
NewRfFieldfor parameters specific to cavity design andCavitySettingsfor parameters specific to the cavity under study.Warning, all phases are defined as:
\[\phi = \omega_0^{rf} t\]While in the rest of the code it is defined as:
\[\phi = \omega_0_^{bunch} t\]All phases are stored in radian.
- Parameters:
e_spat (Callable[[float], float]) – Spatial component of the electric field. Needs to be multiplied by the cos(omega t) to have the full electric field. Initialized to null function.
k_e (float) – Norm of the electric field.
phi_0 (dict[str, None | float | bool]) –
- Holds the electric field phase. The keys are:
phi_0_rel : relative phi_0 in rad phi_0_abs : absolute phi_0 in rad nominal_rel : relative phi_0 in rad in the nominal (ref) linac abs_phase_flag : if the relative or absolute phi_0 must be used phi_0_abs_but_reference_phase_is_different : used when the
ListOfElementsunder study does not start at the beginning of the linac and we use TraceWin. new_reference_phase : phase at the entrance of thisListOfElements.
v_cav_mv (float) – Cavity accelerating field in MV.
phi_s (float) – Cavity synchronous phase in rad.
omega0_rf (float) – RF pulsation of the cavity in rad/s.
bunch_to_rf (float) – \(f_{rf} / f_{bunch}\). In particular, it is used to convert the rf absolute phase given by the transfer matrix function of
Envelope1DandEnvelope3Dto bunch absolute phase.n_cell (int) – Number of cells in the cavity.
n_z (int | None) – Number of points in the file that gives
e_spat, the spatial component of the electric field.
- __init__(k_e: float = nan, absolute_phase_flag: bool = False, phi_0: float | None = None) None
Instantiate object.
- get(*keys: str, to_deg: bool = False, **kwargs: bool | str) list | ndarray | float | None
Shorthand to get attributes from this class.
- Parameters:
- Returns:
out – Attribute(s) value(s).
- Return type:
list | numpy.ndarray | float | None
- class NewRfField
Bases:
objectCos-like RF field.
Warning, all phases are defined as:
\[\phi = \omega_0^{rf} t\]While in the rest of the code it is defined as:
\[\phi = \omega_0_^{bunch} t\]All phases are stored in radian.
- Parameters:
e_spat (Callable[[float], float]) – Spatial component of the electric field. Needs to be multiplied by the cos(omega t) to have the full electric field. Initialized to null function.
n_cell (int) – Number of cells in the cavity.
n_z (int | None) – Number of points in the file that gives
e_spat, the spatial component of the electric field.