LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read binary dump of LabVIEW cluster from Python

Solved!
Go to solution

Some years ago I developed an application in LabVIEW which hadnles some data in a LabVIEW cluster and saves them to a binary file dumping the cluster to the file.

Now one of my customers asks me to read that file with Python.

Is there a way to do this?

Thanks

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 6
(2,380 Views)

Hi vix,

 


@vix wrote:

Some years ago I developed an application in LabVIEW which hadnles some data in a LabVIEW cluster and saves them to a binary file dumping the cluster to the file.

Now one of my customers asks me to read that file with Python.

Is there a way to do this?


Yes.

Look up how your old application saved those data, i.e. determine the exact cluster datatype.

Then try to read the cluster elements from your binary file…

 

Mind to attach both the cluster and some example data files?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,362 Views)

Hi GerdW,

I attach a LV 2020 vi which saves some dummy data, so that you can see the exact cluster datatype.

If you run the vi, a binary file is dumped.

 

Is there a library in Python to read from LabVIEW cliusters?

I wonder about padding and such kind of thigs that happens behind the scenes when working with binary dumps.

 

 

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 6
(2,340 Views)

Hi vix,

 


@vix wrote:

I attach a LV 2020 vi which saves some dummy data, so that you can see the exact cluster datatype.

 

Is there a library in Python to read from LabVIEW cliusters?

I wonder about padding and such kind of thigs that happens behind the scenes when working with binary dumps.


I can't open this right now.

Can you attach the original VI? Dumping binary data might change from LabVIEW version to version! See the hassles with Datalog files, which include a notification of the LabVIEW version used for saving…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(2,332 Views)

Hi Gerd,

I attach the LabVIEW 2012 version.

The original application is in LabVIEW 2012.

Let me know if you can open this.

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 5 of 6
(2,330 Views)
Solution
Accepted by topic author vix

Hi vix,

 

oh boy!

 

I guess it will be easier to write a LabVIEW routine to convert that cluster into some XML or JSON or even handcrafted text format instead of trying to read this binary files directly with Python!

 

See this:

The first cluster contains arrays, with 2 elements in them. The binary file starts with "00000002 0000000B 0000006F" for the very first array in the very first subcluster (2 elements, integer items with value 11=0B and 111=6F). I don't see an indication of the cluster, so your Python routine will have a hard time to recognize the clusters in your data files… (LabVIEW writes I32 length parameters for arrays and strings, a path converts to an array of strings with a different kind of length encoding, and so on.)

 

Or the other way around: your Python routine needs to know the exact order of elements in your huge cluster and needs to detect and parse each element. Those waveforms can become trickier, when they also carry (an unknown number of) attributes…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 6
(2,301 Views)