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
LALBCVWaveform.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 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 B.S. Sathyaprakash
22 * \file
23 * \ingroup LALInspiral_h
24 *
25 * \brief This module contains a single function <tt>LALBCVWaveform()</tt>.
26 *
27 * ### Prototypes ###
28 *
29 * <tt>LALLALBCVWaveform():</tt>
30 * <ul>
31 * <li> \c signalvec: Output containing the <em>Fourier transform</em> of the inspiral waveform.
32 * </li><li> \c params: Input containing binary chirp parameters;
33 * it is necessary and sufficent to specify the following parameters
34 * of the \c params structure:
35 * <tt>psi0, psi3, alpha, fendBCV(fFinal), nStartPad, fLower, tSampling</tt>.
36 * All other parameters in \c params are ignored. </li></ul>
37 *
38 * <tt>LALLALBCVSpinWaveform()</tt>
39 * <ul>
40 * <li> \c signalvec: Output containing the <em>Fourier transform</em> of the inspiral waveform.
41 * </li><li> \c params: Input containing binary chirp parameters;
42 * it is necessary and sufficent to specify the following parameters
43 * of the \c params structure:
44 * <tt>psi0, psi3, alpha1, alpha2, beta, fendBCV(fFinal), nStartPad, fLower, tSampling</tt>.
45 * All other parameters in \c params are ignored. </li></ul> *
46 *
47 * ### Description ###
48 *
49 * This module can be used to generate <em>detection template
50 * family</em> of Buonanno, Chen and Vallisneri \cite BCV03 ,BCV03b].
51 * There are two modules: <tt>LALBCVWaveform.</tt> and <tt>LALBCVSpinWaveform.</tt>
52 * The former can be used to generate non-spinning waveforms and the DTF
53 * it implements is given in \eqref{eq_BCV_NonSpinning} and the latter
54 * to generate spinning waveforms (\eqref{eq_BCV_Spinning}.
55 *
56 * ### Algorithm ###
57 *
58 * A straightforward implementation of the formula. Note that the routine returns
59 * <tt>Fourier transform</tt> of the signal as opposed to most other modules in this
60 * package which return time-domain signals. Also, the amplitude is quite arbitrary.
61 *
62 * ### Uses ###
63 *
64 * \code
65 * ASSERT
66 * ATTATCHSTATUSPTR
67 * DETATCHSTATUSPTR
68 * INITSTATUS
69 * RETURN
70 * \endcode
71 *
72 * ### Notes ###
73 *
74 * %% Any relevant notes.
75 *
76 */
77
78#include <math.h>
79#include <lal/LALInspiral.h>
80
81void
84 REAL4Vector *signalvec,
86 )
87 {
88
89 REAL8 f, df;
90 REAL8 shift, phi, psi, amp0, amp, alpha;
91 INT4 n, i;
92
95
96 ASSERT (signalvec, status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
97 ASSERT (signalvec->data, status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
98 ASSERT (params, status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
99 ASSERT (params->nStartPad >= 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
100 ASSERT (params->fLower > 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
101 ASSERT (params->tSampling > 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
102
103 n = signalvec->length;
104
105 df = params->tSampling/(REAL8)n;
106 params->fFinal = params->fCutoff;
107 alpha = params->alpha / pow(params->fCutoff, (2./3.));
108
109
110 /* to do : check that a_f in [0,1]??*/
111
112 /*
113 totalMass = params->totalMass * LAL_MTSUN_SI;
114 shift = LAL_TWOPI * (params->tC - (float)n /params->tSampling
115 - params->startTime - params->nStartPad/params->tSampling);
116 */
117 /*
118 shift = LAL_TWOPI * ((double) params->nStartPad/params->tSampling + params->startTime);
119 phi = params->startPhase + params->psi0 * pow(params->fLower, -(5./3.))
120 + params->psi3 * pow(params->fLower, -(2./3.));
121 */
122 shift = -LAL_TWOPI * ((double)params->nStartPad/params->tSampling);
123 phi = - params->startPhase;
124
125 /*
126 amp0 = params->signalAmplitude * pow(5./(384.*params->eta), 0.5) *
127 totalMass * pow(LAL_PI * totalMass,-(7./6.)) *
128 params->tSampling * (2. / signalvec->length);
129
130 */
131
132 amp0 = params->signalAmplitude;
133 /* Computing BCV waveform */
134
135 signalvec->data[0] = 0.0;
136 signalvec->data[n/2] = 0.0;
137
138 for(i=1;i<n/2;i++)
139 {
140 f = i*df;
141
142 if (f < params->fLower || f > params->fFinal)
143 {
144 /*
145 * All frequency components below params->fLower and above fn are set to zero
146 */
147 signalvec->data[i] = 0.;
148 signalvec->data[n-i] = 0.;
149
150 }
151 else
152 {
153 /* What shall we put for sign phi? for uspa it must be "-" */
154 psi = (shift*f + phi + params->psi0*pow(f,-(5./3.)) + params->psi3*pow(f,-(2./3.)));
155 amp = amp0 * (1. - alpha * pow(f,(2./3.))) * pow(f,-(7./6.));
156
157 signalvec->data[i] = (REAL4) (amp * cos(psi));
158 signalvec->data[n-i] = (REAL4) (-amp * sin(psi));
159 }
160 }
162 RETURN(status);
163}
164
165
166
167
168
169
170void
173 REAL4Vector *signalvec,
175 )
176 {
177
178 REAL8 f, df;
179 REAL8 shift, phi, psi, amp0, ampRe, ampIm, modphase;
180 INT4 n, i;
181
184
185 ASSERT (signalvec, status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
186 ASSERT (signalvec->data, status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
187 ASSERT (params, status, LALINSPIRALH_ENULL, LALINSPIRALH_MSGENULL);
188 ASSERT (params->nStartPad >= 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
189 ASSERT (params->fLower > 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
190 ASSERT (params->tSampling > 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
191
192 n = signalvec->length;
193
194 df = params->tSampling/(REAL8)n;
195
196 /*
197 totalMass = params->totalMass * LAL_MTSUN_SI;
198 shift = LAL_TWOPI * (params->tC - (float)n /params->tSampling
199 - params->startTime - params->nStartPad/params->tSampling);
200 */
201 shift = -LAL_TWOPI * (params->nStartPad/params->tSampling);
202
203 /* use this to shift waveform start time by hand... */
204 /*shift = -LAL_TWOPI * (131072/params->tSampling);*/
205
206 phi = - params->startPhase;
207
208 /*
209 amp0 = params->signalAmplitude * pow(5./(384.*params->eta), 0.5) *
210 totalMass * pow(LAL_PI * totalMass,-(7./6.)) *
211 params->tSampling * (2. / signalvec->length);
212
213 */
214 amp0 = params->signalAmplitude;
215 /* Computing BCV waveform */
216
217 signalvec->data[0] = 0.0;
218 signalvec->data[n/2] = 0.0;
219
220 for(i=1;i<n/2;i++)
221 {
222 f = i*df;
223 if (f < params->fLower || f > params->fCutoff)
224 {
225 /*
226 * All frequency components below params->fLower and above fn are set to zero
227 */
228 signalvec->data[i] = 0.;
229 signalvec->data[n-i] = 0.;
230
231 }
232 else
233 {
234 /* What shall we put for sign phi? for uspa it must be "-" */
235
236 psi = (shift*f + phi + params->psi0*pow(f,-(5./3.)) + params->psi3*pow(f,-(2./3.)));
237 modphase = params->beta * pow(f,-(2./3.));
238
239 ampRe = amp0 * pow(f,-(7./6.))
240 * (params->alpha1
241 + (params->alpha2 * cos(modphase))
242 + (params->alpha3 * sin(modphase)));
243 ampIm = amp0 * pow(f,-(7./6.))
244 * (params->alpha4
245 + (params->alpha5 * cos(modphase))
246 + (params->alpha6 * sin(modphase)));
247
248 signalvec->data[i] = (REAL4) ((ampRe * cos(psi)) - (ampIm * sin(psi)));
249 signalvec->data[n-i] = (REAL4) -1.*((ampRe * sin(psi)) + (ampIm * cos(psi)));
250 }
251 }
252
253 params->fFinal = params->fCutoff;
254
256 RETURN(status);
257}
void LALBCVWaveform(LALStatus *status, REAL4Vector *signalvec, InspiralTemplate *params)
void LALBCVSpinWaveform(LALStatus *status, REAL4Vector *signalvec, InspiralTemplate *params)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
double i
#define LAL_TWOPI
double REAL8
int32_t INT4
float REAL4
#define LALINSPIRALH_ENULL
Arguments contained an unexpected null pointer.
Definition: LALInspiral.h:56
#define LALINSPIRALH_ESIZE
Invalid input range.
Definition: LALInspiral.h:59
int n
double alpha
The inspiral waveform parameter structure containing information about the waveform to be generated.
Definition: LALInspiral.h:205
REAL4 * data
double df