quantize

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