qcodes.monitor

Monitor a set of parameters in a background thread stream output over websocket.

To start monitor, run this file, or if qcodes is installed as a module:

% python -m qcodes.monitor.monitor

Add parameters to monitor in your measurement by creating a new monitor with a list of parameters to monitor:

monitor = qcodes.Monitor(param1, param2, param3, ...)

Classes:

Monitor(*parameters[, interval, ...])

QCodes Monitor - WebSockets server to monitor qcodes parameters.

class qcodes.monitor.Monitor(*parameters: Parameter, interval: float = 1, use_root_instrument: bool = True)[source]

Bases: Thread

QCodes Monitor - WebSockets server to monitor qcodes parameters.

Monitor qcodes parameters.

Parameters:
  • *parameters – Parameters to monitor.

  • interval – How often one wants to refresh the values.

  • use_root_instrument – Defines if parameters are grouped according to parameter.root_instrument or parameter.instrument

Attributes:

running

daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

native_id

Native integral thread ID of this thread, or None if it has not been started.

Methods:

run()

Start the event loop and run forever.

update_all()

Update all parameters in the monitor.

stop()

Shutdown the server, close the event loop and join the thread.

join([timeout])

Overwrite Thread.join to make sure server is stopped before joining avoiding a potential deadlock.

show()

Overwrite this method to show/raise your monitor GUI F.ex.

getName()

Return a string used for identification purposes only.

isDaemon()

Return whether this thread is a daemon.

is_alive()

Return whether the thread is alive.

setDaemon(daemonic)

Set whether this thread is a daemon.

setName(name)

Set the name string for this thread.

start()

Start the thread's activity.

running: Monitor | None = None
loop: AbstractEventLoop | None
run() None[source]

Start the event loop and run forever.

update_all() None[source]

Update all parameters in the monitor.

stop() None[source]

Shutdown the server, close the event loop and join the thread. Setting active Monitor to None.

join(timeout: float | None = None) None[source]

Overwrite Thread.join to make sure server is stopped before joining avoiding a potential deadlock.

static show() None[source]

Overwrite this method to show/raise your monitor GUI F.ex.

import webbrowser
url = "localhost:3000"
# Open URL in new window, raising the window if possible.
webbrowser.open_new(url)
property daemon

A boolean value indicating whether this thread is a daemon thread.

This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False.

The entire Python program exits when only daemon threads are left.

getName()

Return a string used for identification purposes only.

This method is deprecated, use the name attribute instead.

property ident

Thread identifier of this thread or None if it has not been started.

This is a nonzero integer. See the get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited.

isDaemon()

Return whether this thread is a daemon.

This method is deprecated, use the daemon attribute instead.

is_alive()

Return whether the thread is alive.

This method returns True just before the run() method starts until just after the run() method terminates. See also the module function enumerate().

property name

A string used for identification purposes only.

It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor.

property native_id

Native integral thread ID of this thread, or None if it has not been started.

This is a non-negative integer. See the get_native_id() function. This represents the Thread ID as reported by the kernel.

setDaemon(daemonic)

Set whether this thread is a daemon.

This method is deprecated, use the .daemon property instead.

setName(name)

Set the name string for this thread.

This method is deprecated, use the name attribute instead.

start()

Start the thread’s activity.

It must be called at most once per thread object. It arranges for the object’s run() method to be invoked in a separate thread of control.

This method will raise a RuntimeError if called more than once on the same thread object.