Light Crafter DMD

This device allows for control of Light Crafter development module boards. It is currently hard-coded to work with a DLPC300 with a fixed DLP 0.3 WVGA resolution. Extenstion to other models involves subclassing and altering relevant class attributes.

Detailed Documentation

labscript_devices.LightCrafterDMD.arr_to_bmp(arr)[source]

Convert array to 1 bit BMP, white wherever the array is nonzero, and return a bytestring of the BMP data

class labscript_devices.LightCrafterDMD.ImageSet(name, parent_device, connection='Mirror')[source]

Bases: Output

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.

description = 'A set of images to be displayed on an SLM or DMD'

Brief description of the device.

width = 608
height = 684
default_value

A black image.

Raw bitmap data hidden from docs.

Type:

bytes

set_array(t, arr)[source]
set_image(t, path=None, raw=None)[source]

set an image at the given time, either by a filepath to a bmp file, or by a bytestring of bmp data

expand_timeseries(all_times)[source]

We have to override the usual expand_timeseries, as it sees strings as iterables that need flattening! Luckily for us, we should only ever have individual data points, as we won’t be ramping or anything, so this function is a lot simpler than the original, as we have more information about the output.

Not 100% sure that this is enough to cover ramps on other devices sharing the clock, come here if there are issues!

class labscript_devices.LightCrafterDMD.LightCrafterDMD(name, parent_device, server='192.168.1.100', port=21845)[source]

Bases: IntermediateDevice

Provides some error checking to ensure parent_device is a ClockLine.

Calls Device.__init__().

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

  • parent_device (ClockLine) – Parent ClockLine device.

description = 'LightCrafter DMD controller'

Brief description of the device.

allowed_children = [<class 'labscript_devices.LightCrafterDMD.ImageSet'>]

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

Type:

list

max_instructions = 96
clock_limit = 4000
width = 608
height = 684
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.

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.

class labscript_devices.LightCrafterDMD.LightCrafterTab(notebook, settings, restart=False)[source]

Bases: DeviceTab

width = 608
height = 684
initialise_GUI()[source]
initialise_workers()[source]
labscript_device_class_name = 'LightCrafterDMD'
class labscript_devices.LightCrafterDMD.LightCrafterWorker(*args, **kwargs)[source]

Bases: Worker

command = {'advance_pattern_sequence': b'\x04\x03', 'display_mode': b'\x01\x01', 'display_pattern': b'\x04\x05', 'pattern_definition': b'\x04\x01', 'sequence_setting': b'\x04\x00', 'start_pattern_sequence': b'\x04\x02', 'static_image': b'\x01\x05', 'version': b'\x01\x00'}
send_packet_type = {'read': b'\x04', 'write': b'\x02'}
receive_packet_type = {b'\x00': 'System Busy', b'\x01': 'Error', b'\x03': 'Write response', b'\x05': 'Read response'}
flag = {'beginning': b'\x01', 'complete': b'\x00', 'end': b'\x03', 'intermediate': b'\x02'}
error_messages = {b'\x01': 'Command execution failed with unknown error', b'\x02': 'Invalid command', b'\x03': 'Invalid parameter', b'\x04': 'Out of memory resource', b'\x05': 'Hardware device failure', b'\x06': 'Hardware busy', b'\x07': 'Not Initialized (any of the preconditions for the command is not met', b'\x08': 'Some object referred by the command is not found. For example, a solution name was not found', b'\t': 'Checksum error', b'\n': 'Packet format error due to insufficient or larger than expected payload size', b'\x0b': 'Command continuation error due to incorrect continuation flag'}
display_mode = {'pattern': b'\x04', 'static': b'\x00'}
init()[source]
send(type, command, data)[source]
_receive()[source]
receive()[source]
program_manual(values)[source]
transition_to_buffered(device_name, h5file, initial_values, fresh)[source]
transition_to_manual()[source]
abort()[source]
abort_buffered()[source]
abort_transition_to_buffered()[source]
shutdown()[source]