iqm.pulse.gates.cz.round_to_granularity

iqm.pulse.gates.cz.round_to_granularity#

iqm.pulse.gates.cz.round_to_granularity(value, granularity, precision=1e-15)#

Round a value to the nearest multiple of granularity. If the value is within a given precision of a multiple, round to that multiple. Otherwise, round down to the nearest lower multiple.

Parameters:
  • value (float)

  • granularity (float) – granularity

  • precision (float) – rounding precision.

Returns:

value rounded to a granularity.

Return type:

float