core.electric_field module
Hold parameters that are shared by all cavities of same type.
See also
CavitySettings
- class NewRfField
Bases:
object
Cos-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.
- e_spat
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.
- Type:
Callable[[float], float]
- n_cell
Number of cells in the cavity.
- Type:
int
- n_z
Number of points in the file that gives
e_spat
, the spatial component of the electric field.- Type:
int | None
- __init__() None
Instantiate object.
- get(*keys: str, **kwargs: bool | str | None) Any
Shorthand to get attributes from this class or its attributes.
- Parameters:
*keys (str) – Name of the desired attributes.
**kwargs (bool | str | None) – Other arguments passed to recursive getter.
- Returns:
out – Attribute(s) value(s).
- Return type:
Any
- has(key: str) bool
Tell if the required attribute is in this class.
- set_e_spat(e_spat: Callable[[float], float], n_cell: int) None
Set the pos. component of electric field, set number of cells.
- class RfField(k_e: float = nan, absolute_phase_flag: bool = False, phi_0: float | None = None)
Bases:
object
Cos-like RF field.
Deprecated since version 0.6.16: Will be separated into
NewRfField
for parameters specific to cavity design andCavitySettings
for 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.
- e_spat
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.
- Type:
Callable[[float], float]
- k_e
Norm of the electric field.
- Type:
float
- phi_0
- 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
ListOfElements
under study does not start at the beginning of the linac and we use TraceWin. new_reference_phase : phase at the entrance of thisListOfElements
.
- Type:
dict[str, None | float | bool]
- v_cav_mv
Cavity accelerating field in MV.
- Type:
float
- phi_s
Cavity synchronous phase in rad.
- Type:
float
- omega0_rf
RF pulsation of the cavity in rad/s.
- Type:
float
- bunch_to_rf
\(f_{rf} / f_{bunch}\). In particular, it is used to convert the rf absolute phase given by the transfer matrix function of
Envelope1D
andEnvelope3D
to bunch absolute phase.- Type:
float
- n_cell
Number of cells in the cavity.
- Type:
int
- n_z
Number of points in the file that gives
e_spat
, the spatial component of the electric field.- Type:
int | None
- __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:
*keys (str) – Name of the desired attributes.
to_deg (bool, optional) – To apply np.rad2deg function over every
key
containing the string ‘phi’. The default is False.**kwargs (bool | str) – Other arguments passed to recursive getter.
- Returns:
out – Attribute(s) value(s).
- Return type:
list | np.ndarray | float | None
- has(key: str) bool
Tell if the required attribute is in this class.
- set_e_spat(e_spat: Callable[[float], float], n_cell: int) None
Set the pos. component of electric field, set number of cells.
- set_rf_freq(f_mhz: float) None
Initialize the pulsation and the rf / bunch fraction.
- update_phi_0_abs_to_adapt_to_new_ref_phase(old_phi_in: float, new_phi_in: float, phases_are_bunch: bool = True) float
Calculate the new
phi_0_abs
, with a new reference phase.
- compute_param_cav(integrated_field: complex) dict[str, float]
Compute synchronous phase and accelerating field.