Next: Function: monte_carlo()
Up: GRASP Routines: Stochastic background
Previous: Function: simulate_sb()
Contents
Function: combine_data()
0
void combine_data(int which, int n, float *in1, float *in2,
float *out)
This lowlevel function takes two arrays as input, shifts them by half
their length, and combines them with one another and with data stored in
an internallydefined static buffer to produce output data that is
continuous from one call of combine_data() to the next.
The arguments of combine_data() are:
 which: Input.
An integer variable specifying which internallydefined static
buffer should be used when combining the input arrays with data
saved from a previous call.
The allowed values are
.
 n: Input.
The number of data points contained in the input and output arrays.
is assumed to be even.
 in1: Input.
in1[0..n1] is an array of floating point variables containing
the values of the first input array.
 in2: Input.
in2[0..n1] is an array of floating point variables containing
the values of the second input array.
 out: Output.
out[0..n1] is an array of floating point variables
containing the output data, which is continuous from one call of
combine_data() to the next.
combine_data() produces continuous output data by modifying
the appropriately chosen static buffer buf[0..3*n/21] as follows:
The values of the output array out[0..n1] are taken from the
first twothirds of the buffer, while the last onethird of the buffer
is copied to the first third of the buffer in preparation for the
next call.
When this is complete, the last twothirds of the buffer is cleared.
One nice feature of combining the data with a sine function
(rather than with a triangle function, for example) is that if the
input data represent statistically independent, stationary random
processes having zero mean and the same variance, then the output
data will also have zero mean and the same variance.
This is a consequence of the trigonometric identity

(11.11.239) 
Thus, combine_data() preserves the first and secondorder
statistical properties of the input data when constructing the output.
 Authors:
Bruce Allen, ballen@dirac.phys.uwm.edu, and Joseph Romano, romano@csd.uwm.edu
 Comments:
In the context of stochastic background simulations, the two input arrays
would represent two whitened data streams produced by a single detector,
which are then timeshifted and combined to simulate continuousintime
detector output.
Since the contents of the internallydefined static buffer are equal
to zero when combine_data() is first called, the amplitude of the
output array initially builds up from zero to its nominal value over the
course of the first data points.
This corresponds to an effective ``turnon'' transient, with turnon time
equal to ( being the time between successive data
samples).
Next: Function: monte_carlo()
Up: GRASP Routines: Stochastic background
Previous: Function: simulate_sb()
Contents
Bruce Allen
20001119