beam_calculation.tracewin.beam_parameters_factory module

Define a function to generate a BeamParameters for TraceWin.

class BeamParametersFactoryTraceWin(is_3d: bool, is_multipart: bool)

Bases: BeamParametersFactory

A class holding method to generate BeamParameters.

_abc_impl = <_abc._abc_data object>
_extract_emittance_for_99percent(phase_space_name: str, results: dict[str, ndarray]) ndarray

Retrieve the 99% emittances.

Todo

normalized or not???

Parameters:
  • phase_space_name ({'x99', 'y99', 'phiw99'}) – Name of a single phase space.

  • results (dict[str, np.ndarray]) – Results dictionary, which keys are tracewin.out or partran1.out headers and which values are corresponding data.

Returns:

eps – 99% emittance in the desired phase space.

Return type:

np.ndarray

_extract_phase_space_data_for_sigma(phase_space_name: str, results: dict[str, ndarray]) tuple[ndarray, ndarray, ndarray]

Retrieve the data necessary to reconstruct \(\sigma\) beam matrix.

Parameters:
  • phase_space_name ({'x', 'y', 'zdelta'}) – Name of a single phase space.

  • results (dict[str, np.ndarray]) – Results dictionary, which keys are tracewin.out or partran1.out headers and which values are corresponding data.

Returns:

  • sigma_00 (np.ndarray) – (n, ) array containing top-left component of the \(\sigma\) beam matrix.

  • sigma_01 (np.ndarray) – (n, ) array containing top-right component of the \(\sigma\) beam matrix.

  • eps_normalized (np.ndarray) – (n, ) array of normalized emittance.

factory_method(z_abs: ndarray, gamma_kin: ndarray, results: dict[str, ndarray], element_to_index: Callable[[str | Element, str | None], int | slice]) BeamParameters

Create the BeamParameters object.