qcodes.actions

Actions, mainly to be executed in measurement Loops.

class qcodes.actions.BreakIf(condition)[source]

Bases: object

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)[source]

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

Returns

snapshot

Return type

dict

class qcodes.actions.Task(func, *args, **kwargs)[source]

Bases: object

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)[source]

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

Returns

snapshot

Return type

dict

exception qcodes.actions.UnsafeThreadingException[source]

Bases: Exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class qcodes.actions.Wait(delay)[source]

Bases: object

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)[source]

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

Returns

snapshot

Return type

dict