diff --git a/CHANGELOG.md b/CHANGELOG.md index 28484cb1..ade7fd5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [Unreleased] +### Fixed +- Change location of port feedforward and feedback filters in config + + ## [0.3.7] ### Added - Added `WaveformPulse` to allow for pre-defined waveforms. diff --git a/quam/components/ports/analog_outputs.py b/quam/components/ports/analog_outputs.py index 1365581f..f5b70230 100644 --- a/quam/components/ports/analog_outputs.py +++ b/quam/components/ports/analog_outputs.py @@ -33,9 +33,13 @@ def get_port_properties(self): if self.crosstalk is not None: port_properties["crosstalk"] = self.crosstalk if self.feedforward_filter is not None: - port_properties["feedforward_filter"] = list(self.feedforward_filter) + port_properties.setdefault("filter", {})["feedforward"] = list( + self.feedforward_filter + ) if self.feedback_filter is not None: - port_properties["feedback_filter"] = list(self.feedback_filter) + port_properties.setdefault("filter", {})["feedback"] = list( + self.feedback_filter + ) if self.offset is not None: port_properties["offset"] = self.offset return port_properties diff --git a/tests/components/ports/test_lf_fem_analog_ports.py b/tests/components/ports/test_lf_fem_analog_ports.py index b76a07b8..6c621f8e 100644 --- a/tests/components/ports/test_lf_fem_analog_ports.py +++ b/tests/components/ports/test_lf_fem_analog_ports.py @@ -83,6 +83,52 @@ def test_lf_fem_analog_output_port(): } +def test_fem_analog_output_port_filter(): + port = LFFEMAnalogOutputPort("con1", 1, 2) + port.feedforward_filter = None + port.feedback_filter = None + + assert port.get_port_properties() == { + "delay": 0, + "shareable": False, + "output_mode": "direct", + "sampling_rate": 1e9, + "upsampling_mode": "mw", + } + + port.feedforward_filter = [0.7, 0.2, 0.1] + + assert port.get_port_properties() == { + "delay": 0, + "shareable": False, + "output_mode": "direct", + "sampling_rate": 1e9, + "upsampling_mode": "mw", + "filter": {"feedforward": [0.7, 0.2, 0.1]}, + } + + port.feedback_filter = [0.3, 0.4, 0.5] + + assert port.get_port_properties() == { + "delay": 0, + "shareable": False, + "output_mode": "direct", + "sampling_rate": 1e9, + "upsampling_mode": "mw", + "filter": {"feedforward": [0.7, 0.2, 0.1], "feedback": [0.3, 0.4, 0.5]}, + } + + port.feedforward_filter = None + assert port.get_port_properties() == { + "delay": 0, + "shareable": False, + "output_mode": "direct", + "sampling_rate": 1e9, + "upsampling_mode": "mw", + "filter": {"feedback": [0.3, 0.4, 0.5]}, + } + + def test_lf_fem_analog_input_port(): with pytest.raises(TypeError): LFFEMAnalogInputPort()