How do I compare the same channel from hundreds of measurement files?¶
Write a short automation script that loops over the files. For each file,
auto_ImportData() reads the data and auto_LoadDataset() adds the
channel as one more curve to the same diagram of a report template. At the end
auto_ScaleAxes() makes all curves visible. The result is one page with all
test runs on top of each other, instead of hundreds of single plots.
Torque over engine speed from the five sample files Test1.xls to
Test5.xls, loaded into one diagram.¶
How it works¶
Prepare a template (IPW file) with a named diagram, for example
Diagramm 1. See How do I build a report template that I can reuse for every test?.Get the list of files, either from the user with
auto_GetFileNameDialog(n)(up to 16 files) or for a whole folder withGetDirectory("D:/Tests/*.xls").Load the template once with
auto_LoadTemplate().For every file, call
auto_ImportData()and thenauto_LoadDataset()with the same diagram name. Each call adds one curve.Finish with
auto_ScaleAxes()andauto_UpdatePage().
Example for all Excel files of a folder, based on the template
Example.ipw from the UniPlot samples:
def rs_CompareFolder()
{
svFile = GetDirectory("D:/Tests/*.xls");
if (svFile[1] == "") {
return;
}
auto_LoadTemplate("example");
for (i in 1:len(svFile)) {
auto_ImportData(svFile[i]);
auto_LoadDataset("Diagramm 1", "N", "MEFF");
}
auto_ScaleAxes();
auto_UpdatePage();
}
Why it helps¶
One overview page instead of opening every file by hand.
The same script works for 5 or 500 files.
Each curve gets its own style automatically from the active style file.
Good to know¶
The datasets returned by
auto_LoadDataset()can be used for calculations:auto_xy_Mean(hData1, hData2)creates the mean curve of two datasets,auto_xy_Div()divides them. The x values do not have to be identical, but must be ascending and overlap.To use a fixed style for the next curve, call
auto_SetDatasetStyle()beforeauto_LoadDataset().Register the function with
auto_AddToUI()to start it from the Reports menu, see How can colleagues run a recurring evaluation without programming?.