Hello,
I have attached a file (Chart 8.1.8) were we have noticed differences between the calculation of the "Average Cyclic Maximum" and the manually calculated average of the same maxima.
I have set up channel 5 to calculate the average cyclic maximum of channel 4 and show the event markers. In Datapad I prepared the first three columns to show "Time at Maximum", "Maximum Value" and "Average Cyclic Maximum" (with same parameters as for channel 5). Then I used "Multiple Add to Datapad" to select 1 sec around each event and add the corresponding values to the Datapad. I know, it does not make much sense to calculate the average cyclic maximum of single events. But the differences between the "true" maximum and the "Avg Cyclic Maximum" are substantial and we see also differences when we calculate the average of the maxima in longer selections that contain ~10 maxima. Do I miss something or is there really something wrong?
Regards,
Klaus
Avg. Cyclic Maximum vs. "True" Cyclic Maximum
Avg. Cyclic Maximum vs. "True" Cyclic Maximum
 Attachments

 20171109_xxSel.adicht
 (346.5 KiB) Downloaded 54 times
Re: Avg. Cyclic Maximum vs. "True" Cyclic Maximum
Hi Klaus,
The reason for the discrepancy between the data pad maximum calculation and the cyclic maximum channel calculation is due to them calculating maximums over time periods. In the file attached you have set up the data pad channel calculation to select 2 seconds around each event; whereas the channel calculation calculates the maximum between two events. The channel calculation includes the point at the event and takes the following samples up to, but not including, the next event, when calculating the maximum.
The attached screenshot shows the results of selecting the region the channel calculation would use to determine the first maximum value (21.2688). If you select the same region, then the top row of Column B of the data pad shows the same value as the cyclic maximum channel calculation (21.2688).
So the discrepancy is because the multiple add to data pad calculation selected 2 seconds around each event while the cyclic maximum channel calculation used the samples from each event to the next event. I.e multiple add to data pad was calculating the maximum around each event, while cyclic max was calculating the maximum between events.
If you would like more explanation or have any other questions please let me know!
Cheers,
Amy
The reason for the discrepancy between the data pad maximum calculation and the cyclic maximum channel calculation is due to them calculating maximums over time periods. In the file attached you have set up the data pad channel calculation to select 2 seconds around each event; whereas the channel calculation calculates the maximum between two events. The channel calculation includes the point at the event and takes the following samples up to, but not including, the next event, when calculating the maximum.
The attached screenshot shows the results of selecting the region the channel calculation would use to determine the first maximum value (21.2688). If you select the same region, then the top row of Column B of the data pad shows the same value as the cyclic maximum channel calculation (21.2688).
So the discrepancy is because the multiple add to data pad calculation selected 2 seconds around each event while the cyclic maximum channel calculation used the samples from each event to the next event. I.e multiple add to data pad was calculating the maximum around each event, while cyclic max was calculating the maximum between events.
If you would like more explanation or have any other questions please let me know!
Cheers,
Amy
 Attachments

 CyclicMaxSelection.zip
 (73.51 KiB) Downloaded 35 times
Amy Heinrich
Software Engineer, ADInstruments, New Zealand
Software Engineer, ADInstruments, New Zealand
Re: Avg. Cyclic Maximum vs. "True" Cyclic Maximum
Hi Amy,
thanks for the explanation. At least I do understand now how the values for the average cyclic maximum are constructed. Additionally I am even more worried
I have attached a graph with an example were I synthesized some data in channel 1 (sin(t)*sin(1.9*t)). In channel 2 and channel 3 I calculated the average cyclic maximum and minimum (General  Sine shape, Minimum peak height 1 S.D.). All maxima were nicely marked with event markers. Then I combined the traces for the maxima and minima with the data (see attached graph). All "small" maxima that lie between two larger maxima are missed. The (green) trace for the minima is following the minima of the red trace more accurately.
Is this really the intended behaviour? I would think that most people will expect that the maximatrace would show the maxima as the minimatrace is showing the minima.
All the best,
Klaus
thanks for the explanation. At least I do understand now how the values for the average cyclic maximum are constructed. Additionally I am even more worried
I have attached a graph with an example were I synthesized some data in channel 1 (sin(t)*sin(1.9*t)). In channel 2 and channel 3 I calculated the average cyclic maximum and minimum (General  Sine shape, Minimum peak height 1 S.D.). All maxima were nicely marked with event markers. Then I combined the traces for the maxima and minima with the data (see attached graph). All "small" maxima that lie between two larger maxima are missed. The (green) trace for the minima is following the minima of the red trace more accurately.
Is this really the intended behaviour? I would think that most people will expect that the maximatrace would show the maxima as the minimatrace is showing the minima.
All the best,
Klaus
 Attachments

 MaxMin_example.jpg (372.45 KiB) Viewed 589 times
Re: Avg. Cyclic Maximum vs. "True" Cyclic Maximum
Hi Klaus,
Yes, the graph you show really is the expected behavior of the Cyclic Maximum channel calculation, as you will see if you look carefully at the what the maximum value is in the regions between each peak, i.e. the maximum from one peak up to, but not including the sample at the next peak.
It seems that you would like to see the values at each peak expanded out into a step, rather than the maximum between peaks.
One way to do this is to change Cyclic Measurements to trigger on the minimums, by clicking on the Customise... button. This means that the Cyclic Maximum calculation will give the maximums between the minimums, which is what you want.
Alternatively, you can set up Cyclic Measurements to detect maximums and use an Arithmetic expression in another channel like:
where cm1 gives the events detected by Cyclic Measurements on channel 1, and the valueAtEvent() function returns the value of channel 1 at those events.
I have attached a file that demonstrates using the latter technique to calculate the maximums.
In this file, I have also calculated the minimums, but by using the Cyclic Minimum calculated between the Maximum peaks, i.e. a technique for calculating peak minimums that corresponds to the first technique of using the Maximum between the Minimum peaks.
Yes, the graph you show really is the expected behavior of the Cyclic Maximum channel calculation, as you will see if you look carefully at the what the maximum value is in the regions between each peak, i.e. the maximum from one peak up to, but not including the sample at the next peak.
It seems that you would like to see the values at each peak expanded out into a step, rather than the maximum between peaks.
One way to do this is to change Cyclic Measurements to trigger on the minimums, by clicking on the Customise... button. This means that the Cyclic Maximum calculation will give the maximums between the minimums, which is what you want.
Alternatively, you can set up Cyclic Measurements to detect maximums and use an Arithmetic expression in another channel like:
Code: Select all
valueAtEvent(ch1,cm1)
I have attached a file that demonstrates using the latter technique to calculate the maximums.
In this file, I have also calculated the minimums, but by using the Cyclic Minimum calculated between the Maximum peaks, i.e. a technique for calculating peak minimums that corresponds to the first technique of using the Maximum between the Minimum peaks.
 Attachments

 PeakMaxsAndMins.adicht
 (140.5 KiB) Downloaded 34 times
Kit Adams Ph.D
Chief Architect Windows, ADInstruments, New Zealand
Chief Architect Windows, ADInstruments, New Zealand
Re: Avg. Cyclic Maximum vs. "True" Cyclic Maximum
Hi Kit,
with the explanation by you and Amy I do now understand how the cyclic maximum is calculated. But I still think that this is not the expected result if one looks into the LabChart helpfile (see below). Anyway, with your workaround we can calculate our maxima.
Best,
Klaus
with the explanation by you and Amy I do now understand how the cyclic maximum is calculated. But I still think that this is not the expected result if one looks into the LabChart helpfile (see below). Anyway, with your workaround we can calculate our maxima.
Best,
Klaus
 Attachments

 CyclicMax.jpg (12.28 KiB) Viewed 557 times