MeasurementLink Support for Python v1.1.0
What's Changed
- Added support for updating the measurement UI during a measurement.
- To send UI updates while the measurement is running, use the
yieldkeyword instead of thereturnkeyword to "return" the measurement's output tuple. This turns the measurement function into a Python generator function, which allows it to "return" the output tuple multiple times. - When using
yield, it is not necessary to usereturn. If you use bothyieldandreturn, MeasurementLink treats thereturnlike a finalyield. - This feature is intended for interactive usage with InstrumentStudio. In TestStand, only the final UI update is returned.
- This feature requires MeasurementLink 2023 Q3.
- To send UI updates while the measurement is running, use the
- Added support for enums.
- To use an enum type for a configuration or output, pass
nims.DataType.Enumfor the data type and specify theenum_typekeyword argument. - Example:
@measurement_service.configuration("measurement_type", nims.DataType.Enum, Function.DC_VOLTS, enum_type=Function) - This feature requires MeasurementLink 2023 Q3.
- To use an enum type for a configuration or output, pass
- Added support for version 2 of the
MeasurementServiceinterface.- This is required for both the UI update and enum features.
ni-measurementlink-servicenow reads the service's provided interfaces from the.serviceconfigfile. When you update your services to depend onni-measurementlink-serviceversion 1.1 or later, you should update their.serviceconfigfiles to specify both versions of the measurement service interface:
"providedInterfaces": [ "ni.measurementlink.measurement.v1.MeasurementService", "ni.measurementlink.measurement.v2.MeasurementService" ], - Manually launching a measurement service now automatically starts the discovery service just-in-time by @vigkre in #290
- Example improvements:
- Simplified TestStand sequences by reducing the number of setup/cleanup steps and moving them into the main sequence.
- Refactored command line option handling to reduce amount of boilerplate in
measurement.py. - Added a
nidigital_spiexample. - Updated modular instrument examples to use session-based simulation by default.
- Add a
ui_progress_updatesexample by @bkeryan in #266 - Update the
nidaqmx_analog_input_measurementexample to use the NI gRPC Device Server and MeasurementLink Session Management Service by @samchris007 in #268 - Update docs to redirect users to the appropriate release by @bkeryan in #265
- Use NXG/fuse controls for LabVIEW measurement UIs by @pbirkhol-ni in #272
- Added common helper method to reserve and create session for NI-DCPower Example by @vigkre in #263
- Update other examples to match NI-DCPower example changes. by @subash-suresh in #284
- Create predictable Streaming Measurement example and write automated tests by @DelpireNI in #279
- Disable result recording in Setup and Cleanup block steps by @Tharun-Sundar in #278
- NI-Digital: Use timing and levels sheet names rather than paths by @jonathanmendez in #282
- Add helper to get session information based on pin name by @subash-suresh in #276
- Simplify reserve call by extracting reservation timeout constant by @bkeryan in #300
- Add helper to get session information based on pin name by @subash-suresh in #276
- Update Example Services' TestStand Sequences for Enum Support by @WesleyTangNationalInstruments in #295
- Simplify single-session measurements by @bkeryan in #287
- The
SessionManagementClientclass now has a singularreserve_session()method, in addition to the pluralreserve_sessions()method. reserve_session()validates that exactly one session was reserved and returns aSingleSessionReservationobject, wherereservation.session_infois a singleSessionInformationobject.reserve_sessions()allows reserving any number of sessions and returns aMultiSessionReservationobject, wherereservation.session_infois a list ofSessionInformationobjects.
- The
- ni-measurementlink-generator
- Update measurement template to include helpers.py files by @subash-suresh in #293
- Type checking and auto-complete improvements
- Added a
py.typedmarker, which indicates thatni-measurementlink-servicesupports type checking with tools such as mypy and pyright. - Use grpc-stubs for type information by @bkeryan in #275
- Add missing type info to MeasurementContext & use correct types by @bkeryan in #281
- Fix imports in
.pyitype stubs by @bkeryan in #280 - Generate
.pyitype stubs for gRPC client stub classes by @bkeryan in #292
- Added a
- bugfix: 'gbk' codec can't decode byte by @LawsonGu in #240
- Various minor bug fixes and improvements not listed here
New Contributors
- @LawsonGu made their first contribution in #240
- @Tharun-Sundar made their first contribution in #249
Full Changelog: 1.0.1...1.1.0