DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Analyzing multiple TDMS files in one script

Hey all

 

I am new to DIAdem and trying to write a script to analyze a bunch of data files from a test. For this test, the data output would typically be from 8 measurement points, resulting in 8 data files. I currently have a script that analyzes one data file (my intro to DIAdem scripting) but I would like to expand that script to be able to read in all of the data files at once.

 

My end goal will be to create a test report that lists the data from all 8 runs in tabular and graphical form.

 

Any help on loading/analyzing multiple data files in one script, and saving the results of that analysis, would be greatly appreciated.

 

Thank you

Brian

0 Kudos
Message 1 of 4
(2,359 Views)

Hi Brian,

 

I'm not totally clear on the mapping you describe between the 8 loaded values and the output files.  Could you perhaps post the data file(s) and the script you have so far?

 

Brad Turpin

Senior Technical Support Engineer

National Instruments

0 Kudos
Message 2 of 4
(2,301 Views)

Hey Brad

 

Honestly don't remember the specifics of the 8 channels, but I do still have this question and can provide some better detail:

 

I am going to be taking multiple runs of data, all of which will have the same data structure.  I have a script generated to analyze 1 data file but want to get to the point where I can select all of the files and analyze them all at once, using my current script as the 'meat and potatoes' of the analysis and iterating through all of the data files. My end goal would be to have an output to Excel or something like that with results from every data set.

 

My thought process is as follows:

1. Select all data files that are needed for analysis

2. Sort the data from each run into it's own Group

3. Analyze each group as is done in the script for one data file

4. Export the results from each group to Excel

 

My main sticking point seems to be how to iterate through Groups/Channels so that I can make this able to run whether there are 3 data files or 20 data files.

 

I've attached a screenshot of what the Data Tree looks like. This is loading 5 TDMS files.

 

Thanks!

HRA_Brian_0-1618913242875.png

 

 

0 Kudos
Message 3 of 4
(1,841 Views)

Hi Brian,

 

It may indeed be best to load all the data at once into the Data Portal so that you have immediate access to all the results and can send them to an output table.  Another option would be to load each of the N data files individually, run the analysis, then optionally save the analyzed results back to file.  Before saving you can send that file's results to the output table.  By starting with an empty Data Portal before loading each data file, you're guaranteed to be able to re-use your existing analysis script that runs on 1 loaded data set.  In addition to looping over all the N data files and calling your existing code each time, you'd need to add code to correlate the results from each of the N data files and send those to the target output location (Excel file?).

 

If you prefer to load all the N data files into the Data Portal at the same time, then you need an easy way to keep track of which groups came from which file, so that you can loop over all the N data files, analyzing each file's set of groups in turn.  There are several ways to do this: with the start group index for each file, with arrays, with a dictionary object, or with the Data.ElementList() object.  Any preferences?

 

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 4 of 4
(1,793 Views)