beam_calculation.factory module
This module holds a factory to create the BeamCalculator
.
- class BeamCalculatorsFactory(beam_calculator: dict[str, Any], files: dict[str, Any], beam_calculator_post: dict[str, Any] | None = None, **other_kw: dict)
Bases:
object
A class to create
BeamCalculator
objects.- __init__(beam_calculator: dict[str, Any], files: dict[str, Any], beam_calculator_post: dict[str, Any] | None = None, **other_kw: dict) None
Set up factory with arguments common to all
BeamCalculator
.- Parameters:
beam_calculator (dict[str, Any]) – Configuration entries for the first
BeamCalculator
, used for optimisation.files (dict[str, Any]) – Configuration entries for the input/output paths.
beam_calculator_post (dict[str, Any] | None) – Configuration entries for the second optional
BeamCalculator
, used for a more thorough calculation of the beam propagation once the compensation settings are found.other_kw (dict) – Other keyword arguments, not used for the moment.
- _check_consistency_absolute_phases(beam_calculators: Sequence[BeamCalculator]) None
Check that
flag_phi_abs
is the same for all solvers.
- _patch_to_remove_misunderstood_key() None
Patch to remove a key not understood by TraceWin. Declare id list.
Todo
fixme
- _set_out_folders(all_beam_calculator_kw: Sequence[dict[str, Any]]) list[Path]
Set in which subfolder the results will be saved.
- run(tool: str, **beam_calculator_kw) BeamCalculator
Create a single
BeamCalculator
.- Parameters:
beam_calculator_class (ABCMeta) – The specific beam calculator.
- Return type:
- run_all() tuple[BeamCalculator, ...]
Create all the beam calculators.
- IMPLEMENTED_BEAM_CALCULATORS = {'Envelope1D': <class 'beam_calculation.envelope_1d.envelope_1d.Envelope1D'>, 'Envelope3D': <class 'beam_calculation.envelope_3d.envelope_3d.Envelope3D'>, 'TraceWin': <class 'beam_calculation.tracewin.tracewin.TraceWin'>}