diff --git a/src/qibolab/_core/instruments/keysight/__init__.py b/src/qibolab/_core/instruments/keysight/__init__.py index 3d9e27675..839d9093d 100644 --- a/src/qibolab/_core/instruments/keysight/__init__.py +++ b/src/qibolab/_core/instruments/keysight/__init__.py @@ -1,5 +1,7 @@ -from . import qcs +from . import components, qcs +from .components import * from .qcs import * __all__ = [] __all__ += qcs.__all__ +__all__ += components.__all__ diff --git a/src/qibolab/_core/instruments/keysight/components/__init__.py b/src/qibolab/_core/instruments/keysight/components/__init__.py new file mode 100644 index 000000000..23a39cbda --- /dev/null +++ b/src/qibolab/_core/instruments/keysight/components/__init__.py @@ -0,0 +1,5 @@ +from . import configs +from .configs import * + +__all__ = [] +__all__ += configs.__all__ diff --git a/src/qibolab/_core/instruments/keysight/components/configs.py b/src/qibolab/_core/instruments/keysight/components/configs.py new file mode 100644 index 000000000..db700b05c --- /dev/null +++ b/src/qibolab/_core/instruments/keysight/components/configs.py @@ -0,0 +1,16 @@ +from typing import Annotated, Literal, Optional + +from pydantic import Field + +from qibolab._core.components import AcquisitionConfig +from qibolab._core.serialize import NdArray + +__all__ = ["QcsAcquisitionConfig"] + + +class QcsAcquisitionConfig(AcquisitionConfig): + """Acquisition config for Keysight QCS.""" + + kind: Literal["qcs-acquisition"] = "qcs-acquisition" + + state_iq_values: Annotated[Optional[NdArray], Field(repr=False)] = None diff --git a/src/qibolab/_core/instruments/keysight/qcs.py b/src/qibolab/_core/instruments/keysight/qcs.py index e6c4fee40..800c78455 100644 --- a/src/qibolab/_core/instruments/keysight/qcs.py +++ b/src/qibolab/_core/instruments/keysight/qcs.py @@ -2,7 +2,7 @@ from collections import defaultdict from functools import reduce -from typing import ClassVar, Optional +from typing import ClassVar import numpy as np from keysight import qcs @@ -37,8 +37,6 @@ class KeysightQCS(Controller): """Map of QCS virtual channels to QCS physical channels.""" virtual_channel_map: dict[ChannelId, qcs.Channels] """Map of Qibolab channel IDs to QCS virtual channels.""" - classifier_map: Optional[dict[qcs.Channels, qcs.MinimumDistanceClassifier]] = {} - """Map of QCS virtual acquisition channels to QCS state classifiers.""" sampling_rate: ClassVar[float] = ( qcs.SAMPLE_RATES[qcs.InstrumentEnum.M5300AWG] * NS_TO_S ) @@ -86,6 +84,7 @@ def create_program( if isinstance(channel, AcquisitionChannel): probe_channel_id = channel.probe + classifier_reference = configs[channel_id].state_iq_values process_acquisition_channel_pulses( program=program, pulses=sequence.channel(channel_id), @@ -95,7 +94,11 @@ def create_program( virtual_channel=virtual_channel, probe_virtual_channel=self.virtual_channel_map[probe_channel_id], sweeper_pulse_map=sweeper_pulse_map, - classifier=self.classifier_map.get(virtual_channel, None), + classifier=( + None + if classifier_reference is None + else qcs.MinimumDistanceClassifier(classifier_reference) + ), ) elif isinstance(channel, IqChannel): diff --git a/src/qibolab/instruments/keysight_qcs.py b/src/qibolab/instruments/keysight_qcs.py index 1172c47a6..b9416cb60 100644 --- a/src/qibolab/instruments/keysight_qcs.py +++ b/src/qibolab/instruments/keysight_qcs.py @@ -1,7 +1,7 @@ """Driver for Keysight Quantum Control System (QCS).""" -from qibolab._core.instruments.keysight import qcs -from qibolab._core.instruments.keysight.qcs import * # noqa: F403 +from qibolab._core.instruments import keysight +from qibolab._core.instruments.keysight import * # noqa: F403 __all__ = [] -__all__ += qcs.__all__ +__all__ += keysight.__all__