Skip to content

Commit

Permalink
refactor: Rearrange sequence preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Dec 3, 2024
1 parent a33092c commit a62d812
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/qibolab/_core/instruments/qblox/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ def play(
def _upload(
self, sequences: dict[ChannelId, Sequence]
) -> dict[SlotId, dict[ChannelId, SequencerId]]:
channels_by_module = _channels_by_module()
sequencers = defaultdict(dict)
for mod, chs in channels_by_module.items():
for mod, chs in _channels_by_module().items():
module = self._modules[mod]
assert len(module.sequencers) > len(chs)
# Map sequencers to specific outputs (but first disable all sequencer connections)
Expand Down Expand Up @@ -166,10 +165,10 @@ def _prepare(
sweepers: list[ParallelSweepers],
options: ExecutionParameters,
) -> dict[ChannelId, Sequence]:
sequences = {}
for channel in sequence.channels:
filtered = PulseSequence((ch, pulse) for ch, pulse in sequence if ch == channel)
seq = Sequence.from_pulses(filtered, sweepers, options)
sequences[channel] = seq
def ch_pulses(channel: ChannelId):
return PulseSequence((ch, pulse) for ch, pulse in sequence if ch == channel)

return sequences
return {
channel: Sequence.from_pulses(ch_pulses(channel), sweepers, options)
for channel in sequence.channels
}

0 comments on commit a62d812

Please sign in to comment.