Skip to content

Guide on integrating measurement plug-ins with Python applications, featuring an example sequencer to illustrate the integration process.

License

Notifications You must be signed in to change notification settings

ni/measurement-plugin-integration-example-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An Example Measurement Plug-In Sequencer for Python

Overview

This tool serves as a reference for integrating the Measurement Plug-In Client Generator to generate measurement plug-in clients and showcase the sequencing of measurement plug-ins using the generated clients.

Workflow Diagram

sequencer-example-workflow-diagram

Dependencies

  • Python 3.9 or later

Steps to use the Sequencer tool

Step 1: Install the Package

After downloading the ni_measurement_plugin_sequencer-x.x.x-py3-none-any.whl file from the latest release assets, install the package using the command below.

pip install <path_to_ni_measurement_plugin_sequencer-x.x.x-py3-none-any.whl>

Step 2: Run the Sequencer

To run the ni-measurement-plugin-sequencer, open your command line and enter:

ni-measurement-plugin-sequencer <path_to_sequence_directory>
  • <path_to_sequence_directory>: Specify the directory path where the generated clients and sequence files will be stored. Confirm that the directory exists and has the necessary write permissions.

Step 3: Review the Generated Sequence File

The generated sequence.py file will contain the following:

  • pin_map_methods: A list of methods used to register the pin map for the measurement plug-ins. Update pin_map_path variable with the pin map file path.
    • These lines of code can be removed for the non-pin-centric workflow.
  • A loop to register the pin map for each measurement plug-in.

Note: Users must update the sequence.py file to define their sequences using the generated measurement plug-in clients.

Step 4: Set Up Logging

  • A basic logger package (ni_sequence_logger) is provided to log the execution results of the sequence.
  • Download this logging package from the latest release assets and install using the command,
pip install <path_to_ni_sequence_logger-x.x.x-py3-none-any.whl>
  • Once installed, the logging package will ensure that the logging configuration is set up in the generated code, allowing the sequence file to be executed and capturing logs from various operations throughout the sequence.

Step 5: Execute the Sequence

  • Run the sequence.py file to execute the sequence.
  • The log will be saved as a CSV file in the current working directory.
Note: Before creating clients, the tool automatically handles directory cleanup by,

- Clearing the content of the `__init__.py` file (if it exists).
- Removing all generated clients.
- Deleting the `sequence.py` file (if present).
  • Note:
    • No dependency management: The user must take care of managing the dependencies for the respective sequence directory.
      • The sequencer doesn't generate a pyproject.toml file. Instead, the user must ensure that the necessary dependencies are installed.

Note

  • For guidance on integrating the Measurement Plug-In Client Generator with your custom application, please refer to this documentation.