LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read tdms with root / c++ in linux

Solved!
Go to solution

Hello,

 

I want to save my data in a format which can be opened later with cern ROOT software in a linux system.

therefore I'm wondering if it's possible to have a linux library for c++ to read tdms files or at least to have a file offset of this tdms so that I could manually write c++ code in linux to extract the tdms data and convert in a .root file.

 

I'm quite sure the NI guys wannt to advice me to stay with the tdms format but unfortunately this is not my decision.

 

So is there hope to have a linux library to read tdms files within a c++/root code or at least to have a offset of this tdms files?

 

best regards

0 Kudos
Message 1 of 11
(6,507 Views)
Solution
Accepted by rolfk

LabVIEW began to have TDMS functions since the 2012 release. So you can install a 2012 and later version of LV to access TDMS files on Linux. 

Just for curiosity, which format are you going to be save to?

0 Kudos
Message 2 of 11
(6,489 Views)

I think you misunderstood me or I didn't understand your answer. I need a piece of software ( sourcecode or compiled library) which allows me to read from tdms files from c++ code in an linux environment. There will be no way to install a LabVIEW version on this Linux machines to use it. It all have to be done by c++ in linux. Therefore I need in an ideal case a linux library or c++ sourcecode or at least a detailed structure of this tdms files to write my own software which will read data from this tdms files. If there is no way for this I would have no choice but to design a new data format.

 

for your question:

a) if there is a way to access the data in tdms files from c++ in linux

 

Ni5663E -> DAQ-Software (written in LabVIEW) -> save the raw data in .tdms format

raw data in .tdms -> processed by ROOT ( https://en.wikipedia.org/wiki/ROOT  ,  http://root.cern.ch/drupal/ )Software -> results are saved in ROOT Files.

 

b) if there is no way

I have to design a new data format, this will be a binary files with files and frame headers.

 

I hope this answers your question.

best regards

0 Kudos
Message 3 of 11
(6,474 Views)

Hello,

 

have a look at this whitepaper, topic number four:

http://www.ni.com/white-paper/3727/en/

 

Might this be what you are looking for?

 

Kind regards,

Rome

NI Germany

0 Kudos
Message 4 of 11
(6,463 Views)

@RomBe

 

I know this page and no. Because we dont't use OpenOffice to open hundret of files from the beamtime with a size of 500mb to 1gb each and windows dll don't work in linux (or am i wrong?).

What I'm looking for is c++ code or a linux library i can call from a c++ code that later we can do the following:

 

c++ code example (just made up to demonstrate what I have to do)

.
.
.
CReadTDMSFile file;
file.open("file.tdms");
.
.
.
Long_t lNSamples = file.GetAttribute("NumberOfSamples");
.
.
.
file.close();
.
.
.

 I hope this made clear.

 

best regards

christian

 

0 Kudos
Message 5 of 11
(6,454 Views)

there is a python lib (github?? ask g++gle)  to read tdms data , maybe you can include or convert that?

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 6 of 11
(6,444 Views)

@Henrik

Hello and thanks.

I think you were refering to http://sourceforge.net/projects/pytdms/

I haven't used python before but it was quite close to c/c++ (if I'm not wrong) and it runs also in linux.

This seems like a very good solution even if I havent looked in the code yet.

 

thank you all for your help 🙂

 

also greetings from germany 🙂

Message 7 of 11
(6,439 Views)

Have you solved your problem? If it is solved, can you tell me how you solved it? I also encountered the same problem.

0 Kudos
Message 8 of 11
(3,388 Views)

I'm not aware of ready made C source code to read and write TDMS files. This document about the internal file format is to my knowledge the best option you have. The developer of the Python library was using it too, to get his library working.

 

If you end up creating such a library it would be great if you decided to put it on an open source repository like github. 😁

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 11
(3,381 Views)

Thanks  reply

  There is no C source code, just a dll file. So I have to find another way to solve this problem. I am currently trying to call the Python library about TDMS in C, but I still don’t know if I can read my existing TDMS file in Linux

0 Kudos
Message 10 of 11
(3,376 Views)