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
GenerateInspiralWaveform.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 Anand Sengupta, Thomas Cokelaer, Evan Ochsner
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., Cokelaer T.
22 * \file
23 * \ingroup LALInspiral_h
24 *
25 * \brief Test routine for wave generation codes.
26 *
27 * To get some help just type the name of the executable and the option --h
28 *
29 * Basically, you can provide all the arguments from the InspiralTemplate structure such as
30 * --approximant, --order ....
31 *
32 */
33
34
35#define LALGENERATEINSPIRALWAVEFORMC_ENORM 0
36#define LALGENERATEINSPIRALWAVEFORMC_ESUB 1
37#define LALGENERATEINSPIRALWAVEFORMC_EARG 2
38#define LALGENERATEINSPIRALWAVEFORMC_EVAL 3
39#define LALGENERATEINSPIRALWAVEFORMC_EFILE 4
40#define LALGENERATEINSPIRALWAVEFORMC_EMEM 5
41
42#define LALGENERATEINSPIRALWAVEFORMC_MSGENORM "Normal exit"
43#define LALGENERATEINSPIRALWAVEFORMC_MSGESUB "Subroutine failed"
44#define LALGENERATEINSPIRALWAVEFORMC_MSGEARG "Error parsing arguments"
45#define LALGENERATEINSPIRALWAVEFORMC_MSGEVAL "Input argument out of valid range"
46#define LALGENERATEINSPIRALWAVEFORMC_MSGEFILE "Could not open file"
47#define LALGENERATEINSPIRALWAVEFORMC_MSGEMEM "Out of memory"
48
49#define INSPIRALTEMPLATE_APPROXIMANT TaylorT4
50#define INSPIRALTEMPLATE_ORDER LAL_PNORDER_THREE_POINT_FIVE
51#define INSPIRALTEMPLATE_AMPORDER LAL_PNORDER_NEWTONIAN
52#define INSPIRALTEMPLATE_MASS1 10.
53#define INSPIRALTEMPLATE_MASS2 10.
54#define INSPIRALTEMPLATE_FCUTOFF 1000.
55#define INSPIRALTEMPLATE_FLOWER 40.
56#define INSPIRALTEMPLATE_TSAMPLING 2048.
57#define INSPIRALTEMPLATE_DISTANCE 1. /*MPC*/
58#define INSPIRALTEMPLATE_SIGNALAMPLITUDE 1.
59#define INSPIRALTEMPLATE_STARTPHASE 0.
60#define INSPIRALTEMPLATE_STARTTIME 0.
61
62#define INSPIRALTEMPLATE_THETA 0.
63#define INSPIRALTEMPLATE_ZETA2 0.
64#define INSPIRALTEMPLATE_OMEGAS 0.
65
66#define INSPIRALTEMPLATE_ALPHA 0.
67#define INSPIRALTEMPLATE_PSI0 100000.
68#define INSPIRALTEMPLATE_PSI3 -1000.
69
70#define INSPIRALTEMPLATE_ALPHA1 0.
71#define INSPIRALTEMPLATE_ALPHA2 0.
72#define INSPIRALTEMPLATE_ALPHA3 0.
73#define INSPIRALTEMPLATE_ALPHA4 0.
74#define INSPIRALTEMPLATE_ALPHA5 0.
75#define INSPIRALTEMPLATE_ALPHA6 0.
76#define INSPIRALTEMPLATE_BETA 0.
77
78#define INSPIRALTEMPLATE_INCLINATION 0.1
79#define INSPIRALTEMPLATE_ECCENTRICITY 0.
80#define INSPIRALTEMPLATE_ORBITTHETA0 0.0
81#define INSPIRALTEMPLATE_ORBITPHI0 0.0
82#define INSPIRALTEMPLATE_SPIN1X 0.0
83#define INSPIRALTEMPLATE_SPIN1Y 0.0
84#define INSPIRALTEMPLATE_SPIN1Z 0.0
85#define INSPIRALTEMPLATE_SPIN2X 0.0
86#define INSPIRALTEMPLATE_SPIN2Y 0.0
87#define INSPIRALTEMPLATE_SPIN2Z 0.0
88
89#define INSPIRALTEMPLATE_CHI 0.
90#define INSPIRALTEMPLATE_KAPPA 0.
91
92#define INSPIRALTEMPLATE_SOURCETHETA 0.
93#define INSPIRALTEMPLATE_SOURCEPHI 0.
94#define INSPIRALTEMPLATE_POLARISATIONANGLE 0.
95
96#define INSPIRALTEMPLATE_INTERACTION LAL_INSPIRAL_INTERACTION_ALL_SPIN
97#define INSPIRALTEMPLATE_AXISCHOICE LAL_SIM_INSPIRAL_FRAME_AXIS_VIEW
98#define INSPIRALTEMPLATE_FIXEDSTEP 0
99#define INSPIRALTEMPLATE_INSPIRALONLY 0
100
101#include <stdio.h>
102#include <lal/LALInspiral.h>
103#include <lal/LALNoiseModels.h>
104#include <lal/RealFFT.h>
105#include <lal/AVFactories.h>
106#include <lal/Random.h>
107#include <lal/GenerateInspiral.h>
108#include <lal/StringInput.h>
109
110#define ERROR( code, msg, statement ) \
111do \
112if ( lalDebugLevel & LALERROR ) \
113{ \
114 LALPrintError( "Error[0] %d: program %s, file %s, line %d, %s\n" \
115 " %s %s\n", (code), program, __FILE__, \
116 __LINE__, "$Id$", statement ? statement : \
117 "", (msg) ); \
118} \
119while (0)
120
121#define WARNING( statement ) \
122do \
123if ( lalDebugLevel & LALWARNING ) \
124{ \
125 LALPrintError( "Warning[0]: program %s, file %s, line %d, %s\n" \
126 " %s\n", program, __FILE__, __LINE__, \
127 "$Id$", (statement) ); \
128} \
129while (0)
130
131#define INFO( statement ) \
132do \
133if ( lalDebugLevel & LALINFO ) \
134{ \
135 LALPrintError( "Info[0]: program %s, file %s, line %d, %s\n" \
136 " %s\n", program, __FILE__, __LINE__, \
137 "$Id$", (statement) ); \
138} \
139while (0)
140
141#define SUB( func, statusptr ) \
142do \
143if ( (func), (statusptr)->statusCode ) \
144{ \
145 ERROR( LALGENERATEINSPIRALWAVEFORMC_ESUB, LALGENERATEINSPIRALWAVEFORMC_MSGESUB, \
146 "Function call \"" #func "\" failed:" ); \
147 exit( LALGENERATEINSPIRALWAVEFORMC_ESUB ); \
148} \
149while (0)
150
151typedef struct{
157 char tag[200];
158 char waveformString[LIGOMETA_WAVEFORM_MAX];
160
162
163void printf_timeseries (FILE *f1, UINT4 n, REAL4 *signal1, REAL8 delta);
164void printf_timeseries2 (UINT4 n, REAL4 *signal1, REAL4 *signal2, REAL8 delta);
165void ParseParameters(UINT4 argc, CHAR **argv, OtherParamIn *otherIn);
167void readPSD(REAL8 *psd, REAL4 Df, UINT4 length);
170
171
173 UINT4 argc,
174 CHAR **argv,
176
177{
178 UINT4 i = 1;
179
182
183 while(i <argc)
184 {
185 if (strcmp(argv[i],"--approximant")==0)
186 {
187 params->massChoice = m1Andm2;
188 if (strcmp(argv[++i],"AmpCorPPN")==0){
189 params->approximant = AmpCorPPN; }
190 else if (strcmp(argv[i],"GeneratePPN")==0){
191 params->approximant = GeneratePPN; }
192 else if (strcmp(argv[i],"TaylorN")==0){
193 params->approximant = TaylorN; }
194 else if (strcmp(argv[i],"TaylorEt")==0){
195 params->approximant = TaylorEt; }
196 else if (strcmp(argv[i],"TaylorT4")==0){
197 params->approximant = TaylorT4; }
198 else if (strcmp(argv[i],"TaylorT1")==0){
199 params->approximant = TaylorT1; }
200 else if (strcmp(argv[i],"TaylorT2")==0){
201 params->approximant = TaylorT2;}
202 else if (strcmp(argv[i],"TaylorT3")==0){
203 params->approximant = TaylorT3;}
204 else if (strcmp(argv[i],"TaylorF1")==0){
205 params->approximant = TaylorF1;}
206 else if (strcmp(argv[i],"TaylorF2")==0){
207 params->approximant = TaylorF2;}
208 else if (strcmp(argv[i],"TaylorF2RedSpin")==0){
209 params->approximant = TaylorF2RedSpin;}
210 else if (strcmp(argv[i],"PadeT1")==0){
211 params->approximant = PadeT1;}
212 else if (strcmp(argv[i],"PadeF1")==0){
213 params->approximant = PadeF1;}
214 else if (strcmp(argv[i],"EOB")==0){
215 params->approximant = EOB;}
216 else if (strcmp(argv[i],"EOBNR")==0){
217 params->approximant = EOBNR;}
218 else if (strcmp(argv[i],"EOBNRv2")==0){
219 params->approximant = EOBNRv2;}
220 else if (strcmp(argv[i],"EOBNRv2HM")==0){
221 params->approximant = EOBNRv2HM;}
222 else if (strcmp(argv[i],"IMRPhenomA")==0){
223 params->approximant = IMRPhenomA;}
224 else if (strcmp(argv[i],"IMRPhenomB")==0){
225 params->approximant = IMRPhenomB;}
226 else if (strcmp(argv[i],"IMRPhenomFA")==0){
227 params->approximant = IMRPhenomFA;}
228 else if (strcmp(argv[i],"IMRPhenomFB")==0){
229 params->approximant = IMRPhenomFB;}
230 else if (strcmp(argv[i],"SpinTaylor")==0){
231 params->approximant = SpinTaylor;}
232 else if (strcmp(argv[i],"SpinTaylorFrameless")==0){
233 params->approximant = SpinTaylorFrameless;}
234 else if (strcmp(argv[i],"SpinTaylorT3")==0){
235 params->approximant = SpinTaylorT3; }
236 else if (strcmp(argv[i],"SpinTaylorT4")==0){
237 params->approximant = SpinTaylorT4; }
238 else if (strcmp(argv[i],"SpinQuadTaylor")==0){
239 params->approximant = SpinQuadTaylor;}
240 else if (strcmp(argv[i],"PhenSpinTaylorRD")==0){
241 params->approximant = PhenSpinTaylorRD;}
242 else if (strcmp(argv[i],"FindChirpSP")==0){
243 params->approximant = FindChirpSP;}
244 else if (strcmp(argv[i],"FindChirpPTF")==0){
245 params->approximant = FindChirpPTF;}
246 else if (strcmp(argv[i],"BCV")==0){
247 params->approximant = BCV;
248 params->massChoice = psi0Andpsi3;
249 }
250 else if (strcmp(argv[i],"BCVSpin")==0){
251 params->massChoice = psi0Andpsi3;
252 params->approximant = BCVSpin;
253 }
254 else if (strcmp(argv[i],"BCVC")==0){
255 params->approximant = BCVC;
256 params->massChoice = psi0Andpsi3;
257 }
258 else if (strcmp(argv[i],"Eccentricity")==0){
259 params->approximant = Eccentricity; }
260 else if (strcmp(argv[i],"NumRel")==0){
261 params->approximant = NumRel;}
262 else if (strcmp(argv[i],"FrameFile")==0){
263 params->approximant = FrameFile;}
264 else {fprintf(stderr,"Approximant not found in ParseParameter function\n");}
265 }
266 else if (strcmp(argv[i],"--order")==0){
267 params->order = (LALPNOrder) atoi(argv[++i]);}
268 else if (strcmp(argv[i],"--amp-order")==0){
269 params->ampOrder = (LALPNOrder) atoi(argv[++i]);}
270 else if (strcmp(argv[i],"--mass1")==0){
271 params->mass1 = atof(argv[++i]);}
272 else if (strcmp(argv[i],"--mass2")==0){
273 params->mass2 = atof(argv[++i]);}
274 else if (strcmp(argv[i],"--massChoice")==0){
275 if (strcmp(argv[++i],"masses")==0){
276 params->massChoice = m1Andm2;}
277 else if (strcmp(argv[i],"psi")==0){
278 params->massChoice = psi0Andpsi3;}
279 }
280 else if (strcmp(argv[i],"--fLower")==0){
281 params->fLower = atof(argv[++i]);}
282 else if (strcmp(argv[i],"--fcutoff")==0){
283 params->fCutoff = atof(argv[++i]);}
284 else if (strcmp(argv[i],"--fFinal")==0){
285 params->fFinal = atof(argv[++i]);}
286 else if (strcmp(argv[i],"--distance")==0){
287 params->distance = atof(argv[++i]); }
288 else if (strcmp(argv[i],"--startPhase")==0){
289 params->startPhase = atof(argv[++i]); }
290 else if (strcmp(argv[i],"--startTime")==0){
291 params->startTime = atof(argv[++i]); }
292 else if (strcmp(argv[i],"--inclination")==0){
293 params->inclination = atof(argv[++i]); }
294 else if (strcmp(argv[i],"--sourceTheta")==0){
295 params->sourceTheta = atof(argv[++i]); }
296 else if (strcmp(argv[i],"--sourcePhi")==0){
297 params->sourcePhi = atof(argv[++i]); }
298 else if (strcmp(argv[i],"--polarisationAngle")==0){
299 params->polarisationAngle = atof(argv[++i]); }
300 else if (strcmp(argv[i],"--spin1x")==0){
301 params->spin1[0]= atof(argv[++i]);}
302 else if (strcmp(argv[i],"--spin1y")==0){
303 params->spin1[1]= atof(argv[++i]); }
304 else if (strcmp(argv[i],"--spin1z")==0){
305 params->spin1[2]= atof(argv[++i]); }
306 else if (strcmp(argv[i],"--spin2x")==0){
307 params->spin2[0]= atof(argv[++i]);}
308 else if (strcmp(argv[i],"--spin2y")==0){
309 params->spin2[1]= atof(argv[++i]);}
310 else if (strcmp(argv[i],"--spin2z")==0){
311 params->spin2[2]= atof(argv[++i]);}
312 else if (strcmp(argv[i],"--tSampling")==0){
313 params->tSampling = atof(argv[++i]); }
314 else if (strcmp(argv[i],"--nStartPad")==0){
315 params->nStartPad = atoi(argv[++i]);}
316 else if (strcmp(argv[i],"--nEndPad")==0){
317 params->nEndPad = atoi(argv[++i]);}
318 else if (strcmp(argv[i],"--eccentricity")==0){
319 params->eccentricity = atof(argv[++i]); }
320 else if (strcmp(argv[i],"--ieta")==0){
321 params->ieta = atof(argv[++i]); }
322 else if (strcmp(argv[i],"--Theta")==0){
323 params->Theta = atof(argv[++i]); }
324 else if (strcmp(argv[i],"--Zeta2")==0){
325 params->Zeta2 = atof(argv[++i]); }
326 else if (strcmp(argv[i],"--OmegaS")==0){
327 params->OmegaS = atof(argv[++i]); }
328 else if (strcmp(argv[i],"--alpha")==0){
329 params->alpha = atof(argv[++i]); }
330 else if (strcmp(argv[i],"--psi0")==0){
331 params->psi0 = atof(argv[++i]); }
332 else if (strcmp(argv[i],"--psi3")==0){
333 params->psi3 = atof(argv[++i]); }
334 else if (strcmp(argv[i],"--alpha1")==0){
335 params->alpha1 = atof(argv[++i]); }
336 else if (strcmp(argv[i],"--alpha2")==0){
337 params->alpha2 = atof(argv[++i]); }
338 else if (strcmp(argv[i],"--alpha3")==0){
339 params->alpha3 = atof(argv[++i]); }
340 else if (strcmp(argv[i],"--alpha4")==0){
341 params->alpha4 = atof(argv[++i]); }
342 else if (strcmp(argv[i],"--alpha5")==0){
343 params->alpha5 = atof(argv[++i]); }
344 else if (strcmp(argv[i],"--alpha6")==0){
345 params->alpha6 = atof(argv[++i]); }
346 else if (strcmp(argv[i],"--beta")==0){
347 params->beta = atof(argv[++i]); }
348 else if (strcmp(argv[i],"--orbitTheta0")==0){
349 params->orbitTheta0 = atof(argv[++i]); }
350 else if (strcmp(argv[i],"--orbitPhi0")==0){
351 params->orbitPhi0 = atof(argv[++i]); }
352 else if (strcmp(argv[i],"--chi")==0){
353 params->chi = atof(argv[++i]); }
354 else if (strcmp(argv[i],"--kappa")==0){
355 params->kappa = atof(argv[++i]); }
356 else if (strcmp(argv[i],"--interaction")==0)
357 {
358 if (strcmp(argv[++i],"NO")==0){
359 params->interaction = LAL_INSPIRAL_INTERACTION_NONE; }
360 else if (strcmp(argv[i],"SO15")==0){
362 else if (strcmp(argv[i],"SS")==0){
364 else if (strcmp(argv[i],"SSself")==0){
366 else if (strcmp(argv[i],"QM")==0){
368 else if (strcmp(argv[i],"SO25")==0){
370 else if (strcmp(argv[i],"SO30")==0){
372 else if (strcmp(argv[i],"AllSpin")==0){
374 else if (strcmp(argv[i],"Tidal")==0){
376 else if (strcmp(argv[i],"Tidal6")==0){
378 else if (strcmp(argv[i],"All")==0){
379 params->interaction = LAL_INSPIRAL_INTERACTION_ALL; }
380 else
381 fprintf(stderr,"Invalid choice of --interaction\n");
382 }
383 else if (strcmp(argv[i],"--axisChoice")==0)
384 {
385 if (strcmp(argv[++i],"TotalJ")==0){
387 else if (strcmp(argv[i],"View")==0){
389 else if (strcmp(argv[i],"OrbitalL")==0){
391 else
392 fprintf(stderr,"Invalid choice of --axisChoice\n");
393 }
394 else if (strcmp(argv[i],"--fixedStep")==0){
395 params->fixedStep = atoi(argv[++i]); }
396 else if (strcmp(argv[i],"--inspiralOnly")==0){
397 params->inspiralOnly = atoi(argv[++i]); }
398 i++;
399 }
400
401
403 RETURN(status);
404}
405
406
407
410
411{
412 /* Print values of all parameters to screen */
413 printf("# approximant = %-15.12d\n", params.approximant);
414 printf("# order = %-15.12d\n", params.order);
415 printf("# ampOrder = %-15.12d\n", params.ampOrder);
416 printf("# mass1 = %-15.12f\n", params.mass1);
417 printf("# mass2 = %-15.12f\n", params.mass2);
418 printf("# fLower = %-15.12f\n", params.fLower);
419 printf("# fCutoff = %-15.12f\n", params.fCutoff);
420 printf("# distance = %-15.12f\n", params.distance);
421 printf("# startPhase = %-15.12f\n", params.startPhase);
422 printf("# startTime = %-15.12f\n", params.startTime);
423 printf("# inclination = %-15.12f\n", params.inclination);
424 printf("# sourceTheta = %-15.12f\n", params.sourceTheta);
425 printf("# sourcePhi = %-15.12f\n", params.sourcePhi);
426 printf("# polarisationAngle = %-15.12f\n", params.polarisationAngle);
427 printf("# spin1 x = %-15.12f\n", params.spin1[0]);
428 printf("# spin1 y = %-15.12f\n", params.spin1[1]);
429 printf("# spin1 z = %-15.12f\n", params.spin1[2]);
430 printf("# spin2 x = %-15.12f\n", params.spin2[0]);
431 printf("# spin2 y = %-15.12f\n", params.spin2[1]);
432 printf("# spin2 z = %-15.12f\n", params.spin2[2]);
433 printf("# tSampling = %-15.12f\n", params.tSampling);
434 printf("# nStartPad = %-15.12d\n", params.nStartPad);
435 printf("# nEndPad = %-15.12d\n", params.nStartPad);
436 printf("# eccentricity = %-15.12f\n", params.eccentricity);
437 printf("# ieta = %-15.12d\n", params.ieta);
438 printf("# Theta = %-15.12f\n", params.Theta);
439 printf("# Zeta2 = %-15.12f\n", params.Zeta2);
440 printf("# OmegaS = %-15.12f\n", params.OmegaS);
441 printf("# alpha = %-15.12f\n", params.alpha);
442 printf("# psi0 = %-15.12f\n", params.psi0);
443 printf("# psi3 = %-15.12f\n", params.psi3);
444 printf("# alpha1 = %-15.12f\n", params.alpha1);
445 printf("# alpha2 = %-15.12f\n", params.alpha2);
446 printf("# alpha3 = %-15.12f\n", params.alpha3);
447 printf("# alpha4 = %-15.12f\n", params.alpha4);
448 printf("# alpha5 = %-15.12f\n", params.alpha5);
449 printf("# alpha6 = %-15.12f\n", params.alpha6);
450 printf("# beta = %-15.12f\n", params.beta);
451 printf("# chi = %-15.12f\n", params.chi);
452 printf("# kappa = %-15.12f\n", params.kappa);
453 printf("# orbitTheta0 = %-15.12f\n", params.orbitTheta0);
454 printf("# orbitPhi0 = %-15.12f\n", params.orbitPhi0);
455 printf("# interaction = %-15.12d\n", params.interaction);
456 printf("# axisChoice = %-15.12d\n", params.axisChoice);
457 printf("# fixedStep = %-15.12d\n", params.fixedStep);
458 printf("# inspiralOnly = %-15.12d\n", params.inspiralOnly);
459
460/* Paramters which are computed using LALInspiralParameterCalc */
461
462 printf("# chirpMass = %-15.12f\n", params.chirpMass);
463 printf("# eta = %-15.12f\n", params.eta);
464 printf("# totalMass = %-15.12f\n", params.totalMass);
465 printf("# mu = %-15.12f\n", params.mu);
466 printf("# fFinal = %-15.12f\n", params.fFinal);
467 printf("# t0 = %-15.12f\n", params.t0);
468 printf("# t2 = %-15.12f\n", params.t2);
469 printf("# t3 = %-15.12f\n", params.t3);
470 printf("# t4 = %-15.12f\n", params.t4);
471 printf("# t5 = %-15.12f\n", params.t5);
472 printf("# t6 = %-15.12f\n", params.t6);
473 printf("# t7 = %-15.12f\n", params.t7);
474 printf("# tC = %-15.12f\n", params.tC);
475 printf("# signalAmplitude = %-15.12f\n", params.signalAmplitude);
476 printf("# vFinal = %-15.12f\n", params.vFinal);
477 printf("# end_time (s) = %-15.12d\n", params.end_time.gpsSeconds);
478 printf("# end_time (ns) = %-15.12d\n", params.end_time.gpsNanoSeconds);
479 printf("# massChoice = %-15.12d\n", params.massChoice);
480
481 RETURN(status);
482}
483
484
485/**/
486
489
490{
491
497 params->massChoice = m1Andm2;
507 params->polarisationAngle = INSPIRALTEMPLATE_POLARISATIONANGLE;
515 params->nStartPad = 0;
516 params->nEndPad = 0;
539 params->signalAmplitude = INSPIRALTEMPLATE_SIGNALAMPLITUDE;
540 params->ieta = 1.;
541
542 RETURN(status);
543}
544
545
546
548
549{
550
551 fprintf(stderr,"InspiralTemplate Structure; parsing arguments\n");
552 fprintf(stderr,"--approximant (TaylorT1, TaylorT2, TaylorT3, TaylorT4,\n");
553 fprintf(stderr,"\t\tTaylorF1, TaylorF2, TaylorF2RedSpin, PadeT1, PadeF1, BCV, BCVSpin\n");
554 fprintf(stderr,"\t\tBCVC, SpinTaylorT3, SpinTaylorFrameless, SpinTaylor,\n");
555 fprintf(stderr,"\t\tSpinQuadTaylor, PhenSpinTaylorRD,\n");
556 fprintf(stderr,"\t\tFindChirpSP, FindChirpPTF, GeneratePPN, AmpCorPPN,\n");
557 fprintf(stderr,"\t\tFrameFile, NumRel, Eccentricity, EOB, EOBNR,\n");
558 fprintf(stderr,"\t\tIMRPhenomA, IMRPhenomB, IMRPhenomFA, IMRPhenomFB,\n");
559 fprintf(stderr,"\t\tTaylorEt, TaylorN)\n");
560 fprintf(stderr,"--order (0, 1, 2, 3, 4, 5, 6, 7, 8 (i.e. 4==twoPN)\n");
561 fprintf(stderr,"--ampOrder (0, 1, 2, 3, 4, 5 (i.e. 4==twoPN)\n");
562 fprintf(stderr,"--mass1 (in solar mass)\n");
563 fprintf(stderr,"--mass2 (in solar mass)\n");
564 fprintf(stderr,"--massChoice ('psi' for BCV(Spin) or 'masses' otherwise)\n");
565 fprintf(stderr,"--fLower (in Hz)\n");
566 fprintf(stderr,"--fCutoff (in Hz)\n");
567 fprintf(stderr,"--fFinal (in Hz - not usually needed)\n");
568 fprintf(stderr,"--distance (in Mpc)\n");
569 fprintf(stderr,"--startPhase \n");
570 fprintf(stderr,"--startTime \n");
571 fprintf(stderr,"--inclination (angle between L and line of sight in rad.)\n");
572 fprintf(stderr,"--sourceTheta (source sky position zenith angle)\n");
573 fprintf(stderr,"--sourcePhi (source sky position azimuth angle)\n");
574 fprintf(stderr,"--polarisationAngle (i.e. 'psi' in antenna patterns)\n");
575 fprintf(stderr,"--spin1x (Vector components for spin for mass1)\n");
576 fprintf(stderr,"--spin1y (Only used by spinning waveforms)\n");
577 fprintf(stderr,"--spin1z (Kerr limit: s1x^2 + s1y^2 + s1z^2 <= 1)\n");
578 fprintf(stderr,"--spin2x (Vector components for spin for mass2)\n");
579 fprintf(stderr,"--spin2y (Only used by spinning waveforms)\n");
580 fprintf(stderr,"--spin2z (Kerr limit: s1x^2 + s1y^2 + s1z^2 <= 1)\n");
581 fprintf(stderr,"--tSampling (sample rate in Hz)\n");
582 fprintf(stderr,"--nStartPad (# samples of zero padding at start)\n");
583 fprintf(stderr,"--nEndPad (# samples of zero padding at end)\n");
584 fprintf(stderr,"--eccentricity \n");
585 fprintf(stderr,"--ieta (set to 0 to turn off eta dependence)\n");
586 fprintf(stderr,"--Theta (EOB 3PN - not used anymore)\n");
587 fprintf(stderr,"--Zeta2 (EOB 3PN - not used anymore)\n");
588 fprintf(stderr,"--OmegaS (EOB 3PN - not used anymore)\n");
589 fprintf(stderr,"--alpha (BCV must be > 0)\n");
590 fprintf(stderr,"--psi0 (BCV must be > 0)\n");
591 fprintf(stderr,"--psi3 (BCV must be < 0)\n");
592 fprintf(stderr,"--alpha1 (BCVSpin)\n");
593 fprintf(stderr,"--alpha2 (BCVSpin)\n");
594 fprintf(stderr,"--alpha3 (BCVSpin)\n");
595 fprintf(stderr,"--alpha4 (BCVSpin)\n");
596 fprintf(stderr,"--alpha5 (BCVSpin)\n");
597 fprintf(stderr,"--alpha6 (BCVSpin)\n");
598 fprintf(stderr,"--beta (BCVSpin)\n");
599 fprintf(stderr,"--chi (PTF spin magnitude)\n");
600 fprintf(stderr,"--kappa (PTF spin angle cosine)\n");
601 fprintf(stderr,"--orbitTheta0 (initial orientation of L - not used)\n");
602 fprintf(stderr,"--orbitPhi0 (initial orientation of L - not used)\n");
603 fprintf(stderr,"--interaction (used by PhenSpinTaylorRD to control spin effects included)\n");
604 fprintf(stderr," NO - no spin effects\n");
605 fprintf(stderr," SO - spin-orbit effects (default)\n");
606 fprintf(stderr," SS - spin-spin effects\n");
607 fprintf(stderr," SSself - self spin-spin effects\n");
608 fprintf(stderr," QM - quadrupole-monopole effects\n");
609 fprintf(stderr," Allspin - all of the above effects\n");
610 fprintf(stderr,"--inputAxis (used by PhenSpinTaylorRD to set frame z-axis)\n");
611 fprintf(stderr," TotalJ - z-axis along initial total angular momentum\n");
612 fprintf(stderr," View - z-axis along line of sight\n");
613 fprintf(stderr," OrbitalL - z-axis along initial orbital angular momentum\n");
614 fprintf(stderr,"--fixedStep (used by PhenSpinTaylorRD to set integrator)\n");
615 fprintf(stderr," 1 - use fixed step integrator\n");
616 fprintf(stderr," other - use adaptive step integrator (default)\n");
617 fprintf(stderr,"--inspiralOnly (used by PhenSpinTaylorRD to attach RD or not)\n");
618 fprintf(stderr," 1 - inspiral-only waveform\n");
619 fprintf(stderr," other - attach ringdown for IMR waveform (default)\n");
620
621
622}
623
624
625/* --- Main part --- */
626int main (int argc , char **argv) {
627 REAL4Vector *signal1 = NULL; /* storing waveforms */
628 REAL4Vector *signal2 = NULL; /* storing waveforms */
629 REAL4Vector *dummy = NULL; /* stores h+ when hx desired */
630 REAL8Vector *psd=NULL;
631 static LALStatus status;
632 InspiralTemplate params; /* the parameters */
633 REAL8 dt, cosI, ampFac, plusFac, crossFac, dist;
634 UINT4 n,i;
635 UINT4 nby2;
636 InspiralInit paramsInit;
637 expnCoeffs ak;
638
639 RealFFTPlan *revp =NULL;
640 RealFFTPlan *frwd =NULL;
641 char name1[256];
642
643 static OtherParamIn otherIn; /* some extra parameters to parse */
644 FILE *f1=NULL, *f2=NULL, *f3=NULL, *f4=NULL; /* output file pointers */
645
646 program = *argv;
647
648 /* --- we start real computation here --- */
649 otherIn.PrintParameters = 0; /* by default we don't print the parameters */
650 otherIn.output = 0; /* by default we don't output the waveforms */
651 otherIn.realImag = 0; /* by default output FD waveforms as |h(f)| */
652 strncpy(otherIn.tag, "1", sizeof(otherIn.tag));/*default tag for file names*/
653 ParseParameters(argc, argv, &otherIn);/* let's parse user parameters */
655 &status);
656
658 &status); /* parse user inspiral template parameters */
659
660
661 SUB( LALInspiralInit(&status, &params, &paramsInit), &status);
662
663 /**************************************************************
664 * The following are used only when the psd is read from a
665 * file as, for example, the s5 psd
666 *************************************************************/
667
668 if (otherIn.psd_data_file)
669 {
670 n = params.tSampling * 8;
671 if (paramsInit.nbins < n)
672 {
673 paramsInit.nbins = n;
674 }
675 else
676 {
677 fprintf(stderr, "Length is not enough\n");
678 exit(0);
679 }
680 }
681
682
683 if(otherIn.output)
684 {
685 sprintf(name1, "wave-TD-%s.dat", otherIn.tag); f1 = fopen(name1, "w");
686 sprintf(name1, "wave-OT-%s.dat", otherIn.tag); f2 = fopen(name1, "w");
687 sprintf(name1, "wave-NW-%s.dat", otherIn.tag); f3 = fopen(name1, "w");
688 sprintf(name1, "wave-FD-%s.dat", otherIn.tag); f4 = fopen(name1, "w");
689 }
690
691
692
693 if (otherIn.PrintParameters)
694 {
695 fprintf(stderr, "the inspiral structure (your parameters) before the call to the waveform generation:\n");
697 }
698
699 /* force those parameters */
700 dt = 1./params.tSampling;
701 n = paramsInit.nbins;
702 nby2 = n/2;
703
704 if( params.approximant == AmpCorPPN )
705 {
706 n *= pow(1./(1.+params.ampOrder/2.), -8./3.);
707 }
708
709 if (otherIn.PrintParameters)
710 {
711 fprintf(stderr, "#Testing Inspiral Signal Generation Codes:\n");
712 fprintf(stderr, "#Signal n=%d, t0=%e, t2=%e, t3=%e\n",
713 n, params.t0, params.t2, params.t3);
714 fprintf(stderr,"#size in bins %d\n",n);
715 fprintf(stderr,"#size in seconds %f\n",params.tC);
716 }
717
718 SUB( LALSCreateVector(&status, &(signal1), n), &status);
719 SUB( LALSCreateVector(&status, &(signal2), n), &status);
720 SUB( LALSCreateVector(&status, &(dummy), n), &status);
723 LALDCreateVector(&status, &psd, (nby2+1));
724
725 params.ieta = 1;
726
728
729
730 switch (params.approximant)
731 {
732 /* These FD approximants generate h(f) and IFFT to get h(t) */
733 case PadeF1:
734 case TaylorF1:
735 case TaylorF2:
736 case TaylorF2RedSpin:
737 case FindChirpSP:
738 case BCV:
739 case BCVC:
740 case BCVSpin:
741 case IMRPhenomFA:
742 case IMRPhenomFB:
743 switch( otherIn.output )
744 {
745 default:
746 case 0:
747 case 1:
748 cosI = cos(params.inclination);
750 ampFac = -2.0 * params.mu * LAL_MRSUN_SI/params.distance;
751 plusFac = ampFac * (1.0 + cosI*cosI);
752 params.signalAmplitude = plusFac;
753 SUB(LALInspiralWave(&status, signal2, &params), &status);
754 XLALREAL4VectorFFT(signal1, signal2, revp);
755 break;
756 case 2:
757 cosI = cos(params.inclination);
759 ampFac = -2.0 * params.mu * LAL_MRSUN_SI/params.distance;
760 crossFac = ampFac * 2.0 * cosI;
761 params.signalAmplitude = crossFac;
762 SUB(LALInspiralWaveTemplates(&status, dummy, signal2, &params),
763 &status);
764 XLALREAL4VectorFFT(signal1, signal2, revp);
765 break;
766 case 3:
767 buildhoft(&status, signal2, &params, &otherIn);
768 XLALREAL4VectorFFT(signal1, signal2, revp);
769 break;
770 }
771 break;
772 /* For default case, print a warning, but continue */
773 /* If a new waveform was implemented, it may succeed */
774 /* Otherwise, the call to LALInspiral, etc. will still fail */
775 default:
776 fprintf(stderr, "Warning! approximant appears to be unknown\n");
777 /* fallthrough */
778 /* These TD approximants generate h(t), h+(t), hx(t) directly */
779 case TaylorT1:
780 case TaylorT2:
781 case TaylorT3:
782 case TaylorT4:
783 case TaylorEt:
784 case TaylorN:
785 case EOB:
786 case EOBNR:
787 case EOBNRv2:
788 case EOBNRv2HM:
789 case PadeT1:
790 case GeneratePPN:
791 case AmpCorPPN:
792 case SpinTaylorT3:
793 case SpinTaylor:
795 case SpinQuadTaylor:
796 case PhenSpinTaylorRD:
797 case IMRPhenomA:
798 case IMRPhenomB:
799 case Eccentricity:
800 switch( otherIn.output )
801 {
802 default:
803 case 0:
804 case 1:
805 cosI = cos(params.inclination);
807 ampFac = -2.0 * params.mu * LAL_MRSUN_SI/params.distance;
808 plusFac = ampFac * (1.0 + cosI*cosI);
809 params.signalAmplitude = plusFac;
810 SUB(LALInspiralWave(&status, signal1, &params), &status);
811 break;
812 case 2:
813 cosI = cos(params.inclination);
815 ampFac = -2.0 * params.mu * LAL_MRSUN_SI/params.distance;
816 crossFac = ampFac * 2.0 * cosI;
817 params.signalAmplitude = crossFac;
818 SUB(LALInspiralWaveTemplates(&status, dummy, signal1, &params),
819 &status);
820 break;
821 case 3:
822 buildhoft(&status, signal1, &params, &otherIn);
823 break;
824 }
825 if(otherIn.taper) /* Taper if requested */
826 {
828 bookends = 0;
829 if (otherIn.taper==1) bookends = LAL_SIM_INSPIRAL_TAPER_START;
830 if (otherIn.taper==2) bookends = LAL_SIM_INSPIRAL_TAPER_END;
831 if (otherIn.taper==3) bookends = LAL_SIM_INSPIRAL_TAPER_STARTEND;
832 XLALSimInspiralREAL4WaveTaper(signal1, bookends);
833 }
834 break;
835 }
836 if(otherIn.output) printf_timeseries (f1, n, signal1->data, dt);
837 {
838 REAL8 df, f, hSq, sSq, hMag, sMag, sRe, sIm, rho, rhosq=0, rhoDet=8.;
839
840 XLALREAL4VectorFFT(signal2, signal1, frwd);
841 df = 1./(n * dt);
842 if (otherIn.psd_data_file)
843 {
844 readPSD(psd->data, df, nby2);
845 }
846 else
847 {
849 }
850 for (i=1; i<nby2; i++)
851 {
852 UINT4 j = n-i;
853 f = (double)i*df;
854 if (psd->data[i])
855 {
856 sRe = signal2->data[i] * dt;
857 sIm = signal2->data[j] * dt;
858 hSq = sRe*sRe + sIm*sIm;
859 hMag = sqrt(hSq);
860 sSq = hSq / (psd->data[i]) ;
861 sMag = hMag / (psd->data[i]) ;
862 if (f>params.fLower)
863 {
864 if (params.approximant != EOBNR && params.approximant != EOBNRv2
865 && params.approximant != EOBNRv2HM && params.fFinal > f)
866 rhosq += sSq;
867 else
868 rhosq += sSq;
869 }
870 signal2->data[i] = sRe / sqrt(psd->data[i]);
871 signal2->data[j] = sIm / sqrt(psd->data[i]);
872 if( otherIn.realImag == 1 )
873 {
874 if(otherIn.output) fprintf(f3, "%e %e %e %e\n", f,
875 sRe/(psd->data[i]), sIm/(psd->data[i]), psd->data[i]);
876 if(otherIn.output) fprintf(f4, "%e %e %e\n", f, sRe, sIm);
877 }
878 else
879 {
880 if(otherIn.output) fprintf(f3, "%e %e %e\n",
881 f, sMag, psd->data[i]);
882 if(otherIn.output) fprintf(f4, "%e %e\n", f, hMag);
883 }
884 }
885 else
886 {
887 signal2->data[i] = 0.;
888 signal2->data[j] = 0.;
889 sSq = 0.;
890 }
891 }
892 /* Above, 'rhosq' = \Sum_i | h(f_i) |^2 / Sn(f_i)
893 * Therefore, SNR^2 = 4 \int | h(f) |^2 / Sn(f) df ~= 4 * rhosq * df
894 * so SNR = rho = sqrt(4 * rhosq * df)
895 */
896 rho = sqrt(4. * rhosq * df);
897 /* Distance in Mpc at which the SNR is 8 */
898 dist = (params.distance/(LAL_PC_SI*1e6))*(rho/rhoDet);
899 if( otherIn.PrintParameters )
900 {
901 fprintf(stderr, "mass1: %e, mass2: %e, # samples: %d,\nSNR: %e, "
902 "distance at which SNR=8: %e\n", params.mass1, params.mass2,
903 signal2->length, rho, dist);
904 }
905 signal2->data[0] = 0.;
906 signal2->data[nby2] = 0.;
907 XLALREAL4VectorFFT(signal1, signal2, revp);
908 if(otherIn.output) printf_timeseries (f2, n, signal1->data, dt);
909 }
910
913 SUB( LALSDestroyVector(&status, &signal1), &status);
914 SUB( LALSDestroyVector(&status, &signal2), &status);
916
917 if (otherIn.PrintParameters)
918 {
919 fprintf(stderr, "fFinal = %f Hz tFinal = %f seconds\n" ,
920 params.fFinal, params.tC);
921 fprintf(stderr, "the inspiral structure after the call "
922 "to the waveform generation:\n");
924 }
925 /*
926 LALCheckMemoryLeaks();
927 */
928 if(otherIn.output)
929 {
930 fclose(f1);
931 fclose(f2);
932 fclose(f3);
933 fclose(f4);
934 }
935
936 return 0;
937}
938
939void
941 CHAR **argv,
942 OtherParamIn *otherIn)
943{
944 UINT4 i = 1, i1 = 0;
945 INT4 order = 0;
946
947 while(i < argc)
948 {
949 if ( strcmp(argv[i], "--verbose") == 0 )
950 {
951 otherIn->PrintParameters = 1;
952 }
953 else if ( strcmp(argv[i], "--output") == 0 )
954 {
955 otherIn->output = atoi(argv[++i]);
956 }
957 else if ( strcmp(argv[i], "--taper") == 0 )
958 {
959 otherIn->taper = atoi(argv[++i]);
960 }
961 else if ( strcmp(argv[i], "--psd-data-file") == 0 )
962 {
963 otherIn->psd_data_file = 1;
964 }
965 else if( strcmp(argv[i], "--h") == 0 )
966 {
968 }
969 else if( strcmp(argv[i],"-h") == 0 )
970 {
972 }
973 else if( strcmp(argv[i],"-help") == 0 )
974 {
976 }
977 else if( strcmp(argv[i],"--help") == 0 )
978 {
980 }
981 else if( strcmp(argv[i],"--tag") == 0 )
982 {
983 strncpy(otherIn->tag, argv[++i], sizeof(otherIn->tag) - 1);
984 }
985 else if( strcmp(argv[i],"--approximant") == 0 )
986 {
987 i1 = i + 1;
988 }
989 else if( strcmp(argv[i],"--order") == 0 )
990 {
991 order = atoi(argv[++i]);
992 }
993 else if( strcmp(argv[i],"--real-imag") == 0 )
994 {
995 otherIn->realImag = atoi(argv[++i]);
996 }
997 i++;
998 }
999 if( otherIn->output == 3 )
1000 { /* concatenate approximant and order in a string for SimInspiralTable */
1001 strcpy( otherIn->waveformString, argv[i1] );
1002 switch( order )
1003 {
1004 case 8:
1005 strcat( otherIn->waveformString, "pseudoFourPN" );
1006 break;
1007 case 7:
1008 strcat( otherIn->waveformString, "threePointFivePN" );
1009 break;
1010 case 6:
1011 strcat( otherIn->waveformString, "threePN" );
1012 break;
1013 case 5:
1014 strcat( otherIn->waveformString, "twoPointFivePN" );
1015 break;
1016 case 4:
1017 strcat( otherIn->waveformString, "twoPN" );
1018 break;
1019 case 3:
1020 strcat( otherIn->waveformString, "onePointFivePN" );
1021 break;
1022 case 2:
1023 strcat( otherIn->waveformString, "onePN" );
1024 break;
1025 case 1:
1026 strcat( otherIn->waveformString, "oneHalfPN" );
1027 break;
1028 case 0:
1029 printf(" WARNING: you have chose Newtonian order\n");
1030 strcat( otherIn->waveformString, "newtonian" );
1031 break;
1032 default:
1033 printf("Invalid PN order requested, using 3.5PN\n");
1034 strcat( otherIn->waveformString, "threePointFivePN" );
1035 break;
1036 }
1037 }
1038}
1039
1040
1042{
1043
1044 fprintf(stderr,"GenerateInspiralWaveform Help\n");
1045 fprintf(stderr,"---------------------------------------------------------\n");
1046 fprintf(stderr,"All unspecified parameters use default values.\n");
1047 fprintf(stderr,"If you don't know what a parameter does it's");
1048 fprintf(stderr," (probably) safe to omit it.\n");
1049 fprintf(stderr,"---------------------------------------------------------\n");
1050 fprintf(stderr,"--h for help\n");
1051 fprintf(stderr,"--verbose to print Inspiral Template parameters\n");
1052 fprintf(stderr,"--tag TAG adds 'TAG' identifier to file names\n");
1053 fprintf(stderr,"--psd-data-file file.dat reads noise curve from file.dat (NOT WORKING YET!)\n");
1054 fprintf(stderr,"\t Initial LIGO design PSD used if no PSD file is given\n");
1055 fprintf(stderr,"--output=N to generate time and freq. domain waveforms:\n");
1056 fprintf(stderr," N = 0 - do not output any files (default)\n");
1057 fprintf(stderr," N = 1 - output plus polarization h+\n");
1058 fprintf(stderr," N = 2 - output cross polarization hx\n");
1059 fprintf(stderr," N = 3 - output measured strain h = F+ h+ + Fx hx\n");
1060 fprintf(stderr,"For N != 0, the waveform will be written to these files:\n");
1061 fprintf(stderr," wave-TD-TAG.dat (time domain)\n");
1062 fprintf(stderr," wave-OT-TAG.dat (TD (Wiener) optimal template)\n");
1063 fprintf(stderr," wave-FD-TAG.dat (frequency domain)\n");
1064 fprintf(stderr," wave-NW-TAG.dat (noise-weighted FD)\n");
1065 fprintf(stderr,"Note: Not all approximants support all types of output\n");
1066 fprintf(stderr," N = 1 calls LALInspiralWave()\n");
1067 fprintf(stderr," N = 2 calls LALInspiralWaveTemplates()\n");
1068 fprintf(stderr," N = 3 calls LALInspiralWaveForInjection() via LALGenerateInspiral()\n");
1069 fprintf(stderr,"If the approximant you want fails, make it callable from these functions\n");
1070 fprintf(stderr,"--real-imag=N controls output of complex FD and NW waveforms:\n");
1071 fprintf(stderr," N = 0 - output | h(f) | (default)\n");
1072 fprintf(stderr," N = 1 - output Re(h(f)) and Im(h(f))\n");
1073 fprintf(stderr,"---------------------------------------------------------\n");
1075
1076}
1077
1078
1079void printf_timeseries (FILE *f1, UINT4 n, REAL4 *signal1, REAL8 delta)
1080{
1081 UINT4 i=0;
1082
1083 /*
1084 FILE *outfile1;
1085 outfile1=fopen("wave1.dat","w");
1086 */
1087 do
1088 /* fprintf (outfile1,"%e %e\n", i*delta+t0, *(signal1+i) );
1089 */
1090 fprintf (f1,"%e %e\n", i*delta, signal1[i] );
1091 while (n-++i);
1092
1093 /*
1094 fprintf(outfile1,"&\n");
1095 fclose(outfile1);
1096 */
1097}
1098
1099
1100
1101void printf_timeseries2 (UINT4 n, REAL4 *signal1, REAL4 *signal2, REAL8 delta)
1102{
1103 UINT4 i=0;
1104 FILE *outfile1;
1105
1106 outfile1=fopen("wave2.dat","w");
1107
1108 do
1109 /* fprintf (outfile1,"%e %e\n", i*delta+t0, *(signal+i) );
1110 */
1111 fprintf (stdout,"%e %e %e\n", i*delta, *(signal1+i), *(signal2+i) );
1112 while (n-++i);
1113
1114 fclose(outfile1);
1115}
1116
1117
1118void readPSD(REAL8 *psd, REAL4 Df, UINT4 length)
1119{
1120 FILE *f1;
1121 UINT4 i=1, j=0;
1122 REAL4 f;
1123 REAL4 x;
1124
1125 psd[0] = 0;
1126 f1 = fopen("lho4k_070318_strain.txt", "r");
1127
1128 if (fscanf(f1, "%e %e", &f, &x) == EOF)
1129 {
1130 fprintf(stderr, "Problem reading file lho4k_070318_strain.txt stopping\n");
1131 exit(0);
1132 }
1133 if (f!=Df)
1134 {
1135 fprintf(stderr, "Incompatible frequency resolution, exiting\n");
1136 exit(0);
1137 }
1138
1139 psd[i] = x*x;
1140
1141 while(fscanf(f1, "%e %e", &f, &x) != EOF && i<length)
1142 {
1143 ++i;
1144 psd[i] = x*x;
1145 }
1146
1147 for (j=i; j<length; j++)
1148 {
1149 psd[j] = 0;
1150 }
1151 fclose(f1);
1152
1153 return;
1154}
1155
1158{
1159 REAL4 Fp, Fc, hp, hc, A1, A2, cosshift, sinshift;
1160 REAL4 cosphi, sinphi, theta, phi, psi;
1161 UINT4 i, len;
1162 CoherentGW waveform;
1163 memset( &waveform, 0, sizeof(CoherentGW) );
1164 PPNParamStruc ppnParams;
1165 memset( &ppnParams, 0, sizeof(PPNParamStruc) );
1166 ppnParams.deltaT = 1./params->tSampling;
1167 ppnParams.lengthIn = 0;
1168 ppnParams.ppn = NULL;
1169
1170 /* Construct a SimInspiralTable... */
1171 SimInspiralTable simTable;
1172 memset( &simTable, 0, sizeof(SimInspiralTable) );
1173 /* ... and populate it with desired parameter values */
1174 /*simTable.waveform = otherIn->waveformString;*/
1175 memcpy( simTable.waveform, otherIn->waveformString,
1176 sizeof(otherIn->waveformString) );
1177
1178 if (strstr(simTable.waveform,"PhenSpinTaylorRD")) {
1180 strcat(simTable.waveform,"OrbitalL");}
1181 else if (params->axisChoice==LAL_SIM_INSPIRAL_FRAME_AXIS_TOTAL_J) {
1182 strcat(simTable.waveform,"TotalJ");
1183 }
1184 if (params->inspiralOnly==1) {
1185 strcat(simTable.waveform,"inspiralOnly");
1186 }
1187 if (params->fixedStep==1) {
1188 strcat(simTable.waveform,"fixedStep");
1189 }
1190 }
1191 switch (params->interaction) {
1193 strcat(simTable.waveform,"NO");
1194 break;
1196 strcat(simTable.waveform,"SO15PN");
1197 break;
1199 strcat(simTable.waveform,"SO25PN");
1200 break;
1202 strcat(simTable.waveform,"SO");
1203 break;
1205 strcat(simTable.waveform,"SS");
1206 break;
1208 strcat(simTable.waveform,"SELF");
1209 break;
1211 strcat(simTable.waveform,"QM");
1212 break;
1214 strcat(simTable.waveform,"ALL_SPIN");
1215 break;
1217 strcat(simTable.waveform,"TIDAL5PN");
1218 break;
1220 strcat(simTable.waveform,"TIDAL");
1221 break;
1223 strcat(simTable.waveform,"ALL");
1224 break;
1225
1226 }
1227
1228 simTable.mass1 = params->mass1;
1229 simTable.mass2 = params->mass2;
1230 simTable.eta = params->eta;
1231 simTable.mchirp = params->chirpMass;
1232 simTable.distance = params->distance;
1233 simTable.longitude = params->sourceTheta;
1234 simTable.latitude = params->sourcePhi;
1235 simTable.inclination = params->inclination;
1236 simTable.coa_phase = params->startPhase; /* Is this what I want?? */
1237 simTable.polarization = params->polarisationAngle;
1238 simTable.psi0 = params->psi0;
1239 simTable.psi3 = params->psi3;
1240 simTable.alpha = params->alpha;
1241 simTable.alpha1 = params->alpha1;
1242 simTable.alpha2 = params->alpha2;
1243 simTable.alpha3 = params->alpha3;
1244 simTable.alpha4 = params->alpha4;
1245 simTable.alpha5 = params->alpha5;
1246 simTable.alpha6 = params->alpha6;
1247 simTable.beta = params->beta;
1248 simTable.spin1x = params->spin1[0];
1249 simTable.spin1y = params->spin1[1];
1250 simTable.spin1z = params->spin1[2];
1251 simTable.spin2x = params->spin2[0];
1252 simTable.spin2y = params->spin2[1];
1253 simTable.spin2z = params->spin2[2];
1254 simTable.theta0 = params->orbitTheta0;
1255 simTable.phi0 = params->orbitPhi0;
1256 simTable.f_lower = params->fLower;
1257 simTable.f_final = params->fFinal;
1258 simTable.amp_order = params->ampOrder;
1259 sprintf(simTable.taper, "TAPER_NONE");
1260 /* We'll taper (or not) later in code, so just set TAPER_NONE here */
1261
1262 theta = params->sourceTheta;
1263 phi = params->sourcePhi;
1264 psi = params->polarisationAngle;
1265 Fp = 0.5 * (1. + cos(theta)*cos(theta) ) * cos(2.*phi) * cos(2.*psi)
1266 - cos(theta) * sin(2.*phi) * sin(2.*psi);
1267 Fc = 0.5 * (1. + cos(theta)*cos(theta) ) * cos(2.*phi) * sin(2.*psi)
1268 + cos(theta) * sin(2.*phi) * cos(2.*psi);
1269
1270 /* This function fills a CoherentGW with info to construct h(t) */
1271 LALGenerateInspiral(status, &waveform, &simTable, &ppnParams);
1272
1273
1274 if( waveform.h == NULL ) /* build h(t) from a, phi, shift */
1275 {
1276 len = waveform.phi->data->length;
1277 /* Some approximants do not set waveform.shift. We use shift(t) if set. */
1278 /* Otherwise, we assume the shift is a constant 0 */
1279 if( waveform.shift == NULL )
1280 {
1281 for(i = 0; i < len; i++)
1282 {
1283 A1 = waveform.a->data->data[2*i];
1284 A2 = waveform.a->data->data[2*i+1];
1285 cosshift = 1.;
1286 sinshift = 0.;
1287 cosphi = cos( waveform.phi->data->data[i] );
1288 sinphi = sin( waveform.phi->data->data[i] );
1289 hp = A1 * cosshift * cosphi - A2 * sinshift * sinphi;
1290 hc = A1 * sinshift * cosphi + A2 * cosshift * sinphi;
1291 wave->data[i] = Fp * hp + Fc * hc;
1292 }
1293 }
1294 else
1295 {
1296 for(i = 0; i < len; i++)
1297 {
1298 A1 = waveform.a->data->data[2*i];
1299 A2 = waveform.a->data->data[2*i+1];
1300 cosshift = cos( waveform.shift->data->data[i] );
1301 sinshift = sin( waveform.shift->data->data[i] );
1302 cosphi = cos( waveform.phi->data->data[i] );
1303 sinphi = sin( waveform.phi->data->data[i] );
1304 hp = A1 * cosshift * cosphi - A2 * sinshift * sinphi;
1305 hc = A1 * sinshift * cosphi + A2 * cosshift * sinphi;
1306 wave->data[i] = Fp * hp + Fc * hc;
1307 }
1308 }
1309 }
1310 else /* build h(t) from h+ and hx in waveform->h */
1311 {
1312 len=waveform.h->data->length < wave->length ? waveform.h->data->length : wave->length;
1313 for(i = 0; i < len; i++)
1314 {
1315 wave->data[i] = Fp * waveform.h->data->data[2*i]
1316 + Fc * waveform.h->data->data[2*i+1];
1317 }
1318 for (i=len;i<wave->length;i++) wave->data[i]=0.;
1319 }
1320
1321 return;
1322}
#define INSPIRALTEMPLATE_ORBITPHI0
#define INSPIRALTEMPLATE_STARTTIME
#define INSPIRALTEMPLATE_PSI0
#define INSPIRALTEMPLATE_SPIN1X
static void LALInspiralITStructureHelp(void)
#define INSPIRALTEMPLATE_APPROXIMANT
#define INSPIRALTEMPLATE_ALPHA1
#define INSPIRALTEMPLATE_ALPHA4
#define INSPIRALTEMPLATE_KAPPA
#define INSPIRALTEMPLATE_SPIN1Z
char * program
static void LALInspiralITStructureParseParameters(LALStatus *status, UINT4 argc, CHAR **argv, InspiralTemplate *params)
#define INSPIRALTEMPLATE_INCLINATION
#define INSPIRALTEMPLATE_ALPHA3
#define INSPIRALTEMPLATE_AXISCHOICE
#define INSPIRALTEMPLATE_ORBITTHETA0
#define INSPIRALTEMPLATE_SOURCEPHI
int main(int argc, char **argv)
#define INSPIRALTEMPLATE_BETA
#define SUB(func, statusptr)
#define INSPIRALTEMPLATE_FLOWER
#define INSPIRALTEMPLATE_SOURCETHETA
#define INSPIRALTEMPLATE_ALPHA6
static void LALInspiralITStructureSetDefault(LALStatus *status, InspiralTemplate *params)
void printf_timeseries2(UINT4 n, REAL4 *signal1, REAL4 *signal2, REAL8 delta)
#define INSPIRALTEMPLATE_ALPHA5
#define INSPIRALTEMPLATE_ORDER
#define INSPIRALTEMPLATE_OMEGAS
#define INSPIRALTEMPLATE_THETA
#define INSPIRALTEMPLATE_INSPIRALONLY
#define INSPIRALTEMPLATE_ECCENTRICITY
#define INSPIRALTEMPLATE_SPIN1Y
#define INSPIRALTEMPLATE_ALPHA2
#define INSPIRALTEMPLATE_STARTPHASE
#define INSPIRALTEMPLATE_POLARISATIONANGLE
#define INSPIRALTEMPLATE_ALPHA
#define INSPIRALTEMPLATE_SPIN2Z
#define INSPIRALTEMPLATE_PSI3
void printf_timeseries(FILE *f1, UINT4 n, REAL4 *signal1, REAL8 delta)
void buildhoft(LALStatus *status, REAL4Vector *wave, InspiralTemplate *params, OtherParamIn *otherIn)
#define INSPIRALTEMPLATE_SPIN2Y
void readPSD(REAL8 *psd, REAL4 Df, UINT4 length)
#define INSPIRALTEMPLATE_SIGNALAMPLITUDE
#define INSPIRALTEMPLATE_MASS1
#define INSPIRALTEMPLATE_DISTANCE
#define INSPIRALTEMPLATE_ZETA2
static void LALInspiralITStructurePrint(LALStatus *status, InspiralTemplate params)
#define INSPIRALTEMPLATE_CHI
void LALGenerateInspiralWaveformHelp(void)
#define INSPIRALTEMPLATE_FIXEDSTEP
#define INSPIRALTEMPLATE_SPIN2X
#define INSPIRALTEMPLATE_AMPORDER
#define INSPIRALTEMPLATE_MASS2
void ParseParameters(UINT4 argc, CHAR **argv, OtherParamIn *otherIn)
#define INSPIRALTEMPLATE_TSAMPLING
#define INSPIRALTEMPLATE_INTERACTION
#define INSPIRALTEMPLATE_FCUTOFF
void LALInspiralWaveTemplates(LALStatus *status, REAL4Vector *filter1, REAL4Vector *filter2, InspiralTemplate *params)
void LALInspiralSetup(LALStatus *status, expnCoeffs *ak, InspiralTemplate *params)
void LALInspiralInit(LALStatus *status, InspiralTemplate *params, InspiralInit *paramsInit)
void LALInspiralWave(LALStatus *status, REAL4Vector *signalvec, InspiralTemplate *params)
static double double delta
#define ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
#define LIGOMETA_WAVEFORM_MAX
#define fscanf
#define fprintf
double i
double theta
void LALGenerateInspiral(LALStatus *status, CoherentGW *waveform, SimInspiralTable *thisEvent, PPNParamStruc *ppnParams)
#define LAL_PC_SI
#define LAL_MRSUN_SI
double REAL8
char CHAR
uint32_t UINT4
int32_t INT4
float REAL4
@ psi0Andpsi3
BCV parameters and .
Definition: LALInspiral.h:187
@ m1Andm2
component masses
Definition: LALInspiral.h:179
@ LAL_INSPIRAL_INTERACTION_TIDAL_5PN
Leading-order tidal interaction.
Definition: LALInspiral.h:124
@ LAL_INSPIRAL_INTERACTION_ALL
all spin and tidal interactions
Definition: LALInspiral.h:127
@ LAL_INSPIRAL_INTERACTION_TIDAL_6PN
Next-to-leading-order tidal interaction.
Definition: LALInspiral.h:125
@ LAL_INSPIRAL_INTERACTION_SPIN_ORBIT_25PN
Next-to-leading-order spin-orbit interaction.
Definition: LALInspiral.h:122
@ LAL_INSPIRAL_INTERACTION_QUAD_MONO_2PN
Quadrupole-monopole interaction.
Definition: LALInspiral.h:121
@ LAL_INSPIRAL_INTERACTION_SPIN_ORBIT_3PN
Spin-spin interaction.
Definition: LALInspiral.h:123
@ LAL_INSPIRAL_INTERACTION_NONE
No spin, tidal or other interactions.
Definition: LALInspiral.h:117
@ LAL_INSPIRAL_INTERACTION_SPIN_SPIN_2PN
Spin-spin interaction.
Definition: LALInspiral.h:119
@ LAL_INSPIRAL_INTERACTION_SPIN_ORBIT_15PN
Leading order spin-orbit interaction.
Definition: LALInspiral.h:118
@ LAL_INSPIRAL_INTERACTION_ALL_SPIN
all spin interactions, no tidal interactions
Definition: LALInspiral.h:126
@ LAL_INSPIRAL_INTERACTION_SPIN_SPIN_SELF_2PN
Spin-spin-self interaction.
Definition: LALInspiral.h:120
void LALNoiseSpectralDensity(LALStatus *status, REAL8Vector *psd, void(*NoisePsd)(LALStatus *status, REAL8 *shf, REAL8 f), REAL8 df)
void LALLIGOIPsd(LALStatus UNUSED *status, REAL8 *psd, REAL8 f)
LALSimInspiralApplyTaper
LALPNOrder
LAL_SIM_INSPIRAL_TAPER_START
LAL_SIM_INSPIRAL_TAPER_STARTEND
LAL_SIM_INSPIRAL_TAPER_END
LAL_SIM_INSPIRAL_FRAME_AXIS_VIEW
LAL_SIM_INSPIRAL_FRAME_AXIS_TOTAL_J
LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L
EOB
PadeT1
IMRPhenomFB
EOBNRv2HM
SpinTaylorT4
TaylorEt
FrameFile
GeneratePPN
BCVSpin
NumRel
EOBNRv2
TaylorN
IMRPhenomFA
SpinQuadTaylor
FindChirpSP
TaylorF2RedSpin
Eccentricity
EOBNR
PadeF1
IMRPhenomA
AmpCorPPN
TaylorF1
TaylorT3
FindChirpPTF
TaylorT4
TaylorF2
IMRPhenomB
PhenSpinTaylorRD
SpinTaylorFrameless
BCV
TaylorT1
SpinTaylor
SpinTaylorT3
TaylorT2
BCVC
int XLALSimInspiralREAL4WaveTaper(REAL4Vector *signalvec, LALSimInspiralApplyTaper bookends)
#define RealFFTPlan
REAL4FFTPlan * XLALCreateReverseREAL4FFTPlan(UINT4 size, int measurelvl)
REAL4FFTPlan * XLALCreateForwardREAL4FFTPlan(UINT4 size, int measurelvl)
void XLALDestroyREAL4FFTPlan(REAL4FFTPlan *plan)
int XLALREAL4VectorFFT(REAL4Vector *_LAL_RESTRICT_ output, const REAL4Vector *_LAL_RESTRICT_ input, const REAL4FFTPlan *plan)
void LALDCreateVector(LALStatus *, REAL8Vector **, UINT4)
void LALDDestroyVector(LALStatus *, REAL8Vector **)
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALSCreateVector(LALStatus *, REAL4Vector **, UINT4)
int n
x
REAL4TimeSeries * shift
REAL4TimeVectorSeries * a
REAL8TimeSeries * phi
REAL4TimeVectorSeries * h
The inspiral waveform parameter structure containing information about the waveform to be generated.
Definition: LALInspiral.h:205
char waveformString[LIGOMETA_WAVEFORM_MAX]
This structure stores the parameters for constructing a restricted post-Newtonian waveform.
REAL4Vector * ppn
The parameters selecting the type of post-Newtonian expansion; If ppn=NULL, a "normal" (physical) ex...
REAL8 deltaT
The requested sampling interval of the waveform, in s.
UINT4 lengthIn
The maximum number of samples in the generated waveform; If zero, the waveforms can be arbitrarily lo...
REAL4Sequence * data
REAL4VectorSequence * data
REAL4 * data
REAL8Sequence * data
REAL8 * data
CHAR taper[LIGOMETA_INSPIRALTAPER_MAX]
CHAR waveform[LIGOMETA_WAVEFORM_MAX]
This structure contains various post-Newtonian and P-approximant expansion coefficients; the meanings...
Definition: LALInspiral.h:399
double inclination
double eccentricity
double distance
double df