|
Developer Documentation |
|||||||||
prev file | next file | ||||||||||
SUMMARY: fields | routine DETAILS: routine | ||||||||||
./guide accum.pro
accum |
procedure accum[, accumnum], [weight=float], [dc=spectrum or integer] |
This procedure adds a data container to an accum buffer, in preparation for averaging. The primary data container (!g.s[0], the PDC) is used by default but an alternate data container can be specified using the 'dc' keyword.
The first data container accum'ed in a buffer is used as a template for that buffer and subsequent data containers accum'ed to that buffer must match in number of channels. On subsequent uses of accum, a warning is printed if the channel spacing (frequency_interval) or frequency resolution differs from the values already in the buffer. The accumulation proceeds even when a warning is printed. Use resample to change the frequency_interval and gsmooth to change the frequency_resolution.
There are four accum buffers available to this and related GUIDE-layer procedures. Users can use these to have several averages proceeding simultaneously, but separately, when it is useful to do so (e.g. polarizations). Use the accumnum keyword to specify which buffer to use (defaults to 0).
The default weight for each spectrum is exposure*frequency_resolution/Tsys^2. A different weight can be given using the weight keyword. Alternatively, each channel can be given a separate weight by providing a vector of weights in the weight argument. In that case, the number of elements in weight must be the same as in the data. This can be used to re-start an accum from a previous average where the weight was retrieved from that average. See ave for more details. See dcaccum for additional information on how the header parameters are weighted during the accumulation.
Blanked channels (Not a Number data values) are excluded from the average. An entirely blanked spectrum (all values are NaNs - e.g. bad lags from the GBT spectrometer) is completely ignored by the accumulation (the contents of that accum buffer are unchanged).
sclear getrec,1 accum getrec,2 accum ave
Average two polarizations separately for some position switched scans
sclear ; clears accum buffer 0 sclear, 1 ; clears accum buffers 1 getps,32,plnum=0 accum, 0 getps,32,plnum=1 accum, 1 getps,34,plnum=0 accum, 0 getps,34,plnum=1 accum, 1 ave,1 ; Average plnum=1 data and store ; the result in the PDC copy,0,1 ; Copy the result to DC 1 ave, 0 ; Average plnum=0 data oshow, 1 ; Overplot the plnum=1 average
Average some data, remember the vector weights at the average, and then average some more data.
sclear getrec,1 accum getrec,2 accum ave, wtarray=wtave1_3 copy, 0, 10 ; save average for later use sclear ; no necessary, but better to be sure getrec,3 accum getrec,4 accum ave, wtarray=wtave3_4 copy, 0, 11 ; save this for later use ; other things could happen here ; average 11 and 10 using appropriate weighting ; they might not be scalars if some part of each was flagged or ; blanked sclear accum, dc=10, weight=wtave1_3 accum, dc=11, weight=wtave3_4 ave, wtarray=wtave_all4
Parameters | |
accumnum |
accum buffer. Defaults to the primary buffer (accumnum = 0). There are 4 buffers in all so this value must be between 0 and 3, inclusive. |