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
LALInspiralTaylorT4Test.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 TaylorT4 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>T4wave1.dat</tt> in
27 * the current directory. This is generated using the
28 * XLALSimInspiralTaylorT4PNRestricted routine. The seond output file is
29 * <tt>T4wave2.dat</tt> in the current directory. This is generated using the
30 * LALInspiralWave4Templates routine.
31 *
32 * ### Usage ###
33 *
34 * <tt>LALInspiralTaylorT4Test</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;
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 params.approximant = TaylorT4;
82 params.mass1 = m1;
83 params.mass2 = m2;
84 params.totalMass = m;
85 params.eta = nu;
86 params.tSampling = 4096;
87 params.fCutoff = 2047.;
88 params.fLower = 40.;
90 params.ieta = 1;
91
92 dt = 1. / params.tSampling;
93
94 start = clock();
95 length = XLALSimInspiralTaylorT4PNRestricted(&hplus, &hcross, 0., dt, params.mass1*LAL_MSUN_SI, params.mass2*LAL_MSUN_SI, params.fLower, 0., params.distance, lambda1, lambda2, XLALSimInspiralGetTidalOrder(waveFlags), 0, 7);
96 diff = clock() - start;
97 msec = diff * 1000 / CLOCKS_PER_SEC;
98 printf("Time taken %d seconds %d milliseconds\n", msec/1000, msec%1000);
99
100 fprintf(stderr, "length = %i\n", length);
101 fprintf(stderr, "T = %f\n", (float) length * dt);
102
103 outputfile = fopen("T4wave1.dat","w");
104
105 length = hplus->data->length;
106
107 for(i = 0; i < length; i++) {
108 fprintf(outputfile,"%e\t%e\t%e\n",
109 i*dt,
110 hplus->data->data[i],
111 hcross->data->data[i]);
112 }
113
114 fclose(outputfile);
115 fprintf(stdout,"waveform saved in T4wave1.dat\n" );
116
117 start = clock();
118 h_plus = XLALCreateREAL4TimeSeries("", &tc, 0.0, dt, &lalDimensionlessUnit, 4096*3);
119 h_cross = XLALCreateREAL4TimeSeries("", &tc, 0.0, dt, &lalDimensionlessUnit, 4096*3);
120
121 fprintf(stderr, "Lower cut-off frequency used will be %fHz\n", params.fLower);
122
123 /* --- now we can call the injection function --- */
124 LALTaylorT4WaveformTemplates(&mystatus, h_plus->data, h_cross->data, &params);
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 if ( mystatus.statusCode )
130 {
131 fprintf( stderr, "LALInspiralTaylorT4Test: error generating waveform\n" );
132 exit( 1 );
133 }
134
135 /* --- and finally save in a file --- */
136
137 outputfile = fopen("T4wave2.dat","w");
138
139 length = h_plus->data->length;
140
141 for(i = 0; i < length; i++) {
142 fprintf(outputfile,"%e\t%e\t%e\n",
143 i*dt,
144 h_plus->data->data[i],
145 h_cross->data->data[i]);
146 }
147
148 fclose(outputfile);
149 fprintf(stdout,"waveform saved in T4wave2.dat\n" );
150 return 0;
151}
void LALTaylorT4WaveformTemplates(LALStatus *status, REAL4Vector *signalvec1, REAL4Vector *signalvec2, InspiralTemplate *params)
int main(void)
Create waveforms based on the TaylorT4 model.
#define fprintf
double i
#define LAL_MSUN_SI
#define LAL_PC_SI
#define LIGOTIMEGPSZERO
double REAL8
int32_t INT4
TaylorT4
LAL_PNORDER_THREE_POINT_FIVE
LAL_PNORDER_NEWTONIAN
int XLALSimInspiralTaylorT4PNRestricted(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