diff --git a/quam/components/hardware.py b/quam/components/hardware.py index ca416e6d..ee3a93c1 100644 --- a/quam/components/hardware.py +++ b/quam/components/hardware.py @@ -26,8 +26,7 @@ class LocalOscillator(QuamComponent): frequency: float = None power: float = None - def configure(self): - ... + def configure(self): ... @quam_dataclass diff --git a/quam/components/octave.py b/quam/components/octave.py index bec99dad..1d30f5e6 100644 --- a/quam/components/octave.py +++ b/quam/components/octave.py @@ -44,8 +44,18 @@ def initialize_default_connectivity(self): ) for i in range(1, 6): - self.RF_outputs[i] = OctaveUpConverter(octave=self) - self.IF_outputs[i] = OctaveDownConverter(octave=self, id=i) + self.RF_outputs[i] = OctaveUpConverter( + octave=self, + port_I=("con1", 2 * i - 1), + port_Q=("con1", 2 * i), + LO_frequency=None, # TODO What should default be? + ) + + for i in range(1, 3): + self.IF_outputs[i] = OctaveDownConverter( + octave=self, + + ) def apply_to_config(self, config: Dict) -> None: if "octaves" not in config: @@ -59,15 +69,16 @@ def apply_to_config(self, config: Dict) -> None: config["octaves"][self.name] = { "RF_outputs": {}, "IF_outputs": {}, + "RF_inputs": {}, "loopbacks": self.loopbacks, } @quam_dataclass class OctaveConverter(FrequencyConverter, ABC): - channel: Channel port_I: Tuple[str, int] port_Q: Tuple[str, int] + channel: Channel = None id: Union[int, str] = None @property @@ -159,16 +170,12 @@ def config_settings(self): def apply_to_config(self, config: Dict) -> None: super().apply_to_config(config) - config["octaves"][self.octave.name]["IF_outputs"][self.name] = { + config["octaves"][self.octave.name]["RF_outputs"][self.name] = { "RF_source": self.RF_source, "LO_frequency": self.LO_frequency, "LO_source": self.LO_source, "IF_mode_I": self.IF_mode_I, "IF_mode_Q": self.IF_mode_Q, - "IF_outputs": { - "IF_out1": {"port": self.port_I, "name": "out1"}, # - "IF_out2": {"port": self.port_Q, "name": "out2"}, - }, } diff --git a/tests/components/test_octave.py b/tests/components/test_octave.py new file mode 100644 index 00000000..06723e91 --- /dev/null +++ b/tests/components/test_octave.py @@ -0,0 +1,41 @@ +from copy import deepcopy + +from quam.components.octave import Octave, OctaveUpConverter, OctaveDownConverter +from quam.core.qua_config_template import qua_config_template +from quam.core.quam_classes import QuamRoot, quam_dataclass + + +@quam_dataclass +class OctaveQuAM(QuamRoot): + octave: Octave + + +def test_instantiate_octave(): + octave = Octave(name="octave1") + assert octave.RF_outputs == {} + assert octave.IF_outputs == {} + assert octave.loopbacks == [] + + +def test_instantiate_octave_default_connectivity(): + octave = Octave() + octave.initialize_default_connectivity() + + assert list(octave.RF_outputs) == [1, 2, 3, 4, 5] + + +def test_empty_octave_config(): + octave = Octave(name="octave1") + machine = OctaveQuAM(octave=octave) + config = machine.generate_config() + + expected_cfg = deepcopy(qua_config_template) + expected_cfg["octaves"] = { + "octave1": { + "RF_outputs": {}, + "IF_outputs": {}, + "loopbacks": [], + } + } + + assert config == expected_cfg