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
BCVTemplates.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 Jolien Creighton, 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 *
24 * \brief Creates a template mesh for BCV (or, alternatively, for SPA but
25 * assuing a constant metric) using the mismatch metric.
26 *
27 * ### Usage ###
28 *
29 *
30 * ### Description ###
31 *
32 *
33 * ### Algorithm ###
34 *
35 *
36 * ### Uses ###
37 *
38 * \code
39 * lalDebugLevel
40 * \endcode
41 *
42 * ### Notes ###
43 *
44 */
45
46#include <math.h>
47#include <stdlib.h>
48#include <lal/LALInspiralBank.h>
49#include <lal/AVFactories.h>
50#include <lal/SeqFactories.h>
51
52/* Default parameter settings. */
53
54int
55main(void)
56{
57 /* top-level status structure */
58 static LALStatus status;
59 static InspiralCoarseBankIn coarseIn;
60 static InspiralTemplateList *list1, *list2;
61
62 static RectangleIn RectIn;
63 static RectangleOut RectOut;
64 void (*noisemodel)(LALStatus*,REAL8*,REAL8) = LALLIGOIPsd;
65
66 INT4 j, valid, numPSDpts=262144;
67 FILE *fpr;
68 INT4 nlist1, nlist2;
69/* Number of templates is nlist */
70
71
72 fpr = fopen("BCVTemplates.out", "w");
73 nlist1 = 0;
74 nlist2 = 0;
75 coarseIn.HighGM =6.;
76 coarseIn.LowGM = 3.;
77 coarseIn.fLower = 40.L;
78 coarseIn.fUpper = 2000.L;
79 coarseIn.tSampling = 4096.L;
80 coarseIn.order = LAL_PNORDER_TWO;
81 coarseIn.space = Tau0Tau3;
82 coarseIn.mmCoarse = 0.95;
83 coarseIn.mmFine = 0.97;
84 coarseIn.iflso = 0.0L;
85 coarseIn.mMin = 3.0;
86 coarseIn.mMax = 20.0;
87 coarseIn.MMax = coarseIn.mMax * 2.;
89 /* coarseIn.massRange = MinComponentMassMaxTotalMass;*/
90 /* minimum value of eta */
91 coarseIn.etamin = coarseIn.mMin * ( coarseIn.MMax - coarseIn.mMin) / pow(coarseIn.MMax,2.);
92 coarseIn.psi0Min = 1.e0;
93 coarseIn.psi0Max = 2.5e4;
94 coarseIn.psi3Min = -2.2e3;
95 coarseIn.psi3Max = 8.e2;
96 coarseIn.alpha = 0.L;
97 coarseIn.numFcutTemplates = 4;
98
99 memset( &(coarseIn.shf), 0, sizeof(REAL8FrequencySeries) );
100 coarseIn.shf.f0 = 0;
101 LALDCreateVector( &status, &(coarseIn.shf.data), numPSDpts );
102 coarseIn.shf.deltaF = coarseIn.tSampling / (2.*(REAL8) coarseIn.shf.data->length + 1.L);
103 LALNoiseSpectralDensity (&status, coarseIn.shf.data, noisemodel, coarseIn.shf.deltaF );
104
105 coarseIn.approximant = BCV;
106 coarseIn.space = Psi0Psi3;
107
108 LALInspiralCreateCoarseBank(&status, &list1, &nlist1, coarseIn);
109 for (j=0; j<nlist1; j++)
110 {
111 fprintf(fpr, "%e %e %e %e\n",
112 list1[j].params.psi0,
113 list1[j].params.psi3,
114 list1[j].params.totalMass,
115 list1[j].params.fFinal);
116 }
117 fprintf(fpr, "&\n");
118 coarseIn.approximant = TaylorT1;
119 coarseIn.space = Tau0Tau3;
120
121 LALInspiralCreateCoarseBank(&status, &list2, &nlist2, coarseIn);
122
123 for (j=0; j<nlist2; j++)
124 {
125 fprintf(fpr, "%e %e %e %e\n",
126 list2[j].params.t0,
127 list2[j].params.t3,
128 list2[j].params.mass1,
129 list2[j].params.mass2
130 );
131 }
132
133 fprintf(fpr, "&\n");
134
135 /* Print rectagles*/
136
137 RectIn.dx = sqrt(2.0 * (1. - coarseIn.mmCoarse)/list1[0].metric.g00 );
138 RectIn.dy = sqrt(2.0 * (1. - coarseIn.mmCoarse)/list1[0].metric.g11 );
139 RectIn.theta = list1[0].metric.theta;
140
141 /* Print out the template parameters */
142 for (j=0; j<nlist1; j++)
143 {
144 /*
145 Retain only those templates that have meaningful masses:
146 */
147 RectIn.x0 = (REAL8) list1[j].params.psi0;
148 RectIn.y0 = (REAL8) list1[j].params.psi3;
149 /*
150 LALInspiralValidParams(&status, &valid, bankParams, coarseIn);
151 */
152 valid = 1;
153 if (valid)
154 {
155 LALRectangleVertices(&status, &RectOut, &RectIn);
156 fprintf(fpr, "%e %e\n%e %e\n%e %e\n%e %e\n%e %e\n",
157 RectOut.x1, RectOut.y1,
158 RectOut.x2, RectOut.y2,
159 RectOut.x3, RectOut.y3,
160 RectOut.x4, RectOut.y4,
161 RectOut.x5, RectOut.y5);
162 fprintf(fpr, "&\n");
163 }
164 }
165
166 /* Free the list, and exit. */
167 if (list1 != NULL) LALFree (list1);
168 if (list2 != NULL) LALFree (list2);
169 LALDDestroyVector( &status, &(coarseIn.shf.data) );
171 fclose(fpr);
172 return 0;
173}
int main(void)
Definition: BCVTemplates.c:55
void LALCheckMemoryLeaks(void)
#define LALFree(p)
#define fprintf
double REAL8
int32_t INT4
void LALRectangleVertices(LALStatus *status, RectangleOut *out, RectangleIn *in)
Function to find the vertices of a rectangle given its centre, half side-lengths and orientation angl...
void LALInspiralCreateCoarseBank(LALStatus *status, InspiralTemplateList **list, INT4 *nlist, InspiralCoarseBankIn bankIn)
@ MinMaxComponentMass
@ Psi0Psi3
for BCV templates
@ Tau0Tau3
space of chirptimes
void LALNoiseSpectralDensity(LALStatus *status, REAL8Vector *psd, void(*NoisePsd)(LALStatus *status, REAL8 *shf, REAL8 f), REAL8 df)
void LALLIGOIPsd(LALStatus UNUSED *status, REAL8 *psd, REAL8 f)
BCV
TaylorT1
LAL_PNORDER_TWO
void LALDCreateVector(LALStatus *, REAL8Vector **, UINT4)
void LALDDestroyVector(LALStatus *, REAL8Vector **)
Input for choosing a template bank.
REAL8 mmFine
Fine grid minimal match.
REAL8 mMin
minimum mass of components to search for
REAL8 mMax
maximum mass of components to search for
InspiralBankMassRange massRange
enum that determines whether templates should be chosen using fixed ranges for component masses or to...
REAL8 tSampling
Sampling rate.
REAL8FrequencySeries shf
Frequency series containing the PSD.
LALPNOrder order
Post-Newtonian order of the waveform.
REAL8 psi3Min
minimum value of the parameter
INT4 iflso
iflso is an integer that tells whether to compute the moments using an upper limit defined by flso; t...
REAL8 MMax
alternatively, maximum total mass of binary to search for
REAL8 etamin
minimum value of eta in our search
REAL8 fUpper
Upper frequency cutoff.
REAL8 fLower
Lower frequency cutoff.
REAL4 HighGM
UNDOCUMENTED.
Approximant approximant
Approximant of the waveform.
UINT4 numFcutTemplates
Number of templates required in the fCut (upper cutoff) dimension and the value of upper and lower cu...
REAL8 psi3Max
maximum value of the parameter
REAL8 mmCoarse
Coarse grid minimal match.
CoordinateSpace space
enum that decides whether to use or in constructing the template bank
REAL4 LowGM
UNDOCUMENTED.
REAL8 alpha
the BCV amplitude correction parameter
REAL8 psi0Min
minimum value of the parameter
REAL8 psi0Max
maximum value of the parameter
REAL8 g11
11-component of the diagonalised metric
REAL8 g00
00-component of the diagonalised metric
REAL8 theta
Angle from tau0 to semi-major axis of the ellipse.
REAL8 psi3
BCV parameter .
Definition: LALInspiral.h:246
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 t3
1.5 post-Newtonian chirp time in seconds (input/output)
Definition: LALInspiral.h:296
REAL8 fFinal
final frequency reached, in units of Hz (output)
Definition: LALInspiral.h:293
REAL8 mass2
Mass of the secondary in solar mass (mass1 need not be larger than mass2 (input/output)
Definition: LALInspiral.h:212
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
REAL8Sequence * data
Input structure to function LALRectangleVertices()
Output structure to function LALRectangleVertices().