quantize

Stoner.tools.quantize(number: Union[float, int, complex, numpy.ndarray], quantum: Union[float, int, complex]) Union[float, int, complex, numpy.ndarray][source]

Round a number to the nearest multiple of a quantum.

Parameters
  • number (float,array) – Number(s) to be rounded to the nearest qyuantum

  • quantum (float) – Quantum to round to

Returns

number rounded to qunatum