Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALInspiral 5.0.3.1-b246709
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALInspiralTest.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 Stas Babak, Bernd Machenschalk, David Churches, Duncan Brown, David Chin, Jolien Creighton, B.S. Sathyaprakash, Thomas Cokelaer
3*
4* This program is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation; either version 2 of the License, or
7* (at your option) any later version.
8*
9* This program is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12* GNU General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with with program; see the file COPYING. If not, write to the
16* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17* MA 02110-1301 USA
18*/
19
20/**
21 * \author Sathyaprakash, B. S.
22 * \file
23 * \ingroup LALInspiral_h
24 *
25 * \brief Test routine for codes that generate inspiral waveform from non-spinning black
26 * hole binaries.
27 *
28 * Time domain signals are returned when the \c approximant is
29 * one of <tt>TaylorT1, TaylorT2, TaylorT3, PadeT1, EOB, SpinTaylorT3</tt>
30 * and frequency domain signals are returned when the \c approximant is
31 * one of <tt>TaylorF1, TaylorF2, BCV.</tt> This code checks every available approximant
32 * at every order and reports whether or not there was any problem with the
33 * generation codes.
34 *
35 * To generate a waveform first set the \c InspiralTemplate structure (see
36 * below for an example). Next, to measure the length of the array required
37 * call the function
38 * \code
39 * LALInspiralWaveLength (&status, &n, params)
40 * \endcode
41 * The length will be returned in \c n. Finally, call the function
42 * \code
43 * LALInspiralWave(&status, signal1, params);
44 * \endcode
45 * to generate the wave, which will be returned in \c signal.
46 *
47 * Example values of the parameters that can be set (with options in brackets) is:
48 * \code
49 * params.OmegaS = 0.; (Unknown 3PN parameter in energy; shown to be 0 by DJS)
50 * params.Theta = 0.; (Unknown 3PN parameter in flux; arbitrarily set to 0)
51 * params.ieta=1; (1 for comparable masses model, 0 for test mass model)
52 * params.mass1=1.4; (masses of the component stars in solar masses)
53 * params.mass2=1.4;
54 * params.startTime=0.0; (defined so that the instantaneous GW frequency
55 * is params.fLower at params.startTime)
56 * params.startPhase=0.0; (0 to LAL_PI_2)
57 * params.fLower=40.0; (in Hz)
58 * params.fCutoff=1000.0; (in Hz)
59 * params.tSampling=4000.; (in Hz; should be larger than 2 fCutoff or 2 flso,
60 * whichever is smaller)
61 * params.signalAmplitude=1.0;
62 * params.nStartPad=0; (number of leading zero bins)
63 * params.nEndPad=0; (number of trailing zero bins)
64 * params.approximant=TaylorF2; (TaylorT1, PadeT1=ODE solver;
65 * TaylorT2=implicit phasing formula solved in quadrature;
66 * TaylorT3=explicit time-domain phasing;
67 * TaylorF1=stationary phase approx. using ODEs;
68 * TaylorF2=usual stationary phase approx.;
69 * EOB=effective-one-body approach)
70 * params.order=twoPN; (also newtonian, onePN, oneAndHalfPN, twoPN,
71 * twoAndHalfPN, threePN, threeAndHalfPN)
72 * params.massChoice=m1Andm2; (also t0t2, t0t3, t0t4, totalMassAndEta,totalMassAndMu)
73 * params.psi0 = 132250.; (parameter required to generate BCV detection templates)
74 * params.psi3 = -1014.2; (parameter required to generate BCV detection templates)
75 * params.alpha = 0.528; (amplitude correction used in BCV templates)
76 * params.fFinal = 868.7; (frequency at which the BCV template is terminated)
77 *
78 * \endcode
79 *
80 */
81
82#include <stdio.h>
83#include <lal/LALInspiral.h>
84#include <lal/RealFFT.h>
85#include <lal/AVFactories.h>
86
87
88void printf_timeseries (int n, float *sig, double delta, double t0) ;
89void printf_timeseries (int n, float *sig, double delta, double t0)
90{
91 int i=0;
92 FILE *outfile1;
93
94 outfile1=fopen("wave1.dat","a");
95
96 do
97 fprintf (outfile1,"%e %e\n", i*delta+t0, *(sig+i));
98 while (n-++i);
99
100 fprintf(outfile1,"&\n");
101 fclose(outfile1);
102}
103
104
105int main (void) {
106 static REAL4Vector *signal1;
107 static LALStatus status;
109 static REAL8 dt;
110 UINT4 n;
111
112 params.OmegaS = 0.;
113 params.Theta = 0.;
114 params.ieta=1;
115 params.mass1=5.1;
116 params.mass2=5.;
117 params.startTime=0.0;
118 params.startPhase=0.0;
119 params.fLower=40.0;
120 params.fCutoff=2048.00;
121 params.tSampling=8192.0;
122 params.order=6;
123 params.approximant=IMRPhenomB;
124/* SpinTaylorT3 */
125 params.signalAmplitude=1.0;
126 params.nStartPad=0;
127 params.nEndPad=0;
128 params.massChoice=m1Andm2;
129 params.distance = 100.;
130 dt = 1./params.tSampling;
131 params.spin1[2]=1.0;
132 params.spin2[2]=0.99;
133
136 fprintf(stderr, "Testing Inspiral Signal Generation Codes:\n");
137 fprintf(stderr, "Signal length=%d, m1=%e, m2=%e, fLower=%e, fUpper=%e\n",
138 n, params.mass1, params.mass2, params.fLower, params.fCutoff);
139 LALCreateVector(&status, &signal1, n);
140
141 LALInspiralWave(&status, signal1, &params);
142 fprintf(stderr,"fFinal = %e\n", params.fFinal);
143 printf_timeseries(signal1->length, signal1->data, dt, params.startTime);
145
146 printf("duration is %f \n", params.tC);
147 printf("final frequency is %f \n", params.fFinal);
148
149 LALDestroyVector(&status, &signal1);
151 return 0;
152}
void REPORTSTATUS(LALStatus *status)
void LALInspiralWaveLength(LALStatus *status, UINT4 *n, InspiralTemplate params)
void LALInspiralParameterCalc(LALStatus *status, InspiralTemplate *params)
void LALInspiralWave(LALStatus *status, REAL4Vector *signalvec, InspiralTemplate *params)
int main(void)
void printf_timeseries(int n, float *sig, double delta, double t0)
void LALCheckMemoryLeaks(void)
static double double delta
#define fprintf
double i
double REAL8
uint32_t UINT4
@ m1Andm2
component masses
Definition: LALInspiral.h:179
IMRPhenomB
void LALDestroyVector(LALStatus *, REAL4Vector **)
void LALCreateVector(LALStatus *, REAL4Vector **, UINT4)
int n
double t0
The inspiral waveform parameter structure containing information about the waveform to be generated.
Definition: LALInspiral.h:205
REAL4 * data
double distance