Skip to content

Commit

Permalink
octave ports
Browse files Browse the repository at this point in the history
  • Loading branch information
nulinspiratie committed Jul 3, 2024
1 parent bae1b09 commit 5001015
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions quam/components/octave.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from typing import Any, Optional, Union, ClassVar, Dict, List, Tuple, Literal
from dataclasses import field

from quam.components.ports.analog_outputs import LFAnalogOutputPort
from quam.components.ports.base_ports import BasePort
from quam.core import QuamComponent, quam_dataclass
from quam.components.hardware import BaseFrequencyConverter, FrequencyConverter
from quam.components.channels import (
Expand Down Expand Up @@ -274,10 +276,19 @@ def apply_to_config(self, config: Dict) -> None:
"input_attenuators": self.input_attenuators,
}
if isinstance(self.channel, SingleChannel):
output_config["I_connection"] = self.channel.opx_output
if isinstance(self.channel.opx_output, LFAnalogOutputPort):
output_config["I_connection"] = self.channel.opx_output.port_tuple
else:
output_config["I_connection"] = self.channel.opx_output
elif isinstance(self.channel, IQChannel):
output_config["I_connection"] = tuple(self.channel.opx_output_I)
output_config["Q_connection"] = tuple(self.channel.opx_output_Q)
if isinstance(self.channel.opx_output_I, LFAnalogOutputPort):
output_config["I_connection"] = self.channel.opx_output_I.port_tuple
else:
output_config["I_connection"] = tuple(self.channel.opx_output_I)
if isinstance(self.channel.opx_output_Q, LFAnalogOutputPort):
output_config["Q_connection"] = self.channel.opx_output_Q.port_tuple
else:
output_config["Q_connection"] = tuple(self.channel.opx_output_Q)


@quam_dataclass
Expand Down Expand Up @@ -379,14 +390,20 @@ def apply_to_config(self, config: Dict) -> None:
IF_channels = []
opx_channels = []

opx_port_tuples = [
p.port_tuple if isinstance(p, BasePort) else tuple(p) for p in opx_channels
]

IF_config = config["octaves"][self.octave.name]["IF_outputs"]
for k, (IF_ch, opx_ch) in enumerate(zip(IF_channels, opx_channels), start=1):
for k, (IF_ch, opx_port_tuples) in enumerate(
zip(IF_channels, opx_port_tuples), start=1
):
label = f"IF_out{IF_ch}"
IF_config.setdefault(label, {"port": tuple(opx_ch), "name": f"out{k}"})
if IF_config[label]["port"] != tuple(opx_ch):
IF_config.setdefault(label, {"port": opx_port_tuples, "name": f"out{k}"})
if IF_config[label]["port"] != opx_port_tuples:
raise ValueError(
f"Error generating config for Octave downconverter id={self.id}: "
f"Unable to assign {label} to port {opx_ch} because it is already "
f"Unable to assign {label} to port {opx_port_tuples} because it is already "
f"assigned to port {IF_config[label]['port']} "
)

Expand Down

0 comments on commit 5001015

Please sign in to comment.