Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing Samples with Python

Hello, 

 

I am using Python 3.8 and the nidaqmx package to collect data from my USB-6218. I want to collect a chunk of data from 12 analog input voltage channels at 500 Hz. I am hoping to collect 5 seconds of data at a time, so that would be 2500 samples. In the following example I collect a data chunk of 2500 samples at 500 Hz and save it to a text file.

Correct_Samples.PNG

When I open up the text file I can confirm that there are 2500 samples. I will be integrating the data collection into a larger script in which I will need call the "read" statement from within a function. I tested this out with the following example. 

 

Not_Correct_Samples.PNG

When I look at the data generated with this script I notice that the number of samples per channel is 2486 samples instead of 2500. The only difference between the two scripts is calling the read statement in a function? Why are there less samples recorded when I utilize a function? If anyone has an insight into what might be causing this or how to correctly initiate data collection from within a function, it would be greatly appreciated. Thank you!

 

  

0 Kudos
Message 1 of 1
(745 Views)