beam_calculation.envelope_3d.element_envelope3d_parameters module

Define a class to hold solver parameters for Envelope3D.

This module holds ElementEnvelope3DParameters, that inherits from the Abstract Base Class ElementCalculatorParameters. It holds the transfer matrix function that is used, as well as the meshing in accelerating elements.

In a first time, only Runge-Kutta (no leapfrog) and only Python (no Cython).

The list of implemented transfer matrices is implemented_transfer_matrices.

class BendEnvelope3DParameters(transf_mat_module: ModuleType, elt: Bend, n_steps: int = 1, **kwargs: str)

Bases: ElementEnvelope3DParameters

Hold specific parameters to compute Bend transfer matrix.

__init__(transf_mat_module: ModuleType, elt: Bend, n_steps: int = 1, **kwargs: str)

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.

  • kwargs – kwargs

_abc_impl = <_abc._abc_data object>
class DriftEnvelope3DParameters(transf_mat_module: ModuleType, elt: Drift | FieldMap, n_steps: int = 1, **kwargs: str)

Bases: ElementEnvelope3DParameters

Hold the properties to compute transfer matrix of a Drift.

__init__(transf_mat_module: ModuleType, elt: Drift | FieldMap, n_steps: int = 1, **kwargs: str) 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 ElementEnvelope3DParameters(transf_mat_function: Callable, length_m: float, n_steps: int, **kwargs)

Bases: ElementEnvelope1DParameters

Hold the parameters to compute beam propagation in an Element.

has and get method inherited from ElementCalculatorParameters parent class.

__init__(transf_mat_function: Callable, length_m: float, n_steps: int, **kwargs) None

Save useful parameters as attribute.

Parameters:
  • transf_mat_function (Callable) – transf_mat_function

  • length_m (float) – length_m

  • n_steps (int) – n_steps

_abc_impl = <_abc._abc_data object>
_transfer_matrix_results_to_dict(transfer_matrix: 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(transfer_matrix: 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()

Change solver parameters for efficiency purposes.

abstract transfer_matrix_arguments() Sequence[Any]

Give the element parameters necessary to compute transfer matrix.

class FieldMapEnvelope3DParameters(transf_mat_module: ModuleType, elt: FieldMap, method: str, n_steps_per_cell: int, solver_id: str, phi_s_model: str = 'historical', **kwargs: str)

Bases: ElementEnvelope3DParameters

Hold the properties to compute transfer matrix of a FieldMap.

Non-accelerating cavities will use DriftEnvelope3DParameters 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) None

Create the specific parameters for a drift.

_abc_impl = <_abc._abc_data object>
_transfer_matrix_results_to_dict(transfer_matrix: ndarray, gamma_phi: ndarray, integrated_field: float | None) dict

Convert the results given by the transf_mat function to 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.

class QuadEnvelope3DParameters(transf_mat_module: ModuleType, elt: Quad, n_steps: int = 1, **kwargs: str)

Bases: ElementEnvelope3DParameters

Hold the properties to compute transfer matrix of a Quad.

__init__(transf_mat_module: ModuleType, elt: Quad, n_steps: int = 1, **kwargs: str) None

Create the specific parameters for a drift.

_abc_impl = <_abc._abc_data object>
transfer_matrix_arguments() tuple[float, float]

Give the element parameters necessary to compute transfer matrix.

class SolenoidEnvelope3DParameters(transf_mat_module: ModuleType, elt: Solenoid, n_steps: int = 1, **kwargs: str)

Bases: ElementEnvelope3DParameters

Hold the properties to compute transfer matrix of a Quad.

__init__(transf_mat_module: ModuleType, elt: Solenoid, n_steps: int = 1, **kwargs: str) None

Create the specific parameters for a drift.

_abc_impl = <_abc._abc_data object>