nidaqmx-python icon indicating copy to clipboard operation
nidaqmx-python copied to clipboard

Task.read has inconsistent return type between normal AI and power channels

Open bkeryan opened this issue 11 months ago • 0 comments

For normal AI channels, leaving samples_to_read unset reduces the dimensions of the resulting list:

  • Single channel task:
    • task.read() -> scalar
    • task.read(1) -> 1D list by sample
    • task.read(N) -> 1D list by sample
  • Multi-channel task:
    • task.read() -> 1D list by channel
    • task.read(1) -> 2D list by channel, sample
    • task.read(N) -> 2D list by channel, sample

However, for power channels, explicitly setting samples_to_read=1 has the same effect:

  • Single channel task:
    • task.read() -> scalar
    • task.read(1) -> scalar
    • task.read(N) -> 1D list by sample
  • Multi-channel task:
    • task.read() -> 1D list by channel
    • task.read(1) -> 1D list by channel
    • task.read(N) -> 2D list by channel, sample

Passing samps_per_chan=1 to task.read() returns a different data type, which may cause errors for programs that don't expect that to happen.

bkeryan avatar Mar 05 '24 00:03 bkeryan