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
LALInspiralTaylorT3Test.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 TaylorT3 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>T3wave1.dat</tt> in
27 * the current directory. This is generated using the
28 * XLALSimInspiralTaylorT3PNRestricted routine. The seond output file is
29 * <tt>T3wave2.dat</tt> in the current directory. This is generated using the
30 * XLALInspiralWave3Templates routine.
31 *
32 * ### Usage ###
33 *
34 * <tt>LALInspiralTaylorT3Test</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, 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 nu = m1 * m2 / m / m;
73
74 lambda1 = 0.;
75 lambda2 = 0.;
76 LALSimInspiralWaveformFlags *waveFlags;
78
79 O = 0;
80 switch (O)
81 {
82 case 0:
83 case 1:
84 O = 0;
86 break;
87 case 2:
88 params.order = LAL_PNORDER_ONE;
89 break;
90 case 3:
92 break;
93 case 4:
94 params.order = LAL_PNORDER_TWO;
95 break;
96 case 5:
98 break;
99 case 6:
101 break;
102 case 7:
104 break;
105 }
106
107 params.approximant = TaylorT3;
108 params.ampOrder = LAL_PNORDER_NEWTONIAN;
109 params.mass1 = m1;
110 params.mass2 = m2;
111 params.totalMass = m;
112 params.eta = nu;
113 params.tSampling = 4096;
114 params.fCutoff = 2047.;
115 params.fLower = 40.;
116 params.distance = 1e6 * LAL_PC_SI;
117 params.ieta = 1;
118
119
120
121 dt = 1. / params.tSampling;
122
123 start = clock();
124 length = XLALSimInspiralTaylorT3PNRestricted(&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);
125 diff = clock() - start;
126 msec = diff * 1000 / CLOCKS_PER_SEC;
127 printf("Time taken %d seconds %d milliseconds\n", msec/1000, msec%1000);
128
129 fprintf(stderr, "length = %i\n", length);
130 fprintf(stderr, "T = %f\n", (float) length * dt);
131
132 outputfile = fopen("T3wave1.dat","w");
133
134 length = hplus->data->length;
135
136 for(i = 0; i < length; i++) {
137 fprintf(outputfile,"%e\t%e\t%e\n",
138 i*dt,
139 hplus->data->data[i],
140 hcross->data->data[i]);
141 }
142
143 fclose(outputfile);
144 fprintf(stdout,"waveform saved in T3wave1.dat\n" );
145
146 start = clock();
147 h_plus = XLALCreateREAL4TimeSeries("", &tc, 0.0, dt, &lalDimensionlessUnit, 4096*3);
148 h_cross = XLALCreateREAL4TimeSeries("", &tc, 0.0, dt, &lalDimensionlessUnit, 4096*3);
149
150 fprintf(stderr, "Lower cut-off frequency used will be %fHz\n", params.fLower);
151
152 /* --- now we can call the injection function --- */
153 XLALInspiralWave3Templates(h_plus->data, h_cross->data, &params);
154 diff = clock() - start;
155 msec = diff * 1000 / CLOCKS_PER_SEC;
156 printf("Time taken %d seconds %d milliseconds\n", msec/1000, msec%1000);
157
158 if ( mystatus.statusCode )
159 {
160 fprintf( stderr, "LALInspiralTaylorT3Test: error generating waveform\n" );
161 exit( 1 );
162 }
163
164 /* --- and finally save in a file --- */
165
166 outputfile = fopen("T3wave2.dat","w");
167
168 length = h_plus->data->length;
169
170 for(i = 0; i < length; i++) {
171 fprintf(outputfile,"%e\t%e\t%e\n",
172 i*dt,
173 h_plus->data->data[i],
174 h_cross->data->data[i]);
175 }
176
177 fclose(outputfile);
178 fprintf(stdout,"waveform saved in T3wave2.dat\n" );
179 return 0;
180}
int XLALInspiralWave3Templates(REAL4Vector *signalvec1, REAL4Vector *signalvec2, InspiralTemplate *params)
int main(void)
Create waveforms based on the TaylorT3 model.
#define fprintf
double i
#define LAL_MSUN_SI
#define LAL_PC_SI
#define LIGOTIMEGPSZERO
double REAL8
int32_t INT4
TaylorT3
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 XLALSimInspiralTaylorT3PNRestricted(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
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