QCoDeS example with Thorlabs KLS1550 laser source

(same .dll as for KLS101, KLSnnn)


Import all required libraries for driving the devices.

import qcodes as qc
from qcodes_contrib_drivers.drivers.Thorlabs.Kinesis import Thorlabs_Kinesis
from qcodes_contrib_drivers.drivers.Thorlabs.KLS1550 import Thorlabs_KLS1550

Create an instance of Thorlabs_Kinesis which is a wrapper for the device dll (passed as an argument to the object) that starts up the Kinesis server. The DLL needs be installed from https://www.thorlabs.com/software_pages/viewsoftwarepage.cfm?code=Motion_Control under “Kinesis software”.

[ ]:
kinesis = Thorlabs_Kinesis("Thorlabs.MotionControl.KCube.LaserSource.dll", sim=False)

Create an instance of Thorlabs_KLS1550 which is the device driver object, opening the device and starting polling (requesting device information) at 200 milisecods loops (must know the serial number shown on the device).

[ ]:
laser = Thorlabs_KLS1550(

Turning the laser output on/off

Set the parameter output_enabled to True for “laser on” and False for “laser off”. Note that the laser will only turn on if the safety switch is also on.

[ ]:
laser.output_enabled.set(True) # laser turns on
[ ]:
laser.output_enabled.set(False) # laser turns off
[ ]:
laser.output_enabled.get() # Check laser output status

Setting the laser output power

Set the laser output power in Watts and get the current power value from the device (also in Watts)

laser.power.set(1e-3) # Set power to 1 mW
[ ]:
laser.power.get() # Gets laser power reading


Disconnect the device from the driver (but not the server, it still shows under device_list), stopping polling and closing the device (both for Kinesis server and qcodes).