ni / ni/nidaqmx-python

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

Open
#527 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
592
Forks
199
Avg merge
1d 16h
Merged PRs (30d)
10

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Task.read entry point and compare return shapes for normal AI and power channels with samples_to_read unset, set to 1, and set to N. Use the examples in the issue to define consistent behavior, then add regression coverage for single- and multi-channel reads.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.