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: float | ndarray, beta: float | ndarray, key: str, omega_0_bunch: float, **beam_kwargs) float | ndarray

Phase/position converters.

energy(energy_in: float | ndarray, key: str, q_over_m: float, m_over_q: float, e_rest_mev: float, **beam_kwargs) float | ndarray

Convert energy or Lorentz factor into another related quantity.

longitudinal(long_in: float | ndarray, ene: float | ndarray, key: str, e_rest_mev: float, **beam_kwargs) float | ndarray

Convert energies between longitudinal phase spaces.

emittance(eps_orig: float | ndarray, key: str, gamma_kin: float | ndarray, beta_kin: float | ndarray, lambda_bunch: float | ndarray, e_rest_mev: float | ndarray, **beam_kwargs) float | ndarray

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

twiss(twiss_orig: ndarray, gamma_kin: float | ndarray, key: str, lambda_bunch: float | ndarray, e_rest_mev: float | ndarray, beta_kin: float | ndarray | None = None, **beam_kwargs) ndarray

Convert Twiss array from a phase space to another.