LALInspiralWave.c

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 David Churches, Duncan Brown, Jolien Creighton, David McKechan, B.S. Sathyaprakash, Thomas Cokelaer
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="LALInspiralWaveCV">
00021 Author: Churches, D. K and Sathyaprakash, B.S. and Cokelaer. T
00022 $Id: LALInspiralWave.c,v 1.34 2008/08/13 12:13:04 whelan Exp $
00023 </lalVerbatim>  */
00024 
00025 /*  <lalLaTeX>
00026 
00027 \subsection{Module \texttt{LALInspiralWave.c} and \texttt{LALInspiralWaveTemplates.c}}
00028 
00029 Interface routine needed to generate all waveforms in the {\tt inspiral} package. 
00030 
00031 To generate a waveform 
00032 a user is noramlly required to (a) choose the binary parameters, starting frequency, number of
00033 bins of leading and trailing zero-padding, etc., in the structure {\tt InspiralTemplate params}
00034 and (b) call the following three functions in the order given:
00035 {\tt LALInspiralParameterCalc,} {\tt LALInspiralWaveLength,} and {\tt LALInspiralWave.} 
00036 Either a time- or a frequency-domain signal is returned depending upon the 
00037 {\tt approximant} requested (see Notes below).
00038 
00039 \subsubsection*{Prototypes}
00040 \vspace{0.1in}
00041 \input{LALInspiralWaveCP}
00042 \idx{LALInspiralWave()}
00043 \begin{itemize}
00044 \item {\tt signal:} Output containing the inspiral waveform.
00045 \item {\tt params:} Input containing binary chirp parameters.
00046 \end{itemize}
00047 
00048 \vspace{0.1in}
00049 \input{LALInspiralWaveTemplatesCP}
00050 \idx{LALInspiralWaveTemplates()}
00051 \begin{itemize}
00052 \item {\tt signal1:} Output containing the 0-phase inspiral waveform.
00053 \item {\tt signal2:} Output containing the $\pi/2$-phase inspiral waveform.
00054 \item {\tt params:} Input containing binary chirp parameters.
00055 \end{itemize}
00056 
00057 \subsubsection*{Description}
00058 
00059 The code \texttt{LALInspiralWave} is the user interface to the inspiral codes. It takes from the user all
00060 the physical parameters which specify the binary, and calls the relevent wave generation function.
00061 Currently nine different approximants are fully implemented. These are {\tt TaylorT1, TaylorT2,
00062 TaylorT3, TaylorF1, TaylorF2, PadeT1, EOB, BCV, SpinTaylorT3.}
00063 {\tt Taylor} approximants can all be generated at seven different post-Newtonian orders, 
00064 from Newtonian to 3.5 PN order, {\tt PadeT1} exists at order 1.5PN and higher, 
00065 {\tt EOB} at orders 2 and higher. {\tt SpinTaylorT3} is implemented only at 2PN order
00066 by solving the evolution equations for the spin and orbital angular momenta and a
00067 time-domain phasing formula. Finally, PN order is undefined for {\tt BCV.} 
00068 The approximant and the order are set up by the enums \texttt{Approximant} and \texttt{Order,}
00069 respectively.
00070 
00071 The waveforms are all terminated one bin before the last stable orbit is reached.
00072 The last stable orbit corresponding to a given {\tt Approximant} and {\tt Order} is
00073 defined as follows: For all {\tt Taylor} approximants at orders 0PN, 1PN and 1.5PN 
00074 $v_{\rm lso}^2=1/6,$ and at 2PN, 2.5PN, 3PN and 3.5PN 
00075 $v_{\rm lso}^2 = x^{\rm lso}_{T_4},$ where $x^{\rm lso}_{T_4}$ is 
00076 defined in Table \ref{table:energy}.  In the case of {\tt Pade} approximant
00077 at 1.5PN order $v_{\rm lso}^2=1/6,$ and at orders 2PN, 2.5PN, 3PN and 3.5PN
00078 $v_{\rm lso}^2 = x^{\rm lso}_{P_4},$ where $x^{\rm lso}_{P_4}$ is 
00079 defined in Table \ref{table:energy}. In the case of {\tt EOB} approximant,
00080 defined only at orders greater than 2PN, the plunge waveform is 
00081 terminated at the light-ring orbit defined by Equation~(\ref{eq:LightRing}).
00082 
00083 In the case of {\tt LALInspiralWaveTemplates} {\tt *signla1} 
00084 contains the `0-phase' inspiral template and {\tt *signal2} contains 
00085 a signal that is $\pi/2$ out of phase with respect to {\tt *signal1.}
00086 Currently, a template pair is generated only for the following {\tt approximants:}
00087 {\tt TaylorT1, TaylorT2, TaylorT3, PadeT1, EOB.}
00088 
00089 See the test codes for examples of how to generate different approximations.
00090 
00091 \subsubsection*{Algorithm}
00092 Simple use of {\tt switch} statement to access different PN approximations.
00093 
00094 \subsubsection*{Uses}
00095 Depending on the user inputs one of the following functions is called:\\
00096 \texttt{LALInspiralWave1\\}
00097 \texttt{LALInspiralWave2\\}
00098 \texttt{LALInspiralWave3\\}
00099 \texttt{LALInspiralStationaryPhaseApprox1\\}
00100 \texttt{LALInspiralStationaryPhaseApprox2\\}
00101 \texttt{LALEOBWaveform\\}
00102 \texttt{LALBCVWaveform\\}
00103 \texttt{LALInspiralSpinModulatedWave\\}
00104 
00105 \subsubsection*{Notes}
00106 
00107 \begin{itemize}
00108     \item A time-domain waveform is returned when the {\tt approximant} is one of
00109         {\tt TaylorT1, TaylorT2, TaylorT3, PadeT1, EOB, SpinTaylorT3}
00110     \item A frequency-domain waveform is returned when the {\tt approximant} is one of
00111         {\tt TaylorF1, TaylorF2, BCV}. 
00112          In these cases the code returns the real and imagninary parts of the 
00113          Fourier domain signal in the convention of fftw. For a signal vector 
00114          of length {\tt n=signal->length} ({\tt n} even):
00115      \begin{itemize}
00116          \item {\tt signal->data[0]} is the {\it real} 0th frequency component of the Fourier transform.
00117          \item {\tt signal->data[n/2]} is the {\it real} Nyquist frequency component of the Fourier transform.
00118          \item {\tt signal->data[k]} and {\tt signal->data[n-k],} for {\tt k=1,\ldots, n/2-1,} are
00119              the real and imaginary parts of the Fourier transform at a frequency $k\Delta f=k/T,$ $T$ being
00120              the duration of the signal and $\Delta f=1/T$ is the frequency resolution.
00121      \end{itemize}
00122 \end{itemize}
00123 \vfill{\footnotesize\input{LALInspiralWaveCV}}
00124 
00125 </lalLaTeX>  */
00126 
00127 #include <lal/LALInspiral.h>
00128 #include <lal/LALNoiseModels.h>
00129 #include <lal/LALStdlib.h>
00130 #include <lal/GeneratePPNInspiral.h>
00131 
00132 NRCSID (LALINSPIRALWAVEC, "$Id: LALInspiralWave.c,v 1.34 2008/08/13 12:13:04 whelan Exp $");
00133 
00134 /*  <lalVerbatim file="LALInspiralWaveCP"> */
00135 void 
00136 LALInspiralWave(
00137    LALStatus        *status,
00138    REAL4Vector      *signal,
00139    InspiralTemplate *params
00140    )
00141 { /* </lalVerbatim>  */
00142 
00143    INITSTATUS(status, "LALInspiralWave", LALINSPIRALWAVEC);
00144    ATTATCHSTATUSPTR(status);
00145 
00146    ASSERT (signal,  status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
00147    ASSERT (signal->length >= 2, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
00148    ASSERT (signal->data,  status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
00149    ASSERT (params,  status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
00150 
00151 
00152    ASSERT((INT4)params->approximant >= 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
00153    ASSERT((INT4)params->approximant < NumApproximants, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
00154    ASSERT((int)params->order >= 0, status, LALINSPIRALH_EORDER, LALINSPIRALH_MSGEORDER);
00155    ASSERT(params->order <= 8, status, LALINSPIRALH_EORDER, LALINSPIRALH_MSGEORDER);
00156 
00157    switch (params->approximant) 
00158    {
00159       case TaylorT1:
00160       case PadeT1:
00161            LALInspiralWave1(status->statusPtr, signal, params);
00162            CHECKSTATUSPTR(status);
00163            break;
00164       case TaylorT2:
00165            LALInspiralWave2(status->statusPtr, signal, params);
00166            CHECKSTATUSPTR(status);
00167            break;
00168       case TaylorT3:
00169            LALInspiralWave3(status->statusPtr, signal, params);
00170            CHECKSTATUSPTR(status);
00171            break;
00172       case EOB:
00173       case EOBNR:
00174            LALEOBWaveform(status->statusPtr, signal, params);
00175            CHECKSTATUSPTR(status);
00176            break;
00177       case BCV:
00178            LALBCVWaveform(status->statusPtr, signal, params);
00179            CHECKSTATUSPTR(status);
00180            break;
00181       case BCVSpin:
00182            LALBCVSpinWaveform(status->statusPtr, signal, params);
00183            CHECKSTATUSPTR(status);
00184            break;
00185       case TaylorF1:
00186            LALInspiralStationaryPhaseApprox1(status->statusPtr, signal, params); 
00187            CHECKSTATUSPTR(status);
00188            break;
00189       case TaylorF2:
00190       case FindChirpSP:
00191            LALInspiralStationaryPhaseApprox2(status->statusPtr, signal, params); 
00192            CHECKSTATUSPTR(status);
00193            break;
00194       case PadeF1:
00195            ABORT(status, LALINSPIRALH_ECHOICE, LALINSPIRALH_MSGECHOICE);
00196            break;
00197       case SpinTaylorT3:
00198            LALInspiralSpinModulatedWave(status->statusPtr, signal, params);
00199            CHECKSTATUSPTR(status);
00200            break;
00201       case SpinTaylor:
00202            /*GenerateTimeDomainWaveformForInjection (status->statusPtr, signal, params);
00203            CHECKSTATUSPTR(status);*/
00204            /* this generate the h+ waveform whereas the one above takes into
00205             * account h+, hx and orientation of the system*/
00206            LALSTPNWaveform(status->statusPtr, signal, params); 
00207            CHECKSTATUSPTR(status);
00208            break;
00209       case AmpCorPPN:
00210            LALInspiralAmplitudeCorrectedWave(status->statusPtr, signal, params);
00211            CHECKSTATUSPTR(status);         
00212            break;
00213       case Eccentricity:
00214            LALInspiralEccentricity(status->statusPtr, signal, params);
00215            CHECKSTATUSPTR(status);         
00216            break;
00217       default:
00218            ABORT( status, 9999, "Unknown case in switch." );
00219    }
00220 
00221    DETATCHSTATUSPTR(status);
00222    RETURN (status);
00223 }
00224 
00225 
00226 NRCSID (LALINSPIRALWAVETEMPLATESC, "$Id: LALInspiralWave.c,v 1.34 2008/08/13 12:13:04 whelan Exp $");
00227 
00228 /*  <lalVerbatim file="LALInspiralWaveTemplatesCP"> */
00229 void 
00230 LALInspiralWaveTemplates(
00231    LALStatus        *status,
00232    REAL4Vector      *signal1,
00233    REAL4Vector      *signal2,
00234    InspiralTemplate *params
00235    )
00236 { /* </lalVerbatim>  */
00237 
00238    INITSTATUS(status, "LALInspiralWaveTemplates", LALINSPIRALWAVETEMPLATESC);
00239    ATTATCHSTATUSPTR(status);
00240    
00241    ASSERT (signal1,  status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
00242    ASSERT (signal2,  status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
00243    ASSERT (signal1->length >= 2, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
00244    ASSERT (signal2->length >= 2, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
00245    ASSERT (signal1->data,  status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
00246    ASSERT (signal2->data,  status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
00247    ASSERT (params,  status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
00248 
00249 
00250    ASSERT((INT4)params->approximant >= 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
00251    ASSERT((INT4)params->approximant < NumApproximants, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
00252    ASSERT((INT4)params->order >= 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
00253    ASSERT((INT4)params->order <= 8, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
00254 
00255    switch (params->approximant) 
00256    {
00257       case TaylorT1:
00258       case PadeT1:
00259            LALInspiralWave1Templates(status->statusPtr, signal1, signal2, params);
00260            CHECKSTATUSPTR(status);
00261            break;
00262       case TaylorT2:
00263            LALInspiralWave2Templates(status->statusPtr, signal1, signal2, params);
00264            CHECKSTATUSPTR(status);
00265       break;
00266       case TaylorT3:
00267            LALInspiralWave3Templates(status->statusPtr, signal1, signal2, params);
00268            CHECKSTATUSPTR(status);
00269            break;
00270       case EOB:
00271       case EOBNR:
00272            LALEOBWaveformTemplates(status->statusPtr, signal1, signal2, params);
00273            CHECKSTATUSPTR(status);
00274            break;
00275       case TaylorF1:
00276       case TaylorF2:
00277       case FindChirpSP:
00278       case PadeF1:
00279       case BCV:
00280       case BCVSpin:
00281       case SpinTaylor:
00282            LALSTPNWaveformTemplates(status->statusPtr, signal1, signal2, params);
00283            CHECKSTATUSPTR(status);
00284            break; 
00285       case AmpCorPPN:
00286            LALInspiralAmplitudeCorrectedWaveTemplates(status->statusPtr, signal1, signal2, params);
00287            CHECKSTATUSPTR(status);
00288            break;
00289       case Eccentricity:
00290            LALInspiralEccentricityTemplates(status->statusPtr, signal1, signal2, params);
00291            CHECKSTATUSPTR(status);
00292            break;
00293       default: 
00294            ABORT( status, 9999, "Unknown case in switch." );
00295            
00296    }
00297 
00298    DETATCHSTATUSPTR(status);
00299    RETURN (status);
00300 }
00301 
00302 
00303 
00304 NRCSID (LALINSPIRALWAVEFORINJECTIONC, "$Id: LALInspiralWave.c,v 1.34 2008/08/13 12:13:04 whelan Exp $");
00305 
00306 /*  <lalVerbatim file="LALInspiralWaveForInjectionCP"> */
00307 void 
00308 LALInspiralWaveForInjection(
00309    LALStatus        *status,
00310    CoherentGW       *waveform,
00311    InspiralTemplate *inspiralParams,
00312    PPNParamStruc  *ppnParams)
00313 { /* </lalVerbatim>  */
00314 
00315    INITSTATUS(status, "LALInspiralWaveForInjection", LALINSPIRALWAVEFORINJECTIONC);
00316    ATTATCHSTATUSPTR(status);
00317 
00318    ASSERT (inspiralParams,  status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
00319    ASSERT (ppnParams,  status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
00320 
00321 
00322    switch (inspiralParams->approximant) 
00323      {
00324      case TaylorT1:
00325      case PadeT1:
00326        LALInspiralWave1ForInjection(status->statusPtr, waveform, inspiralParams, ppnParams);    
00327        CHECKSTATUSPTR(status);
00328        break;
00329      case TaylorT2:
00330        LALInspiralWave2ForInjection(status->statusPtr, waveform, inspiralParams, ppnParams);
00331        CHECKSTATUSPTR(status);
00332        break;
00333      case TaylorT3:
00334        LALInspiralWave3ForInjection(status->statusPtr, waveform, inspiralParams, ppnParams);
00335        CHECKSTATUSPTR(status);
00336        break;
00337      case EOB:
00338      case EOBNR:
00339        LALEOBWaveformForInjection(status->statusPtr, waveform, inspiralParams, ppnParams);
00340        CHECKSTATUSPTR(status);
00341            break;
00342       case BCV:
00343         /*       LALBCVWaveformForInjection(status->statusPtr, waveform, inspiralParams, ppnParams);*/
00344       case BCVSpin:
00345       case TaylorF1:
00346       case TaylorF2:
00347       case FindChirpSP:
00348       case PadeF1:
00349            ABORT(status, LALINSPIRALH_ECHOICE, LALINSPIRALH_MSGECHOICE);
00350            break;
00351       case SpinTaylor:
00352            LALSTPNWaveformForInjection(status->statusPtr, waveform, inspiralParams, ppnParams);
00353            CHECKSTATUSPTR(status);
00354            break;
00355       case AmpCorPPN:
00356            LALInspiralAmplitudeCorrectedWaveForInjection(status->statusPtr, waveform, inspiralParams, ppnParams);
00357            CHECKSTATUSPTR(status);
00358         break;
00359       default:
00360            ABORT( status, 9999, "Unknown case in switch." );
00361         
00362    }
00363 
00364    DETATCHSTATUSPTR(status);
00365    RETURN (status);
00366 }
00367 

Generated on Sat Sep 6 03:07:12 2008 for LAL by  doxygen 1.5.2