Skip to content

Commit

Permalink
generalized ports
Browse files Browse the repository at this point in the history
  • Loading branch information
nulinspiratie committed Jun 26, 2024
1 parent cacb945 commit c8ad5bc
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
13 changes: 7 additions & 6 deletions quam/components/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from quam.components.hardware import BaseFrequencyConverter, Mixer, LocalOscillator
from quam.components.pulses import Pulse, BaseReadoutPulse
from quam.components.ports import LFAnalogOutputPort, LFAnalogInputPort
from quam.core import QuamComponent, quam_dataclass
from quam.core.quam_classes import QuamDict
from quam.utils import string_reference as str_ref
Expand Down Expand Up @@ -485,7 +486,7 @@ class SingleChannel(Channel):
is None.
"""

opx_output: Union[Tuple[str, int], Tuple[str, int, int]]
opx_output: Union[Tuple[str, int], Tuple[str, int, int], LFAnalogOutputPort]
filter_fir_taps: List[float] = None
filter_iir_taps: List[float] = None

Expand Down Expand Up @@ -560,7 +561,7 @@ class InSingleChannel(Channel):
Used to account for signal smearing.
"""

opx_input: Union[Tuple[str, int], Tuple[str, int, int]]
opx_input: Union[Tuple[str, int], Tuple[str, int, int], LFAnalogInputPort]
opx_input_offset: float = None

time_of_flight: int = 24
Expand Down Expand Up @@ -831,8 +832,8 @@ class IQChannel(Channel):
for the IQ output.
"""

opx_output_I: Union[Tuple[str, int], Tuple[str, int, int]]
opx_output_Q: Union[Tuple[str, int], Tuple[str, int, int]]
opx_output_I: Union[Tuple[str, int], Tuple[str, int, int], LFAnalogOutputPort]
opx_output_Q: Union[Tuple[str, int], Tuple[str, int, int], LFAnalogOutputPort]

opx_output_offset_I: float = None
opx_output_offset_Q: float = None
Expand Down Expand Up @@ -1026,8 +1027,8 @@ class InIQChannel(Channel):
input_gain (float): The gain of the input channel. Default is None.
"""

opx_input_I: Union[Tuple[str, int], Tuple[str, int, int]]
opx_input_Q: Union[Tuple[str, int], Tuple[str, int, int]]
opx_input_I: Union[Tuple[str, int], Tuple[str, int, int], LFAnalogInputPort]
opx_input_Q: Union[Tuple[str, int], Tuple[str, int, int], LFAnalogInputPort]

time_of_flight: int = 24
smearing: int = 0
Expand Down
35 changes: 30 additions & 5 deletions quam/components/ports.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
from dataclasses import field
from typing import Dict, List, Literal, Optional, Tuple
from typing import ClassVar, Dict, List, Literal, Optional, Tuple
from quam.core import QuamComponent, quam_dataclass


@quam_dataclass
class OPXPlusAnalogOutputPort(QuamComponent):
class Port(QuamComponent):
port_type: ClassVar[str]


@quam_dataclass
class LFAnalogOutputPort(QuamComponent):
port_type: ClassVar[str] = "analog_output"


class LFAnalogInputPort(QuamComponent):
port_type: ClassVar[str] = "analog_input"


@quam_dataclass
class OPXPlusAnalogOutputPort(LFAnalogOutputPort):
port: Tuple[str, int]
offset: float = 0.0
delay: int = 0
Expand All @@ -13,9 +27,20 @@ class OPXPlusAnalogOutputPort(QuamComponent):
feedback_filter: List[float] = field(default_factory=list)
shareable: bool = False

def get_port_config(self):
return {
"port": self.port,
"offset": self.offset,
"delay": self.delay,
"crosstalk": self.crosstalk,
"feedforward_filter": self.feedforward_filter,
"feedback_filter": self.feedback_filter,
"shareable": self.shareable,
}


@quam_dataclass
class OPXPlusAnalogInputPort(QuamComponent):
class OPXPlusAnalogInputPort(LFAnalogInputPort):
port: Tuple[str, int]
offset: float = 0.0
gain_db: int = 0
Expand All @@ -39,7 +64,7 @@ class OPXPlusDigitalInputPort(QuamComponent):


@quam_dataclass
class LFFEMAnalogOutputPort(QuamComponent):
class LFFEMAnalogOutputPort(LFAnalogOutputPort):
port: Tuple[str, int]
offset: float = 0.0
delay: int = 0
Expand All @@ -53,7 +78,7 @@ class LFFEMAnalogOutputPort(QuamComponent):


@quam_dataclass
class LFFEMAnalogInputPort(QuamComponent):
class LFFEMAnalogInputPort(LFAnalogInputPort):
port: Tuple[str, int]
offset: float = 0.0
gain_db: int = 0
Expand Down

0 comments on commit c8ad5bc

Please sign in to comment.