|
Developer Documentation |
|||||||||
| prev file | next file | ||||||||||
| SUMMARY: fields | routine DETAILS: routine | ||||||||||
./toolbox accumave.pro
| accumave |
procedure accumave, accumbuf, dc, [/noclear], [/quiet], [wtarray=variable], [count=variable] |
Get the average from an ongoing accumulation.
The dc argument will contain the result. The wtarray keyword will contain the value of the weight array used at the time of the average. This can be used in a subsequent dcaccum or accum call.
The contents of the accum buffer are cleared as a consequence of calling accumave, unless the noclear keyword is set.
Note: It is a good idea to use accumclear to clear the accum buffer before using it the first time so that you can be certain it is starting from a cleared (empty) state.
Note: The frequency_resolution in dc will be the maximum resolution in all of the data containers used in the accumulation.
a = {accum_struct}
accumclear, a ; not necessary here, but good practice
get,index=1
dcaccum, a, !g.s[0]
get,index=2
dcaccum, a, !g.s[0]
accumave, a, myavg
show, myavg
data_free, myavg ; be sure and clean up when done
; or the same step at the end, but get the average
; note that the previous dcaccum etc. must be repeated here
; since accumave cleared the average
accumave, a, myavg, wtarray=myweight
show, myavg
data_copy, myavg, mywt
setdcdata, mywt, wtarray ; put the weight array in a copy of the data
show, mywt ; show the weight array
; clean up when done
data_free, myavg
data_free, mywt
Note: the accum_struct structure used here has internal pointers. Use sclear to clear them, either implicitly (by use of accumave) or explicitly.
| Parameters | |
|
accumbuf |
The accumulation buffer to use. |
|
dc |
The resulting average. |