element_envelope3d_parameters module

Define a class to hold solver parameters for Envelope3D.

This module holds ElementEnvelope3DParameters, that inherits from the Abstract Base Class ElementBeamCalculatorParameters. 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 PARAMETERS_3D.

class ElementEnvelope3DParameters(length_m, n_steps, beam_kwargs, transf_mat_function=None, **kwargs)[source]

Bases: ElementEnvelope1DParameters

Hold the parameters to compute beam propagation in an Element.

has and get method inherited from ElementCalculatorParameters parent class.

Parameters:
__init__(length_m, n_steps, beam_kwargs, transf_mat_function=None, **kwargs)[source]

Save useful parameters as attribute.

Parameters:
  • length_m (float) – length_m

  • n_steps (int) – n_steps

  • beam_kwargs (dict[str, Any]) – Configuration dict holding initial beam parameters.

  • transf_mat_function (Callable | None, optional) – Function to compute transfer matrix of element. The default is None, in which case we fall back on Drift transfer matrix.

_transfer_matrix_results_to_dict(transfer_matrix, gamma_phi, integrated_field)[source]

Convert the results given by the transf_mat function to dict.

Parameters:
Return type:

dict

_proper_transfer_matrix_func(element_nature, method=None)[source]

Get the proper transfer matrix function.

Parameters:
  • element_nature (str)

  • method (str | None, default: None)

Return type:

Callable

_abc_impl = <_abc._abc_data object at 0x73dca78d87c0>
class DriftEnvelope3DParameters(elt, beam_kwargs, n_steps=1, **kwargs)[source]

Bases: ElementEnvelope3DParameters

Hold the properties to compute transfer matrix of a Drift.

Parameters:
__init__(elt, beam_kwargs, n_steps=1, **kwargs)[source]

Create the specific parameters for a drift.

Parameters:
_abc_impl = <_abc._abc_data object at 0x73dca78d8780>
class QuadEnvelope3DParameters(elt, beam_kwargs, n_steps=1, **kwargs)[source]

Bases: ElementEnvelope3DParameters

Hold the properties to compute transfer matrix of a Quad.

Parameters:
__init__(elt, beam_kwargs, n_steps=1, **kwargs)[source]

Create the specific parameters for a drift.

Parameters:
transfer_matrix_kw(*args, **kwargs)[source]

Give the element parameters necessary to compute transfer matrix.

Return type:

dict[str, Any]

_abc_impl = <_abc._abc_data object at 0x73dca78d8100>
class SolenoidEnvelope3DParameters(elt, beam_kwargs, n_steps=1, **kwargs)[source]

Bases: ElementEnvelope3DParameters

Hold properties to compute transfer matrix of a Solenoid.

Parameters:
__init__(elt, beam_kwargs, n_steps=1, **kwargs)[source]

Create the specific parameters for a drift.

Parameters:
_abc_impl = <_abc._abc_data object at 0x73dca78d8080>
class FieldMapEnvelope3DParameters(elt, method, n_steps_per_cell, solver_id, beam_kwargs, phi_s_model='historical', **kwargs)[source]

Bases: ElementEnvelope3DParameters

Hold the properties to compute transfer matrix of a FieldMap.

Non-accelerating cavities will use DriftEnvelope3DParameters instead.

Parameters:
__init__(elt, method, n_steps_per_cell, solver_id, beam_kwargs, phi_s_model='historical', **kwargs)[source]

Create the specific parameters for a drift.

Parameters:
transfer_matrix_kw(w_kin, cavity_settings, *args, phi_0_rel=None, **kwargs)[source]

Give the element parameters necessary to compute transfer matrix.

Parameters:
  • w_kin (float) – Kinetic energy at the entrance of cavity in \(\mathrm{MeV}\).

  • cavity_settings (CavitySettings) – Object holding the cavity parameters that can be changed.

  • phi_0_rel (float | None) – Relative entry phase of the cavity. When provided, it means that we are trying to find the \(\phi_{0,\,\mathrm{rel}}\) matching a given \(\phi_s\). The default is None.

Returns:

Keyword arguments that will be passed to the 3D transfer matrix function defined in envelope_3d.transfer_matrices_p.

Return type:

dict[str, Any]

_transfer_matrix_results_to_dict(transfer_matrix, gamma_phi, integrated_field)[source]

Convert the results given by the transf_mat function to dict.

Overrides the default method defined in the ABC.

Parameters:
Return type:

dict

re_set_for_broken_cavity()[source]

Make beam calculator call Drift func instead of FieldMap.

Return type:

Callable

_broken_transfer_matrix_results_to_dict(transfer_matrix, gamma_phi, integrated_field)[source]

Convert the results given by the transf_mat function to a dict.

Parameters:
Return type:

dict

_broken_transfer_matrix_kw(*args, **kwargs)[source]

Give the element parameters necessary to compute transfer matrix.

Return type:

dict[str, Any]

_abc_impl = <_abc._abc_data object at 0x73dca78d8e40>
class BendEnvelope3DParameters(elt, beam_kwargs, n_steps=1, **kwargs)[source]

Bases: ElementEnvelope3DParameters

Hold specific parameters to compute Bend transfer matrix.

Parameters:
__init__(elt, beam_kwargs, n_steps=1, **kwargs)[source]

Instantiate object and pre-compute some parameters for speed.

Parameters:
  • transf_mat_module (types.ModuleType) – Module where the transfer matrix function is defined.

  • elt (Bend) – BEND element.

  • kwargs (str) – kwargs

  • beam_kwargs (dict[str, Any])

  • n_steps (int, default: 1)

_abc_impl = <_abc._abc_data object at 0x73dca78d8b80>
_add_cavity_phase(solver_id, w_kin_in, cavity_settings, rf_kwargs)[source]

Set reference phase and function to compute \(\phi_s\).

Parameters:
Return type:

None