labscript.outputs.Output

class Output(name, parent_device, connection, limits=None, unit_conversion_class=None, unit_conversion_parameters=None, default_value=None, **kwargs)[source]

Bases: Device

Base class for all output classes.

__init__(name, parent_device, connection, limits=None, unit_conversion_class=None, unit_conversion_parameters=None, default_value=None, **kwargs)[source]

Instantiate an Output.

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

  • parent_device (IntermediateDevice) – Parent device the output is connected to.

  • connection (str) – Channel of parent device output is connected to.

  • limits (tuple, optional) – (min,max) allowed for the output.

  • unit_conversion_class (labscript_utils:labscript_utils.unitconversions, optional) – Unit concersion class to use for the output.

  • unit_conversion_parameters (dict, optional) – Dictonary or kwargs to pass to the unit conversion class.

  • default_value (float, optional) – Default value of the output if no output is commanded.

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

Raises:

LabscriptError – Limits tuple is invalid or unit conversion class units don’t line up.

Methods

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

Instantiate an Output.

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.

do_checks(trigger_times)

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

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.

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.

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.

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.

add_instruction(time, instruction, units=None)[source]

Adds a hardware instruction to the device instruction list.

Parameters:
  • time (float) – Time, in seconds, that the instruction begins.

  • instruction (dict or float) – Instruction to add.

  • units (str, optional) – Units instruction is in, if instruction is a float.

Raises:

LabscriptError – If time requested is not allowed or samplerate is too fast.

allowed_states = None
apply_calibration(value, units)[source]

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

Parameters:
  • value (float) – Value to apply calibration to.

  • units (str) – Units to convert to. Must be defined by the unit conversion class.

Returns:

Converted value.

Return type:

float

Raises:

LabscriptError – If no unit conversion class is defined or units not in that class.

property clock_limit

Returns the parent clock line’s clock limit.

Type:

float

description = 'generic output'

Brief description of the device.

do_checks(trigger_times)[source]

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

Parameters:

trigger_times (iterable) – Times to confirm don’t conflict with instructions.

Raises:

LabscriptError – If a trigger time conflicts with an instruction.

dtype

alias of float64

expand_timeseries(all_times, flat_all_times_len)[source]

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. These are the values that this output should update to on each clock tick, and are the raw values that should be used to program the output device. They are stored in self.raw_output.

get_all_outputs()[source]

Get all children devices that are outputs.

For Output, this is self.

Returns:

List of children Output.

Return type:

list

get_change_times()[source]

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

Returns:

List of times output changes values.

Return type:

list

get_ramp_times()[source]

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

Returns:

List of (start, stop) times of ramps for this Output.

Return type:

list

instruction_to_string(instruction)[source]

Gets a human readable description of an instruction.

Parameters:

instruction (dict or str) – Instruction to get description of, or a fixed instruction defined in allowed_states.

Returns:

Instruction description.

Return type:

str

make_timeseries(change_times)[source]

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. (Which are the times that one or more connected outputs in the same pseudoclock change state). By state, I don’t mean the value of the output at that moment, rather I mean what instruction it has. This might be a single value, or it might be a reference to a function for a ramp etc. This list of states is stored in self.timeseries rather than being returned.

offset_instructions_from_trigger(trigger_times)[source]

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

Parameters:

trigger_times (iterable) – Times of all trigger events.

scale_factor = 1
property trigger_delay

The earliest time output can be commanded from this device after a trigger. This is nonzeo on secondary pseudoclocks due to triggering delays.

Type:

float

property wait_delay

The earliest time output can be commanded from this device after a wait. This is nonzeo on secondary pseudoclocks due to triggering delays and the fact that the master clock doesn’t provide a resume trigger to secondary clocks until a minimum time has elapsed: compiler.wait_delay. This is so that if a wait is extremely short, the child clock is actually ready for the trigger.

Type:

float