Summary: Test engineers typically add manual-control screens to LabVIEW applications. While it would be helpful to repetitively execute varying parts of those manual-control screens, LabVIEW is not optimal for dynamic scripting, or on-the-fly sequencing with flow control. (Imagine editing the source code of Excel each time you wanted to create a macro.) And while Python is built for scripting, it requires advanced custom coding to interface with LabVIEW.
Announcing TestScript: a free Python/LabVIEW connector from Wineman Technology that is simple to add to your existing LabVIEW application and abstracts complex Python coding, allowing you to easily use Python to control LabVIEW or vice versa.
We hope you enjoy using TestScript!
In a previous post, Brandon Jones outlined several ways that people have connected Python and LabVIEW in the past. In this post, I will outline how the Raleigh office, in conjunction with Brandon and others, have collaborated to release TestScript - a free Python/LabVIEW connector you can download to solve additional problems not addressed by previous approaches (TestScript is bidirectional).
Problem: Imagine compiling a LabVIEW instrument-control application that has a manual control screen (which essentially all LabVIEW applications end up having). Each day in the lab you find quick measurement tasks that you would like to do, but you would prefer not to bug them into the base application, so you resort to the manual control screen. For example, today you want to push a button to start data logging, then press a button to flip a relay, then wait 5 seconds, and flip the relay back with a final button press... and then repeat that process overnight.
Problem: You would like to take advantage of Python libraries from within a LabVIEW application, but LabVIEW doesn't have a "Python functions" palette. Perhaps an engineer wants to develop a model based on LabVIEW data for predicting component failure. Training machine learning models and other forms of artificial intelligence or statistical learning in order to analyze data to make better business decisions can take an immense amount of compute time, and GPU computing can greatly decrease such costs.
Solution: TestScript. While there are non-Python based approaches out there, Python offers an extremely simple syntax to use for scripting (e.g. writing a few lines of code to flip that relay back and forth all night). This is especially true when used in the context of TestScript, which abstracts away the complexity of communication between LabVIEW and Python and is straightforward to add to your existing LabVIEW application.
Python is also an excellent choice for GPU-accelerated machine learning because of its extensive library ecosystem. TestScript allows you to generate data in LabVIEW and then tell Python to analyze that data.
- Fully bi-directional: LabVIEW can tell Python to run a script, and Python can tell LabVIEW to execute a command. Either direction can include arguments. TestScript allows you to send data to Python for analysis using any algorithm you like, including using GPU-enabled packages like tensorflow or theano. You can even run multiple Python scripts at once or run scripts on a different computer (even with Linux) than the test machine running your LabVIEW application!
- The Python side is written so that once engineers define their functions, they can write scripts with no import statements or unnecessary setup - they just start writing scripts! All the Python capabilities for flow control are already present, so you can branch and loop with ease.
- Since Python itself is open-source and free, you don't need any license other than LabVIEW to work with TestScript. Except for exotic things like executing GPU-enabled algorithms, TestScript uses only base Python modules; you can install base Python 3 and get functionality right away. If you're interested in GPU-enabled toolkits, then we recommend installing a distribution like Anaconda and a development environment like PyCharm.
- TestScript is heavily documented. The Python code complies with PEP 8 documentation standards, and the LabVIEW side is equally commented. We have tried to take as simple an approach as possible for readability.
- On the LabVIEW side, we have reduced the coupling between TestScript and your LabVIEW framework as much as possible: you should be able to drop TestScript into your framework with little difficulty. TestScript works in LabVIEW 2013, 32-bit, or later, and Python 3.
- We are releasing TestScript with as permissive a license as we can. The basic details you need to know are these: a. Wineman Technology has the copyright. b. You can use TestScript internally however you like, including commercially. c. You can't use TestScript to compete with Wineman Technology, either directly or indirectly, without permission. d. There's no warranty for TestScript - it's "as is" software.
Learn more about TestScript and download it here: