labscript.outputs.DigitalQuantity

class DigitalQuantity(name, parent_device, connection, inverted=False, **kwargs)[source]

Bases: Output

Base class for DigitalOut.

It is also used internally by other, more complex, output types.

__init__(name, parent_device, connection, inverted=False, **kwargs)[source]

Instantiate a digital quantity.

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

  • parent_device (IntermediateDevice) – Device this quantity is attached to.

  • connection (str) – Connection on parent device we are connected to.

  • inverted (bool, optional) – If True, output is logic inverted.

  • **kwargs – Passed to Output.__init__().

Methods

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

Instantiate a digital quantity.

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.

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.

allowed_states = {0: 'low', 1: 'high'}
default_value = 0
description = 'digital quantity'

Brief description of the device.

disable(t)[source]

Commands the output to disable.

If inverted=True, this will set the output high.

Parameters:

t (float) – Time, in seconds, when the output disables.

dtype

alias of uint32

enable(t)[source]

Commands the output to enable.

If inverted=True, this will set the output low.

Parameters:

t (float) – Time, in seconds, when the output enables.

go_high(t)[source]

Commands the output to go high.

Parameters:

t (float) – Time, in seconds, when the output goes high.

go_low(t)[source]

Commands the output to go low.

Parameters:

t (float) – Time, in seconds, when the output goes low.

repeat_pulse_sequence(t, duration, pulse_sequence, period, samplerate)[source]

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

The pulse sequence specified will be repeated from time t until t+duration.

Note 1: The samplerate should be significantly faster than the smallest time difference between two states in the pulse sequence, or else points in your pulse sequence may never be evaluated.

Note 2: The time points your pulse sequence is evaluated at may be different than you expect, if another output changes state between t and t+duration. As such, you should set the samplerate high enough that even if this rounding of tie points occurs (to fit in the update required to change the other output) your pulse sequence will not be significantly altered)

Parameters:
  • t (float) – Time, in seconds, to start the pulse sequence.

  • duration (float) – How long, in seconds, to repeat the sequence.

  • pulse_sequence (list) – List of tuples, with each tuple of the form (time, state).

  • period (float) – Defines how long the final tuple will be held for before repeating the pulse sequence. In general, should be longer than the entire pulse sequence.

  • samplerate (float) – How often to update the output, in Hz.