beam_calculation.tracewin.transfer_matrix_factory module

Provide an easy way to generate TransferMatrix.

class TransferMatrixFactoryTraceWin(is_3d: bool)

Bases: TransferMatrixFactory

Provide a method for easy creation of TransferMatrix.

_abc_impl = <_abc._abc_data object>
_load_transfer_matrices(path_cal: str, filename: str = 'Transfer_matrix1.dat', high_def: bool = False) tuple[ndarray, ndarray, ndarray]

Get the full transfer matrices calculated by TraceWin.

Parameters:
  • filename (str, optional) – The name of the transfer matrix file produced by TraceWin. The default is ‘Transfer_matrix1.dat’.

  • high_def (bool, optional) – To get the transfer matrices at all the solver step, instead at the elements exit only. The default is False. Currently not implemented.

Returns:

  • element_numbers (np.ndarray) – Number of the elements.

  • position_in_m (np.ndarray) – Position of the elements.

  • transfer_matrices (np.ndarray) – Cumulated transfer matrices of the elements.

run(tm_cumul_in: ndarray, path_cal: str, element_to_index: Callable) TransferMatrix

Load the TraceWin transfer matrix file and create the object.

Parameters:
  • tm_cumul_in (np.ndarray) – Cumulated transfer matrix at entrance of linac or linac subset.

  • path_cal (str) – Full path to transfer matrix file.

  • element_to_index (Callable) – to doc

Returns:

transfer_matrix – Object holding the various transfer matrices in the \([x-x']\), \([y-y']\) and \([z-\delta]\) planes.

Return type:

TransferMatrix