Skip to content

Commit

Permalink
octave updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nulinspiratie committed Mar 6, 2024
1 parent 8bf53d9 commit 335b320
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 10 deletions.
3 changes: 1 addition & 2 deletions quam/components/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class LocalOscillator(QuamComponent):
frequency: float = None
power: float = None

def configure(self):
...
def configure(self): ...


@quam_dataclass
Expand Down
23 changes: 15 additions & 8 deletions quam/components/octave.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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"},
},
}


Expand Down
41 changes: 41 additions & 0 deletions tests/components/test_octave.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 335b320

Please sign in to comment.