07-26-2023 11:05 AM - edited 07-26-2023 11:07 AM
Could you please let me know is it possible to generate summary file containing the average of all channels for logs captured using flexlogger. This would help in analyzing the data instead of opening each log and calculating the average.
Generation of the summary file should be followed automatically after the log is captured.
Solved! Go to Solution.
07-26-2023 11:26 AM
Hello,
There are a couple ways to do that:
1) Create a plugin with the FlexLogger Plug-in Development Kit that computes the average and log it as one of the signals to the TDMS file.
FlexLogger Plug-In Development Kit Download - NI
2) Use the FlexLogger Python API.
Using Python, you can automate FlexLogger. The upcoming version, that will be posted to github momentarily has support for events.
i.e. FlexLogger can send an event to Python to get a notification of when a log file is done writing.
In response to that event, you can use the Python TDMS package to read the log file, compute the average and save it to a new file.
07-26-2023 12:05 PM
Could you please share an example of using Python TDMS package to read the tdms log file, compute the average and save it to a new file.
07-26-2023 01:31 PM
Sure! Let me write something and I'll post it soon.
07-26-2023 01:33 PM
That would be really helpful!
07-26-2023 05:06 PM
I forgot to mention built-in ways to have access to the channel average.
In the TDMS file, each channel has a custom property named NI_ChannelValueAverage, which may be what you're looking for.
If you want to save it to a different file, then the Python API may be what you need.
It is also worth noting that FlexLogger has a built-in functionality allowing you to compute a running average:
You can add it by choosing from the toolbar: Add channels>>Calculation>>Statistics>>Mean.
This will create a channel computing the running average of another channel that will be logged in the TDMS file.
Hope this helps.
07-26-2023 06:02 PM
If you go the Python route, you would first need to install the niflexlogger-automation package.
The Python library to manipulate tdms files is npTDMS.
Welcome to npTDMS’s documentation — npTDMS 1.7.0 documentation
I am attaching a Python script that shows how to access a channel average, after FlexLogger finishes writing the TDMS file.
Hope this helps. Please let me know if you have any questions.
07-31-2023 12:26 PM
Thank you, this worked!