element_envelope1d_parameters_factory module
Create the solver parameters for Envelope1D.
- PARAMETERS_1D = { <class 'lightwin.core.elements.quad.Quad'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.solenoid.Solenoid'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.thin_steering.ThinSteering'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.aperture.Aperture'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.bend.Bend'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.BendEnvelope1DParameters'>, <class 'lightwin.core.elements.diagnostic.Diagnostic'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.drift.Drift'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.edge.Edge'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.field_maps.field_map.FieldMap'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.FieldMapEnvelope1DParameters'>, <class 'lightwin.core.elements.field_maps.superposed_field_map.SuperposedFieldMap'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.SuperposedFieldMapEnvelope1DParameters'>, <class 'lightwin.core.elements.field_maps.superposed_field_map.SuperposedPlaceHolderElt'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DummyEnvelope1DParameters'>}
Implemented elements; a non-implemented element will be replaced by a Drift. A warning will be raised.
- class ElementEnvelope1DParametersFactory(method, n_steps_per_cell, solver_id, beam_kwargs, phi_s_definition='historical')[source]
Bases:
ElementBeamCalculatorParametersFactoryDefine a method to easily create the solver parameters.
- Parameters:
method (
Literal['RK4','leapfrog'])n_steps_per_cell (
int)solver_id (
str)beam_kwargs (
BeamKwargs)phi_s_definition (
Literal['historical','lagniel'], default:'historical')
- _parameters = { <class 'lightwin.core.elements.quad.Quad'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.solenoid.Solenoid'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.thin_steering.ThinSteering'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.aperture.Aperture'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.bend.Bend'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.BendEnvelope1DParameters'>, <class 'lightwin.core.elements.diagnostic.Diagnostic'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.drift.Drift'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.edge.Edge'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DriftEnvelope1DParameters'>, <class 'lightwin.core.elements.field_maps.field_map.FieldMap'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.FieldMapEnvelope1DParameters'>, <class 'lightwin.core.elements.field_maps.superposed_field_map.SuperposedFieldMap'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.SuperposedFieldMapEnvelope1DParameters'>, <class 'lightwin.core.elements.field_maps.superposed_field_map.SuperposedPlaceHolderElt'>: <class 'lightwin.beam_calculation.envelope_1d.element_envelope1d_parameters.DummyEnvelope1DParameters'>}
- __init__(method, n_steps_per_cell, solver_id, beam_kwargs, phi_s_definition='historical')[source]
Prepare import of proper functions.
- Parameters:
method (
Literal['RK4','leapfrog'])n_steps_per_cell (
int)solver_id (
str)beam_kwargs (
BeamKwargs)phi_s_definition (
Literal['historical','lagniel'], default:'historical')
- Return type:
None
- run(elt)[source]
Create the proper subclass of solver parameters, instantiate it.
Note
If an Element type is not found in
self.parameters, we take its mother type.- Parameters:
elt (
Element) – Element under study.- Returns:
Proper instantiated subclass of
ElementEnvelope1DParameters.- Return type:
See also
- _parameters_constructor(elt)[source]
Get the proper object constructor.
Examples
>>> self._parameters_constructor(Drift()) DriftEnvelope1DParameters
In 1D, a quadrupole is basically a drift.
>>> self._parameters_constructor(Quad()) DriftEnvelope1DParameters
As DiagPosition is not in parameters, we look for the mother class Diagnostic.
>>> self._parameters_constructor(DiagPosition()) DriftEnvelope1DParameters
To avoid wasting computation time, non-accelerating field maps are treated as drifts.
>>> self._parameters_constructor(FieldMap100(is_accelerating=False)) DriftEnvelope1DParameters
- _abc_impl = <_abc._abc_data object at 0x7318fb30c700>