Skip to content

Update waveform conversion code to account for new timing fields#333

Merged
mjohanse-emr merged 31 commits into
mainfrom
users/mjohanse/new_timing_fields
Jun 4, 2026
Merged

Update waveform conversion code to account for new timing fields#333
mjohanse-emr merged 31 commits into
mainfrom
users/mjohanse/new_timing_fields

Conversation

@mjohanse-emr
Copy link
Copy Markdown
Collaborator

@mjohanse-emr mjohanse-emr commented May 20, 2026

What does this Pull Request accomplish?

AB#3877566

Updates the waveform conversion functions to handle the following new timing fields:

  • timestamp
  • time_offset
  • timestamps

NI-APIs change to add the new fields

Unit tests have been added to test conversion cases specific to these parameters.
Existing unit tests have been updated where necessary (example, don't expect and exception for irregular timing anymore). Unit test updates include

  • Adding new unit tests for the new timing parameters. Ideas for new tests were taken from the similar C# change.
  • Refactoring timing based unit tests into a separate base class.
  • Moving the rest of the waveform validation tests into subclasses based on the waveform type
  • Separating the spectrum tests into a different file since they are not timing based and don't need to be a subclass.

Similar change in the C# API

Why should this Pull Request be merged?

To establish parity between our python API and our C# API.
To allow Python users to publish Irregular Timing waveforms and "Relative Timing" waveforms.

What testing has been done?

Many new tests have been added that were inspired by the C# auto tests.
Existing waveform conversion tests are passing.

… fix existing tests.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

Test Results

  120 files  ±    0    120 suites  ±0   3m 18s ⏱️ -4s
  366 tests +  115    358 ✅ +  109    8 💤 + 6  0 ❌ ±0 
3 660 runs  +1 150  3 546 ✅ +1 066  114 💤 +84  0 ❌ ±0 

Results for commit da641d0. ± Comparison against base commit 0b84363.

This pull request removes 71 and adds 186 tests. Note that renamed tests count towards both.
tests.unit.test_waveform_conversion ‑ test___analog_waveform_non_zero_samples___convert___valid_protobuf
tests.unit.test_waveform_conversion ‑ test___analog_waveform_samples_only___convert___valid_protobuf
tests.unit.test_waveform_conversion ‑ test___analog_waveform_with_extended_properties___convert___valid_protobuf
tests.unit.test_waveform_conversion ‑ test___analog_waveform_with_irregular_timing___convert___raises_value_error
tests.unit.test_waveform_conversion ‑ test___analog_waveform_with_standard_timing___convert___valid_protobuf
tests.unit.test_waveform_conversion ‑ test___dbl_analog_wfm_with_attributes___convert___valid_python_object
tests.unit.test_waveform_conversion ‑ test___dbl_analog_wfm_with_timing___convert___valid_python_object
tests.unit.test_waveform_conversion ‑ test___dbl_analog_wfm_with_timing_no_dt___convert___valid_python_object
tests.unit.test_waveform_conversion ‑ test___dbl_analog_wfm_with_timing_no_t0___convert___valid_python_object
tests.unit.test_waveform_conversion ‑ test___dbl_analog_wfm_with_y_data___convert___valid_python_object
…
tests.unit.test_spectrum_conversion ‑ test___dbl_spectrum_with_attributes___convert___valid_python_object
tests.unit.test_spectrum_conversion ‑ test___dbl_spectrum_with_data___convert___valid_python_object
tests.unit.test_spectrum_conversion ‑ test___default_dbl_spectrum___convert___valid_python_object
tests.unit.test_spectrum_conversion ‑ test___default_spectrum___convert___valid_protobuf
tests.unit.test_spectrum_conversion ‑ test___spectrum_with_data___convert___valid_protobuf
tests.unit.test_spectrum_conversion ‑ test___spectrum_with_extended_properties___convert___valid_protobuf
tests.unit.test_waveform_conversion.TestDigitalWaveformConversion ‑ test____waveform_with_scaling___convert___valid_protobuf
tests.unit.test_waveform_conversion.TestDigitalWaveformConversion ‑ test___default_digital_waveform___convert___valid_protobuf
tests.unit.test_waveform_conversion.TestDigitalWaveformConversion ‑ test___default_digital_waveform_proto___convert___valid_python_object
tests.unit.test_waveform_conversion.TestDigitalWaveformConversion ‑ test___digital_waveform_proto_with_attributes___convert___valid_python_object
…

♻️ This comment has been updated with latest results.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
…al mode.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/test_waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/test_waveform_conversion.py Outdated
@mjohanse-emr mjohanse-emr requested a review from jasonmreding May 20, 2026 19:52
@mjohanse-emr mjohanse-emr changed the title Users/mjohanse/new timing fields Update waveform conversion code to account for new timing fields May 20, 2026
@mjohanse-emr mjohanse-emr marked this pull request as ready for review May 20, 2026 19:55
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/test_waveform_conversion.py Outdated
…ed to time_offset.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
…s point, it's super annoying.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/test_waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/test_waveform_conversion.py Outdated
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
…sing.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
…o verify normalization.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
… for easier maintainability where it makes sense.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
…ssible.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
Copy link
Copy Markdown

@jasonmreding jasonmreding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only did a cursory review of the test changes as I assume it was mostly refactoring. If you want a more thorough review of anything in particular, let me know.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Comment thread packages/ni.protobuf.types/tests/unit/timed_waveform_conversion_tests.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/timed_waveform_conversion_tests.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/test_waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/timed_waveform_conversion_tests.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/timed_waveform_conversion_tests.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/test_waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/test_waveform_conversion.py Outdated
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
…class.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
@mjohanse-emr mjohanse-emr requested a review from bkeryan June 3, 2026 22:37
Comment thread packages/ni.protobuf.types/tests/unit/base_waveform_conversion_tests.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/base_waveform_conversion_tests.py Outdated
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
@mjohanse-emr mjohanse-emr requested a review from bkeryan June 3, 2026 23:23
@mjohanse-emr mjohanse-emr merged commit c106356 into main Jun 4, 2026
593 of 602 checks passed
@mjohanse-emr mjohanse-emr deleted the users/mjohanse/new_timing_fields branch June 4, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants