config.beam_calculator module

Define the functions to test the BeamCalculator arguments.

Todo

Handling of arguments for TW could be cleaner

IMPLEMENTED_BEAM_CALCULATORS = ('Envelope1D', 'TraceWin', 'Envelope3D')
IMPLEMENTED_ENVELOPE1D_METHODS = ('leapfrog', 'RK4')
IMPLEMENTED_ENVELOPE3D_METHODS = ('RK4',)
_edit_configuration_dict_in_place_envelope1d(beam_calculator_kw: dict, config_folder: Path) None

Modify the kw dict inplace.

_edit_configuration_dict_in_place_envelope3d(beam_calculator_kw: dict, config_folder: Path) None

Modify the kw dict inplace.

_edit_configuration_dict_in_place_tracewin(beam_calculator_kw: dict, config_folder: Path) None

Transform some values.

The arguments that will be passed to the TraceWin executable are removed from beam_calculator_kw and stored in args_for_tracewin, which is an entry of beam_calculator_kw.

_find_file(config_folder: Path, file: str) Path

Look for file as absolute and in config_folder.

_test_envelope1d(method: str, flag_cython: bool, flag_phi_abs: bool, n_steps_per_cell: int, **beam_calculator_kw: bool | str | int) None

Test the consistency for the basic Envelope1D beam calculator.

_test_envelope3d(flag_phi_abs: bool, n_steps_per_cell: int, method: str = 'RK4', flag_cython: bool | None = None, **beam_calculator_kw: bool | str | int) None

Check validity of arguments for Envelope3D.

_test_tracewin(config_folder: Path, machine_config_file: str, simulation_type: str, ini_path: str, path_cal: str = '', synoptic_file: str = '', partran: int | None = None, toutatis: int | None = None, machine_name: str = '', **beam_calculator_kw) None

Test consistency for TraceWin beam calculator.

_test_tracewin_executable(config_folder: Path, machine_config_file: str, simulation_type: str, machine_name: str = '', **kwargs) Path

Look for the configuration file, check if TW executable exists.

edit_configuration_dict_in_place(beam_calculator_kw: dict, config_folder: Path, **kwargs) None

Precompute some useful values, transform some str into Path.

test(tool: str, **beam_calculator_kw: bool | str | int) None

Ensure that selected BeamCalculator will be properly initialized.