07-23-2011 02:40 PM
I need to save data in a binary format which can be opened with Python. I have tried the "Write Waveforms to File (1D).vi" and can open them back up in LabView, but the binary format is not published anywhere, so I cannot open them in Python. They appear to be saving as DataLog type binary files.
Is there another binary format which I can use that I can open in Python?
The reason I need this is that with 16-channel DAQ at 20kHz I can only save about 30 seconds of data. For longer periods, the task of writing to a text file consumes all available memory and cpu.
07-24-2011 09:44 AM
Did you try the Export Waveforms to Spreadsheet File as an alternative?
You can always crete your own format by simply using the Write Binary File. This will create a very compact file. You need to define your own header to indicate the number of channels and the timing information. Python can read binary files. There's an example that ships with LabVIEW on reading/writing binary files.
07-24-2011 01:37 PM
I found a solution. I found an open-source project called pyTDMS (google for it), and it can read tdms type files sometimes. It was some trial and error to get my data saved in a way that pyTDMS could open the file, but in the end it works great.
I have two digital output channels as well as 16 analog input channels, so here is how I had to save the data within LabView:
The 16 analog input channels were saved as a 1D array of waveforms. Then the digital output channels were made into another 1D array of waveforms. The trick was to use the write tdms subvi twice. Once for the analog input channels and again, on the same file, for the digital output channels. pyTDMS opens these files just fine, and I can use the metadata to sort out what channels the data goes with in Python.
10-03-2014 08:50 PM
Does pytdms can solve the following problem: Convert TDMS files in txt. Is it possible with pytdms? I lay in the Python language. Thank you.