Problem to Solve
Specifying samples_to_read=READ_ALL_AVAILABLE (-1) tells DAQmx to automatically query task.in_stream.avail_samp_per_chan, but there are additional corner cases:
- For finite acquisitions:
- Use
task.timing.samp_quant_samp_per_chan instead.
- ...Unless
task.in_stream.read_all_avail_samp is set to False.
- Reading before the task is verified
Proposed Solution
NI-DAQmx 24.5 or 24.8 added support for a new internal attribute, DefaultNumberOfSamplesToRead, which indicates the raw data size in bits. I think the corresponding C API function name is DAQmxGetDefaultNumberOfSamplesToRead. If this function is available, nidaqmx-python should use it instead of calculating the value based on multiple attributes.
AB#3240032