labscript.core.Pseudoclock

class Pseudoclock(name, pseudoclock_device, connection, **kwargs)[source]

Bases: Device

Parent class of all pseudoclocks.

You won’t usually interact with this class directly, unless you are implementing a new PsedoclockDevice in labscript-devices. It provides common functionality for generating pseudoclock instructions..

__init__(name, pseudoclock_device, connection, **kwargs)[source]

Creates a Pseudoclock.

Parameters:
  • name (str) – python variable name to assign the device instance to.

  • pseudoclock_device (PseudoclockDevice) – Parent pseudoclock device

  • connection (str) – Connection on this device that links to parent

  • **kwargs – Passed to Device().

Methods

__init__(name, pseudoclock_device, ...)

Creates a Pseudoclock.

add_device(device)

Adds a child device to this device.

collect_change_times(all_outputs, ...)

Asks all connected outputs for a list of times that they change state.

expand_change_times(all_change_times, ...)

For each time interval delimited by change_times, constructs an array of times at which the clock for this device needs to tick.

generate_clock()

Generate the pseudoclock and configure outputs for each tick of the clock.

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_outputs_by_clockline()

Obtain all outputs by clockline.

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().

init_device_group(hdf5_file)

Creates the device group in the shot file.

quantise_to_pseudoclock(times)

Quantises times to the resolution of the controlling pseudoclock.

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.

Attributes

allowed_children

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

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.

t0

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

add_device(device)[source]

Adds a child device to this device.

Parameters:

device (Device) – Device to add.

Raises:

LabscriptError – If device is not an allowed child of this device.

allowed_children = [<class 'labscript.core.ClockLine'>]

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

Type:

list

collect_change_times(all_outputs, outputs_by_clockline)[source]

Asks all connected outputs for a list of times that they change state.

Takes the union of all of these times. Note that at this point, a change from holding-a-constant-value to ramping-through-values is considered a single state change. The clocking times will be filled in later in the expand_change_times function, and the ramp values filled in with expand_timeseries.

Parameters:
  • all_outputs (list) – List of all outputs connected to this pseudoclock.

  • outputs_by_clockline (dict) – List of all outputs connected to this pseudoclock, organized by clockline.

Returns:

Tuple containing:

  • all_change_times (list): List of all change times.

  • change_times (dict): Dictionary of all change times organised by which clock they are attached to.

Return type:

tuple

description = 'Generic Pseudoclock'

Brief description of the device.

expand_change_times(all_change_times, change_times, outputs_by_clockline)[source]

For each time interval delimited by change_times, constructs an array of times at which the clock for this device needs to tick. If the interval has all outputs having constant values, then only the start time is stored. If one or more outputs are ramping, then the clock ticks at the maximum clock rate requested by any of the outputs. Also produces a higher level description of the clocking; self.clock. This list contains the information that facilitates programming a pseudo clock using loops.

generate_clock()[source]

Generate the pseudoclock and configure outputs for each tick of the clock.

generate_code(hdf5_file)[source]

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

Will recursively call generate_code for all children devices.

Parameters:

hdf5_file (h5py.File) – Handle to shot file.

get_outputs_by_clockline()[source]

Obtain all outputs by clockline.

Returns:

Tuple containing:

  • all_outputs (list): List of all outputs, obtained from get_all_outputs().

  • outputs_by_clockline (dict): Dictionary of outputs, organised by clockline.

Return type:

tuple