Function:

`void extract_signal(int average, float *in1, float *in2, int n,
float delta_t, double *whiten1, double *whiten2, double *signal12)`

This function calculates the real-time cross-correlation spectrum
of the unwhitened data streams and ,
using a Hann window and averaging the spectrum for two overlapped
data sets, if desired.

The arguments of `extract_signal()` are:

`average:`Input. An integer variable that should be set equal to 1 if the values of the real-time cross-correlation spectra corresponding to two overlapped data sets are to be averaged.`in1:`Input.`in1[0..n-1]`is an array of floating point variables containing the values of the assumed continuous-in-time whitened data stream produced by the first detector. is the convolution of detector whitening filter with the data stream , where is the gravitational strain and is the noise intrinsic to the detector. The variables`in1[]`have units of rHz (or ), which follows from the definition of as a strain and as the ``inverse'' of the square root of the noise power spectrum .`in1[i]`contains the value of evaluated at the discrete time , where .`in2:`Input.`in2[0..n-1]`is an array of floating point variables containing the values of the assumed continuous-in-time whitened data stream produced by the second detector, in exactly the same format as the previous argument.`n:`Input. The number of data points corresponding to an observation time , where is the sampling period of the detectors, defined below. should equal an integer power of 2.`delta_t:`Input. The sampling period (in sec) of the detectors.`whiten1:`Input.`whiten1[0..n-1]`is an array of double precision variables containing the values of the real and imaginary parts of the spectrum of the whitening filter of the first detector. These variables have units (or ), which are inverse to the units of the square root of the noise power spectrum .`whiten1[2*i]`and`whiten1[2*i+1]`contain, respectively, the values of the real and imaginary parts of evaluated at the discrete frequency , where .`whiten2:`Input.`whiten2[0..n-1]`is an array of double precision variables containing the values of the real and imaginary parts of the spectrum of the whitening filter of the second detector, in exactly the same format as the previous argument.`signal12:`Output.`signal12[0..n/2-1]`is an array of double precision variables containing the values of the real-time cross-correlation spectrum

(11.16.244) `signal12[i]`contains the value of evaluated at the discrete frequency , where .

`extract_signal()` calculates the real-time cross-correlation
spectrum
as follows:

- (i)
- It first stores the input data streams and
in the last
two-thirds of internally-defined static buffers
`buf1[0..3*n/2-1]`and`buf2[0..3*n/2-1]`. The first one-third of these buffers contains the input data left over from the previous call. - (ii)
- It then multiplies the first two-thirds of these buffers
by the Hann window function:

(11.16.245) *Numerical Recipes in C*, p.553. It is needed to offset the reduction in power that is introduced by the windowing. - (iii)
- The windowed data is then Fourier transformed into the frequency domain, where it is unwhitened by dividing by the (complex) spectra and , which represent the whitening filters of the two detectors. The resulting unwhitened frequency components are denoted by and ; the superscript indicates that we are analyzing the first of two overlapped data sets.
- (iv)
- The real-time cross-correlation spectrum is then calculated
according to:

(11.16.246) - (v)
- The data contained in the last two-thirds of the buffers is then copied to the first two-thirds of the buffers, and steps (ii)-(iv) are repeated, yielding a second real-time cross-correlation spectrum .
- (vi)
- If average=1,
is given by:

(11.16.247) - (vii)
- Finally, the data contained in the last two-thirds of the
buffers is again copied to the first two-thirds, in preparation for the
next call to
`extract_sb()`. The data saved in the first one-third of these buffers will match onto the next input data streams if the input data from one call of`extract_sb()`to the next is continuous.

Note: One should call `extract_sb()` with
, when one suspects that the current input data is
*not* continuous with the data that was saved from the previous call.
This is because a discontinuity between the ``old'' and ``new'' data
sets has a tendency to introduce spurious large frequency components
into the real-time cross-correlation spectrum, which should not be present.
Since a single input data stream by itself is continuous,
the cross-correlation spectrum
(which is
calculated on the second pass through the data) will be free of these
spurious large frequency components.
This is why we set
equal to
--and not equal to
--when
.

- Authors: Bruce Allen, ballen@dirac.phys.uwm.edu, and Joseph Romano, romano@csd.uwm.edu
- Comments: Although it is possible and more efficient to write a single function to extract the real-time detector noise power and cross-correlation signal spectra simultaneously, we have chosen--for the sake of modularity--to write separate functions to perform these two tasks separately. (See also the comment at the end of Sec. .)