Skip to content

Commit

Permalink
fix: Ensure probe channels exclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Feb 7, 2025
1 parent 68bd8f3 commit 7c968bd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/qibolab/_core/instruments/qblox/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
from .log import Logger
from .results import AcquiredData, extract, integration_lenghts
from .sequence import Q1Sequence, compile
from .validate import _assert_no_probe
from .validate import assert_channels_exclusion

__all__ = ["Cluster"]

SAMPLING_RATE = 1


class Cluster(Controller):
"""Controller object for Qblox cluster."""

name: str
"""Device name.
Expand Down Expand Up @@ -109,7 +111,7 @@ def play(
log = Logger(configs)

for ps in sequences:
_assert_no_probe(ps, self._probes)
assert_channels_exclusion(ps, self._probes)
sequences_ = compile(ps, sweepers, options, self.sampling_rate)
log.sequences(sequences_)
sequencers = self._configure(sequences_, configs, options.acquisition_type)
Expand Down
6 changes: 4 additions & 2 deletions src/qibolab/_core/instruments/qblox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ def _los(
"""
return {
(iq, lo)
for iq, lo in {
for iq, lo in (
(iq, cast(IqChannel, channels[iq]).lo)
for iq in (_iqout(ch, channels[ch]) for ch in mod_channels)
if iq is not None
}
)
if lo is not None
}

Expand All @@ -111,6 +111,7 @@ def module(
channels: dict[ChannelId, Channel],
configs: Configs,
):
"""Configure module-wide settings."""
# map sequencers to specific outputs (but first disable all sequencer connections)
mod.disconnect_outputs()

Expand All @@ -134,6 +135,7 @@ def sequencer(
configs: Configs,
acquisition: AcquisitionType,
):
"""Configure sequencer-wide settings."""
# upload sequence
# - ensure JSON compatibility of the sent dictionary
seq.sequence(json.loads(sequence.model_dump_json()))
Expand Down
16 changes: 14 additions & 2 deletions src/qibolab/_core/instruments/qblox/validate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
from qibolab._core.identifier import ChannelId
from qibolab._core.sequence import PulseSequence

__all__ = []

def _assert_no_probe(ps: PulseSequence, probes: set[ChannelId]):
return

def assert_channels_exclusion(ps: PulseSequence, excluded: set[ChannelId]):
"""Deny group of channels.
Mainly used to deny probe channels, since probe events are currently required to be
bundled with acquisitions, cf. :class:`qibolab.Readout`.
An extended discussion about the probe-acquisition merge is found at:
https://github.com/qiboteam/qibolab/pull/1088#issuecomment-2637800857
"""
assert not any(
ch in excluded for ch, _ in ps
), "Probe channels can not be controlled independently, please use Readout events."

0 comments on commit 7c968bd

Please sign in to comment.