class ZISession(server_host: str, server_port: int | None = None, *, hf2: bool | None = None, new_session=False, connection: ziDAQServer | None = None)[source]#

Bases: object

Session to a data server.

Zurich Instruments devices use a server-based connectivity methodology. Server-based means that all communication between the user and the instrument takes place via a computer program called a server, the data sever. The data sever recognizes available instruments and manages all communication between the instrument and the host computer on one side, and communication to all the connected clients on the other side. (For more information on the architecture please refer to the user manual http://docs.zhinst.com/labone_programming_manual/introduction.html)

The entry point into any connection is therefor a client session to a existing data sever. This class represents a single client session to a data server. The session enables the user to connect to one or multiple instruments (also creates the dedicated objects for each device), access the LabOne modules and poll data.

Since QCoDeS normally instantiate the device specific objects directly this driver also exposes helper classes for that directly. These helper classes create a session and connect the specified device to it. To avoid that each device has a own session by default ZISession only creates one session to a single data server and reuses that.


Except for the HF2 a single session can be used to connect to all devices from Zurich Instruments. Since the HF2 is historically based on another data server called the hf2 data server it is not possible to connect HF2 devices a “normal” data server and also not possible to connect devices apart from HF2 to the hf2 data server.

  • server_host (str) – Host address of the data server (e.g. localhost)

  • server_port (int | None) – Port number of the data server. If not specified the session uses the default port 8004 (8005 for HF2 if specified). (default = None)

  • hf2 (bool | None) – Flag if the session should be established with an HF2 data sever or the “normal” one for all other devices. If not specified the session will detect the type of the data server based on the port. (default = None)

  • 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 since it requires more resources and can create unwanted side effects.

  • connection (ziDAQServer) – Existing daq server object. If specified the session will not create a new session to the data server but reuse the passed one. (default = None)