The present situation is fragmented, both at the Platform level (frontend) and Instrument level (backend), because of the historical way the hardware optimization landed in Qibolab.
We could reconcile the frontend by having a single Platform.execute(), doing both sweeps and unrolling, possibly at the same time.
The interface would be simply:
and the current three alternatives are obtained by passing a 1-element list for sequences, or no sweepers object, or both (I also wonder whether, for symmetry, we should have a list[Sweeper] - but that's a detail).
This will require some logic for the missing case of simultaneous sweep and unrolling. In particular, if a sequence containing sweepers is to be unrolled, we should definitely give the user the option to tell that is the same sweeper in all sequences, otherwise a nested loop will be attempted, as nested as the number of swept pulses fitting in the batch.
To make it possible, #692 will be needed.
For the time being, if multiple sequences will be passed, the potential sweepers should be unrolled (generating even more lists), which is simpler to implement, and does not require any change in the user code (on the contrary, the mark for sweepers identity will have to be explicitly inserted by the user).
The present situation is fragmented, both at the
Platform
level (frontend) andInstrument
level (backend), because of the historical way the hardware optimization landed in Qibolab.Platform
The
Platform
implements the support for sequence unrolling, by differentiating: https://github.com/qiboteam/qibolab/blob/47d1d550a32f455fa2cc149820fa0ce06ae96795/src/qibolab/platform.py#L193-L195 https://github.com/qiboteam/qibolab/blob/47d1d550a32f455fa2cc149820fa0ce06ae96795/src/qibolab/platform.py#L229-L231 even if they are reconvened later on inPlatform._execute()
. Moreover, sweepers require the usage of a separate method: https://github.com/qiboteam/qibolab/blob/47d1d550a32f455fa2cc149820fa0ce06ae96795/src/qibolab/platform.py#L269-L271 (also notice how**kwargs
enter the first two, and not the latter - but they are always unused, so we could well drop them).We could reconcile the frontend by having a single
Platform.execute()
, doing both sweeps and unrolling, possibly at the same time. The interface would be simply:and the current three alternatives are obtained by passing a 1-element list for
sequences
, or nosweepers
object, or both (I also wonder whether, for symmetry, we should have alist[Sweeper]
- but that's a detail).This will require some logic for the missing case of simultaneous sweep and unrolling. In particular, if a sequence containing sweepers is to be unrolled, we should definitely give the user the option to tell that is the same sweeper in all sequences, otherwise a nested loop will be attempted, as nested as the number of swept pulses fitting in the batch. To make it possible, #692 will be needed.
For the time being, if multiple sequences will be passed, the potential
sweepers
should be unrolled (generating even more lists), which is simpler to implement, and does not require any change in the user code (on the contrary, the mark for sweepers identity will have to be explicitly inserted by the user).Controller
At the backend level, we have the
Controller.play()
andController.sweep()
methods. But they are already collapsed somewhere, e.g. https://github.com/qiboteam/qibolab/blob/47d1d550a32f455fa2cc149820fa0ce06ae96795/src/qibolab/instruments/qm/driver.py#L111-L112 a suitable implementation of sweepers (with a proper recursion) for the other drivers will remove the necessity for the separation. At that point, we will just keep theController.play()
with the strictly more general.sweep()
interface.