labscript.labscript.WaitMonitor

class WaitMonitor(name, parent_device, connection, acquisition_device, acquisition_connection, timeout_device=None, timeout_connection=None, timeout_trigger_type='rising', **kwargs)[source]

Bases: Trigger

__init__(name, parent_device, connection, acquisition_device, acquisition_connection, timeout_device=None, timeout_connection=None, timeout_trigger_type='rising', **kwargs)[source]

Create a wait monitor.

This is a device or devices, one of which:

  1. outputs pulses every time the master pseudoclock begins running (either at the start of the shot or after a wait

  2. measures the time in between those pulses in order to determine how long the experiment was paused for during waits

  3. optionally, produces pulses in software time that can be used to retrigger the master pseudoclock if a wait lasts longer than its specified timeout

Parameters:
  • parent_device (Device) – The device with buffered digital outputs that should be used to produce the wait monitor pulses. This device must be one which is clocked by the master pseudoclock.

  • connection (str) – The name of the output connection of parent_device that should be used to produce the pulses.

  • acquisition_device (Device) – The device which is to receive those pulses as input, and that will measure how long between them. This does not need to be the same device as the wait monitor output device (corresponding to parent_device and connection). At time of writing, the only devices in labscript that can be a wait monitor acquisition device are NI DAQmx devices that have counter inputs.

  • acquisition_connection (str) – The name of the input connection on acquisition_device that is to read the wait monitor pulses. The user must manually connect the output device (parent_device/connection) to this input with a cable, in order that the pulses can be read by the device. On NI DAQmx devices, the acquisition_connection should be the name of the counter to be used such as ‘Ctr0’. The physical connection should be made to the input terminal corresponding to the gate of that counter.

  • timeout_device (Device, optional) – The device that should be used to produce pulses in software time if a wait lasts longer than its prescribed timeout. These pulses can connected to the trigger input of the master pseudoclock, via a digital logic to ‘AND’ it with other trigger sources, in order to resume the master pseudoclock upon a wait timing out. To produce these pulses during a shot requires cooperation between the acquisition device and the timeout device code, and at present this means only NI DAQmx devices can be used as the timeout device (though it need not be the same device as the acquisition device). If not set, timeout pulses will not be produced and the user must manually resume the master pseudoclock via other means, or abort a shot if the indended resumption mechanism fails.

  • timeout_connection (str, optional) – Which connection on the timeout device should be used to produce timeout pulses. Since only NI DAQmx devices are supported at the moment, this must be a digital output on a port on the NI DAQmx device that is not being used. Most NI DAQmx devices have both buffered and unbuffered ports, so typically one would use one line of one of the unbuffered ports for the timeout output.

  • timeout_trigger_type (str) – The edge type to be used for the timeout signal, either 'rising' or 'falling'

Methods

__init__(name, parent_device, connection, ...)

Create a wait monitor.

add_device(device)

Adds a child device to this device.

add_instruction(time, instruction[, units])

Adds a hardware instruction to the device instruction list.

apply_calibration(value, units)

Apply the calibration defined by the unit conversion class, if present.

disable(t)

Commands the output to disable.

do_checks(trigger_times)

Basic error checking to ensure the user's instructions make sense.

enable(t)

Commands the output to enable.

expand_timeseries(all_times, flat_all_times_len)

This function evaluates the ramp functions in self.timeseries at the time points in all_times, and creates an array of output values at those times.

generate_code(hdf5_file)

Generate hardware instructions for device and children, then save to h5 file.

get_all_children()

Get all children devices for this device.

get_all_outputs()

Get all children devices that are outputs.

get_change_times()

If this function is being called, it means that the parent Pseudoclock has requested a list of times that this output changes state.

get_properties([location])

Get all properties in location.

get_property(name[, location])

Method to get a property of this device already set using Device.set_property().

get_ramp_times()

If this is being called, then it means the parent Pseuedoclock has asked for a list of the output ramp start and stop times.

go_high(t)

Commands the output to go high.

go_low(t)

Commands the output to go low.

init_device_group(hdf5_file)

Creates the device group in the shot file.

instruction_to_string(instruction)

Gets a human readable description of an instruction.

make_timeseries(change_times)

If this is being called, then it means the parent Pseudoclock has asked for a list of this output's states at each time in change_times.

offset_instructions_from_trigger(trigger_times)

Subtracts self.trigger_delay from all instructions at or after each trigger_time.

quantise_to_pseudoclock(times)

Quantises times to the resolution of the controlling pseudoclock.

repeat_pulse_sequence(t, duration, ...)

This function only works if the DigitalQuantity is on a fast clock

set_properties(properties_dict, property_names)

Add one or a bunch of properties packed into properties_dict

set_property(name, value[, location, overwrite])

Method to set a property for this device.

trigger(t, duration)

Command a trigger pulse.

Attributes

allowed_children

Defines types of devices that are allowed to be children of this device.

allowed_states

clock_limit

Returns the parent clock line's clock limit.

default_value

description

Brief description of the device.

parent_clock_line

Stores the clocking clockline, which may be itself.

pseudoclock_device

Stores the clocking pseudoclock, which may be itself.

scale_factor

t0

The earliest time output can be commanded from this device at the start of the experiment.

trigger_delay

The earliest time output can be commanded from this device after a trigger.

wait_delay

The earliest time output can be commanded from this device after a wait.