schlabonski / cubini Goto Github PK
View Code? Open in Web Editor NEWA python library to control several Thorlabs' KPZ101 piezo controler cubes
A python library to control several Thorlabs' KPZ101 piezo controler cubes
We're attempting to control a Thorlabs KPZ101 piezo controller using this, and are running into what appear to be pyusb or libusb NotImplementedErrors left and right that we don't know how to resolve.
When attempting to read the device serial number in KPZ101.init() ,
sn = usb.util.get_string(dev, 3, dev.iSerialNumber) throws the error.
If we bypass that and use the first device, we run into it again on this line:
com = ComPort(usb_device=kpz)
pyusb: 1.2.1, libusb: 1.0.26
I played around in pyusb, and found that I could retrieve the device and retrieve some fields such as dev.iSerialNumber and dev.idProduct, but many of the pyusb fields returned the error as well. Any suggestions would be appreciated.
Traceback (most recent call last):
File "C:/Users/JeremyBrown_db259ax/AppData/Roaming/JetBrains/PyCharmCE2021.2/scratches/scratch_15_thorlabs_piezo.py", line 10, in
kpz = KPZ101()
File "c:\users\jeremybrown_db259ax\code\cubini-main\cubini\KPZ101.py", line 35, in init
com = ComPort(usb_device=kpz)
File "c:\users\jeremybrown_db259ax\code\cubini-main\cubini\vcp_terminal.py", line 66, in init
usb_device.set_configuration()
File "C:\ProgramData\Anaconda3\lib\site-packages\usb\core.py", line 915, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "C:\ProgramData\Anaconda3\lib\site-packages\usb\core.py", line 113, in wrapper
return f(self, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\usb\core.py", line 158, in managed_set_configuration
self.managed_open()
File "C:\ProgramData\Anaconda3\lib\site-packages\usb\core.py", line 113, in wrapper
return f(self, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\usb\core.py", line 131, in managed_open
self.handle = self.backend.open_device(self.dev)
File "C:\ProgramData\Anaconda3\lib\site-packages\usb\backend\libusb1.py", line 804, in open_device
return _DeviceHandle(dev)
File "C:\ProgramData\Anaconda3\lib\site-packages\usb\backend\libusb1.py", line 652, in init
_check(_lib.libusb_open(self.devid, byref(self.handle)))
File "C:\ProgramData\Anaconda3\lib\site-packages\usb\backend\libusb1.py", line 600, in _check
raise NotImplementedError(_strerror(ret))
NotImplementedError: Operation not supported or unimplemented on this platform
Hi,
I have some difficult of using this library. I have a kpz101 cube and it can be found and used in Thorlab's Kinesis sofware. But When I using this python library and it cannot find the kpz101 cube. I've double checked the serial number and it is correct. This is the error message. Could you please let me know how to solve the issue? Thank you very much in advance.
"No KPZ101 with matching serial number 29501195 found!
KPZ101 29501195 not found."
The __del__(self)
method calls for #self.com.disconnect()
which calls self.device.attach_kernel_driver(0)
in vcp_terminal.py
which calls self._ctx.backend.attach_kernel_driver()
in core.py
. The attach_kernel_driver()
method is not implemented in the core.py
and raises a Not_Implemented
exception when called.
This bug appears to be because core.py
is not up to date ? Any known solutions ?
I tried a ''hack'' by simply commenting out the line ant it seems to work so far... but it is not ideal.
Found this similar problem being discussed here but it does not seem to apply in this case.
PyUSB(v1.2.1) and LibUSB (v1.0.24) all up to date, installed via anaconda. Using Python 3.8.12 on Windows 10 64-bit.
When set_ouput_voltage()
is called before set_max_voltage
it will throw an error. This could be fixed by reading the current voltage limit from the device and setting it during initialization.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.