typing module
Define types for better code-completion and linting.
- PHASE_SPACES = ('phiw', 'phiw99', 't', 'x', 'x99', 'y', 'y99', 'z', 'zdelta')
List of different phase spaces.
- GETTABLE_BEAM_PARAMETERS_PHASE_SPACE = ( 'alpha', 'beta', 'beta_kin', 'envelope_energy', 'envelope_pos', 'eps', 'eps_no_normalization', 'eps_normalized', 'gamma', 'gamma_kin', 'sigma', 'twiss', 'z_abs', 'phiw', 'phiw99', 't', 'x', 'x99', 'y', 'y99', 'z', 'zdelta')
Attributes that are stored in
InitialPhaseSpaceBeamParametersandPhaseSpaceBeamParameters.
- GETTABLE_BEAM_PARAMETERS = ( 'alpha_phiw', 'beta_phiw', 'envelope_energy_phiw', 'envelope_pos_phiw', 'eps_phiw', 'eps_no_normalization_phiw', 'eps_normalized_phiw', 'gamma_phiw', 'sigma_phiw', 'twiss_phiw', 'alpha_phiw99', 'beta_phiw99', 'envelope_energy_phiw99', 'envelope_pos_phiw99', 'eps_phiw99', 'eps_no_normalization_phiw99', 'eps_normalized_phiw99', 'gamma_phiw99', 'sigma_phiw99', 'twiss_phiw99', 'alpha_t', 'beta_t', 'envelope_energy_t', 'envelope_pos_t', 'eps_t', 'eps_no_normalization_t', 'eps_normalized_t', 'gamma_t', 'sigma_t', 'twiss_t', 'alpha_x', 'beta_x', 'envelope_energy_x', 'envelope_pos_x', 'eps_x', 'eps_no_normalization_x', 'eps_normalized_x', 'gamma_x', 'sigma_x', 'twiss_x', 'alpha_x99', 'beta_x99', 'envelope_energy_x99', 'envelope_pos_x99', 'eps_x99', 'eps_no_normalization_x99', 'eps_normalized_x99', 'gamma_x99', 'sigma_x99', 'twiss_x99', 'alpha_y', 'beta_y', 'envelope_energy_y', 'envelope_pos_y', 'eps_y', 'eps_no_normalization_y', 'eps_normalized_y', 'gamma_y', 'sigma_y', 'twiss_y', 'alpha_y99', 'beta_y99', 'envelope_energy_y99', 'envelope_pos_y99', 'eps_y99', 'eps_no_normalization_y99', 'eps_normalized_y99', 'gamma_y99', 'sigma_y99', 'twiss_y99', 'alpha_z', 'beta_z', 'envelope_energy_z', 'envelope_pos_z', 'eps_z', 'eps_no_normalization_z', 'eps_normalized_z', 'gamma_z', 'sigma_z', 'twiss_z', 'alpha_zdelta', 'beta_zdelta', 'envelope_energy_zdelta', 'envelope_pos_zdelta', 'eps_zdelta', 'eps_no_normalization_zdelta', 'eps_normalized_zdelta', 'gamma_zdelta', 'sigma_zdelta', 'twiss_zdelta', 'alpha', 'beta', 'beta_kin', 'envelope_energy', 'envelope_pos', 'eps', 'eps_no_normalization', 'eps_normalized', 'gamma', 'gamma_kin', 'sigma', 'twiss', 'z_abs', 'phiw', 'phiw99', 't', 'x', 'x99', 'y', 'y99', 'z', 'zdelta')
Attributes that are stored in
InitialBeamParametersandBeamParameters.
- BEAM_KEYS = ( 'e_mev', 'e_rest_mev', 'f_bunch_mhz', 'i_milli_a', 'q_adim', 'sigma', 'inv_e_rest_mev', 'gamma_init', 'omega_0_bunch', 'lambda_bunch', 'q_over_m', 'm_over_q')
Attributes stored in the
ParticleFullTrajectory.beamdictionary.
- GETTABLE_PARTICLE = ( 'beta', 'gamma', 'phi_abs', 'synchronous', 'w_kin', 'z_in', 'e_mev', 'e_rest_mev', 'f_bunch_mhz', 'i_milli_a', 'q_adim', 'sigma', 'inv_e_rest_mev', 'gamma_init', 'omega_0_bunch', 'lambda_bunch', 'q_over_m', 'm_over_q')
Attributes that can be extracted with
ParticleFullTrajectory.get()method.
- GETTABLE_BEAM_CALC_PARAMETERS = ( 'abs_mesh', 'd_z', 'n_steps', 'rel_mesh', 's_in', 's_out', 'transf_mat_function')
Attributes that can be extracted with
ElementBeamCalculatorParameters.get()method.
- REFERENCE_PHASES = ('phi_0_abs', 'phi_0_rel', 'phi_s')
The three types of reference phase
- REFERENCE_PHASE_POLICY = ('phi_0_abs', 'phi_0_rel', 'phi_s', 'as_in_original_dat')
Reference phase policy at
BeamCalculatorcreation. Note that some cavities can see their reference phase change during execution of the code, according to the compensations strategy.
- EXPORT_PHASES = ('phi_0_abs', 'phi_0_rel', 'phi_s', 'as_in_original_dat', 'as_in_settings')
How phases shall be saved in the output
DATfile.
- ALLOWED_STATUS = ( 'nominal', 'rephased (in progress)', 'rephased (ok)', 'failed', 'compensate (in progress)', 'compensate (ok)', 'compensate (not ok)')
Different status for cavities
- STATUS_T
Different status for cavities
alias of
Literal[‘compensate (in progress)’, ‘compensate (not ok)’, ‘compensate (ok)’, ‘failed’, ‘nominal’, ‘rephased (in progress)’, ‘rephased (ok)’]
- GETTABLE_CAVITY_SETTINGS = ( 'acceptance_energy', 'acceptance_phi', 'field', 'freq_cavity_mhz', 'k_e', 'omega_0_rf', 'phi_ref', 'phi_rf', 'phi_s', 'reference', 'status', 'v_cav_mv', 'phi_0_abs', 'phi_0_rel', 'phi_s')
Attributes that can be extracted with
CavitySettings.get()method.
- CONCATENABLE_CAVITY_SETTINGS = ( 'acceptance_energy', 'acceptance_phi', 'phi_0_abs', 'phi_0_rel', 'phi_bunch', 'phi_ref', 'phi_rf', 'phi_s', 'v_cav_mv')
Attributes from
CavitySettingsto concatenate into a list when called fromListOfElements.get()(orSimulationOutput.get())
- GETTABLE_ELT = ( 'dat_idx', 'elt_idx', 'idx', 'idx_in_lattice', 'lattice', 'length_m', 'name', 'nature', 'section', 'abs_mesh', 'd_z', 'n_steps', 'rel_mesh', 's_in', 's_out', 'transf_mat_function')
Attributes that can be extracted with
Element.get()method.
- GETTABLE_FIELD_MAP = ( 'aperture_flag', 'field_map_filename', 'field_map_folder', 'geometry', 'dat_idx', 'elt_idx', 'idx', 'idx_in_lattice', 'lattice', 'length_m', 'name', 'nature', 'section', 'abs_mesh', 'd_z', 'n_steps', 'rel_mesh', 's_in', 's_out', 'transf_mat_function', 'acceptance_energy', 'acceptance_phi', 'field', 'freq_cavity_mhz', 'k_e', 'omega_0_rf', 'phi_ref', 'phi_rf', 'phi_s', 'reference', 'status', 'v_cav_mv', 'phi_0_abs', 'phi_0_rel', 'phi_s')
Attributes that can be extracted with
FieldMap.get()method.
- CONCATENABLE_ELTS = ( 'aperture_flag', 'field_map_filename', 'field_map_folder', 'geometry', 'dat_idx', 'elt_idx', 'idx', 'idx_in_lattice', 'lattice', 'length_m', 'name', 'nature', 'section', 'abs_mesh', 'd_z', 'n_steps', 'rel_mesh', 's_in', 's_out', 'transf_mat_function', 'acceptance_energy', 'acceptance_phi', 'field', 'freq_cavity_mhz', 'k_e', 'omega_0_rf', 'phi_ref', 'phi_rf', 'phi_s', 'reference', 'status', 'v_cav_mv', 'phi_0_abs', 'phi_0_rel', 'phi_s')
Attributes from
ElementorFieldMapto concatenate into a list when called fromListOfElements.get()(orSimulationOutput.get(),Accelerator.get())
- GETTABLE_ELTS = ( 'accelerator_path', 'dat_file', 'dat_filecontent', 'elts_n_cmds', 'files', 'input_beam', 'input_particle', 'tm_cumul_in', 'aperture_flag', 'field_map_filename', 'field_map_folder', 'geometry', 'dat_idx', 'elt_idx', 'idx', 'idx_in_lattice', 'lattice', 'length_m', 'name', 'nature', 'section', 'abs_mesh', 'd_z', 'n_steps', 'rel_mesh', 's_in', 's_out', 'transf_mat_function', 'acceptance_energy', 'acceptance_phi', 'field', 'freq_cavity_mhz', 'k_e', 'omega_0_rf', 'phi_ref', 'phi_rf', 'phi_s', 'reference', 'status', 'v_cav_mv', 'phi_0_abs', 'phi_0_rel', 'phi_s', 'beta', 'gamma', 'phi_abs', 'synchronous', 'w_kin', 'z_in', 'e_mev', 'e_rest_mev', 'f_bunch_mhz', 'i_milli_a', 'q_adim', 'sigma', 'inv_e_rest_mev', 'gamma_init', 'omega_0_bunch', 'lambda_bunch', 'q_over_m', 'm_over_q', 'alpha_phiw', 'beta_phiw', 'envelope_energy_phiw', 'envelope_pos_phiw', 'eps_phiw', 'eps_no_normalization_phiw', 'eps_normalized_phiw', 'gamma_phiw', 'sigma_phiw', 'twiss_phiw', 'alpha_phiw99', 'beta_phiw99', 'envelope_energy_phiw99', 'envelope_pos_phiw99', 'eps_phiw99', 'eps_no_normalization_phiw99', 'eps_normalized_phiw99', 'gamma_phiw99', 'sigma_phiw99', 'twiss_phiw99', 'alpha_t', 'beta_t', 'envelope_energy_t', 'envelope_pos_t', 'eps_t', 'eps_no_normalization_t', 'eps_normalized_t', 'gamma_t', 'sigma_t', 'twiss_t', 'alpha_x', 'beta_x', 'envelope_energy_x', 'envelope_pos_x', 'eps_x', 'eps_no_normalization_x', 'eps_normalized_x', 'gamma_x', 'sigma_x', 'twiss_x', 'alpha_x99', 'beta_x99', 'envelope_energy_x99', 'envelope_pos_x99', 'eps_x99', 'eps_no_normalization_x99', 'eps_normalized_x99', 'gamma_x99', 'sigma_x99', 'twiss_x99', 'alpha_y', 'beta_y', 'envelope_energy_y', 'envelope_pos_y', 'eps_y', 'eps_no_normalization_y', 'eps_normalized_y', 'gamma_y', 'sigma_y', 'twiss_y', 'alpha_y99', 'beta_y99', 'envelope_energy_y99', 'envelope_pos_y99', 'eps_y99', 'eps_no_normalization_y99', 'eps_normalized_y99', 'gamma_y99', 'sigma_y99', 'twiss_y99', 'alpha_z', 'beta_z', 'envelope_energy_z', 'envelope_pos_z', 'eps_z', 'eps_no_normalization_z', 'eps_normalized_z', 'gamma_z', 'sigma_z', 'twiss_z', 'alpha_zdelta', 'beta_zdelta', 'envelope_energy_zdelta', 'envelope_pos_zdelta', 'eps_zdelta', 'eps_no_normalization_zdelta', 'eps_normalized_zdelta', 'gamma_zdelta', 'sigma_zdelta', 'twiss_zdelta', 'alpha', 'beta', 'beta_kin', 'envelope_energy', 'envelope_pos', 'eps', 'eps_no_normalization', 'eps_normalized', 'gamma', 'gamma_kin', 'sigma', 'twiss', 'z_abs', 'phiw', 'phiw99', 't', 'x', 'x99', 'y', 'y99', 'z', 'zdelta')
Attributes that can be extracted with
ListOfElements.get()method.
- GETTABLE_STRUCTURE_DEPENDENT = ( 'dat_idx', 'elt_idx', 'idx', 'idx_in_lattice', 'lattice', 'length_m', 'name', 'nature', 'section', 'abs_mesh', 'd_z', 'n_steps', 'rel_mesh', 's_in', 's_out', 'transf_mat_function', 'aperture_flag', 'field_map_filename', 'field_map_folder', 'geometry', 'field', 'freq_cavity_mhz', 'omega_0_rf')
Attributes that are structure-dependent and should not vary from simulation to simulation
- GETTABLE_TRANSFER_MATRIX = ( 'cumulated', 'individual', 'n_points', 'r_xx', 'r_yy', 'r_zdelta', 'r_zdelta_11', 'r_zdelta_12', 'r_zdelta_21', 'r_zdelta_22', 'r_zz')
Attributes that can be extracted with
TransferMatrix.get()method.
- NEEDS_3D = ( 'eps_t', 'eps_x', 'eps_y', 'mismatch_factor_t', 'mismatch_factor_x', 'mismatch_factor_y')
Attributes that you can get from 3D
SimulationOutput.
- NEEDS_MULTIPART = ('eps_phiw99', 'eps_x99', 'eps_y99', 'pow_lost')
Attributes that you can get from multipart
SimulationOutput.
- GETTABLE_SIMULATION_OUTPUT = ( 'acceptance_energy', 'acceptance_phi', 'beam_parameters', 'element_to_index', 'elt_idx', 'mismatch_factor_zdelta', 'phi_s', 'set_of_cavity_settings', 'synch_trajectory', 'v_cav_mv', 'z_abs', 'alpha_phiw', 'beta_phiw', 'envelope_energy_phiw', 'envelope_pos_phiw', 'eps_phiw', 'eps_no_normalization_phiw', 'eps_normalized_phiw', 'gamma_phiw', 'sigma_phiw', 'twiss_phiw', 'alpha_phiw99', 'beta_phiw99', 'envelope_energy_phiw99', 'envelope_pos_phiw99', 'eps_phiw99', 'eps_no_normalization_phiw99', 'eps_normalized_phiw99', 'gamma_phiw99', 'sigma_phiw99', 'twiss_phiw99', 'alpha_t', 'beta_t', 'envelope_energy_t', 'envelope_pos_t', 'eps_t', 'eps_no_normalization_t', 'eps_normalized_t', 'gamma_t', 'sigma_t', 'twiss_t', 'alpha_x', 'beta_x', 'envelope_energy_x', 'envelope_pos_x', 'eps_x', 'eps_no_normalization_x', 'eps_normalized_x', 'gamma_x', 'sigma_x', 'twiss_x', 'alpha_x99', 'beta_x99', 'envelope_energy_x99', 'envelope_pos_x99', 'eps_x99', 'eps_no_normalization_x99', 'eps_normalized_x99', 'gamma_x99', 'sigma_x99', 'twiss_x99', 'alpha_y', 'beta_y', 'envelope_energy_y', 'envelope_pos_y', 'eps_y', 'eps_no_normalization_y', 'eps_normalized_y', 'gamma_y', 'sigma_y', 'twiss_y', 'alpha_y99', 'beta_y99', 'envelope_energy_y99', 'envelope_pos_y99', 'eps_y99', 'eps_no_normalization_y99', 'eps_normalized_y99', 'gamma_y99', 'sigma_y99', 'twiss_y99', 'alpha_z', 'beta_z', 'envelope_energy_z', 'envelope_pos_z', 'eps_z', 'eps_no_normalization_z', 'eps_normalized_z', 'gamma_z', 'sigma_z', 'twiss_z', 'alpha_zdelta', 'beta_zdelta', 'envelope_energy_zdelta', 'envelope_pos_zdelta', 'eps_zdelta', 'eps_no_normalization_zdelta', 'eps_normalized_zdelta', 'gamma_zdelta', 'sigma_zdelta', 'twiss_zdelta', 'alpha', 'beta', 'beta_kin', 'envelope_energy', 'envelope_pos', 'eps', 'eps_no_normalization', 'eps_normalized', 'gamma', 'gamma_kin', 'sigma', 'twiss', 'z_abs', 'phiw', 'phiw99', 't', 'x', 'x99', 'y', 'y99', 'z', 'zdelta', 'beta', 'gamma', 'phi_abs', 'synchronous', 'w_kin', 'z_in', 'e_mev', 'e_rest_mev', 'f_bunch_mhz', 'i_milli_a', 'q_adim', 'sigma', 'inv_e_rest_mev', 'gamma_init', 'omega_0_bunch', 'lambda_bunch', 'q_over_m', 'm_over_q', 'cumulated', 'individual', 'n_points', 'r_xx', 'r_yy', 'r_zdelta', 'r_zdelta_11', 'r_zdelta_12', 'r_zdelta_21', 'r_zdelta_22', 'r_zz', 'eps_t', 'eps_x', 'eps_y', 'mismatch_factor_t', 'mismatch_factor_x', 'mismatch_factor_y', 'eps_phiw99', 'eps_x99', 'eps_y99', 'pow_lost')
Attributes that can be extracted with
SimulationOutput.get()method.
- GETTABLE_ACCELERATOR = ( 'accelerator_path', 'elts', 'name', 'simulation_outputs', 'accelerator_path', 'dat_file', 'dat_filecontent', 'elts_n_cmds', 'files', 'input_beam', 'input_particle', 'tm_cumul_in', 'aperture_flag', 'field_map_filename', 'field_map_folder', 'geometry', 'dat_idx', 'elt_idx', 'idx', 'idx_in_lattice', 'lattice', 'length_m', 'name', 'nature', 'section', 'abs_mesh', 'd_z', 'n_steps', 'rel_mesh', 's_in', 's_out', 'transf_mat_function', 'acceptance_energy', 'acceptance_phi', 'field', 'freq_cavity_mhz', 'k_e', 'omega_0_rf', 'phi_ref', 'phi_rf', 'phi_s', 'reference', 'status', 'v_cav_mv', 'phi_0_abs', 'phi_0_rel', 'phi_s', 'beta', 'gamma', 'phi_abs', 'synchronous', 'w_kin', 'z_in', 'e_mev', 'e_rest_mev', 'f_bunch_mhz', 'i_milli_a', 'q_adim', 'sigma', 'inv_e_rest_mev', 'gamma_init', 'omega_0_bunch', 'lambda_bunch', 'q_over_m', 'm_over_q', 'alpha_phiw', 'beta_phiw', 'envelope_energy_phiw', 'envelope_pos_phiw', 'eps_phiw', 'eps_no_normalization_phiw', 'eps_normalized_phiw', 'gamma_phiw', 'sigma_phiw', 'twiss_phiw', 'alpha_phiw99', 'beta_phiw99', 'envelope_energy_phiw99', 'envelope_pos_phiw99', 'eps_phiw99', 'eps_no_normalization_phiw99', 'eps_normalized_phiw99', 'gamma_phiw99', 'sigma_phiw99', 'twiss_phiw99', 'alpha_t', 'beta_t', 'envelope_energy_t', 'envelope_pos_t', 'eps_t', 'eps_no_normalization_t', 'eps_normalized_t', 'gamma_t', 'sigma_t', 'twiss_t', 'alpha_x', 'beta_x', 'envelope_energy_x', 'envelope_pos_x', 'eps_x', 'eps_no_normalization_x', 'eps_normalized_x', 'gamma_x', 'sigma_x', 'twiss_x', 'alpha_x99', 'beta_x99', 'envelope_energy_x99', 'envelope_pos_x99', 'eps_x99', 'eps_no_normalization_x99', 'eps_normalized_x99', 'gamma_x99', 'sigma_x99', 'twiss_x99', 'alpha_y', 'beta_y', 'envelope_energy_y', 'envelope_pos_y', 'eps_y', 'eps_no_normalization_y', 'eps_normalized_y', 'gamma_y', 'sigma_y', 'twiss_y', 'alpha_y99', 'beta_y99', 'envelope_energy_y99', 'envelope_pos_y99', 'eps_y99', 'eps_no_normalization_y99', 'eps_normalized_y99', 'gamma_y99', 'sigma_y99', 'twiss_y99', 'alpha_z', 'beta_z', 'envelope_energy_z', 'envelope_pos_z', 'eps_z', 'eps_no_normalization_z', 'eps_normalized_z', 'gamma_z', 'sigma_z', 'twiss_z', 'alpha_zdelta', 'beta_zdelta', 'envelope_energy_zdelta', 'envelope_pos_zdelta', 'eps_zdelta', 'eps_no_normalization_zdelta', 'eps_normalized_zdelta', 'gamma_zdelta', 'sigma_zdelta', 'twiss_zdelta', 'alpha', 'beta', 'beta_kin', 'envelope_energy', 'envelope_pos', 'eps', 'eps_no_normalization', 'eps_normalized', 'gamma', 'gamma_kin', 'sigma', 'twiss', 'z_abs', 'phiw', 'phiw99', 't', 'x', 'x99', 'y', 'y99', 'z', 'zdelta')
Attributes that can be extracted with
Accelerator.get()method.
- GET_ELT_ARG = ('first', 'last')
Magic values for the
eltkeyword argument ingetmethods.
- VARIABLES = ('k_e', 'phi_0_abs', 'phi_0_rel', 'phi_s')
Implemented optimization variables
- CONSTRAINTS = ('phi_s',)
Implemented optimization constraints
- DESIGN_SPACES = ( 'AbsPhaseAmplitude', 'AbsPhaseAmplitudeWithConstrainedSyncPhase', 'Everything', 'RelPhaseAmplitude', 'RelPhaseAmplitudeWithConstrainedSyncPhase', 'SyncPhaseAmplitude', 'UserDefined', 'abs_phase_amplitude', 'abs_phase_amplitude_with_constrained_sync_phase', 'everything', 'rel_phase_amplitude', 'rel_phase_amplitude_with_constrained_sync_phase', 'sync_phase_amplitude', 'user_defined', 'unconstrained', 'unconstrained_rel', 'constrained_sync_phase', 'sync_phase_as_variable')
Implemented
DesignSpaceFactorypresets.
- class DesignSpaceKw[source]
Bases:
TypedDictHolds all
TOMLconfiguration entries for design space.- design_space_preset: Literal['AbsPhaseAmplitude', 'AbsPhaseAmplitudeWithConstrainedSyncPhase', 'Everything', 'RelPhaseAmplitude', 'RelPhaseAmplitudeWithConstrainedSyncPhase', 'SyncPhaseAmplitude', 'UserDefined', 'abs_phase_amplitude', 'abs_phase_amplitude_with_constrained_sync_phase', 'everything', 'rel_phase_amplitude', 'rel_phase_amplitude_with_constrained_sync_phase', 'sync_phase_amplitude', 'user_defined', 'unconstrained', 'unconstrained_rel', 'constrained_sync_phase', 'sync_phase_as_variable']
- variables_filepaths: NotRequired[Path]
- constraints_filepaths: NotRequired[Path]
- variable_names: NotRequired[Collection[Literal['k_e', 'phi_0_abs', 'phi_0_rel', 'phi_s']]]
- constraints_names: NotRequired[Collection[Literal['phi_s']]]
- max_increase_sync_phase_in_percent: NotRequired[float]
- max_absolute_sync_phase_in_deg: NotRequired[float]
- min_absolute_sync_phase_in_deg: NotRequired[float]
- max_decrease_k_e_in_percent: NotRequired[float]
- max_increase_k_e_in_percent: NotRequired[float]
- maximum_k_e_is_calculated_wrt_maximum_k_e_of_section: NotRequired[bool]
- class CavParams[source]
Bases:
TypedDictHolds cavity parameters in a
SimulationOutput.All lists have the length of the associated
ListOfElements. They containNonewhereElementis not aFieldMap.- acceptance_phi: NotRequired[list[float | None]]
- acceptance_energy: NotRequired[list[float | None]]
- phi_0: NotRequired[list[float | None]]
- ID_NATURE = ('cavity', 'element', 'lattice', 'name', 'section')
Allowed values for the
id_naturekey ofwtfconfiguration table.
- class ConfigKw[source]
Bases:
TypedDictHolds all configuration dicts.
- beam: BeamKwargs
- beam_calculator_post: NotRequired[dict[str, Any]]
- wtf: NotRequired[dict[str, Any]]
- design_space: NotRequired[DesignSpaceKw]
- evaluators: NotRequired[dict[str, Any]]