beam_calculation.envelope_1d.element_envelope1d_parameters module
Define a class to hold solver parameters for Envelope1D
.
This module holds ElementEnvelope1DParameters
, that inherits
from the Abstract Base Class ElementBeamCalculatorParameters
.
It holds the transfer matrix function that is used, according to the solver
(Runge-Kutta or leapfrog) and their version (Python or Cython), as well as the
meshing in accelerating elements.
- class BendEnvelope1DParameters(transf_mat_module: ModuleType, elt: Bend, n_steps: int = 1, **kwargs: str | int)
Bases:
ElementEnvelope1DParameters
Hold the specific parameters to compute
Bend
transfer matrix.In particular, we define
factor_1
,factor_2
andfactor_3
to speed-up calculations.- __init__(transf_mat_module: ModuleType, elt: Bend, n_steps: int = 1, **kwargs: str | int) None
Instantiate object and pre-compute some parameters for speed.
- Parameters:
transf_mat_module (ModuleType) – Module where the transfer matrix function is defined.
elt (Bend) –
BEND
element.n_steps (int, optional) – Number of integration steps. The default is 1.
- _abc_impl = <_abc._abc_data object>
- _pre_compute_factors_for_transfer_matrix(length_m: float, h_squared: float, k_x: float, index_is_lower_than_unity: bool) tuple[float, float, float]
Compute factors to speed up the transfer matrix calculation.
factor_1
is:\[\frac{-h^2\Delta s}{k_x^2}\]factor_2
is:\[\frac{h^2 \sin{(k_x\Delta s)}}{k_x^3}\]if \(n \leq 1\). Else:
\[\frac{h^2 \sinh{(k_x\Delta s)}}{k_x^3}\]factor_3
is:\[\Delta s \left(1 - \frac{h^2}{k_x^2}\right)\]
- transfer_matrix_arguments() tuple[float, float, float, float]
Give the element parameters necessary to compute transfer matrix.
- class DriftEnvelope1DParameters(transf_mat_module: ModuleType, elt: Element, n_steps: int = 1, **kwargs: str | int)
Bases:
ElementEnvelope1DParameters
Hold the properties to compute transfer matrix of a
Drift
.As this is 1D, it is also used for
Solenoid
,Quad
, brokenFieldMap
.- __init__(transf_mat_module: ModuleType, elt: Element, n_steps: int = 1, **kwargs: str | int) None
Create the specific parameters for a drift.
- _abc_impl = <_abc._abc_data object>
- transfer_matrix_arguments() tuple[float, int]
Give the element parameters necessary to compute transfer matrix.
- class ElementEnvelope1DParameters(transf_mat_function: Callable, length_m: float, n_steps: int, **kwargs: str | int)
Bases:
ElementBeamCalculatorParameters
Hold the parameters to compute beam propagation in an Element.
has
andget
method inherited fromElementBeamCalculatorParameters
parent class.- __init__(transf_mat_function: Callable, length_m: float, n_steps: int, **kwargs: str | int) None
Set the actually useful parameters.
- _abc_impl = <_abc._abc_data object>
- _transfer_matrix_results_to_dict(r_zz: ndarray, gamma_phi: ndarray, integrated_field: float | None) dict
Convert the results given by the transf_mat function to dict.
- _transfer_matrix_results_to_dict_broken_field_map(r_zz: ndarray, gamma_phi: ndarray, itg_field: float | None) dict
Convert the results given by the transf_mat function to dict.
This method should override the default
_transfer_matrix_results_to_dict
when the element under study is a broken field map.
- re_set_for_broken_cavity() None
Change solver parameters for efficiency purposes.
- set_absolute_meshes(pos_in: float, s_in: int) tuple[float, int]
Set the absolute indexes and arrays, depending on previous elem.
- transf_mat_function_wrapper(w_kin_in: float, **rf_field_kwargs) dict
Calculate beam propagation in the
Element
.
- abstract transfer_matrix_arguments() Sequence[Any]
Give the element parameters necessary to compute transfer matrix.
- transfer_matrix_kw() dict
Keyword arguments.
- class FieldMapEnvelope1DParameters(transf_mat_module: ModuleType, elt: FieldMap, method: str, n_steps_per_cell: int, solver_id: str, phi_s_model: str = 'historical', **kwargs: str | int)
Bases:
ElementEnvelope1DParameters
Hold the properties to compute transfer matrix of a
FieldMap
.Non-accelerating cavities will use
DriftEnvelope1DParameters
instead.- __init__(transf_mat_module: ModuleType, elt: FieldMap, method: str, n_steps_per_cell: int, solver_id: str, phi_s_model: str = 'historical', **kwargs: str | int) None
Create the specific parameters for a field map.
- _abc_impl = <_abc._abc_data object>
- _transfer_matrix_results_to_dict(r_zz: ndarray, gamma_phi: ndarray, integrated_field: float | None) dict
Convert the results given by the transf_mat function to a dict.
Overrides the default method defined in the ABC.
- re_set_for_broken_cavity() Callable
Make beam calculator call Drift func instead of FieldMap.
- transfer_matrix_arguments() tuple[float, int]
Give the element parameters necessary to compute transfer matrix.
- transfer_matrix_kw() dict
Give field map filename, used by Cython.