qcodes_loop.actions

Actions, mainly to be executed in measurement Loops.

class qcodes_loop.actions.BreakIf(condition)

Loop action that breaks out of the loop if a condition is truthy.

Parameters:

condition (Callable) – a callable taking no arguments. Can be a simple function that returns truthy when it’s time to quit

Raises:

TypeError – if condition is not a callable with no aguments.

Examples

>>> BreakIf(lambda: gates.chan1.get() >= 3)
snapshot(update=False)

Snapshots breakif action :param update: TODO not in use :type update: bool

Returns:

snapshot

Return type:

dict

class qcodes_loop.actions.Task(func, *args, **kwargs)

A predefined task to be executed within a measurement Loop.

The first argument should be a callable, to which any subsequent args and kwargs (which are evaluated before the loop starts) are passed.

The args and kwargs are first evaluated if they are found to be callable.

Keyword Args passed when the Task is called are ignored, but are accepted for compatibility with other things happening in a Loop.

Parameters:
  • func (Callable) – Function to executed

  • *args – pass to func, after evaluation if callable

  • **kwargs – pass to func, after evaluation if callable

snapshot(update=False)

Snapshots task :param update: TODO not in use :type update: bool

Returns:

snapshot

Return type:

dict

exception qcodes_loop.actions.UnsafeThreadingException
class qcodes_loop.actions.Wait(delay)

A simple class to tell a Loop to wait <delay> seconds.

This is transformed into a Task within the Loop, such that it can do other things (monitor, check for halt) during the delay.

But for use outside of a Loop, it is also callable (then it just sleeps)

Parameters:

delay – seconds to delay

Raises:

ValueError – if delay is negative

snapshot(update=False)

Snapshots delay :param update: TODO not in use :type update: bool

Returns:

snapshot

Return type:

dict