SimulateInspiral.h

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Teviet Creighton
00003 *
00004 *  This program is free software; you can redistribute it and/or modify
00005 *  it under the terms of the GNU General Public License as published by
00006 *  the Free Software Foundation; either version 2 of the License, or
00007 *  (at your option) any later version.
00008 *
00009 *  This program is distributed in the hope that it will be useful,
00010 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 *  GNU General Public License for more details.
00013 *
00014 *  You should have received a copy of the GNU General Public License
00015 *  along with with program; see the file COPYING. If not, write to the
00016 *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00017 *  MA  02111-1307  USA
00018 */
00019 
00020 /************************ <lalVerbatim file="SimulateInspiralHV">
00021 Author: Creighton, T. D.
00022 $Id: SimulateInspiral.h,v 1.4 2007/06/08 14:41:47 bema Exp $
00023 **************************************************** </lalVerbatim> */
00024 
00025 /********************************************************** <lalLaTeX>
00026 
00027 \section{Header \texttt{SimulateInspiral.h}}
00028 \label{s:SimulateInspiral.h}
00029 
00030 Provides a routine to inject inspirals into time series data.
00031 
00032 \subsection*{Synopsis}
00033 \begin{verbatim}
00034 #include <lal/SimulateInspiral.h>
00035 \end{verbatim}
00036 
00037 The routines in \verb@GeneratePPNInspiral.h@,
00038 \verb@SimulateCoherentGW.h@, and \verb@Inject.h@ provide a powerful
00039 mechanism for simulating the instrumental response to a physical
00040 inspiral event, including such considerations as the polarization
00041 response and propagation delay for a particular instrument, which are
00042 necessary if one wants to model coincident detection in a network of
00043 detectors.  In many cases, though, one simply wants to generate a
00044 signal with a given signal-to-noise ratio and a given coalescence
00045 time, and inject it into a time series.  This header provides a
00046 steamlined interface to accomplish this with a minimum of fuss to the
00047 user.
00048 
00049 In order to provide this streamlined interface, two calculations have
00050 to be internalized.  First, the waveform must be time-shifted so that
00051 it coalesces at the specified time.  This is straightforward and
00052 requires no explanation.  Second, the waveform must be scaled to have
00053 some specified amplitude.  To do this, we must first state what we
00054 mean by ``amplitude''.
00055 
00056 We define the \emph{characteristic detection amplitude} $A_c$ of a
00057 gravitational-wave signal to be its root summed squared contribution
00058 to the sampled detector output.  That is, if the detector output can
00059 be written as $o(t_k)=n(t_k)+s(t_k)$, where $n$ is the contribution
00060 due to noise, $s$ is the contribution due to signal, and $t_k=k\Delta
00061 t$ are the discrete time samples, then:
00062 \begin{equation}
00063 \label{eq:SimulateInspiralH:characteristic-amplitude}
00064 A_c \equiv \sqrt{\sum_{k=-\infty}^\infty |s(t_k)|^2} \;.
00065 \end{equation}
00066 If $T(f)$ is the detector transfer function (such that a gravitational
00067 have signal $\tilde{h}(f)$ in the frequency domain produces an output
00068 $\tilde{o}(f)=\tilde{n}(f)+T(f)\tilde{h}(f)$), the characteristic
00069 detection amplitude has the not-so-obvious relation that:
00070 \begin{equation}
00071 \label{eq:SimulateInspiralH:characteristic-gw-amplitude}
00072 A_c^2 = \int_{-\infty}^\infty \frac{df}{\Delta t}
00073         |T(f)\tilde{h}(f)|^2 \;.
00074 \end{equation}
00075 So why use this quantity to specify the signal amplitude?  First, it
00076 is easy for a simulation/injection routine to calculate.  Second, if
00077 we assume that $T(f)$ is a true whitening filter such that the output
00078 power spectral density is flat $S_o(f)=S_o=$constant, then the sampled
00079 noise output is uncorrelated noise with a mean of zero and a variance
00080 of $\sigma_n^2=S_o/2\Delta t$.  The intrinsic signal-to-noise power is
00081 then given by the simple relation:
00082 \begin{eqnarray}
00083 (h|h) & = & 2\int_{-\infty}^\infty df\,\frac{|\tilde{h}(f)|^2}{S_h(f)}
00084         \nonumber\\
00085       & = & 2\int_{-\infty}^\infty df\,\frac{|T(f)\tilde{h}(f)|^2}{S_o}
00086         \nonumber\\
00087       & = & \frac{A_c^2}{\sigma_n^2} \;.
00088         \label{eq:SimulateInspiralH:instrinsic-snr-power}
00089 \end{eqnarray}
00090 Thus to simulate a signal with an intrinsic signal-to-noise amplitude
00091 $\sqrt{(h|h)}$, simply fill a data vector with uncorrelated noise with
00092 variance $\sigma_n^2$ and inject a signal with a characteristic
00093 detection amplitude of $A_c=\sigma_n\sqrt{(h|h)}$.
00094 
00095 We refer the reader to the Conventions section at the end of this
00096 header documentation for a more detailed derivation of these
00097 specifications.
00098 
00099 ******************************************************* </lalLaTeX> */
00100 
00101 #ifndef _SIMULATEINSPIRAL_H
00102 #define _SIMULATEINSPIRAL_H
00103 
00104 #include <lal/LALStdlib.h>
00105 #include <lal/DetectorSite.h>
00106 #include <lal/SkyCoordinates.h>
00107 #include <lal/LALBarycenter.h>
00108 
00109 #ifdef  __cplusplus
00110 extern "C" {
00111 #pragma }
00112 #endif
00113 
00114 NRCSID( SIMULATEINSPIRALH, "$Id: SimulateInspiral.h,v 1.4 2007/06/08 14:41:47 bema Exp $" );
00115 
00116 /********************************************************** <lalLaTeX>
00117 \subsection*{Error conditions}
00118 ****************************************** </lalLaTeX><lalErrTable> */
00119 #define SIMULATEINSPIRALH_ENUL 1
00120 #define SIMULATEINSPIRALH_EMEM 2
00121 #define SIMULATEINSPIRALH_EDF  3
00122 #define SIMULATEINSPIRALH_EBAD 4
00123 
00124 #define SIMULATEINSPIRALH_MSGENUL "Unexpected null pointer in arguments"
00125 #define SIMULATEINSPIRALH_MSGEMEM "Memory allocation error"
00126 #define SIMULATEINSPIRALH_MSGEDF  "Transfer frequency interval is zero"
00127 #define SIMULATEINSPIRALH_MSGEBAD "Bad parameters: ac and dEff are negative"
00128 /******************************************** </lalErrTable><lalLaTeX>
00129 
00130 \subsection*{Types}
00131 
00132 \subsubsection*{Structure \texttt{SimulateInspiralParamStruc}}
00133 \idx[Type]{SimulateInspiralParamStruc}
00134 
00135 \noindent This structure stores the parameters required to simulate a
00136 set of inspiral signal in white Gaussian noise.  It can be part of a
00137 linked list of inspiral events, to allow for multiple injections.  It
00138 consists of the following fields:
00139 
00140 \begin{description}
00141 \item[\texttt{LIGOTimeGPS timeC}] The time of coalescence.
00142 
00143 \item[\texttt{REAL4 phiC}] The wave phase at coalescence, in radians.
00144 
00145 \item[\texttt{REAL4 mass1, mass2}] The masses of the binary
00146 components, in $M_\odot$.
00147 
00148 \item[\texttt{REAL4 signalAmplitude, effDist}] The characteristic
00149 detection amplitude $A_c$, in ADC counts, and the effective distance
00150 in Mpc of an optimally-oriented source that would give that amplitude.
00151 A negative number means the quantity is unspecified.  In general only
00152 one of these must be specified by the user; the simulation routine
00153 will set the other to be consistent with the first.
00154 
00155 \item[\texttt{REAL4 fStart}] The lower cutoff frequency at which
00156 waveform generation will begin, in Hz.  If $\leq0$, the cutoff
00157 frequency will be taken as the point where the instrument sensitivity
00158 function is $\sim10^{-6}$ of its optimal value, as determined from the
00159 transfer function.
00160 
00161 \item[\texttt{SimulateInspiralParamStruc *next}] Pointer to another
00162 inspiral event to be injected, or \verb@NULL@ if this is the last (or
00163 only) injection.
00164 \end{description}
00165 
00166 ******************************************************* </lalLaTeX> */
00167 
00168 typedef struct tagSimulateInspiralParamStruc {
00169   LIGOTimeGPS timeC;      /* time of coalescence */
00170   REAL4 phiC;             /* phase at coalescence */
00171   REAL4 mass1, mass2;     /* binary masses (solar masses) */
00172   REAL4 signalAmplitude;  /* characteristic amplitude (counts) */
00173   REAL4 effDist;          /* effective distance (Mpc) */
00174   REAL4 fStart;           /* waveform start frequency (Hz) */
00175   struct tagSimulateInspiralParamStruc *next; /* next node in list */
00176 } SimulateInspiralParamStruc;
00177 
00178 /********************************************************** <lalLaTeX>
00179 
00180 \subsection*{Conventions}
00181 
00182 We define here the conventions we use when talking about
00183 signal-to-noise ratios in coloured and white noise.  You may also want
00184 to read the signal processing conventions in Secs.~.1.1 and~.1.2 of
00185 the \verb@findchirp@ package, since this section is esentially a
00186 summary and extension of those conventions.
00187 
00188 \subsubsection*{Signal-to-noise definitions}
00189 
00190 We first reiterate the standard definitions (given in the
00191 \verb@findchirp@ package) of the Fourier transform pair:
00192 \begin{equation}
00193 \label{eq:SimulateInspiralH:fourier-transforms}
00194 \tilde{a}(f) = \int_{-\infty}^\infty dt\,a(t)e^{-2\pi ift}
00195 \qquad\rightleftharpoons\qquad
00196 a(t) = \int_{-\infty}^\infty df\,\tilde{a}(f)e^{2\pi ift} \;,
00197 \end{equation}
00198 of the power spectral density $S_n(f)$ of a stationary random process
00199 (noise) $n(t)$:
00200 \begin{equation}
00201 \label{eq:SimulateInspiralH:noise-psd}
00202 \langle\tilde{n}(f)\tilde{n}^*(f')\rangle
00203         = \frac{1}{2}S_n(f)\delta(f-f')
00204 \end{equation}
00205 (where $\langle\ldots\rangle$ denotes an enseble average over
00206 instantiations of the random process), and finally of the
00207 noise-weighted inner product $(a|b)$ of two time series $a(t)$ and
00208 $b(t)$:
00209 \begin{equation}
00210 \label{eq:SimulateInspiralH:inner-product}
00211 (a|b) = \int_{-\infty}^\infty df\,\frac{\tilde{a}(f)\tilde{b}(f)^*
00212         + \tilde{a}(f)^*\tilde{b}(f)}{S_n(f)} \;.
00213 \end{equation}
00214 In the case where the time series are all real and the noise has zero
00215 mean $\langle n(t)\rangle=0$, the weighting on the inner product leads
00216 to the property that:
00217 \begin{equation}
00218 \label{eq:SimulateInspiralH:inner-product-normalisation}
00219 \langle(n|s)^2\rangle = (s|s) \;.
00220 \end{equation}
00221 We call this quantity the \emph{intrinsic signal-to-noise power} of
00222 the waveform $s(t)$, and its square root $\sqrt{(s|s)}$ the
00223 \emph{intrinsic signal-to-noise amplitude}.
00224 
00225 In the theory of signal processing, if one has a data stream
00226 $o(t)=n(t)+s(t)$ and can determine a \emph{matched filter}
00227 $a(t)\propto s(t)$, one can then define a signal-to-noise estimator
00228 $r=(o|a)/\sqrt{(a|a)}$ with the property that $\langle
00229 r\rangle=\sqrt{(s|s)}$ and $\sigma_r=\sqrt{\langle r^2\rangle-\langle
00230 r\rangle^2}=1$ (these follow from
00231 Eq.~(\ref{eq:SimulateInspiralH:inner-product-normalisation}) and
00232 $\langle n\rangle=0$).  This is the justification for calling
00233 $\sqrt{(s|s)}$ a signal-to-noise ratio.
00234 
00235 However, in many cases one can only define a set of orthogonal
00236 waveforms $\{a_1,\ldots,a_N:(a_i|a_j)=(a_i|a_i)\delta_{ij}\}$ spanning
00237 the space of possible signals.  Specifically, for inspiral signals,
00238 one does not know in advance the phase of the waveform, and so one
00239 must filter the data using two orthogonal waveforms $\{a_s,a_c\}$ (the
00240 sine and cosine quadratures) that are $90^\circ$ out of phase.  As
00241 described in the
00242 \verb@FindChirp.h@ header, the optimal statistic in this case is:
00243 \begin{equation}
00244 \label{eq:SimulateInspiralH:rhosq}
00245 \rho^2 = \frac{(o|a_s)^2}{(a_s|a_s)} + \frac{(o|a_c)^2}{(a_c|a_c)}
00246 \end{equation}
00247 (where we have implicitly already maximised over any filter
00248 parameters, including time-of-arrival).  This statistic no longer has
00249 unit variance, but instead has the property that:
00250 \begin{equation}
00251 \label{eq:SimulateInspiralH:rhosq-expectation}
00252 \langle\rho^2\rangle = 2 + (s|s)\;.
00253 \end{equation}
00254 By comparison, for the perfectly-matched filter one has $\langle
00255 r^2\rangle=1+(s|s)$, which is why one often says that the search over
00256 phase halves the effective signal-to-noise power.  However, this
00257 statement is ambiguous, as the two statistics $\rho$ and $r$ have
00258 completely diffferent probability distributions in the presence of
00259 noise, and even in the absence of any signal we have
00260 $\langle\rho\rangle>0$ (its value depends on the particular noise
00261 probability distribution).
00262 
00263 \subsubsection*{Specification to white noise}
00264 
00265 White noise is stationary zero-mean noise whose power spectral density
00266 $S_n(f)$ is independent of $f$.  This property allows inner products
00267 to be expressed equivalently in the time domain as well as in the
00268 frequency domain:
00269 \begin{equation}
00270 \label{eq:SimulateInspiralH:inner-product-time}
00271 (a|b) = \int_{-\infty}^\infty dt\,\frac{a(t)b(t)^* + a(t)^*b(t)}{S_n} \;.
00272 \end{equation}
00273 If the white noise process $n(t)$ is discretely sampled at intervals
00274 $\Delta t$, we find that different time samples are uncorrelated:
00275 \begin{equation}
00276 \label{eq:SimulateInspiralH:noise-correlation}
00277 \langle n(t_j)n(t_{j'})^*\rangle = \sigma_n^2 \delta_{jj'} \;,
00278 \end{equation}
00279 where $\sigma_n^2$ is the variance in the sampled noise.  This can be
00280 proven using the definitions of the discrete inverse FFT and discrete
00281 power spectrum given in Eqs.~(.9) and~(.19) of the \verb@findchirp@
00282 package:
00283 \begin{eqnarray}
00284 \langle n(t_j)n(t_{j'})^*\rangle
00285 & = & \frac{1}{N^2}\sum_{k=0}^{N-1}\sum_{k'=0}^{N-1}
00286         e^{2\pi i(jk-j'k')/N} \langle\tilde{n}_k\tilde{n}_{k'}\rangle
00287         \nonumber\\
00288 & = & \frac{1}{N^2}\sum_{k=0}^{N-1}\sum_{k'=0}^{N-1}
00289         e^{2\pi i(jk-j'k')/N} \frac{N}{2\Delta t}S_n\delta_{kk'}
00290         \nonumber\\
00291 & = & \frac{S_n}{2N\Delta t}\sum_{k=0}^{N-1} e^{2\pi i(j-j')k/N}
00292         \nonumber\\
00293 & = & \frac{S_n}{2\Delta t}\delta_{jj'} \;,\nonumber
00294 \end{eqnarray}
00295 whence we have $\sigma_n^2=S_n/2\Delta t$.  We note that the
00296 divergence as $\Delta t\rightarrow0$ reflects the fact that the
00297 idealized white power spectral density integrates to an infinite
00298 amount of power as $f\rightarrow\infty$.  Real noise processes always
00299 have some minimum timescale below which correlations between
00300 subsequent measurements are inevitable.
00301 
00302 Reexpressing the inner product in
00303 Eq.~(\ref{eq:SimulateInspiralH:inner-product-time}) for
00304 discretely-sampled time series, we have:
00305 \begin{equation}
00306 \label{eq:SimulateInspiralH:inner-product-sampled}
00307 (a|b) = \sum_k \Delta t\,\frac{a(t_k)b(t_k)^* + a(t_k)^*b(t_k)}{S_n}
00308       = \frac{\mathrm{Re}\left[\sum_k
00309                 a(t_k)b(t_k)^*\right]}{\sigma_n^2} \;.
00310 \end{equation}
00311 The intrinsic signal-to-noise amplitude also takes an intuitive form:
00312 \begin{equation}
00313 \label{eq:SimulateInspiralH:snr-sampled}
00314 \sqrt{(s|s)} = \frac{\sqrt{\sum_k |s(t_k)|^2}}{\sigma_n}
00315 \end{equation}
00316 This, then, is the key formula that we will use to determine the
00317 signal-to-noise amplitude of a whitened signal that is to be injected
00318 into white noise.  It applies to any stationary white noise (recall
00319 that ``white'' implies zero mean), but we will almost always be
00320 concerned with white Gaussian noise, where the differential
00321 probability of a noise sample $n(t_k)$ lying in an infinitesimal range
00322 $(n,n+dn)$ is:
00323 \begin{equation}
00324 \label{eq:SimulateInspiralH:gaussian-pdf}
00325 \frac{dP[n(t_k)\in(n,n+dn)]}{dn} = \frac{1}{\sqrt{2\pi\sigma_n^2}}
00326         e^{-n^2/2\sigma_n^2} \;.
00327 \end{equation}
00328 
00329 ******************************************************* </lalLaTeX> */
00330 
00331 /* <lalLaTeX>
00332 \vfill{\footnotesize\input{SimulateInspiralHV}}
00333 </lalLaTeX> */
00334 
00335 
00336 /* Function prototypes. */
00337 
00338 /* <lalLaTeX>
00339 \newpage\input{SimulateInspiralC}
00340 </lalLaTeX> */
00341 void
00342 LALSimulateInspiral( LALStatus                  *,
00343                      REAL4TimeSeries            *output,
00344                      COMPLEX8FrequencySeries    *transfer,
00345                      SimulateInspiralParamStruc *params );
00346 
00347 /* <lalLaTeX>
00348 %\newpage\input{SimulateInspiralTestC}
00349 </lalLaTeX> */
00350 
00351 #ifdef  __cplusplus
00352 #pragma {
00353 }
00354 #endif
00355 
00356 #endif /* _SIMULATEINSPIRAL_H */

Generated on Sun Oct 12 02:32:27 2008 for LAL by  doxygen 1.5.2