For my DIY microscope I had a task - generate a train of digital pulses which simulate camera trigger, so that other devices (galvo and laser) are synched. I wanted to do it in Python, so that it seamlessly integrates in my data acquisition and analysis Jupyter notebook.
After some quick search I found a PyDAQmx library which seemed mature and had good examples to begin with.
Installation was smooth: download, unzip, open Anaconda prompt,
python setup.py install
After only 30 min fiddling, I was able to solve my problem in just a few lines of code:
Holy crap, it just works, out of the box. Oscilloscope shows nice digital pulses every 100 ms, each 1 ms long. The code is much shorter and cleaner than would be in C, C#, or LabView.
PyDAQmx appears to be a full-power wrapper around native NI DAQmx drivers (yes, they need to be installed), so presumably it can do all that can be done in C or even LabView (this statement needs to be tested).
One can use PyDAQmx to control galvos with fast analog output waveforms, as shown by @kyleellefsen in his code.
Many thanks to @clade for writing PyDAQmx! Really made my day..
My system was: Windows 10, Python 2.7 (x32), NI PCIe-6321 board.
After some quick search I found a PyDAQmx library which seemed mature and had good examples to begin with.
Installation was smooth: download, unzip, open Anaconda prompt,
python setup.py install
After only 30 min fiddling, I was able to solve my problem in just a few lines of code:
Holy crap, it just works, out of the box. Oscilloscope shows nice digital pulses every 100 ms, each 1 ms long. The code is much shorter and cleaner than would be in C, C#, or LabView.
PyDAQmx appears to be a full-power wrapper around native NI DAQmx drivers (yes, they need to be installed), so presumably it can do all that can be done in C or even LabView (this statement needs to be tested).
One can use PyDAQmx to control galvos with fast analog output waveforms, as shown by @kyleellefsen in his code.
Many thanks to @clade for writing PyDAQmx! Really made my day..
My system was: Windows 10, Python 2.7 (x32), NI PCIe-6321 board.
Comments
Post a Comment