nidaqmx-python
nidaqmx-python copied to clipboard
Task.read has inconsistent return type between normal AI and power channels
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.