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:
ElementEnvelope1DParametersHold the parameters to compute beam propagation in an
Element.has and get method inherited from ElementCalculatorParameters parent class.
- Parameters:
length_m (
float)n_steps (
int)beam_kwargs (
BeamKwargs)
- __init__(length_m, n_steps, beam_kwargs, transf_mat_function=None, **kwargs)[source]
Save useful parameters as attribute.
- Parameters:
length_m (
float) – Length of elemet in \(\mathrm{m}\).n_steps (
int) – Number of solver steps.beam_kwargs (
BeamKwargs) – Configuration dict holding initial beam parameters.transf_mat_function (
Callable|None, default:None) – Function to compute transfer matrix of element. The default is None, in which case we fall back on Drift transfer matrix.
- Return type:
None
- transfer_matrix_kw(*args, **kwargs)[source]
Give the element parameters necessary to compute transfer matrix.
The only missing argument is
gamma_in, as it does not convern the element directly.
- _transfer_matrix_results_to_dict(transfer_matrix, gamma_phi, integrated_field)[source]
Convert the results given by the transf_mat function to dict.
- _proper_transfer_matrix_func(element_nature, method=None)[source]
Get the proper transfer matrix function.
- _abc_impl = <_abc._abc_data object at 0x7318fb2a2d40>
- class DriftEnvelope3DParameters(elt, beam_kwargs, n_steps=1, **kwargs)[source]
Bases:
ElementEnvelope3DParametersHold the properties to compute transfer matrix of a
Drift.- Parameters:
beam_kwargs (
BeamKwargs)n_steps (
int, default:1)kwargs (
str)
- __init__(elt, beam_kwargs, n_steps=1, **kwargs)[source]
Create the specific parameters for a drift.
- Parameters:
beam_kwargs (
BeamKwargs)n_steps (
int, default:1)kwargs (
str)
- Return type:
None
- transfer_matrix_kw(*args, **kwargs)[source]
Give the element parameters necessary to compute transfer matrix.
The only missing argument is
gamma_in, as it does not convern the element directly.
- _abc_impl = <_abc._abc_data object at 0x7318fb2a39c0>
- class QuadEnvelope3DParameters(elt, beam_kwargs, n_steps=1, **kwargs)[source]
Bases:
ElementEnvelope3DParametersHold the properties to compute transfer matrix of a
Quad.- Parameters:
elt (
Quad)beam_kwargs (
BeamKwargs)n_steps (
int, default:1)kwargs (
str)
- __init__(elt, beam_kwargs, n_steps=1, **kwargs)[source]
Create the specific parameters for a drift.
- Parameters:
elt (
Quad)beam_kwargs (
BeamKwargs)n_steps (
int, default:1)kwargs (
str)
- Return type:
None
- transfer_matrix_kw(*args, **kwargs)[source]
Give the element parameters necessary to compute transfer matrix.
The only missing argument is
gamma_in, as it does not convern the element directly.
- _abc_impl = <_abc._abc_data object at 0x7318fb2a3e40>
- class SolenoidEnvelope3DParameters(elt, beam_kwargs, n_steps=1, **kwargs)[source]
Bases:
ElementEnvelope3DParametersHold properties to compute transfer matrix of a
Solenoid.- Parameters:
elt (
Solenoid)beam_kwargs (
BeamKwargs)n_steps (
int, default:1)kwargs (
str)
- __init__(elt, beam_kwargs, n_steps=1, **kwargs)[source]
Create the specific parameters for a drift.
- Parameters:
elt (
Solenoid)beam_kwargs (
BeamKwargs)n_steps (
int, default:1)kwargs (
str)
- Return type:
None
- _abc_impl = <_abc._abc_data object at 0x7318fb2a0400>
- class FieldMapEnvelope3DParameters(elt, method, n_steps_per_cell, solver_id, beam_kwargs, phi_s_model='historical', **kwargs)[source]
Bases:
ElementEnvelope3DParametersHold the properties to compute transfer matrix of a
FieldMap.Non-accelerating cavities will use
DriftEnvelope3DParametersinstead.- 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.
- 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, default: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.
- Return type:
- Returns:
Keyword arguments that will be passed to the 3D transfer matrix function defined in
envelope_3d.transfer_matrices_p.
- _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.
- re_set_for_broken_cavity()[source]
Make beam calculator call Drift func instead of FieldMap.
- Return type:
- _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.
- _broken_transfer_matrix_kw(*args, **kwargs)[source]
Give the element parameters necessary to compute transfer matrix.
- _abc_impl = <_abc._abc_data object at 0x7318fb2ce000>
- _get_phi_0_rel(cavity_settings)[source]
Get the phase from the object.
- Parameters:
cavity_settings (
CavitySettings)- Return type:
- class BendEnvelope3DParameters(elt, beam_kwargs, n_steps=1, **kwargs)[source]
Bases:
ElementEnvelope3DParametersHold specific parameters to compute
Bendtransfer matrix.- Parameters:
elt (
Bend)beam_kwargs (
BeamKwargs)n_steps (
int, default:1)kwargs (
str)
- __init__(elt, beam_kwargs, n_steps=1, **kwargs)[source]
Instantiate object and pre-compute some parameters for speed.
- Parameters:
transf_mat_module – Module where the transfer matrix function is defined.
elt (
Bend) –BENDelement.kwargs (
str) – kwargsbeam_kwargs (
BeamKwargs)n_steps (
int, default:1)
- _abc_impl = <_abc._abc_data object at 0x7318fb2cdb80>