Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALInspiral 5.0.3.1-ea7c608
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALInspiralTaylorT2Test.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2011 Drew Keppel
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 Keppel, D.
22 *
23 * \brief Create waveforms based on the TaylorT2 model.
24 *
25 * Outputs a two files with three columns corresponding to time (in seconds),
26 * \f$h_+\f$, and \f$h_\times\f$. The first output file is <tt>T2wave1.dat</tt> in
27 * the current directory. This is generated using the
28 * XLALSimInspiralTaylorT2PNRestricted routine. The seond output file is
29 * <tt>T2wave2.dat</tt> in the current directory. This is generated using the
30 * XLALInspiralWave3Templates routine.
31 *
32 * ### Usage ###
33 *
34 * <tt>LALInspiralTaylor22Test</tt>
35 *
36 */
37
38#include <time.h>
39#include <math.h>
40#include <lal/LALStdlib.h>
41#include <lal/LALInspiral.h>
42#include <lal/LALSimInspiral.h>
43#include <lal/GeneratePPNInspiral.h>
44#include <lal/GenerateInspiral.h>
45#include <lal/TimeSeries.h>
46#include <lal/Units.h>
47
48int main(void) {
49 static LALStatus mystatus;
50
51 /* variables for timing purposes */
52 clock_t start, diff;
53 int msec;
54
55 REAL4TimeSeries *h_plus;
56 REAL4TimeSeries *h_cross;
57 REAL8TimeSeries *hplus;
58 REAL8TimeSeries *hcross;
60
61 FILE *outputfile;
62 INT4 i,length,O;
63 REAL8 dt, m, m1, m2, mu, nu, lambda1, lambda2;
65
66 memset( &mystatus, 0, sizeof(LALStatus) );
67 memset( &params, 0, sizeof(InspiralTemplate) );
68
69 m1 = 5.;
70 m2 = 5.;
71 m = m1 + m2;
72 mu = m1 * m2 / m;
73 nu = mu / m;
74
75 lambda1 = 0.;
76 lambda2 = 0.;
77 LALSimInspiralWaveformFlags *waveFlags;
79
80 O = 7;
81 switch (O)
82 {
83 case 0:
84 case 1:
85 O = 0;
87 break;
88 case 2:
89 params.order = LAL_PNORDER_ONE;
90 break;
91 case 3:
93 break;
94 case 4:
95 params.order = LAL_PNORDER_TWO;
96 break;
97 case 5:
99 break;
100 case 6:
102 break;
103 case 7:
105 break;
106 }
107
108 params.approximant = TaylorT2;
109 params.ampOrder = LAL_PNORDER_NEWTONIAN;
110 params.mass1 = m1;
111 params.mass2 = m2;
112 params.totalMass = m;
113 params.mu = mu;
114 params.eta = nu;
115 params.tSampling = 4096;
116 params.fCutoff = 2047.;
117 params.fLower = 40.;
118 params.distance = 1e6 * LAL_PC_SI;
119 params.signalAmplitude = 4.0 * params.mu * LAL_MRSUN_SI/params.distance;
120 params.ieta = 1;
121
122
123
124 dt = 1. / params.tSampling;
125
126 start = clock();
127 length = XLALSimInspiralTaylorT2PNRestricted(&hplus, &hcross, 0., dt, params.mass1*LAL_MSUN_SI, params.mass2*LAL_MSUN_SI, params.fLower, 0., params.distance, lambda1, lambda2, XLALSimInspiralGetTidalOrder(waveFlags), 0, O);
128 diff = clock() - start;
129 msec = diff * 1000 / CLOCKS_PER_SEC;
130 printf("Time taken %d seconds %d milliseconds\n", msec/1000, msec%1000);
131
132 fprintf(stderr, "length = %i\n", length);
133 fprintf(stderr, "T = %f\n", (float) length * dt);
134
135 outputfile = fopen("T2wave1.dat","w");
136
137 length = hplus->data->length;
138
139 for(i = 0; i < length; i++) {
140 fprintf(outputfile,"%e\t%e\t%e\n",
141 i*dt,
142 hplus->data->data[i],
143 hcross->data->data[i]);
144 }
145
146 fclose(outputfile);
147 fprintf(stdout,"waveform saved in T2wave1.dat\n" );
148
149 start = clock();
150 h_plus = XLALCreateREAL4TimeSeries("", &tc, 0.0, dt, &lalDimensionlessUnit, params.tSampling*3);
151 h_cross = XLALCreateREAL4TimeSeries("", &tc, 0.0, dt, &lalDimensionlessUnit, params.tSampling*3);
152
153 fprintf(stderr, "Lower cut-off frequency used will be %fHz\n", params.fLower);
154
155 /* --- now we can call the injection function --- */
156 XLALInspiralWave2Templates(h_plus->data, h_cross->data, &params);
157 diff = clock() - start;
158 msec = diff * 1000 / CLOCKS_PER_SEC;
159 printf("Time taken %d seconds %d milliseconds\n", msec/1000, msec%1000);
160
161 if ( mystatus.statusCode )
162 {
163 fprintf( stderr, "LALInspiralTaylorT2Test: error generating waveform\n" );
164 exit( 1 );
165 }
166
167 /* --- and finally save in a file --- */
168
169 outputfile = fopen("T2wave2.dat","w");
170
171 length = h_plus->data->length;
172
173 for(i = 0; i < length; i++) {
174 fprintf(outputfile,"%e\t%e\t%e\n",
175 i*dt,
176 h_plus->data->data[i],
177 h_cross->data->data[i]);
178 }
179
180 fclose(outputfile);
181 fprintf(stdout,"waveform saved in T2wave2.dat\n" );
182 return 0;
183}
int XLALInspiralWave2Templates(REAL4Vector *signalvec1, REAL4Vector *signalvec2, InspiralTemplate *params)
int main(void)
Create waveforms based on the TaylorT2 model.
#define fprintf
double i
#define LAL_MSUN_SI
#define LAL_PC_SI
#define LAL_MRSUN_SI
#define LIGOTIMEGPSZERO
double REAL8
int32_t INT4
TaylorT2
LAL_PNORDER_TWO_POINT_FIVE
LAL_PNORDER_THREE
LAL_PNORDER_TWO
LAL_PNORDER_ONE
LAL_PNORDER_THREE_POINT_FIVE
LAL_PNORDER_ONE_POINT_FIVE
LAL_PNORDER_NEWTONIAN
int XLALSimInspiralTaylorT2PNRestricted(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 i, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int O)
LALSimInspiralWaveformFlags * XLALSimInspiralCreateWaveformFlags(void)
LALSimInspiralTidalOrder XLALSimInspiralGetTidalOrder(LALSimInspiralWaveformFlags *waveFlags)
static const INT4 m
REAL4TimeSeries * XLALCreateREAL4TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalDimensionlessUnit
list mu
start
The inspiral waveform parameter structure containing information about the waveform to be generated.
Definition: LALInspiral.h:205
INT4 statusCode
REAL4Sequence * data
REAL4 * data
REAL8Sequence * data
REAL8 * data
double distance