Skip to content

Commit

Permalink
fixing ports bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nulinspiratie committed Jul 3, 2024
1 parent 514e4e0 commit bae1b09
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions quam/components/ports/ports_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from dataclasses import field
from quam.components.ports.base_ports import FEMPort
from quam.core import quam_dataclass, QuamComponent
from quam.core.quam_classes import QuamBase
from .analog_outputs import (
OPXPlusAnalogOutputPort,
LFFEMAnalogOutputPort,
Expand Down Expand Up @@ -83,7 +84,17 @@ def _get_port(

return ports[port_id]

def reference_to_port(self, port_reference: str, create=False) -> OPXPlusPortTypes:
def reference_to_port(
self,
port_reference: Union[QuamComponent, str],
attr: Optional[str] = None,
create=False,
) -> OPXPlusPortTypes:
if isinstance(port_reference, QuamComponent):
reference = port_reference.get_reference(attr=attr)
if reference is None:
raise ValueError("Cannot get port from reference {port_reference}")
port_reference = reference
elems = port_reference.split("/")
port_type, controller_id, port_id = elems[-3:]

Expand Down Expand Up @@ -221,7 +232,7 @@ def reference_to_port(
attr: Optional[str] = None,
create=False,
) -> FEMPortTypes:
if isinstance(port_reference, QuamComponent):
if isinstance(port_reference, QuamBase):
reference = port_reference.get_reference(attr=attr)
if reference is None:
raise ValueError("Cannot get port from reference {port_reference}")
Expand Down

0 comments on commit bae1b09

Please sign in to comment.