p5control.server.inserv

This module defines the instrument server, which is a rpyc service loading device drivers and exposing them to clients.

exception p5control.server.inserv.InstrumentServerError

Bases: BaseServerError

Exception related to the InstrumentServer

class p5control.server.inserv.InstrumentServer(port: int = 42068, data_server_port: int = 30000, data_server_filename: str | None = None)

Bases: BaseServer

rpyc service that loads devices and exposes them to the client

only public attributes (not starting with “_”) can be called by the client

start()

Starts the RPyC instrument server, then a data server and then starts the status measurement thread

stop()

Stop the instrument server and the status measurement and dataserver if they are running.

Order ist important, first stop the status thread so it does no longer write data to the data server, then the data server can be stopped

measure(name: str | None = None, include: List[str] | None = None, exclude: List[str] | None = None)

Get a measurement of all the specified devices.If either name or the devices are different than the last measurement, a new one is returned

Parameters:
  • name (str, optional) – name of the measurement, will determine the path under which the results are safed in the hdf5 path. I an empty name is provided, a generic name is automatically generated, which updates with every call.

  • include (List[str], optional) – specify the instruments to measure, given their names.

  • exclude (List[str], optional) – if include is not specified, this can be used to exclude some instruments, all others will be measured.