Skip to content

Commit

Permalink
Added test loading Octave
Browse files Browse the repository at this point in the history
  • Loading branch information
nulinspiratie committed Mar 8, 2024
1 parent 550ef49 commit e112061
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
8 changes: 3 additions & 5 deletions quam/components/octave.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class OctaveUpConverter(OctaveFrequencyConverter):
entering the mixer. Off by default.
"""

LO_frequency: float
LO_frequency: float = None
LO_source: Literal["internal", "external"] = "internal"
gain: float = 0
output_mode: Literal[
Expand Down Expand Up @@ -290,10 +290,8 @@ class OctaveDownConverter(OctaveFrequencyConverter):
are connected to the opposite OPX inputs.
"""

LO_frequency: float # Between 2 and 18 GHz
LO_source: Literal["internal", "external"] = (
"internal" # default is internal for LO 1, external for LO 2
)
LO_frequency: float = None
LO_source: Literal["internal", "external"] = "internal"
IF_mode_I: Literal["direct", "envelope", "mixer", "off"] = "direct"
IF_mode_Q: Literal["direct", "envelope", "mixer", "off"] = "direct"
IF_output_I: Literal[1, 2] = 1
Expand Down
29 changes: 29 additions & 0 deletions tests/components/test_octave.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,32 @@ def test_channel_add_RF_inputs(octave):
}

assert cfg["elements"] == expected_cfg_elements


def test_load_octave(octave):
machine = OctaveQuAM(octave=octave)
octave.initialize_default_connectivity()

d = machine.to_dict()

d_expected = {
"__class__": "test_octave.OctaveQuAM",
"octave": {
"RF_inputs": {1: {"id": 1}, 2: {"id": 2}},
"RF_outputs": {
1: {"id": 1},
2: {"id": 2},
3: {"id": 3},
4: {"id": 4},
5: {"id": 5},
},
"ip": "127.0.0.1",
"name": "octave1",
"port": 80,
},
}
assert d == d_expected

machine2 = OctaveQuAM.load(d)

assert d == machine2.to_dict()

0 comments on commit e112061

Please sign in to comment.