Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Thorlab drivers for KDC101, TDC001, PM100D; extend Kinesis libraries to be more general and support more drivers #244

Merged
merged 34 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8502d76
add driver for Thorlabs PM100D
julienbarrier Aug 25, 2023
8c88557
add new HW types
julienbarrier Aug 25, 2023
3cabf93
create private folder to include APT+rotator class
julienbarrier Aug 25, 2023
f80bc9f
add driver for KDC101 rotator
julienbarrier Aug 25, 2023
bee8969
variable type (pass mypy)
julienbarrier Aug 25, 2023
6ec08c2
debug kdc101
julienbarrier Aug 25, 2023
5e4a4b8
add driver for KDC101
julienbarrier Aug 28, 2023
300a79a
change ctypes
julienbarrier Aug 29, 2023
4627230
add parameters
julienbarrier Aug 29, 2023
785251b
debug
julienbarrier Aug 29, 2023
8262286
cleaner code
julienbarrier Aug 29, 2023
cbdf2ce
constraints in parameters
julienbarrier Aug 29, 2023
2f2a8e3
pass mypy
julienbarrier Aug 29, 2023
11a5b92
set position kdc101.py
julienbarrier Aug 29, 2023
88c33bb
debug with real instrument
julienbarrier Aug 29, 2023
778a617
block while setting position
julienbarrier Aug 29, 2023
0c62aa4
add parameters
julienbarrier Aug 29, 2023
6053fba
simplify driver with use of lambda functions
julienbarrier Aug 29, 2023
b9e73f3
add general driver for kinesis
julienbarrier Aug 29, 2023
d9c479b
pass mypy
julienbarrier Aug 29, 2023
e5d3395
Merge branch 'thorlab_drivers' of github.com:julienbarrier/Qcodes_con…
julienbarrier Aug 29, 2023
59d2804
use base instrument for kinesis and CC
julienbarrier Aug 30, 2023
87235a0
debug on real setup
julienbarrier Aug 30, 2023
15b2e57
fix bug acquisition of attenuation
julienbarrier Aug 30, 2023
7351e53
add driver for LS instruments + TDC001
julienbarrier Aug 30, 2023
12fd730
Merge branch 'thorlab_drivers' of github.com:julienbarrier/Qcodes_con…
julienbarrier Aug 30, 2023
233a6c3
refactoring of kinesis
julienbarrier Aug 30, 2023
fd51181
clean drivers + pass mypy
julienbarrier Aug 30, 2023
9e97a06
Merge branch 'QCoDeS:main' into thorlab_drivers
julienbarrier Aug 30, 2023
e3e4fd1
debug
julienbarrier Aug 30, 2023
433a4e3
Merge branch 'thorlab_drivers' of github.com:julienbarrier/Qcodes_con…
julienbarrier Aug 30, 2023
f9faf7a
remove function that ensured back-compatibility to pass mypy
julienbarrier Aug 30, 2023
1813364
resolve @astafan8 ’s suggestions
julienbarrier Aug 31, 2023
8d8a367
use Optional instead of | None for python < 3.10
julienbarrier Aug 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qcodes_contrib_drivers/drivers/Thorlabs/K10CR1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import qcodes.utils.validators as vals
from qcodes import Instrument

from .APT import Thorlabs_APT, ThorlabsHWType
from .private.APT import Thorlabs_APT, ThorlabsHWType


class RotationDirection(enum.Enum):
Expand Down
33 changes: 33 additions & 0 deletions qcodes_contrib_drivers/drivers/Thorlabs/KDC101.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
"""QCoDes-Driver for Thorlab KDC101 K-Cube Brushed DC Servo Motor Controller
https://www.thorlabs.com/thorproduct.cfm?partnumber=KDC101

Authors:
Julien Barrier, <[email protected]>
"""
import logging

from .private.CC import _Thorlabs_CC

log = logging.getLogger(__name__)

class Thorlabs_KDC101(_Thorlabs_CC):
"""Instrument driver for the Thorlabs KDC101 servo motor controller

Args:
name (str): Instrument name.
serial_number (str): Serial number of the device.
simulation (bool): Enables the simulation manager. Defaults to False.
polling (int): Polling rate in ms. Defaults to 200.
julienbarrier marked this conversation as resolved.
Show resolved Hide resolved
home (bool): Sets the device to home state. Defaults to False.
"""
def __init__(self,
name: str,
serial_number: str,
simulation: bool = False,
polling: int = 200,
home: bool = False,
**kwargs):
self._dll_path = 'Thorlabs.MotionControl.KCube.DCServo.dll'
astafan8 marked this conversation as resolved.
Show resolved Hide resolved
super().__init__(name, serial_number, self._dll_path,
simulation, polling, home, **kwargs)
111 changes: 30 additions & 81 deletions qcodes_contrib_drivers/drivers/Thorlabs/KLS1550.py
Original file line number Diff line number Diff line change
@@ -1,81 +1,30 @@
from qcodes import Instrument
import qcodes.utils.validators as vals

from .Kinesis import Thorlabs_Kinesis


class Thorlabs_KLS1550(Instrument):
def __init__(
self,
name: str,
serial_number: str,
polling_speed_ms: int,
kinesis: Thorlabs_Kinesis,
**kwargs,
):
super().__init__(name, **kwargs)
# Save Kinesis server reference
self.kinesis = kinesis

# Initialization
self.serial_number = serial_number
self.polling_speed_ms = polling_speed_ms
self.kinesis.open_laser(self.serial_number)
self.kinesis.start_polling(self.serial_number, self.polling_speed_ms)
self.info = self.kinesis.laser_info(self.serial_number)
self.model = self.info[0].value.decode("utf-8")
self.version = self.info[4].value

# Parameters
self.add_parameter(
"output_enabled",
get_cmd=self._get_output_enabled,
set_cmd=self._set_output_enabled,
vals=vals.Bool(),
unit="",
label="Laser output on/off",
docstring="Turn laser output on/off. Note that laser key switch must be on to turn laser output on.",
)

self.add_parameter(
"power",
get_cmd=self._get_power,
set_cmd=self._set_power,
vals=vals.Numbers(0, 0.007), # [ATTENTION] max power for simulator is 10mW
unit="W",
label="Power output",
)

self.connect_message()

def get_idn(self):
return {
"vendor": "Thorlabs",
"model": self.model,
"firmware": self.version,
"serial": self.serial_number,
}

def _get_output_enabled(self):
# First status bit represents 'output enabled'
return bool(self.kinesis.laser_status_bits(self.serial_number) & 1)

def _set_output_enabled(self, value: bool):
if value:
self.kinesis.laser_enable_output(self.serial_number)
else:
self.kinesis.laser_disable_output(self.serial_number)

def _get_power(self):
return self.kinesis.get_laser_power(self.serial_number)

def _set_power(self, power_W: float):
self.kinesis.set_laser_power(self.serial_number, power_W)

def disconnect(self):
self.kinesis.stop_polling(self.serial_number)
self.kinesis.close_laser(self.serial_number)

def close(self):
self.disconnect()
super().close()
# -*- coding: utf-8 -*-
"""QCoDeS-Driver for Thorlab KLS1550 Laser source

Authors:
iago-rst https://github.com/iago-rst, 2023
Julien Barrier <[email protected]>, 2023
"""
import logging
from .private.LS import _Thorlabs_LS

log = logging.getLogger(__name__)

class Thorlabs_KLS1550(_Thorlabs_LS):
"""Instrument driver for the Thorlabs KLS1550

Args:
name (str): Instrument name.
serial_number (str): Serial number of the device.
simulation (bool): Enables the simulation manager. Defaults to False
polling (int): Polling rate in ms. Defaults to 200.
"""
def __init__(self,
name: str,
serial_number: str,
simulation: bool = False,
polling: int = 200,
**kwargs):
self._dll_path = 'Thorlabs. .dll'
julienbarrier marked this conversation as resolved.
Show resolved Hide resolved
super().__init__(name, serial_number, self._dll_path,
simulation, polling, **kwargs)
132 changes: 0 additions & 132 deletions qcodes_contrib_drivers/drivers/Thorlabs/Kinesis.py

This file was deleted.

2 changes: 1 addition & 1 deletion qcodes_contrib_drivers/drivers/Thorlabs/MFF10x.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qcodes import Instrument
from .APT import Thorlabs_APT, ThorlabsHWType
from .private.APT import Thorlabs_APT, ThorlabsHWType


class Thorlabs_MFF10x(Instrument):
Expand Down
Loading