Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

nidaqmx stream_readers and versus read

Hello

Based on my understanding, to read the data from the buffer two methods can be used: 
(1) task.read()
(2) stream_readers.AnalogSingleChannelReader(task.in_stream)


what is the difference between the two and which one is more preferable.

Regards
Anas 

0 Kudos
Message 1 of 2
(816 Views)

Hello Anas,

 

According to NI-DAQmx Python Documentation,

read(number_of_samples_per_channel=<nidaqmx.task.UnsetNumSamplesSentinel object>, timeout=10.0)

method reads samples from the task or virtual channels you specify.

This read method is dynamic, and is capable of inferring an appropriate return type based on these factors: - The channel type of the task. - The number of channels to read. - The number of samples per channel.

The data type of the samples returned is independently determined by the channel type of the task.

 

Follow the link to learn more about this method:

nidaqmx.task — NI-DAQmx Python API 0.9 documentation (nidaqmx-python.readthedocs.io)

 

 

Class 

stream_readers.AnalogSingleChannelReader(task.in_stream)

 reads samples from an analog input channel in an NI-DAQmx task. You can find more information about it following the link:

 

nidaqmx.stream_readers — NI-DAQmx Python API 0.9 documentation (nidaqmx-python.readthedocs.io)

 

I can't really advise you on which one is better, but I hope the links will help.

Let me know if I can be of any help.

0 Kudos
Message 2 of 2
(705 Views)