# Time Averaging?

Hi there, I'm a fairly novice IGOR user--I've gone through all of the Guided Tours but I can't seem to figure out how to do a time average.

I currently have 1 minute data that I would like to average to 5 minutes. Is there an IGOR function that can do this, or procedure out there that is available?

Thanks!

In reply to by olelytken

The original question is vague. I interpreted it to mean that the data wave is sampled at one-minute intervals, and a running average over 5 samples is desired. If this is the case, I would suggest that Smooth would be appropriate

`DisplayHelpTopic "Smooth"`

For single-pass boxcar (sliding average) smoothing, the command would look like

`Smooth/B  5, myDataWave`

Using a boxcar smoothing can be incorrect, because you end up with 5x more data points than actual information. You should at least set every value which is not a multiple of 5 points to NaN, in the above example.

Alternatively, the Histogram function can be exploited to retrieve time averages very quickly.  The downside is that it doesn't provide uncertainties for the averages. I have a fancier function for uncertainties if you are interested.

make /o TMP_COUNTS; Histogram /C /B={date2secs(2015,09,07) + 10*3600 + 50*60, 20, 1000} INPUT_TIMES TMP_COUNTS
make /o averagedWave; histogram /C /W=INPUT_DATA /B={date2secs(2015,09,07) + 10*3600 + 50*60, 20, 1000} INPUT_TIMES OUTPUT_AVG
OUTPUT_AVG /= TMP_COUNTS

In reply to by jcor

Joel,

I fail to understand your argument. Attached is a simple example of linear data with Gaussian noise, and its Smooth result

make/O/N=500 wave0
wave0 = x + gnoise(4)
duplicate/O wave0, wave00
smooth/B 5, wave0

A resulting graph is attached. Both waves have 500 points.

In reply to by s.r.chinn

I think Joel is making the case that the result of 5 point averaging should be condensed (decimated) into a wave that is only 1/5th the length, with each point representing the average of the 5-point window.

The Decimate procedure does this:

`#include <Decimation>`

Contains the Decimate procedure which creates an output wave by averaging every n points of the input wave down to a one point in the output wave.

Jim,

Thanks for that interpretation. Is there a quantifiable figure-of-merit that argues for one method over the other? In a counter-example (probably not appropriate to the slow 1-s sampling originally requested), rapidly sampled data is best smoothed by a matched filter to optimize signal-to-noise. Also, box-car averaging using hardware has been a well-known experimental technique for repetitive signals, using commercial instruments.

Perhaps Vanessa should consider using binomial smoothing with Smooth/BLPF[=roundMode ] if she has any idea about which high-frequencies are to be rejected from her data.