Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: feedforward and feedback filter locations in config #79

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 6 additions & 2 deletions quam/components/ports/analog_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 46 additions & 0 deletions tests/components/ports/test_lf_fem_analog_ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down