generated from ni/github-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Reverse Indices for Digital Waveform Signals #222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mikeprosserni
wants to merge
25
commits into
main
Choose a base branch
from
users/mprosser/bug-3178052-reverse-signal-index
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Reverse Indices for Digital Waveform Signals #222
mikeprosserni
wants to merge
25
commits into
main
from
users/mprosser/bug-3178052-reverse-signal-index
+600
−155
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Test Results 56 files ± 0 56 suites ±0 26m 34s ⏱️ + 1m 19s Results for commit 2e774ac. ± Comparison against base commit 9713651. This pull request removes 4 and adds 18 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
bkeryan
requested changes
Nov 22, 2025
…78052-reverse-signal-index
…eturns_new_line_name and _DigitalWaveformExtendedProperties
3 tasks
…78052-reverse-signal-index
bkeryan
requested changes
Dec 5, 2025
bkeryan
requested changes
Dec 6, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this Pull Request accomplish?
In NI Digital Waveforms, the signals are typically ordered with the least significant bit last, and that least significant line is line0. That means, for example, if you read digital data from a 32 bit port, the line numbers (aka signal numbers) count down from 31 to 0. Here's what that looks like in LabVIEW. (Note, this is simulated hardware where the samples count up from zero)
In our .NET Digital Waveforms, we match this 'reversed' signal ordering using logic like this (from line 152 in DigitalData.cs)
We should do the same thing in our Python Digital Waveforms.
To accomplish this, I've added a
signal.data_indexproperty alongside thesignal.signal_indexproperty. Thesignal_indexrepresents the line number, and counts down, while thedata_indexrepresents the position in the underlyingsignals.dataarray, and counts up. These two indices are reversed with respect to each other:I have updated
_signal.py,_signal_collection.py, and_waveform.pyto set and use the correct index when accessing things likesignal.dataandsignal.name. (Note that the strings in NI_LineNames match the ordering of data_index, and are reversed with respect to signal_index)I have also updated documentation to explain the difference between the two indices.
Here's a summary of all of the changes:
signal.data_indexsignal.data,signal.name, andsignal.__reduce__()to usedata_indexsignal_collection.__getitem__()to set and usedata_indexDigitalWaveformFaiulre.data_indexDigitalWaveformclasswaveform._signal_namestowaveform._line_nameswaveform._get_signal_name()andset_signal_name()toget_line_name()andset_line_name()waveform.test()to include thedata_indexin theDigitalWaveformFalurereportWhy should this Pull Request be merged?
AB#3178052
What testing has been done?
Added/Updated auto tests:
Signal name caching issue
While updating tests in nidaqmx-python, I noticed that the
signal.namevalue (which is cached) wasn't being cleared/updated whenwaveform.extended_properties["NI_LineNames"]is updated.I added a test
test___signal_with_line_names___change_line_names_property___signal_returns_new_line_nameto demonstrate the issue here in nitypes-python.I fixed the issue by adding a
_DigitalWaveformExtendedPropertiesclass, which just clearsself._waveform._line_nameswhen["NI_LineNames"]is changed.