ewoksxas.converters.larch.convert_kev_to_ev#

ewoksxas.converters.larch.convert_kev_to_ev(energy, threshold=0.01)[source]#

Convert energy values from keV to eV when the data appear to be in keV.

Detection relies on the median step size between consecutive points. X-ray spectroscopy data in eV typically has steps of 0.1-1 eV; the same data in keV has steps of 0.0001-0.001 keV. A threshold of 0.01 sits cleanly between the two ranges for all realistic scans.

Args:

energy: Energy axis values (1D or 2D array). threshold: If the median step size is below this value the data

are assumed to be in keV and multiplied by 1000.

Raises:

ValueError: If energy has more than two dimensions.

Parameters:
  • energy (ndarray[tuple[int, ...], dtype[float64]])

  • threshold (float)

Return type:

ndarray[tuple[int, ...], dtype[float64]]