Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALInspiral 5.0.3.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
InspiralBankGeneration.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 Chad Hanna, Duncan Brown, Benjamin Owen, B.S. Sathyaprakash, 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
22#include<lal/LALStdlib.h>
23#include<lal/LALStatusMacros.h>
24#include<lal/LALInspiral.h>
25#include<lal/LALInspiralBank.h>
26#include<lal/LIGOMetadataTables.h>
27
28void
32 SnglInspiralTable **first,
33 INT4 *ntiles )
34{
35 InspiralTemplateList *coarseList = NULL;
37 InspiralMomentsEtc moments;
38 INT4 cnt = 0;
39 REAL8 fFinal = 0;
40 REAL8 minfFinal = 0;
41 REAL8 maxfFinal = 0;
42 REAL8 q = 0;
43 INT4 chicnt = 0;
44 INT4 kappacnt = 0;
45 INT4 numTmplts = 0;
46 INT4 i;
47 REAL8 *chi, *kappa, dChi, dKappa;
48
51
52 ASSERT( input != NULL, status, LALINSPIRALBANKH_ENULL,
53 LALINSPIRALBANKH_MSGENULL );
54 ASSERT( *first == NULL, status, LALINSPIRALBANKH_ENULL,
55 LALINSPIRALBANKH_MSGENULL );
57 LALINSPIRALBANKH_MSGENUMFCUT );
58
59 /* For nonspinning approximants or (for the moment) IMRPhenomB, call LALInspiralCreateCoarseBank(). */
60 switch( input->approximant )
61 {
62 case BCV:
63 case EOB:
64 case EOBNR:
65 case EOBNRv2:
66 case IMRPhenomA:
67 case IMRPhenomB:
68 case PadeT1:
69 case PadeF1:
70 case TaylorT4:
71 case TaylorF1:
72 case TaylorF2:
73 case TaylorT1:
74 case TaylorT2:
75 case TaylorT3:
76 case TaylorEt:
77 case TaylorN:
78 case AmpCorPPN:
79 case Eccentricity:
80
81 /* Use LALInspiralCreateCoarseBank(). */
82 TRY( LALInspiralCreateCoarseBank( status->statusPtr, &coarseList, ntiles,
83 *input ), status );
84 /* */
85 /* Convert output data structure. */
86 bank = (SnglInspiralTable *) LALCalloc(1, sizeof(SnglInspiralTable));
87 if (bank == NULL){
88 ABORT( status, LALINSPIRALBANKH_EMEM, LALINSPIRALBANKH_MSGEMEM );
89 }
90 *first = bank;
91 for( cnt = 0; cnt < *ntiles; cnt++ )
92 {
93 /* Set the min and max fFinals using the appropriate formula*/
94 if( input->maxFreqCut == FreqCut_SchwarzISCO )
95 {
96 maxfFinal = 1.0 / (6.0 * sqrt(6.0)*LAL_PI
97 *coarseList[cnt].params.totalMass*LAL_MTSUN_SI);
98 }
99 else if( input->maxFreqCut == FreqCut_BKLISCO )
100 {
101 if( coarseList[cnt].params.mass1 > coarseList[cnt].params.mass2 )
102 {
103 q = coarseList[cnt].params.mass2 / coarseList[cnt].params.mass1;
104 }
105 else
106 q = coarseList[cnt].params.mass1 / coarseList[cnt].params.mass2;
107 maxfFinal = 1.0 / (6.0 * sqrt(6.0)*LAL_PI*coarseList[cnt].params.totalMass*LAL_MTSUN_SI) * ( 1 + 2.8*q - 2.6*q*q + 0.8*q*q*q );
108 }
109 else if( input->maxFreqCut == FreqCut_LightRing )
110 {
111 maxfFinal = 1.0 / (3.0 * sqrt(3.0)*LAL_PI
112 *coarseList[cnt].params.totalMass*LAL_MTSUN_SI);
113 }
114 else if( input->maxFreqCut == FreqCut_ERD )
115 {
116 maxfFinal = 1.07*0.5326/(2*LAL_PI*0.955*coarseList[cnt].params.totalMass*LAL_MTSUN_SI);
117 }
118 else if( input->maxFreqCut == FreqCut_FRD )
119 {
120 maxfFinal = ( 1. - 0.63*pow(1. - 3.4641016*coarseList[cnt].params.eta
121 + 2.9*coarseList[cnt].params.eta*coarseList[cnt].params.eta
122 , 0.3) )/( 2.*LAL_PI*(1. - 0.057191
123 *coarseList[cnt].params.eta - 0.498
124 *coarseList[cnt].params.eta*coarseList[cnt].params.eta)
125 *coarseList[cnt].params.totalMass*LAL_MTSUN_SI );
126 }
127 else if( input->maxFreqCut == FreqCut_LRD )
128 {
129 maxfFinal = 1.2* ( 1. - 0.63*pow(1. - 3.4641016*coarseList[cnt].params.eta
130 + 2.9*coarseList[cnt].params.eta*coarseList[cnt].params.eta
131 , 0.3) )/( 2.*LAL_PI*(1. - 0.057191
132 *coarseList[cnt].params.eta - 0.498
133 *coarseList[cnt].params.eta*coarseList[cnt].params.eta)
134 *coarseList[cnt].params.totalMass*LAL_MTSUN_SI );
135 }
136 else
137 ABORT( status, LALINSPIRALBANKH_EFCUT, LALINSPIRALBANKH_MSGEFCUT );
138
139 if( input->minFreqCut == FreqCut_SchwarzISCO )
140 {
141 minfFinal = 1.0 / (6.0 * sqrt(6.0)*LAL_PI
142 *coarseList[cnt].params.totalMass*LAL_MTSUN_SI);
143 }
144 else if( input->minFreqCut == FreqCut_BKLISCO )
145 {
146 if( coarseList[cnt].params.mass1 > coarseList[cnt].params.mass2 )
147 {
148 q = coarseList[cnt].params.mass2 / coarseList[cnt].params.mass1;
149 }
150 else
151 q = coarseList[cnt].params.mass1 / coarseList[cnt].params.mass2;
152 minfFinal = 1.0 / (6.0 * sqrt(6.0)*LAL_PI*coarseList[cnt].params.totalMass*LAL_MTSUN_SI) * ( 1 + 2.8*q - 2.6*q*q + 0.8*q*q*q );
153 }
154 else if( input->minFreqCut == FreqCut_LightRing )
155 {
156 minfFinal = 1.0 / (3.0 * sqrt(3.0)*LAL_PI
157 *coarseList[cnt].params.totalMass*LAL_MTSUN_SI);
158 }
159 else if( input->minFreqCut == FreqCut_ERD )
160 {
161 minfFinal = 1.07*0.5326/(2*LAL_PI*0.955*coarseList[cnt].params.totalMass*LAL_MTSUN_SI);
162 }
163 else if( input->minFreqCut == FreqCut_FRD )
164 {
165 minfFinal = ( 1. - 0.63*pow(1. - 3.4641016*coarseList[cnt].params.eta
166 + 2.9*coarseList[cnt].params.eta*coarseList[cnt].params.eta
167 , 0.3) )/( 2.*LAL_PI*(1. - 0.057191
168 *coarseList[cnt].params.eta - 0.498
169 *coarseList[cnt].params.eta*coarseList[cnt].params.eta)
170 *coarseList[cnt].params.totalMass*LAL_MTSUN_SI );
171 }
172 else if( input->minFreqCut == FreqCut_LRD )
173 {
174 minfFinal = 1.2* ( 1. - 0.63*pow(1. - 3.4641016*coarseList[cnt].params.eta
175 + 2.9*coarseList[cnt].params.eta*coarseList[cnt].params.eta
176 , 0.3) )/( 2.*LAL_PI*(1. - 0.057191
177 *coarseList[cnt].params.eta - 0.498
178 *coarseList[cnt].params.eta*coarseList[cnt].params.eta)
179 *coarseList[cnt].params.totalMass*LAL_MTSUN_SI );
180 }
181 else
182 ABORT( status, LALINSPIRALBANKH_EFCUT, LALINSPIRALBANKH_MSGEFCUT );
183
184 /* For 1 upper frequency cutoff, fill the bank as usual with the
185 * specified fFinal (checked minFreqCut = maxFreqCut in tmpltbank.c)
186 */
187 if( input->numFreqCut == 1 )
188 {
189 bank = bank->next = (SnglInspiralTable *) LALCalloc( 1, sizeof(
191 if (bank == NULL)
192 {
193 ABORT( status, LALINSPIRALBANKH_EMEM, LALINSPIRALBANKH_MSGEMEM );
194 }
195 bank->mass1 = coarseList[cnt].params.mass1;
196 bank->mass2 = coarseList[cnt].params.mass2;
197 bank->mchirp = coarseList[cnt].params.chirpMass;
198 bank->mtotal = coarseList[cnt].params.totalMass;
199 bank->eta = coarseList[cnt].params.eta;
200 bank->tau0 = coarseList[cnt].params.t0;
201 bank->tau2 = coarseList[cnt].params.t2;
202 bank->tau3 = coarseList[cnt].params.t3;
203 bank->tau4 = coarseList[cnt].params.t4;
204 bank->tau5 = coarseList[cnt].params.t5;
205 bank->ttotal = coarseList[cnt].params.tC;
206 bank->psi0 = coarseList[cnt].params.psi0;
207 bank->psi3 = coarseList[cnt].params.psi3;
208
209 /* If fFinal > fNyquist, end template at fNyquist */
210 fFinal = minfFinal;
211 if (fFinal > input->fUpper)
212 {
213 fFinal = input->fUpper;
214 }
215 coarseList[cnt].params.fFinal = fFinal;
216
217 /* Update the Gamma parameter if requested, using the proper cut-off
218 * frequency */
219 if ( input->computeMoments )
220 {
221 coarseList[cnt].params.fCutoff = coarseList[cnt].params.fFinal;
222 LALGetInspiralMoments( status->statusPtr, &moments, &(input->shf),
223 &(coarseList[cnt].params) );
224
225 LALInspiralComputeMetric(status->statusPtr, &(coarseList[cnt].metric),
226 &(coarseList[cnt].params), &moments);
227 }
228
229
230 bank->f_final = coarseList[cnt].params.fFinal;
231 bank->eta = coarseList[cnt].params.eta;
232 bank->beta = coarseList[cnt].params.beta;
233
234 /* Copy the 10 metric co-efficients ... */
235 memcpy (bank->Gamma, coarseList[cnt].metric.Gamma, 10*sizeof(REAL4));
236 }
237
238 /* If we have multiple frequency cutoffs, create duplicate
239 * templates evenly incremented between minfFinal and maxfFinal
240 */
241 else for( i = 0; i < input->numFreqCut; i++ )
242 {
243 bank = bank->next = (SnglInspiralTable *) LALCalloc( 1, sizeof(
245 if (bank == NULL)
246 {
247 ABORT( status, LALINSPIRALBANKH_EMEM, LALINSPIRALBANKH_MSGEMEM );
248 }
249 bank->mass1 = coarseList[cnt].params.mass1;
250 bank->mass2 = coarseList[cnt].params.mass2;
251 bank->mchirp = coarseList[cnt].params.chirpMass;
252 bank->mtotal = coarseList[cnt].params.totalMass;
253 bank->eta = coarseList[cnt].params.eta;
254 bank->tau0 = coarseList[cnt].params.t0;
255 bank->tau2 = coarseList[cnt].params.t2;
256 bank->tau3 = coarseList[cnt].params.t3;
257 bank->tau4 = coarseList[cnt].params.t4;
258 bank->tau5 = coarseList[cnt].params.t5;
259 bank->ttotal = coarseList[cnt].params.tC;
260 bank->psi0 = coarseList[cnt].params.psi0;
261 bank->psi3 = coarseList[cnt].params.psi3;
262
263 /* This calucation is only valid for the PN case. For EOB, we
264 * should use the correct value of v (close to lightring). What
265 * about the amplitude corrected one ? */
266 fFinal = minfFinal + i *
267 (maxfFinal - minfFinal)/(input->numFreqCut - 1);
268 if (fFinal > input->fUpper)
269 {
270 fFinal = input->fUpper;
271 }
272 coarseList[cnt].params.fFinal = fFinal;
273
274 /* Update the Gamma parameter if requested, using the proper cut-off
275 * frequency */
276 if ( input->computeMoments )
277 {
278 coarseList[cnt].params.fCutoff = coarseList[cnt].params.fFinal;
279 LALGetInspiralMoments( status->statusPtr, &moments, &(input->shf),
280 &(coarseList[cnt].params) );
281
282 LALInspiralComputeMetric(status->statusPtr, &(coarseList[cnt].metric),
283 &(coarseList[cnt].params), &moments);
284 }
285
286
287 bank->f_final = coarseList[cnt].params.fFinal;
288 bank->eta = coarseList[cnt].params.eta;
289 bank->beta = coarseList[cnt].params.beta;
290
291 /* Copy the 10 metric co-efficients ... */
292 memcpy (bank->Gamma, coarseList[cnt].metric.Gamma, 10*sizeof(REAL4));
293 }
294
295 }
296 /* Free first template, which is blank. */
297 bank = (*first)->next;
298 LALFree( *first );
299 *first = bank;
300 /* free the coarse list returned by create coarse bank */
301 LALFree( coarseList );
302 break;
303
304 case FindChirpPTF:
305
306 chi = malloc (input->nPointsChi * sizeof(REAL8));
307 kappa = malloc (input->nPointsKappa * sizeof(REAL8));
308 dChi = ( input->chiMax - input->chiMin) / (REAL8) input->nPointsChi;
309 dKappa = ( input->kappaMax - input->kappaMin ) / (REAL8) input->nPointsKappa;
310
311 for (i=0; i < input->nPointsChi; i++)
312 {
313 if (!i) chi[i] = input->chiMin + dChi / 2.0;
314 else chi[i] = chi[0] + i * dChi ;
315 }
316 for (i=0; i < input->nPointsKappa; i++)
317 {
318 if (!i) kappa[i] = input->kappaMin + dKappa / 2.0;
319 else kappa[i] = kappa[0] + i * dKappa ;
320 }
321
322 /* Use LALInspiralCreateCoarseBank(). */
323 TRY( LALInspiralCreateCoarseBank( status->statusPtr, &coarseList, ntiles,
324 *input ), status );
325
326 /* Convert output data structure. */
327 bank = (SnglInspiralTable *) LALCalloc(1, sizeof(SnglInspiralTable));
328 if (bank == NULL){
329 ABORT( status, LALINSPIRALBANKH_EMEM, LALINSPIRALBANKH_MSGEMEM );
330 }
331 *first = bank;
332
333 for ( chicnt = 0; chicnt < input->nPointsChi; chicnt++ )
334 {
335 for( kappacnt = 0; kappacnt < input->nPointsKappa; kappacnt++ )
336 {
337 for( cnt = 0; cnt < *ntiles; cnt++ )
338 {
339 /* restrict the bank boundaries to the region of validity of PTF */
340 if ( coarseList[cnt].params.mass1 < 6.0 ||
341 coarseList[cnt].params.mass2 > 3.0 ) continue;
342 bank = bank->next = (SnglInspiralTable *) LALCalloc( 1, sizeof(
344 if (bank == NULL)
345 {
346 ABORT( status, LALINSPIRALBANKH_EMEM, LALINSPIRALBANKH_MSGEMEM );
347 }
348 numTmplts = numTmplts + 1 ;
349 bank->mass1 = coarseList[cnt].params.mass1;
350 bank->mass2 = coarseList[cnt].params.mass2;
351 bank->mchirp = coarseList[cnt].params.chirpMass;
352 bank->mtotal = coarseList[cnt].params.totalMass;
353 bank->eta = coarseList[cnt].params.eta;
354 bank->kappa = (REAL4) kappa[kappacnt];
355 bank->chi = (REAL4) chi[chicnt];
356 bank->tau0 = coarseList[cnt].params.t0;
357 bank->tau2 = coarseList[cnt].params.t2;
358 bank->tau3 = coarseList[cnt].params.t3;
359 bank->tau4 = coarseList[cnt].params.t4;
360 bank->tau5 = coarseList[cnt].params.t5;
361 bank->ttotal = coarseList[cnt].params.tC;
362 bank->psi0 = coarseList[cnt].params.psi0;
363 bank->psi3 = coarseList[cnt].params.psi3;
364 bank->f_final = coarseList[cnt].params.fFinal;
365 bank->eta = coarseList[cnt].params.eta;
366 bank->beta = coarseList[cnt].params.beta;
367
368
369 /* Copy the 10 metric co-efficients ... */
370 memcpy (bank->Gamma, coarseList[cnt].metric.Gamma, 10*sizeof(REAL4));
371
372 }
373 }
374 }
375
376 free(chi);
377 free(kappa);
378 /* Free first template, which is blank. */
379 bank = (*first)->next;
380 LALFree( *first );
381 *first = bank;
382 /* free the coarse list returned by create coarse bank */
383 LALFree( coarseList );
384 *ntiles = numTmplts;
385 break;
386
387 case BCVSpin:
388 if (input->spinBank==0)
389 {
390 /* Use LALInspiralSpinBank(); no need to convert output. */
391 TRY( LALInspiralSpinBank( status->statusPtr, first, ntiles, input ),
392 status );
393 }
394 else
395 {
396 ABORT( status, LALINSPIRALBANKH_ECHOICE, LALINSPIRALBANKH_MSGECHOICE );
397 }
398
399 if (*ntiles < 1){
400 ABORT( status, LALINSPIRALBANKH_ENULL, LALINSPIRALBANKH_MSGENULL );
401 }
402 break;
403
404 default:
405 ABORT( status, LALINSPIRALBANKH_ECHOICE, LALINSPIRALBANKH_MSGECHOICE );
406
407 }
408
410 RETURN(status);
411}
#define LALCalloc(m, n)
#define LALFree(p)
#define ABORT(statusptr, code, mesg)
#define TRY(func, statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
double i
#define LAL_PI
#define LAL_MTSUN_SI
double REAL8
int32_t INT4
float REAL4
#define LALINSPIRALBANKH_EFCUT
Inappropriate cutoff frequency [SchwarzISCO, BKLISCO, LightRing, ERD, FRD or LRD].
#define LALINSPIRALBANKH_ECHOICE
Invalid choice for an input parameter.
#define LALINSPIRALBANKH_ENULL
Null pointer.
void LALInspiralSpinBank(LALStatus *status, SnglInspiralTable **tiles, INT4 *ntiles, InspiralCoarseBankIn *coarseIn)
This function creates a bank of BCVSpin templates to search for precessing binaries.
void LALInspiralBankGeneration(LALStatus *status, InspiralCoarseBankIn *input, SnglInspiralTable **first, INT4 *ntiles)
void LALInspiralCreateCoarseBank(LALStatus *status, InspiralTemplateList **list, INT4 *nlist, InspiralCoarseBankIn bankIn)
void LALGetInspiralMoments(LALStatus *status, InspiralMomentsEtc *moments, REAL8FrequencySeries *psd, InspiralTemplate *params)
#define LALINSPIRALBANKH_ENUMFCUT
Number of fcut must be greater or equal to 1.
#define LALINSPIRALBANKH_EMEM
Memory allocation failure.
void LALInspiralComputeMetric(LALStatus *status, InspiralMetric *metric, InspiralTemplate *params, InspiralMomentsEtc *moments)
@ FreqCut_SchwarzISCO
the innermost stable circular orbit (ISCO) for a test particle orbiting a Schwarzschild black hole
@ FreqCut_FRD
the "Fundamental RingDown" frequency which is calculated from the Berti, Cardoso and Will (arXiv:gr-q...
@ FreqCut_LightRing
the unstable circular orbit for photons orbiting a Schwarzschild black hole
@ FreqCut_ERD
an effective ringdown frequency studied in Pan et al (arXiv:0704.1964) that was found to give good fi...
@ FreqCut_BKLISCO
a mass ratio dependent ISCO derived from estimates of the final spin of a merged black found in a pap...
@ FreqCut_LRD
the "Lorentzian RingDown" frequency = 1.2*FRD which captures part of the Lorentzian tail from the dec...
EOB
PadeT1
TaylorEt
BCVSpin
EOBNRv2
TaylorN
Eccentricity
EOBNR
PadeF1
IMRPhenomA
AmpCorPPN
TaylorF1
TaylorT3
FindChirpPTF
TaylorT4
TaylorF2
IMRPhenomB
BCV
TaylorT1
TaylorT2
static const INT4 q
Input for choosing a template bank.
INT4 nPointsKappa
UNDOCUMENTED.
INT4 nPointsChi
UNDOCUMENTED.
REAL8 kappaMax
UNDOCUMENTED.
ComputeMoments computeMoments
ComputeMoments tells whether to re-compute the moments using an upper limit defined by flso; This is ...
INT4 numFreqCut
Number of different upper frequency cutoffs (spaced evenly between minFreqCut and maxFreqCut) to use ...
REAL8FrequencySeries shf
Frequency series containing the PSD.
REAL8 chiMin
UNDOCUMENTED.
INT4 spinBank
spinBank=0:use Owen+Hanna bank, spinBank=1:use extended bank by AEI/Cardiff/Osaka,...
FreqCut minFreqCut
smallest upper frequency cutoff to use
REAL8 fUpper
Upper frequency cutoff.
Approximant approximant
Approximant of the waveform.
REAL8 kappaMin
UNDOCUMENTED.
REAL8 chiMax
UNDOCUMENTED.
FreqCut maxFreqCut
largest upper frequency cutoff to use
REAL4 Gamma[10]
3d metric co-efficients in coordinates; Gamma[6] is a vector that stores the upper triangular part o...
Parameter structure that holds the moments of the PSD and other useful constants required in the comp...
REAL8 t5
2.5 post-Newtonian chirp time in seconds (output)
Definition: LALInspiral.h:298
REAL8 psi3
BCV parameter .
Definition: LALInspiral.h:246
REAL8 t2
first post-Newtonian chirp time in seconds (input/output)
Definition: LALInspiral.h:295
REAL8 eta
symmetric mass ratio (input/output)
Definition: LALInspiral.h:291
REAL8 totalMass
total mass of the binary in solar mass (input/output)
Definition: LALInspiral.h:292
REAL8 mass1
Mass of the primary in solar mass (input/output)
Definition: LALInspiral.h:211
REAL8 fCutoff
upper frequency cutoff in Hz to be used in generating the waveform; If the last stable orbit frequenc...
Definition: LALInspiral.h:213
REAL8 t4
second post-Newtonian chirp time in seconds (output)
Definition: LALInspiral.h:297
REAL8 t3
1.5 post-Newtonian chirp time in seconds (input/output)
Definition: LALInspiral.h:296
REAL8 psi0
BCV parameter .
Definition: LALInspiral.h:245
REAL8 fFinal
final frequency reached, in units of Hz (output)
Definition: LALInspiral.h:293
REAL8 t0
Newtonain chirp time in seconds (input/output)
Definition: LALInspiral.h:294
REAL8 chirpMass
chirp mass of the binary in solar mass (output)
Definition: LALInspiral.h:290
REAL8 tC
total chirp time seconds (output)
Definition: LALInspiral.h:301
REAL8 mass2
Mass of the secondary in solar mass (mass1 need not be larger than mass2 (input/output)
Definition: LALInspiral.h:212
REAL8 beta
UNDOCUMENTED.
Definition: LALInspiral.h:251
A grid of inspiral templates (ie a template list).
InspiralTemplate params
Value of the parameters at the lattice point.
InspiralMetric metric
metric at the lattice point
struct tagSnglInspiralTable * next