Add float waveform conversion methods and tests - #365
Conversation
…s still fail. Needs investigation. Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Test Results 120 files ± 0 120 suites ±0 3m 32s ⏱️ -5s 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.♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
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_incrementon the inputspectrumrather than on the converted protobuf (float_spectrum), so it doesn't actually verify those fields are being set byfloat32_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.
… fixes. Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
What does this Pull Request accomplish?
Changes were recently made to
ni-apisto add new float waveform and spectrum types that will be used by the RF InstrumentStudio panels. This PR updatesni.protobufs.typesto add conversion methods and tests for these new message classes:Why should this Pull Request be merged?
AB#3985023
AB#3985037
We need to expose these conversion methods via
ni.protobuf.typesso that the MDS python API can support the new types.What testing has been done?