Skip to content

Commit

Permalink
Add direct support for SHFLI and GHFLI
Browse files Browse the repository at this point in the history
This commit explicitly exposes the device classes for
the SHFLI and GHFLI. This simplifies the connection
setup and makes the support clearly visible.
  • Loading branch information
tobiasah committed Dec 17, 2024
1 parent 339cf3c commit 39b664a
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# zhinst-qcodes Changelog

## Version 0.6.0
* Add explicit Insturment wrappers for SHFLI and GHFLI
* The constructor of `Session` fails when attempting to connect to a data-server on a different LabOne version. This behavior can be overridden by setting the newly added allow_version_mismatch keyword argument to True. When allow_version_mismatch=True is passed to the `Session` constructor the connection to the data-server succeeds even if the version doesn't match.

## Version 0.5.5
Expand Down
2 changes: 2 additions & 0 deletions docs/source/package_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ zhinst-qcodes exposes the following classes:
~zhinst.qcodes.device_creator.UHFQA
~zhinst.qcodes.device_creator.HF2
~zhinst.qcodes.device_creator.ZIDevice
~zhinst.qcodes.device_creator.SHFLI
~zhinst.qcodes.device_creator.GHFLI

In addition the following classes are imported from
`zhinst-toolkit <https://docs.zhinst.com/zhinst-toolkit/en/latest/package_documentation.html>`_:
Expand Down
4 changes: 4 additions & 0 deletions src/zhinst/qcodes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
UHFQA,
ZIDevice,
HF2,
SHFLI,
GHFLI,
)

from zhinst.toolkit import (
Expand Down Expand Up @@ -42,6 +44,8 @@
"UHFQA",
"ZIDevice",
"HF2",
"SHFLI",
"GHFLI",
"Waveforms",
"CommandTable",
"Sequence",
Expand Down
83 changes: 83 additions & 0 deletions src/zhinst/qcodes/device_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
The classes can be used without creating as session to a data server.
"""

import typing as t

from zhinst.qcodes.driver.devices.base import ZIBaseInstrument
Expand Down Expand Up @@ -354,6 +355,88 @@ def __init__(
session.devices[self.serial] = self


class SHFLI(ZIBaseInstrument):
"""QCoDeS driver for the Zurich Instruments SHFLI.
Args:
serial: Serial number of the device, e.g. *'dev12000'*.
The serial number can be found on the back panel of the instrument.
server_host: Host address of the data server (e.g. localhost)
server_port: Port number of the data server. If not specified the session
uses the default port. (default = 8004)
interface: Device interface (e.g. = "1GbE"). If not specified
the default interface from the discover is used.
name: Name of the instrument in qcodes.
raw: Flag if qcodes instance should only created with the nodes and
not forwarding the toolkit functions. (default = False)
new_session: By default zhinst-qcodes reuses already existing data
server session (within itself only), meaning only one session to a
data server exists. Setting the flag will create a new session.
Warning:
Creating a new session should be done carefully and reusing
the created session is not possible. Consider instantiating a
new session directly.
"""

def __init__(
self,
serial: str,
host: str,
port: int = 8004,
*,
interface: t.Optional[str] = None,
name=None,
raw=False,
new_session: bool = False,
):
session = ZISession(host, port, hf2=False, new_session=new_session)
tk_device = session.toolkit_session.connect_device(serial, interface=interface)
super().__init__(tk_device, session, name=name, raw=raw)
session.devices[self.serial] = self


class GHFLI(ZIBaseInstrument):
"""QCoDeS driver for the Zurich Instruments GHFLI.
Args:
serial: Serial number of the device, e.g. *'dev12000'*.
The serial number can be found on the back panel of the instrument.
server_host: Host address of the data server (e.g. localhost)
server_port: Port number of the data server. If not specified the session
uses the default port. (default = 8004)
interface: Device interface (e.g. = "1GbE"). If not specified
the default interface from the discover is used.
name: Name of the instrument in qcodes.
raw: Flag if qcodes instance should only created with the nodes and
not forwarding the toolkit functions. (default = False)
new_session: By default zhinst-qcodes reuses already existing data
server session (within itself only), meaning only one session to a
data server exists. Setting the flag will create a new session.
Warning:
Creating a new session should be done carefully and reusing
the created session is not possible. Consider instantiating a
new session directly.
"""

def __init__(
self,
serial: str,
host: str,
port: int = 8004,
*,
interface: t.Optional[str] = None,
name=None,
raw=False,
new_session: bool = False,
):
session = ZISession(host, port, hf2=False, new_session=new_session)
tk_device = session.toolkit_session.connect_device(serial, interface=interface)
super().__init__(tk_device, session, name=name, raw=raw)
session.devices[self.serial] = self


class MFLI(ZIBaseInstrument):
"""QCoDeS driver for the Zurich Instruments MFLI.
Expand Down

0 comments on commit 39b664a

Please sign in to comment.