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

Thorlabs kinesis drivers #262

Open
wants to merge 67 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
8a8b15d
Add Thorlabs Kinesis C API drivers
thangleiter Mar 21, 2023
0f9c165
Fix relative imports
thangleiter Mar 24, 2023
6a6be07
Move more functionality to base classes
thangleiter Mar 24, 2023
f39f98c
Add toggle_position() function
thangleiter Apr 17, 2023
c536b48
Fix issues with connecting and disconnecting
thangleiter Apr 20, 2023
ee52c4b
Add enums and structs and move to separate modules
thangleiter Apr 28, 2023
66f2068
Move _kinesis to private/kinesis
thangleiter Sep 22, 2023
6f7065f
Reorganize directory structure.
thangleiter Sep 22, 2023
eaa358d
Refactor KinesisInstrument to connect in constructor
thangleiter Sep 22, 2023
d9e1f61
__post_init__ is only available to dataclasses...
thangleiter Sep 22, 2023
8bf1e93
Make position val_mapping dynamic
thangleiter Sep 22, 2023
a11e88a
Fix close if not connected to anything
thangleiter Sep 22, 2023
e5c86a5
Add PM100D driver.
thangleiter Sep 22, 2023
ec20283
Add documentation.
thangleiter Sep 22, 2023
e3fa172
Fix super() call
thangleiter Sep 22, 2023
72b1fe4
Format lines to 72/79 characters
thangleiter Sep 22, 2023
4eec1b1
Refactor ThorlabsKinesis to include more basic functionality
thangleiter Sep 22, 2023
de81674
Add position parameter to K10CR1
thangleiter Sep 22, 2023
e523b31
Fix success definition
thangleiter Sep 26, 2023
6898fe8
Add simulation.
thangleiter Sep 26, 2023
f2daeb5
Fix list_available_devices() for n!=1 devices
thangleiter Sep 26, 2023
d53c9fe
Move error and success checks into get_function()
thangleiter Sep 26, 2023
810221d
Rename functions to mirror DLL names
thangleiter Sep 26, 2023
ace54ef
Add get/set_motor_params_ext and documentation
thangleiter Sep 26, 2023
4bf761b
Make hardware_type and _prefix classmethods
thangleiter Oct 19, 2023
31eccc6
Fix MyPy errors
thangleiter Oct 19, 2023
1f45898
Make list_available_devices available at top-level namespace
thangleiter Oct 20, 2023
7cb04dd
Refactor base class using __init_subclass__
thangleiter Nov 6, 2023
85215b0
Add K10CR1 driver.
thangleiter Nov 6, 2023
83c77ae
Use abbreviated unit.
thangleiter Nov 6, 2023
b738be3
Merge remote-tracking branch 'origin/main' into feature/thorlabs_kine…
thangleiter Nov 6, 2023
2639bb4
Add CC instruments driver draft as an example.
thangleiter Nov 6, 2023
3fdfb81
Move more stuff to base classes
thangleiter Nov 6, 2023
13f8f35
Add rotation modes.
thangleiter Nov 6, 2023
c0a48c9
Add jog_mode and stop_mode parameters
thangleiter Nov 6, 2023
117c1b1
Add status update methods and is_moving()
thangleiter Nov 6, 2023
d62e8bf
Add stop profiles
thangleiter Nov 6, 2023
c1999eb
Rename enums.ISCUnitType -> enums.UnitType
thangleiter Nov 6, 2023
78b1789
Always use real units with the outside world
thangleiter Nov 6, 2023
ce3e03f
Mypy
thangleiter Nov 7, 2023
156d406
Try guessing the libary name based on some common patterns
thangleiter Nov 7, 2023
d54e8ed
Return python int instead of c_int
thangleiter Nov 7, 2023
0ff1948
Fix unit mixup bug
thangleiter Nov 7, 2023
3b75e11
Expose fewer methods to target instruments
thangleiter Nov 7, 2023
f37baa5
Drop unused imports.
thangleiter Nov 7, 2023
9228286
Replace barebones visa driver with version from main
thangleiter Nov 7, 2023
fab686f
Merge branch 'main' into feature/thorlabs_kinesis_drivers
astafan8 Nov 20, 2023
08736af
Merge remote-tracking branch 'origin/main' into feature/thorlabs_kine…
thangleiter Nov 20, 2023
a300dc1
Raise Exception if no devices found
thangleiter Nov 20, 2023
dd446f4
Bugfixes
thangleiter Nov 15, 2023
75885aa
Slightly simplify register_prefix
thangleiter Nov 15, 2023
8b6abcf
Default to blocking moves
thangleiter Nov 15, 2023
6d018c9
Implement jogging
thangleiter Nov 15, 2023
72d5365
Block while homing
thangleiter Nov 15, 2023
590b768
Use currently set stop mode for stopping.
thangleiter Nov 15, 2023
a19cea7
Add some message queue functionality
thangleiter Nov 15, 2023
6eb0708
Fix (ignore) Thorlabs PM100D tlpm driver for mypy
thangleiter Nov 20, 2023
d8f87b4
Rename addr arg for consistency with visa driver
thangleiter Nov 20, 2023
57f66eb
Fix mypy errors
thangleiter Nov 21, 2023
fff0dc1
Manually move to src-layout to merge main
thangleiter Mar 14, 2024
22f348d
Merge branch 'main_trunk' into feature/thorlabs_kinesis_drivers
thangleiter Mar 14, 2024
2fe93c0
Add averaging_time parameter
thangleiter Mar 4, 2024
c7e55b4
Merge branch 'main' into feature/thorlabs_kinesis_drivers
astafan8 Apr 11, 2024
8469b12
Add validator to transit time
thangleiter Apr 11, 2024
8899e61
Remove old file
thangleiter May 15, 2024
553f207
Merge branch 'main' into feature/thorlabs_kinesis_drivers
thangleiter May 15, 2024
1cbc4e4
Update __init__ signatures for newest qcodes version
thangleiter Jun 28, 2024
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
Prev Previous commit
Next Next commit
Add position parameter to K10CR1
thangleiter committed Sep 22, 2023
commit de816746e8c7de5b61109b558f5652b9ed5cda3a
35 changes: 29 additions & 6 deletions qcodes_contrib_drivers/drivers/Thorlabs/Thorlabs_K10CR1/kinesis.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
from __future__ import annotations

import pathlib
from functools import partial
from typing import Mapping, Any

from qcodes import validators as vals
from qcodes_contrib_drivers.drivers.Thorlabs.private.kinesis import enums
from qcodes_contrib_drivers.drivers.Thorlabs.private.kinesis.enums import (
KinesisHWType
)
from qcodes_contrib_drivers.drivers.Thorlabs.private.kinesis.isc import (
KinesisIntegratedStepperMotor
KinesisISCIntrument
)


class ThorlabsK10CR1(KinesisIntegratedStepperMotor):
class ThorlabsK10CR1(KinesisISCIntrument):
"""Kinesis driver for Thorlabs K10CR1 cage rotator.

Args:
@@ -26,10 +34,25 @@ class ThorlabsK10CR1(KinesisIntegratedStepperMotor):
Nicely formatted name of the instrument.

"""
@classmethod
@property
def _prefix(self):
return 'ISC'

def __init__(self, name: str, dll_dir: str | pathlib.Path | None = None,
serial: int | None = None,
metadata: Mapping[Any, Any] | None = None,
label: str | None = None):
super().__init__(name, dll_dir, serial, metadata, label)

self.add_parameter(
"position",
get_cmd=self.kinesis.get_position,
set_cmd=self.kinesis.set_position,
get_parser=partial(self.kinesis.real_value_from_device_unit,
unit_type=enums.ISCUnitType.Distance),
set_parser=partial(self.kinesis.device_unit_from_real_value,
unit_type=enums.ISCUnitType.Distance),
vals=vals.Numbers(0, 360),
unit=u"\u00b0",
label="Position"
)

@classmethod
@property
28 changes: 21 additions & 7 deletions qcodes_contrib_drivers/drivers/Thorlabs/private/kinesis/isc.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
from __future__ import annotations

import ctypes
import pathlib
from abc import ABC
from typing import Mapping, Any

from . import enums
from .core import KinesisInstrument, ThorlabsKinesis, KinesisError
from .core import KinesisInstrument, ThorlabsKinesis


class KinesisIntegratedStepperMotor(KinesisInstrument):
class KinesisISCIntrument(KinesisInstrument, ABC):
"""Devices which are controlled from the IntegratedStepperMotor dll.
"""

def _init_kinesis(self, dll_dir: str | pathlib.Path | None) -> ThorlabsKinesis:
return ThorlabsKinesis('Thorlabs.MotionControl.IntegratedStepperMotors.dll', self._prefix,
dll_dir)
def __init__(self, name: str, dll_dir: str | pathlib.Path | None = None,
serial: int | None = None, metadata: Mapping[Any, Any] | None = None,
label: str | None = None):
super().__init__(name, dll_dir, serial, metadata, label)

# Update the device with stored settings. This is necessary to be able
# to convert units since there are specific formulae for each motor
# taking into account Gearing, Pitch, Steps Per Revolution etc.
self.kinesis.load_settings()

def _init_kinesis(self,
dll_dir: str | pathlib.Path | None) -> ThorlabsKinesis:
return ThorlabsKinesis(
'Thorlabs.MotionControl.IntegratedStepperMotors.dll',
self._prefix,
dll_dir
)

@classmethod
@property