Closed alecandido closed 2 days ago
@alecandido following the meeting last Wednesday, I understood that PulseSequence.concatenate
in the last example pads the the sequence with delays so that the MZ
plays after RX
. However, the following example:
from qibolab import create_platform
from qibolab.sequence import PulseSequence
def sequence_print(sequence: PulseSequence):
for ch, pulse in sequence:
print(ch, pulse)
print()
platform = create_platform("dummy")
q0 = platform.natives.single_qubit[0]
rx_sequence = q0.RX.create_sequence()
mz_sequence = q0.MZ.create_sequence()
sequence = PulseSequence()
sequence.concatenate(rx_sequence)
sequence.concatenate(mz_sequence)
sequence_print(rx_sequence)
sequence_print(mz_sequence)
sequence_print(sequence)
shows that there are no delays present in sequence
.
I think we need to replace https://github.com/qiboteam/qibolab/blob/888753403e496f843d67dd398b3f8ec424ee3749/src/qibolab/sequence.py#L106
with
_synchronize(self, self.channels | other.channels)
in order to get the delays.
Yes, that's correct. I can add this change (and a test) in the PR that will implement this issue.
Two concatenated PulseSequence
should actually start one after the other. If they need to be played in parallel (as it could be the case for different qubits) you should instead use .extend()
(or the associated list operator, i.e. +
, which will create a new sequence, same as |
will do for .concatenate()
).
The idea is to make it simpler to create sequences.
Currently, you have to do something like this:
(cf.
conftest.py
, theexecute
fixture)A couple of proposals to make it simpler are:
Native.create_sequence()
with.__call__()
PulseSequence.concatenate()
with.__or__()
.concatenate()
will be.__ior__()
, since the operation is in-places1 | s2
just by creating a new sequence:It should be possible to then write it like the following: