Skip to content

Commit

Permalink
Back-port connect_to classmethod
Browse files Browse the repository at this point in the history
  • Loading branch information
terrorfisch committed Apr 11, 2024
1 parent b86a2b3 commit 5bb27fa
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions qupulse_hdawg_legacy/zihdawg.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,26 @@ def __init__(self, device_serial: str = None,
# activates channel groups
self.channel_grouping = grouping

@classmethod
def connect_to(cls, device_serial: str = None, **init_kwargs):
"""
:param device_serial:
:param init_kwargs: Forwarded to `HDAWGRepresentation.__init__`
:return:
"""
discovery = zhinst_core.ziDiscovery()
device_id = discovery.find(device_serial)
device_props = discovery.get(device_id)
return cls(
device_serial=device_serial,
device_interface=device_props['interfaces'][0],
data_server_addr=device_props['serveraddress'],
data_server_port=device_props['serverport'],
api_level_number=device_props['apilevel'],
**init_kwargs,
)


@property
def waveform_file_system(self) -> WaveformFileSystem:
return self._waveform_file_system
Expand Down

0 comments on commit 5bb27fa

Please sign in to comment.