Skip to content

Commit

Permalink
fix: unrolling tested with single shot routine
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros11 committed Jul 4, 2024
1 parent 2772911 commit 62d8d48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
3 changes: 0 additions & 3 deletions src/qibolab/instruments/qm/sweepers.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,3 @@ def _sweep_duration(sweepers, qubits, sequence, parameters, relaxation_time):
parameters[operation(pulse)].duration = dur

_sweep_recursion(sweepers[1:], qubits, sequence, parameters, relaxation_time)


#
26 changes: 4 additions & 22 deletions src/qibolab/platform/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,18 @@ def unroll_sequences(
Returns:
total_sequence (:class:`qibolab.pulses.PulseSequence`): Unrolled pulse sequence containing
multiple measurements.
readout_map (dict): Map from original readout pulse serials to the unrolled readout pulse
serials. Required to construct the results dictionary that is returned after execution.
"""
total_sequence = PulseSequence()
readout_map = defaultdict(list)
channels = {pulse.channel for sequence in sequences for pulse in sequence}
for sequence in sequences:
total_sequence.extend(sequence)
# TODO: Fix unrolling results
for pulse in sequence:
if pulse.type is PulseType.READOUT:
readout_map[pulse.id].append(pulse.id)

length = sequence.duration + relaxation_time
pulses_per_channel = sequence.pulses_per_channel
for channel in channels:
delay = length - pulses_per_channel[channel].duration
total_sequence.append(Delay(duration=delay, channel=channel))

return total_sequence, readout_map
return total_sequence


@dataclass
Expand Down Expand Up @@ -285,23 +277,13 @@ def execute_pulse_sequences(
)
log.info(f"Minimal execution time (unrolling): {time}")

# find readout pulses
ro_pulses = {
pulse.id: pulse.qubit
for sequence in sequences
for pulse in sequence.ro_pulses
}

results = defaultdict(list)
bounds = kwargs.get("bounds", self._controller.bounds)
for b in batch(sequences, bounds):
sequence, readouts = unroll_sequences(b, options.relaxation_time)
sequence = unroll_sequences(b, options.relaxation_time)
result = self._execute(sequence, options, **kwargs)
for serial, new_serials in readouts.items():
results[serial].extend(result[ser] for ser in new_serials)

for serial, qubit in ro_pulses.items():
results[qubit] = results[serial]
for key, value in result.items():
results[key].extend(value)

return results

Expand Down

0 comments on commit 62d8d48

Please sign in to comment.