Jump to content
Bean

TestScript: Free Python/LabVIEW Connector

Recommended Posts

https://www.winemantech.com/blog/testscript-python-labview-connector

From release blog...

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.

  • Like 2

Share this post


Link to post
Share on other sites

TestScript is written in Python 3.  If you are looking at calling Python 2.7 modules from LabVIEW, this is what Enthought's tool does (at present, anyhow).  TestScript enables you to use simplified Python 3 scripts to control a LabVIEW application or use a LabVIEW application to run and get results from a Python 3 script.  Because we've defined the Python-to-LabVIEW interface internally, scripts can literally be one line:

myVoltage = xDMMRead()

We can do this since, with comments and whitespace, TesScript contains 3,000 lines of Python code under the hood.  Can you write in Python 3?

And it's free.

Share this post


Link to post
Share on other sites

For clarity:

Currently:  The Enthought Python Integration Toolkit for LabVIEW lets you "Call Python functions directly from LabVIEW, and pass arrays and other numerical data natively" in both Python 2.7 and 3.6, is available for sale at ni.com, includes the Canopy development environment, and from what I understand helps solve some deployment headaches (e.g. Python packages).

The Python node that got released with LabVIEW 2018 lets you call Python functions from LabVIEW in Python 2.7 and 3.6.

TestScript is a free tool that lets you use LabVIEW to run Python 3.x scripts (that call Python functions) and retrieve the results back in LabVIEW ***and also*** lets you launch a Python script from your LabVIEW application that calls LabVIEW functions (that you expose from your application) from Python (e.g. to automate your LabVIEW manual control screen behavior on-the-fly:  flip relay, acquire data, log data, repeat overnight).  Examples included.

Share this post


Link to post
Share on other sites

I haven't head of TestScript before.  Sounds interesting.  But I have tried both the Enthought toolkit as well as the LabVIEW Python Node.

I've been majorly impressed with the Enthought toolkit.  I've passed fairly large data to/from Python and the performance has been pretty great.  And it certainly does solve some deployment headaches.  It has a building mechanism that is able to generate a self-contained python environment with only required libraries for running your code.  You can copy/paste this environment directly onto a deployed machine and it will run!  No need to install and configure a python environment from scratch for every deployed machine. 10/10 recommend

Share this post


Link to post
Share on other sites

That's great insight.  At the end of the day, the Enthought toolkit and the LabVIEW 2018 Python Node are optimized for directly calling Python functions from LabVIEW.  Pretty cool.

TestScript is optimized for running Python scripts from LabVIEW which can call Python functions or custom LabVIEW functions.  If you return values (scalars or arrays) back to LabVIEW at the end of a script, they are returned as a string.  Example script we include (where we pass an array of numbers as a script argument when launching it from LabVIEW):

---

# Use list comprehension to create a list of floats to sum up.
addends = [float(i) for i in locals()['arguments']]

script_update(str(sum(addends)))

---

Since you're familiar with the tools, I'm interested in your feedback if you get a chance to checkout TestScript.  Just email testscript@winemantech.com to connect!

Jason

Share this post


Link to post
Share on other sites

That sounds indeed like a gap-matching tool when it comes to calling LabVIEW code from Python!

I am urged to try it out ASAP, as I see that romance between LabVIEW and Python has already started, but still misses the spark. TestScript indeed promises a lot to kindle up this fire. 

Share this post


Link to post
Share on other sites

I agree:  WYSIWYG DevX and parallelized UI, control, DAQ, and logging meets a readable, exploding, scientific text-based sequencing environment!

TestScript lets you expose any number of LabVIEW actions (flip relay, read DMM, turn on power supply, etc.) and call those directly in your Python script:  xFlipRelay(), xReadDMM(), xPowerSupplyOn().  We recommend having, for example, the front panel button that flips your relay call the same code as the corresponding Python function.  This way, the code behaves identically whether it's being called via manual control screen or Python script.

Please check out the examples, and reach out with product ideas!  We're already folding TestScript into our own projects and loving it.

Jason

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • By David Akinpelu
      I am implementing a TCP connection between MyRio(client) and Python(server). The goal is to send data from the server to the client, perform some calculations, and send the result to the server. I need to keep changing the data being sent to the client. I noticed the first data works fine and the result returned to the server, but the client could not read subsequent data. I debugged and was able to detect that the error is coming from the first read function is the "Reading values subvi"  but I don't know how to correct it. How do I go about it?
      I have attached the files below.
      Reading Unknown Bytes from TCP.vi Second_client.vi SimpleServer.py
    • By Deon
      The Threshold Hysteresis VI allows an input (for example, a sensor) to drift out of an inner limit without generating an invalid flag, but if it drifts outside an outer limit it then becomes invalid. For the reverse, when the input crosses back into the outer limit it remains invalid until the value falls inside the inner limit.
      For simplicity, only one input parameter is provided for both the inner & outer limits, and is negated for the lower limit, as generally tolerance limits are equidistant from the nominal.
    • By Deon
      View File Threshold Hysteresis v1.0 LV8.6.1
      The Threshold Hysteresis VI allows an input (for example, a sensor) to drift out of an inner limit without generating an invalid flag, but if it drifts outside an outer limit it then becomes invalid. For the reverse, when the input crosses back into the outer limit it remains invalid until the value falls inside the inner limit.
      For simplicity, only one input parameter is provided for both the inner & outer limits, and is negated for the lower limit, as generally tolerance limits are equidistant from the nominal.
      Submitter Deon Submitted 11/10/2014 Category General LabVIEW Version License Type  
    • By jossie
      Hello I am quite new to labview and I have some questions regarding labview. We have came up with a simulation build in labview as shown in the folder. However, we will be making use of Myrio to connect current and voltage sensors to send the data to labview when labview is running. We are currently having difficulties trying to search if it is possible to send the wave files and the popout messages ( messagebox.vi and Player2Wins.vi) to NI Dashboard for Labview in Ipad by using myrio. Is it possible for myrio to store wave files and the additional VIs and sending these to NI Dashboard for Labview? 
       
      Otherwise, it is possible for Labview to send the entire program.vi, messagebox.vi and Player2Wins.vi to cloud and people are able to see the GUI in program.vi remotely? ( We have found information like Labview web services etc. We hope that people are able to view our GUI and press the " Press start" button as well as closing the popout messages in a website not from our local network). 
       
      I sincerely apologize if what I am asking does not make sense to people who are reading this. I hope that someone will help me with this as it is very difficult for me to do and I need some guidance from people who are familiar with these. Thanks for taking your time to read and your reply. 
      Simulation_Build_(3).zip Pop-up_Message.vi Player2Wins.vi
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.