Skip to content

Commit

Permalink
Add documentation and channel spec interface for external mixer.
Browse files Browse the repository at this point in the history
  • Loading branch information
deanpoulos committed Dec 19, 2024
1 parent 91a0cff commit b59152d
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 11 deletions.
12 changes: 12 additions & 0 deletions qualang_tools/wirer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ instruments.add_octave(indices=1)
instruments.add_lf_fem(controller=1, slots=[1])
instruments.add_mw_fem(controller=1, slots=[2])
```
#### Setups with External Mixers
Note: An **external mixer** is defined as abstractly as a combined, IQ-upconverter and IQ-downconverter instrument.
```python
# Single LF-FEM and 2x External Mixers
instruments.add_lf_fem(controller=1, slots=[1])
instruments.add_external_mixer(indices=[1, 2])
```
```python
# Single OPX+ and 2x External Mixers
instruments.add_opx_plus(controllers=[1, 2])
instruments.add_external_mixer(indices=[1, 2])
```
<details>
<summary>Image</summary>
<img alt="Empty OPX1000" src=".img/empty_opx1000.png">
Expand Down
3 changes: 3 additions & 0 deletions qualang_tools/wirer/instruments/instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def __init__(self):

def add_external_mixer(self, indices: Union[List[int], int]):
"""
Add an external mixer, which is defined abstractly as a combined, IQ-upconverter and
IQ-downconverter.
`indices` (List[int] | int): Can be one or more indices for one or more external mixers.
"""
if isinstance(indices, int):
Expand Down
66 changes: 55 additions & 11 deletions qualang_tools/wirer/wirer/channel_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
InstrumentChannelMwFemDigitalOutput,
InstrumentChannelLfFemDigitalOutput,
InstrumentChannelOctaveDigitalInput,
InstrumentChannelExternalMixerDigitalInput,
InstrumentChannelExternalMixerDigitalInput
)

# A channel template is a partially filled InstrumentChannel object
Expand Down Expand Up @@ -112,6 +112,29 @@ def __init__(self, index: int = None, rf_in: int = None, rf_out: int = None):


class ChannelSpecLfFemBasebandAndOctave(ChannelSpec):
def __init__(
self,
con: int = None,
slot: int = None,
in_port_i: int = None,
in_port_q: int = None,
out_port_i: int = None,
out_port_q: int = None,
octave_index: int = None,
rf_in: int = None,
rf_out: int = None,
):
super().__init__()
self.channel_templates = [
InstrumentChannelLfFemInput(con=con, slot=slot, port=in_port_i),
InstrumentChannelLfFemInput(con=con, slot=slot, port=in_port_q),
InstrumentChannelLfFemOutput(con=con, slot=slot, port=out_port_i),
InstrumentChannelLfFemOutput(con=con, slot=slot, port=out_port_q),
InstrumentChannelOctaveInput(con=octave_index, port=rf_in),
InstrumentChannelOctaveOutput(con=octave_index, port=rf_out),
]

class ChannelSpecLfFemBasebandAndExternalMixer(ChannelSpec):
def __init__(
self,
con: int = None,
Expand All @@ -120,41 +143,59 @@ def __init__(
in_port_q: int = None,
out_port_i: int = None,
out_port_q: int = None,
octave_index: int = None,
rf_in: int = None,
rf_out: int = None,
mixer_index: int = None,
):
super().__init__()
self.channel_templates = [
InstrumentChannelLfFemInput(con=con, slot=slot, port=in_port_i),
InstrumentChannelLfFemInput(con=con, slot=slot, port=in_port_q),
InstrumentChannelLfFemOutput(con=con, slot=slot, port=out_port_i),
InstrumentChannelLfFemOutput(con=con, slot=slot, port=out_port_q),
InstrumentChannelOctaveInput(con=octave_index, port=rf_in),
InstrumentChannelOctaveOutput(con=octave_index, port=rf_out),
InstrumentChannelExternalMixerInput(con=mixer_index, port=1),
InstrumentChannelExternalMixerOutput(con=mixer_index, port=1),
]


class ChannelSpecOpxPlusBasebandAndOctave(ChannelSpec):
def __init__(
self,
con: int = None,
in_port_i: int = None,
in_port_q: int = None,
out_port_i: int = None,
out_port_q: int = None,
octave_index: int = None,
rf_in: int = None,
rf_out: int = None,
):
super().__init__()
self.channel_templates = [
InstrumentChannelOpxPlusInput(con=con, port=in_port_i),
InstrumentChannelOpxPlusInput(con=con, port=in_port_q),
InstrumentChannelOpxPlusOutput(con=con, port=out_port_i),
InstrumentChannelOpxPlusOutput(con=con, port=out_port_q),
InstrumentChannelOctaveInput(con=octave_index, port=rf_in),
InstrumentChannelOctaveOutput(con=octave_index, port=rf_out),
]

class ChannelSpecOpxPlusBasebandAndExternalMixer(ChannelSpec):
def __init__(
self,
con: int = None,
in_port_i: int = None,
in_port_q: int = None,
out_port_i: int = None,
out_port_q: int = None,
octave_index: int = None,
rf_in: int = None,
rf_out: int = None,
mixer_index: int = None,
):
super().__init__()
self.channel_templates = [
InstrumentChannelOpxPlusInput(con=con, port=in_port_i),
InstrumentChannelOpxPlusInput(con=con, port=in_port_q),
InstrumentChannelOpxPlusOutput(con=con, port=out_port_i),
InstrumentChannelOpxPlusOutput(con=con, port=out_port_q),
InstrumentChannelOctaveInput(con=octave_index, port=rf_in),
InstrumentChannelOctaveOutput(con=octave_index, port=rf_out),
InstrumentChannelExternalMixerInput(con=mixer_index, port=1),
InstrumentChannelExternalMixerOutput(con=mixer_index, port=1),
]


Expand Down Expand Up @@ -192,8 +233,11 @@ def __init__(self, con: int = None, in_port: int = None):
lf_fem_spec = ChannelSpecLfFemSingle
lf_fem_iq_spec = ChannelSpecLfFemBaseband
lf_fem_iq_octave_spec = ChannelSpecLfFemBasebandAndOctave
lf_fem_iq_ext_mixer_spec = ChannelSpecLfFemBasebandAndExternalMixer
opx_spec = ChannelSpecOpxPlusSingle
opx_iq_spec = ChannelSpecOpxPlusBaseband
opx_iq_octave_spec = ChannelSpecOpxPlusBasebandAndOctave
opx_iq_ext_mixer_spec = ChannelSpecOpxPlusBasebandAndExternalMixer
octave_spec = ChannelSpecOctave
ext_mixer_spec = ChannelSpecExternalMixer
opx_dig_spec = ChannelSpecOpxPlusDigital

0 comments on commit b59152d

Please sign in to comment.