Reducing the size of an array by averaging points within the array (IDL) -
while sure there answer, , question low-level (but it's easy things trip up), main issue trying word question.
say have following arrays:
time=[0,1,2,3,4,5,6,7,8,9,10,11] ;in seconds data=[0,1,2,3,4,5,6,7,8,9,10,11]
the 'time' array in bins of '1s', instead array in bins of '2s' data mean:
time=[0,2,4,6,8,10] ;in seconds data=[0.5,2.5,4.5,6.5,8.5,10.5]
is there (and sure there is) idl function implement in idl? actual data array is:
data double = array[15286473]
so rather use existing, efficient, solution unnecessarily creating own.
cheers, paul
nb: can change time array want interpolating data (interpol)
idl> x=[0,1,2,3,4,5,6,7,8,9,10] idl> x_new=interpol(x,(n_elements(x)/2)+1.) idl> print, x_new 0.00000 2.00000 4.00000 6.00000 8.00000 10.0000
the issue data array
i think need rebin
: http://www.exelisvis.com/docs/rebin.html
congrid
provides similar functionality. if rebin
not solve problem, should work:
step = 2 select = step * indgen(floor(n_elements/step)) new_time = (smooth(time, step))[select] new_data = (smooth(data, step))[select]
you might want set /edge_truncate smooth, based on requirements. also, won't interpol work you?