Skip to content

Add float waveform conversion methods and tests - #365

Merged
mjohanse-emr merged 4 commits into
mainfrom
users/mjohanse/float_wfm_conversion_tests
Jul 31, 2026
Merged

Add float waveform conversion methods and tests#365
mjohanse-emr merged 4 commits into
mainfrom
users/mjohanse/float_wfm_conversion_tests

Conversation

@mjohanse-emr

@mjohanse-emr mjohanse-emr commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

What does this Pull Request accomplish?

Changes were recently made to ni-apis to add new float waveform and spectrum types that will be used by the RF InstrumentStudio panels. This PR updates ni.protobufs.types to add conversion methods and tests for these new message classes:

  • FloatAnalogWaveform
  • FloatComplexWaveform
  • FloatSpectrum

Why should this Pull Request be merged?

AB#3985023
AB#3985037

We need to expose these conversion methods via ni.protobuf.types so that the MDS python API can support the new types.

What testing has been done?

  • Unit tests added
  • Unit tests pass

…s still fail. Needs investigation.

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

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Test Results

  120 files  ±  0    120 suites  ±0   3m 32s ⏱️ -5s
  444 tests + 78    432 ✅ + 74   12 💤 + 4  0 ❌ ±0 
4 440 runs  +780  4 286 ✅ +740  154 💤 +40  0 ❌ ±0 

Results for commit 0451134. ± Comparison against base commit 31fb840.

This pull request removes 3 and adds 81 tests. Note that renamed tests count towards both.
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_spectrum_conversion ‑ test___default_float_spectrum___convert___valid_python_object
tests.unit.test_spectrum_conversion ‑ test___default_spectrum32___convert___valid_protobuf
tests.unit.test_spectrum_conversion ‑ test___default_spectrum64___convert___valid_protobuf
tests.unit.test_spectrum_conversion ‑ test___float_spectrum_with_attributes___convert___valid_python_object
tests.unit.test_spectrum_conversion ‑ test___float_spectrum_with_data___convert___valid_python_object
tests.unit.test_spectrum_conversion ‑ test___spectrum32_with_data___convert___valid_protobuf
tests.unit.test_spectrum_conversion ‑ test___spectrum32_with_extended_properties___convert___valid_protobuf
tests.unit.test_spectrum_conversion ‑ test___spectrum64_with_data___convert___valid_protobuf
tests.unit.test_spectrum_conversion ‑ test___spectrum64_with_extended_properties___convert___valid_protobuf
tests.unit.test_waveform_conversion.TestFloatAnalogConversion ‑ test____waveform_with_scaling___convert___valid_protobuf
…

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds float32 (single-precision) waveform/spectrum conversion helpers to ni.protobuf.types to support the new protobuf message classes introduced in ni-apis, and extends unit tests to cover these conversions.

Changes:

  • Added float32 AnalogWaveform and ComplexWaveform conversion functions (FloatAnalogWaveform, FloatComplexWaveform).
  • Added float32 Spectrum conversion functions (FloatSpectrum).
  • Added/updated unit tests for the new float32 conversions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Implements float32 waveform and spectrum <-> protobuf conversions.
packages/ni.protobuf.types/tests/unit/test_waveform_conversion.py Adds unit tests for float32 analog/complex waveform conversions.
packages/ni.protobuf.types/tests/unit/test_spectrum_conversion.py Adds unit tests for float32 spectrum conversions and renames some existing spectrum64 test names.
Comments suppressed due to low confidence (1)

packages/ni.protobuf.types/tests/unit/test_spectrum_conversion.py:105

  • This test currently asserts start_frequency/frequency_increment on the input spectrum rather than on the converted protobuf (float_spectrum), so it doesn't actually verify those fields are being set by float32_spectrum_to_protobuf.
    assert not float_spectrum.attributes
    assert spectrum.start_frequency == 0.0
    assert spectrum.frequency_increment == 0.0
    assert list(float_spectrum.data) == []

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/ni.protobuf.types/tests/unit/test_waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/test_spectrum_conversion.py
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
Comment thread packages/ni.protobuf.types/tests/unit/test_spectrum_conversion.py Outdated
Comment thread packages/ni.protobuf.types/src/ni/protobuf/types/waveform_conversion.py Outdated
… fixes.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
@mjohanse-emr
mjohanse-emr marked this pull request as ready for review July 30, 2026 21:00
@mjohanse-emr
mjohanse-emr requested a review from bkeryan July 30, 2026 21:00
@mjohanse-emr
mjohanse-emr merged commit b5bbfbd into main Jul 31, 2026
311 checks passed
@mjohanse-emr
mjohanse-emr deleted the users/mjohanse/float_wfm_conversion_tests branch July 31, 2026 19:47
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