Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog sample collection in Python does not exceed 1000 samples

Solved!
Go to solution

Hello all,

 

I'm using an NI USB-6210 DAQ to collect analog samples for an FFT and would like to increase the number of samples I can collect per channel so I can increase the speed at which I can update the FFT.  I'm not sure if this is a hardware limitation that I'm misunderstanding, a limitation in the software, or if it is an issue with my code.

 

I cannot get the data collected with the `nidaqmx` module in Python to exceed a read of 1000 samples per channel, however the manual for the USB-6120 states it can handle 4095 samples in the FIFO.  Is this 4095 bytes, so it can only hold ~1000 32-bit floats?

 

Below is my simplified code and it's output.

import numpy as np
import nidaqmx

task = nidaqmx.Task()

task.ai_channels.add_ai_voltage_chan("Dev1/ai0")
task.timing.cfg_samp_clk_timing(10000)

data = task.read(number_of_samples_per_channel=-1)
print("len -1: " + str(len(data)))

data = task.read(number_of_samples_per_channel=4000)
print("len 4000: " + str(len(data)))

data = task.read(number_of_samples_per_channel=250)
print("len 250: " + str(len(data)))

task.close()

Output:

len -1: 1000
len 4000: 1000
len 250: 250

Any assistance or thoughts would be greatly appreciated!

0 Kudos
Message 1 of 2
(2,722 Views)
Solution
Accepted by topic author merlojas

You aren't giving a sample_mode (default FINITE) nor a samps_per_chan (default 1000) in cfg_samp_clk_timing, so you are getting those defaults. From a finite 1000-sample acquisition, you can only read at most 1000 samples.

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
Message 2 of 2
(2,666 Views)