Repository navigation
Reverse Indices for Digital Waveform Signals - #222
Merged
mikeprosserni merged 27 commits intoDec 10, 2025
Merged
Conversation
Contributor
Test Results 56 files ± 0 56 suites ±0 25m 31s ⏱️ +16s Results for commit 7adf82c. ± Comparison against base commit 9713651. This pull request removes 4 and adds 24 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
added 9 commits
November 20, 2025 10:10
mikeprosserni
marked this pull request as ready for review
November 21, 2025 18:19
bkeryan
requested changes
Nov 22, 2025
added 3 commits
November 24, 2025 09:41
…78052-reverse-signal-index
…eturns_new_line_name and _DigitalWaveformExtendedProperties
1 of 3 tasks
added 5 commits
December 3, 2025 09:07
…78052-reverse-signal-index
bkeryan
requested changes
Dec 5, 2025
bkeryan
requested changes
Dec 6, 2025
added 2 commits
December 8, 2025 09:40
bkeryan
approved these changes
Dec 10, 2025
bkeryan
left a comment
Collaborator
There was a problem hiding this comment.
Approved with suggestion (add test case for pickle of _on_key_changed)
bkeryan
requested changes
Dec 10, 2025
…ictionaries can be shared by waveforms
bkeryan
approved these changes
Dec 10, 2025
mikeprosserni
deleted the
users/mprosser/bug-3178052-reverse-signal-index
branch
December 10, 2025 21:24
mikeprosserni
added a commit
that referenced
this pull request
Dec 11, 2025
* add _raw_index * line_index and line_names * more tests * fix new test * data_index and documentation * fix doc types * documentation improvements * documentation improvements * documentation improvements * clean up NI_LineNames in tests * remove DigitalWaveformFailure.data_index * test___signal_with_line_names___change_line_names_property___signal_returns_new_line_name and _DigitalWaveformExtendedProperties * signal_column_index * line lengths * italics for 'See "Signal index vs. signal column index"' notes * add bitorder to from_port, and default to the industry standard 'big' * rename to column_index * bitorder != sys.byteorder * add on_key_changed to ExtendedPropertyDictionary * change tests to big-endian * make on_key_changed private * cleanup * from typing_extensions import TypeAlias, to fix python 3.9 * fix pickling and copying issues with callbacks * change on_key_changed to a list of weak methods, so ExtendedPropertyDictionaries can be shared by waveforms --------- Co-authored-by: Mike Prosser <Mike.Prosser@emerson.com>
1 task done
mikeprosserni
added a commit
that referenced
this pull request
Dec 16, 2025
…als (#222) (#233) * Reverse Indices for Digital Waveform Signals (#222) * add _raw_index * line_index and line_names * more tests * fix new test * data_index and documentation * fix doc types * documentation improvements * documentation improvements * documentation improvements * clean up NI_LineNames in tests * remove DigitalWaveformFailure.data_index * test___signal_with_line_names___change_line_names_property___signal_returns_new_line_name and _DigitalWaveformExtendedProperties * signal_column_index * line lengths * italics for 'See "Signal index vs. signal column index"' notes * add bitorder to from_port, and default to the industry standard 'big' * rename to column_index * bitorder != sys.byteorder * add on_key_changed to ExtendedPropertyDictionary * change tests to big-endian * make on_key_changed private * cleanup * from typing_extensions import TypeAlias, to fix python 3.9 * fix pickling and copying issues with callbacks * change on_key_changed to a list of weak methods, so ExtendedPropertyDictionaries can be shared by waveforms --------- Co-authored-by: Mike Prosser <Mike.Prosser@emerson.com> * Fix unpickling issues with Waveform and Signal (#237) * add versioned unpickling tests for waveform and signal, and fix issues causing the new tests to fail * skip unpickle tests in oldest_deps test run --------- Co-authored-by: Mike Prosser <Mike.Prosser@emerson.com> --------- Co-authored-by: Mike Prosser <Mike.Prosser@emerson.com>
1 task done
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
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.column_indexproperty alongside thesignal.signal_indexproperty. Thesignal_indexrepresents the line number, and counts down, while thecolumn_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 column_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.column_indexsignal.data,signal.name, andsignal.__reduce__()to usecolumn_indexsignal_collection.__getitem__()to set and usecolumn_indexDigitalWaveformFaiulre.column_indexDigitalWaveformclasswaveform._signal_namestowaveform._line_nameswaveform._get_signal_name()andset_signal_name()toget_line_name()andset_line_name()waveform.test()to include thecolumn_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.