Note

This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.

BackendTiming.round_delay

BackendTiming.round_delay(*, time=None, samples=None)[source]

Delay duration closest to input and consistent with timing constraints

This method produces the value to pass for the duration of a Delay instruction of a QuantumCircuit so that the delay fills the time until the next valid pulse, assuming the Delay instruction begins on a sample that is also valid for a pulse to begin on.

The pulse timing constraints of the backend are considered in order to give the number of samples closest to the input (either time or samples) for the start of a pulse in a subsequent instruction to be valid. The delay value in samples is rounded to the least common multiple of the pulse and acquire alignment values in order to ensure that either type of pulse will be aligned.

If BackendTiming.delay_unit() is s, time is returned directly. Typically, this is the case for a simulator where converting to sample number is not needed.

Parameters:
  • time (Optional[float]) – The nominal delay time to convert in seconds

  • samples (Union[int, float, None]) – The nominal delay time to convert in samples

Return type:

Union[int, float]

Returns:

The delay duration in samples if BackendTiming.delay_unit() is dt. Otherwise return time.

Raises:

QiskitError – If either both time and samples are passed or neither is passed.