Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nulinspiratie committed Jul 2, 2024
1 parent 7c7c05a commit f4d4e74
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
20 changes: 12 additions & 8 deletions quam/components/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,15 @@ def apply_to_config(self, config: dict) -> None:
)
return

shareable = self.shareable if self.shareable is not None else False
inverted = self.inverted if self.inverted is not None else False
if len(self.opx_output) == 2:
digital_output_port = OPXPlusDigitalOutputPort(
*self.opx_output, shareable=self.shareable, inverted=self.inverted
*self.opx_output, shareable=shareable, inverted=inverted
)
else:
digital_output_port = FEMDigitalOutputPort(
*self.opx_output, shareable=self.shareable, inverted=self.inverted
*self.opx_output, shareable=shareable, inverted=inverted
)
digital_output_port.apply_to_config(config)

Expand Down Expand Up @@ -964,8 +966,6 @@ def apply_to_config(self, config: dict):
# Add pulses & waveforms
super().apply_to_config(config)

opx_outputs = {"I": self.opx_output_I, "Q": self.opx_output_Q}

if str_ref.is_reference(self.name):
raise AttributeError(
f"Channel {self.get_reference()} cannot be added to the config because"
Expand Down Expand Up @@ -997,7 +997,8 @@ def apply_to_config(self, config: dict):
f"reference: {self.frequency_converter_up}"
)
else:
element_cfg["mixInputs"] = {**opx_ports}

element_cfg["mixInputs"] = {} # To be filled in next section
if self.mixer is not None:
element_cfg["mixInputs"]["mixer"] = self.mixer.name
if self.local_oscillator is not None:
Expand All @@ -1007,7 +1008,7 @@ def apply_to_config(self, config: dict):

opx_outputs = [self.opx_output_I, self.opx_output_Q]
offsets = [self.opx_output_offset_I, self.opx_output_offset_Q]
for opx_output, offset in zip(opx_outputs, offsets):
for I_or_Q, opx_output, offset in zip("IQ", opx_outputs, offsets):
if isinstance(opx_output, LFAnalogOutputPort):
opx_port = opx_output
elif len(opx_output) == 2:
Expand All @@ -1017,6 +1018,8 @@ def apply_to_config(self, config: dict):
opx_port = LFFEMAnalogOutputPort(*opx_output, offset=offset)
opx_port.apply_to_config(config)

element_cfg["mixInputs"][I_or_Q] = opx_port.port_tuple


@quam_dataclass
class InIQChannel(Channel):
Expand Down Expand Up @@ -1095,17 +1098,18 @@ def apply_to_config(self, config: dict):

opx_inputs = [self.opx_input_I, self.opx_input_Q]
offsets = [self.opx_input_offset_I, self.opx_input_offset_Q]
input_gain = int(self.input_gain if self.input_gain is not None else 0)
for k, (opx_input, offset) in enumerate(zip(opx_inputs, offsets), start=1):
if isinstance(opx_input, LFAnalogInputPort):
opx_port = opx_input
elif len(opx_input) == 2:
opx_port = OPXPlusAnalogInputPort(
*opx_input, offset=offset, gain_db=self.input_gain
*opx_input, offset=offset, gain_db=input_gain
)
opx_port.apply_to_config(config)
else:
opx_port = LFFEMAnalogInputPort(
*opx_input, offset=offset, gain_db=self.input_gain
*opx_input, offset=offset, gain_db=input_gain
)
opx_port.apply_to_config(config)
if not isinstance(self.frequency_converter_down, OctaveDownConverter):
Expand Down
2 changes: 1 addition & 1 deletion tests/components/channels/test_digital_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_digital_only_channel(qua_config):
quam = QuamTest(channel=channel)
cfg = quam.generate_config()

qua_config["controllers"] = {"con1": {"digital_outputs": {1: {}}}}
qua_config["controllers"] = {"con1": {"digital_outputs": {1: {"inverted": False, "shareable": False}}}}
qua_config["elements"] = {
"channel": {"digitalInputs": {"1": {"port": ("con1", 1)}}, "operations": {}}
}
Expand Down
7 changes: 3 additions & 4 deletions tests/components/channels/test_in_IQ_out_single_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ def test_generate_config(qua_config):
assert qua_config["controllers"] == {
"con1": {
"analog_inputs": {
1: {},
2: {},
1: {"gain_db": 0, "shareable": False},
2: {"gain_db": 0, "shareable": False},
},
"analog_outputs": {1: {}},
"digital_outputs": {},
"analog_outputs": {1: {"delay": 0, "shareable": False}},
}
}

Expand Down

0 comments on commit f4d4e74

Please sign in to comment.