quantize

Stoner.tools.quantize(number: Union[float, int, complex, ndarray], quantum: Union[float, int, complex]) Union[float, int, complex, 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