Session#

class Session(server_host: str, server_port: Optional[int] = None, *, hf2: Optional[bool] = None, connection: Optional[ziDAQServer] = None)[source]#

Bases: Node

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 for any connection is therefore 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. In short it is the only object the user need to create by himself.

Info:

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.

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

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

  • hf2 (Optional[bool]) – 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)

  • connection (Optional[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)

Methods

connect_device(serial, *[, interface])

Establish a connection to a device.

disconnect_device(serial)

Disconnect a device.

from_existing_connection(connection)

Initialize Session from an existing connection.

poll([recording_time, timeout, flags])

Polls all subscribed data from the data server.

raw_path_to_node(raw_path, *[, module])

Converts a raw node path string into a Node object.

set_transaction()

Context manager for a transactional set.

sync()

Synchronize all connected devices.

Attributes

daq_server

Managed instance of the core.ziDAQServer.

devices

Mapping for the connected devices.

is_hf2_server

Flag if the data server is a HF2 Data Server.

modules

Modules of LabOne.

multi_transaction

Flag if a session wide transaction is in progress.

server_host

Server host.

server_port

Server port.