PyMoDAQ / pymodaq_plugins_thorlabs

Set of PyMoDAQ plugins for instruments from Thorlabs (Kinesis K10CR1 (stepper rotation actuator), Kinesis Flipper, Kinesis KSP100...)
MIT License
3 stars 27 forks source link

Framerate of Thorlabs cameras #9

Closed rgeneaux closed 11 months ago

rgeneaux commented 2 years ago

Hi, We've noticed that when using DCx cameras, the actual framerate in PyMoDAQ is never as high as when using ThorCam (constructor software). On our camera with full frame, >30 fps is achievable in ThorCam (with adequate values of exposure time and clock speed).

Do you guys think that the framerate is lower in PyMoDAQ because its refresh rate is inherently limited? Or is it because the camera options are not set properly in PyMoDAQ and are not accessible in the current plugin?

I've glanced over Instrumental/tree/master/instrumental/drivers/cameras/uc480.py and it looks like there are possibly relevant methods, self._dev.SetFrameRate, or self._dev.PixelClock(lib.PIXELCLOCK_CMD_SET, clock) but I don't know much about Instrumental and whether these should be used.

Do you guys already have plans to expand the available options for those cameras, or should we get thinking about doing that ? :-)

Cheers Romain

rgeneaux commented 1 year ago

Update on FPS of Thorlabs cameras:

There are two types of cameras available: "Scientific Imaging cameras" (Zelux, Kiralux, Quantalux) and "Compact USB cameras" (DCx). They use different drivers.

I implemented the scientific imaging cameras using the pylablib interface which is really cool to use! Currently testing it here https://github.com/Attolab/pymodaq_plugins_thorlabs. It provides very good performances, with a Zelux in pymodaq we get 35 FPS in full frame, and up to 200 FPS using hardware ROIs (same as ThorCam basically).

So it looks like the framerate issues that we had were not inherent to pymodaq, it was more of an inefficient implementation. If someone needs it, the uc480 driver (for Compact USB cameras) should be easy to implement with pylablib as well, hopefully with same performances.

seb5g commented 1 year ago

Do you want to push this so we can release it. I'm going to use very soon such a camera 😋