SCULIB_MAP_ALLAN_VARIANCE

incorporate latest set of MAP demodulated data into Allan variance

Description:

This routine incorporates a data slice into a run of data and updates the Allan variance of the run. The Allan variance is calculated for a range of simulated integration times for which artificial samples are calculated from the input data. The Allan variance for a particular integration time is calculated from:-
variance =i=1n1 (sample(i) sample(i + 1))2 2n (58)

where n is the number of artificial samples available.

Invocation

CALL SCULIB_MAP_ALLAN_VARIANCE (DEMOD, N_BOLS, N_SAMPLES, N_ALLAN_BOL, ALLAN_BOL, KMAX, SUM, N_SUM, ARTIFICIAL, N_ARTIFICIAL, ALLAN_VARIANCE, ALLAN_QUALITY, STATUS)

Arguments

DEMOD (4, N_BOLS, N_SAMPLES) = REAL (Given)
the demodulated data (data,-,-,quality)
N_BOLS = INTEGER (Given)
the number of bolometers taking data
N_SAMPLES = INTEGER (Given)
the number of samples taken for each bolometer
N_ALLAN_BOL = INTEGER (Given)
the number of bolometers whose data is to be averaged together at each sample position
ALLAN_BOL (N_ALLAN_BOL) = INTEGER (Given)
the positions in the demodulated data array of the bolometers whose measurements are to be used for the calculation of Allan variance
KMAX = INTEGER (Given)
the size of the Allan variance array
SUM (KMAX) = REAL (Given and returned)
the accumulator for current artificial sample of length K real samples
N_SUM (KMAX) = INTEGER (Given and returned)
the number of samples currently in the artificial sample accumulator
ARTIFICIAL (KMAX) = REAL (Given and returned)
the last artificial sample of length K samples that was calculated
N_ARTIFICIAL (KMAX) = INTEGER (Given and returned)
the number of artificial samples of length K samples that have been calculated
ALLAN_VARIANCE (KMAX) = REAL (Given and returned)
the Allan variance
ALLAN_QUALITY (KMAX) = INTEGER (Returned)
quality on the Allan variance
STATUS = INTEGER (Given and returned)
global status

Method

If status on entry is good the routine will:-

loop through the data samples to be incorporated -

loop through the bolometers whose data is to be averaged into this sample -

if the bolometer was measured - if the measurement had good quality -

add the measurement to the average for this sample

end if end if

end of loop

if any bolometers had good data for this sample -

calculate the sample average

loop through the Allan variances -

add the sample to the buffer used to calculate the latest artificial sample at the simulated integration time of this variance

if all the data has been obtained for the latest artificial sample -

calculate the artificial sample

if there is only one artificial sample for this simulated integration time we can’t calculate the Allan variance, so set its quality to bad

if there are 2 artifical samples then the Allan variance can be calculated from -

variance = (artificial_2 artificial_1)2 2 × 2 (59)

if there are more than 2 artificial samples

the sum of the squares of the differences between the previous samples is recovered from the current value of the Allan variance

the square of the difference between the current artificial sample and the previous one is added to the sum

the Allan variance is re-calculated

end if

the current artifical sample is stored to be used as the ‘previous’ sample next time round

the variables used to calculate the artificial samples at this simulated integration time are reset

end if

end of loop through Allan variances

end if

end of loop through samples in this dataslice

Copyright

Copyright ©1995,1996,1997,1998,1999 Particle Physics and Astronomy Research Council. All Rights Reserved.