converters module

Define the functions to convert momentum and speeds.

adim_momentum_to_speed_m_per_s(mom)[source]

Convert adim momentum to speed in \(\mathrm{m/s}\).

From the Position Monitor files header:

Note

Momentum is normalized to the product of particle’s mass and speed of light.

So mom is adimensional: normalisation = mass * clight And we de-normalize with: momentum_in_kg_m_per_s = mom * normalisation speed_in_m_per_s = momentum_in_kg_m_per_s / mass = mom * clight

Parameters:

mom (numpy.ndarray) – A 1D or 2D array holding adimensionned momentum along the three directions of one or several particles.

Returns:

speed_in_m_per_s – A 2D array holding the speed along the three directions of one or several particles.

Return type:

numpy.ndarray

adim_momentum_to_speed_mm_per_ns(mom, force_2d=True)[source]

Convert adimensionned momentum to speed in \(\mathrm{mm/ns}\).

Parameters:
  • mom (numpy.ndarray) – A 1D or 2D array holding adimensionned momentum along the three directions of one or several particles.

  • force_2d (bool, optional) – Force output array in 2D.

Returns:

speed_in_mm_per_ns – A 1D or 2D array holding the speed along the three directions of one or several particles.

Return type:

numpy.ndarray

adim_momentum_to_eV(mom, mass_eV)[source]

Convert adimensionned momentum to energy in \(\mathrm{eV}\).

Parameters:
  • mom (numpy.ndarray) – A 1D or 2D array holding adimensionned momentum along the three directions of one particle.

  • mass_eV (float)

Returns:

energy – The energy of the particle in \(\mathrm{eV}\).

Return type:

float