AlexShkarin / pyLabLib

Python package for device control and experiment automation
http://pylablib.readthedocs.io
GNU General Public License v3.0
125 stars 28 forks source link

External Triger and DDG in AndorSDK2 #77

Open physician95 opened 4 months ago

physician95 commented 4 months ago

Hi first of all, thanks a lot for a great package which I can use in my labs!

I was working with an Andor CCD camera with an internal trigger, which was totally ok. Now I need to work with external trigger and DDG. I have already worked code with the first one, but with a certain default optical width and delay of DDG. How can I set these parameters manually?

atmcd32d_lib.py does not have anything similar to self.SetDDGGateTime=wrapper(lib.SetDDGGateTime) in contrast to atmcd32d_defs.py

I tried to write it manually and then use lib.SetDDGGateTime(199968e-9, 20e-9) in AndorSDK2.py but it did not fix the issue.

Many thanks in Advance! Cheers, Andrii

AlexShkarin commented 4 months ago

Dear Andrii,

Thank you for the kind words!

I do not have access to a camera with DDG functionality (as far as I understand from the documentation, that's only USB iStar), so I have not added it to AndorSDK2Camera or to atmcd32d_lib.py. I briefly looked at their definitions, and it seems like doing what you've written, i.e., something like self.SetDDGGateTime=wrapper(lib.SetDDGGateTime), should work for these functions, since they don't have any obscure methods for passing and returning arguments. Therefore, you can implement them within the AndorSDK2Lib class yourself (either by modifying atmcd32d_lib.py, or by appending the class later) and then use them directly. One thing to keep in mind if you have multple cameras connected: you should call _select_camera() method of AndorSDK2Camera before calling these functions to let the SDK know which camera to communicate with.

Regarding SetDDGGateTime function: it has integer arguments, which, according to the documentation, specify time in picoseconds. Therefore, the numbers that you supplied get rounded down to zero, so the call is equivalent to lib.SetDDGGateTime(0, 0). That might be the source of the issue.

Let me know if that solves the problem, or if you have further questions.

Sincerely,

Alexey.