LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

issues running python functions - slow and unreliable

I have a couple of python functions that together use QT5 to generate image data, to be displayed in a 2D image within labview

 

In labview the python session is opened and held in a global variable.  The VI that needs to run the python scripts is loaded into a panel.  One python function is for initialisation, the other provides refreshed image data.

 

If I put the image refresh in a while loop and the init outside of the while loop, it doesn't run.  If I put both in a while loop with case structure round the init function, and use a shift register initially set to 1 and cleared to 0 in the first iteration of the while loop in order to trigger the init once only (technically equivalent to the first scenario), it works but takes anything up to 20 seconds to run the Python code.  The python code runs fine outside of labview and easily provides a descent frame rate.

 

Does anyone have any ideas what might be going on, or how to get labview communicating with python more efficiently?

0 Kudos
Message 1 of 4
(153 Views)

It would be easier to see some actual code instead of ambiguous descriptions.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 2 of 4
(108 Views)

Here is a screenshot.  I've moved as much over to python as possible, so that all labview has to do is run one python script to initialise some variables within python and then loop a script to refresh the image data.  It currently takes ~5 seconds to run the loop and I am not even getting any output.

 

Any ideas what might be causing this?

0 Kudos
Message 3 of 4
(72 Views)

Truncated pictures are typically useless for troubleshooting.

 

I don't see anything that measures or paces the loop rate? How often does it need to be recalculated? How big are these blue arrays?

 

Earlier you said that the VI is embedded into another front panel. Does it work better if it is separate?

How is the rest of the code? e.g. What's the purpose of the sequence frame? What else is going on? How do you stop the loop?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 4 of 4
(59 Views)