In file No file:

int avg (const avg_specs* average_details, int number_of_sets, const float* input_data, int* number_so_far, float* averaged_data)

This function averages real or complex data arrays

Documentation

This function averages real or complex data arrays. Any length of array is supported. Memory space for the data arrays must be allocated by the calling routine. Input and output data is all of type float. For complex input / output, data must be arranged as re part, im part, re part, im part.. until the end of the dataset is reached. The structure avg_complex can help with this. To use the function, the first time you run it, set number_so_far to zero. The structure average_details should contain parameters indicating the type of average and the input data format. if the output data or the input data is complex, space should be allocated for dataset_length * sizeof(avg_complex) at the relevant pointer. Below are definitions of the different average types. AVG_LINEAR_MODULUS. If there are n real / complex elements in each input array, the output for each element is the linear average of the amplitudes of the input elements. For complex input data, the amplitude is the sum in quadrature of the real and complex parts. AVG_EXPON_MODULUS. Same as above, but use an exponential average as defined in 4) below. AVG_LINEAR_VECTOR. For complex input data only. Find an n element array of complex numbers. For the real parts, the elements are the linear average of the real parts of the input data. For the imaginary parts, the output elements are the linear average of the imaginary parts of the input data. AVG_EXPON_VECTOR. Same as above, but take the exponential average as defined in 4) below. AVG_LINEAR_SQUARE. Calulates the root-mean-square rather than a straight average. For complex input data calculates the rms of the modulus. AVG_EXPON_SQUARE. Same as above, but take the exponential average as defined in 4) below.

Returns:
s 0 if successful, -ve if error.
Parameters:
average_details - A structure of type avg_specs. It has 4 elements, all integer - 1) avg_type , one of AVG_LINEAR_MODULUS AVG_EXPON_MODULUS, AVG_LINEAR_VECTOR and AVG_EXPON_VECTOR. 2) dataset_length, the number of elements in the input and output data arrays. 3) data_type, DATA_REAL or DATA_COMPLEX. 4) number_of_averages. The number used in the formula for exponential averages. If number_of_averages = N, the previously averaged data is dminus, the newly computed set of averaged data is dplus, and the data to be added to the average is dnew, then the formula for dplus is dplus = ((n-1)dminus + dnew)/n
number_of_sets - in AVG_ACQUIRE mode more than one data set can be averaged with existing data. This parameter determines how many sets you are adding in a single call to avg. To use this feature, the input_data should consist of the many sets of data to be simultaneously averaged placed end-on-end in a single floating point array.
number_so_far - The number of data sets added so far. Increments by one each time new data is added to the stack.
input_data - A pointer to the input data array
averaged_data - A pointer to the array containing the results of averaging.
Author:
Edward Daw, 11th June 1999.

alphabetic index hierarchy of classes


Please send questions and comments to zweizig_j@ligo.caltech.edu


generated by doc++