converters module

All functions to change units.

Todo

The eps_phiw is not correct. Does not match TraceWin (even if what I compute seems right). Check the zdelta -> phiw conversion.

position(pos_in, beta, key, omega_0_bunch, **beam_kwargs)[source]

Phase/position converters.

Parameters:
Return type:

float | ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]]

energy(energy_in, key, q_over_m, m_over_q, e_rest_mev, **beam_kwargs)[source]

Convert energy or Lorentz factor into another related quantity.

Todo

q_over_m and m_over_q should not be mandatory arguments if they are not always used.

Parameters:
Return type:

float | ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]]

longitudinal(long_in, ene, key, e_rest_mev, **beam_kwargs)[source]

Convert energies between longitudinal phase spaces.

Parameters:
Return type:

float | ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]]

emittance(eps_orig, key, gamma_kin, beta_kin, lambda_bunch, e_rest_mev, **beam_kwargs)[source]

Convert emittance from a phase space to another, or handle norm.

Parameters:
Return type:

float | ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]]

twiss(twiss_orig, gamma_kin, key, lambda_bunch, e_rest_mev, beta_kin=None, **beam_kwargs)[source]

Convert Twiss array from a phase space to another.

Parameters:
Return type:

ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]]