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
CoarseTest2.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 Bernd Machenschalk, David Churches, Duncan Brown, 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 Churches, D. K. and Sathyaprakash, B. S., Cokelaer, T.
22 * \file
23 * \ingroup LALInspiralBank_h
24 *
25 * \brief Test code for the \c bank modules.
26 *
27 * ### Usage ###
28 *
29 * \code
30 * CoarseTest2
31 * \endcode
32 *
33 * ### Description ###
34 *
35 * This test code gives an example of how to generate a template bank and
36 * generates vertices of the ambiguity 'rectangle' around each lattice point
37 * suitable for plotting with xmgr or xgrace. This code generates the template
38 * bank for physical template families such as EOB, TaylorT1, ... save the
39 * coordinates into a file called CoarseTest2.out and then creates a rectangle
40 * for each coordinates which is inscribed into the ambiguity ellipse function.
41 * It can be extended to the BCV case easily by replacing approximant (BCV) and
42 * parameter space (Psi0andPsi3). The code has to be changed to use psi0/psi3
43 * inteasd of tau0/tau3 though.
44 *
45 */
46
47/** \cond DONT_DOXYGEN */
48
49#include <stdio.h>
50#include <lal/AVFactories.h>
51#include <lal/LALInspiralBank.h>
52#include <lal/LALNoiseModels.h>
53
54int
55main(void)
56{
57 /* top-level status structure */
58 static LALStatus status;
59 /* Structure specifying the nature of the bank needed */
60 static InspiralCoarseBankIn coarseIn;
61 /* Template bank lists */
62 static InspiralTemplateList *list1;
63 /* Number of templates in list1 and list2 */
64 INT4 nlist1=0;
65
66 void (*noisemodel)(LALStatus*,REAL8*,REAL8) = LALLIGOIPsd;
67 INT4 j, numPSDpts=262144;
68 FILE *fpr;
69
70
71 fpr = fopen("CoarseTest2.out", "w");
72 coarseIn.LowGM = 3;
73 coarseIn.HighGM= 6;
74 coarseIn.fLower = 40.L;
75 coarseIn.fUpper = 2000.L;
76 coarseIn.tSampling = 4096.L;
77 coarseIn.order = LAL_PNORDER_TWO;
78 coarseIn.space = Tau0Tau3;
79 coarseIn.mmCoarse = 0.95;
80 coarseIn.mmFine = 0.97;
81 coarseIn.iflso = 0.0L;
82 coarseIn.mMin = 3.0;
83 coarseIn.mMax = 20.0;
84 coarseIn.MMax = coarseIn.mMax * 2.;
86 /* coarseIn.massRange = MinComponentMassMaxTotalMass;*/
87 /* minimum value of eta */
88 coarseIn.etamin = coarseIn.mMin * ( coarseIn.MMax - coarseIn.mMin) / pow(coarseIn.MMax,2.);
89 coarseIn.psi0Min = 1.e0;
90 coarseIn.psi0Max = 2.5e4;
91 coarseIn.psi3Min = -2.2e3;
92 coarseIn.psi3Max = 8.e2;
93 coarseIn.alpha = 0.L;
94 coarseIn.numFcutTemplates = 4;
95
96 memset( &(coarseIn.shf), 0, sizeof(REAL8FrequencySeries) );
97 coarseIn.shf.f0 = 0;
98 LALDCreateVector( &status, &(coarseIn.shf.data), numPSDpts );
99 coarseIn.shf.deltaF = coarseIn.tSampling / (2.*(REAL8) coarseIn.shf.data->length + 1.L);
100 LALNoiseSpectralDensity (&status, coarseIn.shf.data, noisemodel, coarseIn.shf.deltaF );
101
102
103 fprintf(fpr, "&\n");
104 coarseIn.approximant = TaylorT1;
105 coarseIn.space = Tau0Tau3;
106 LALInspiralCreateCoarseBank(&status, &list1, &nlist1, coarseIn);
107
108 for (j=0; j<nlist1; j++)
109 {
110 fprintf(fpr, "%e %e %e %e\n",
111 list1[j].params.t0,
112 list1[j].params.t3,
113 list1[j].params.mass1,
114 list1[j].params.mass2
115 );
116 }
117 fprintf(fpr, "&\n");
118
119 coarseIn.approximant = EOB;
120 LALInspiralCreateCoarseBank(&status, &list1, &nlist1, coarseIn);
121
122 {
123 INT4 k;
124 UINT4 valid;
125
126 static RectangleIn RectIn;
127 static RectangleOut RectOut;
128
129
130 RectIn.dx = sqrt(2.0 * (1. - coarseIn.mmCoarse)/list1[0].metric.g00 );
131 RectIn.dy = sqrt(2.0 * (1. - coarseIn.mmCoarse)/list1[0].metric.g11 );
132 RectIn.theta = list1[0].metric.theta;
133
134 /* Print out the template parameters */
135 for (k=0; k<nlist1; k++)
136 {
137 /*
138 Retain only those templates that have meaningful masses:
139 */
140 RectIn.x0 = (REAL8) list1[k].params.t0;
141 RectIn.y0 = (REAL8) list1[k].params.t3;
142 /*
143 LALInspiralValidParams(&status, &valid, bankParams, coarseIn);
144 */
145 valid = 1;
146 if (valid)
147 {
148 LALRectangleVertices(&status, &RectOut, &RectIn);
149 fprintf(fpr, "%e %e\n%e %e\n%e %e\n%e %e\n%e %e\n",
150 RectOut.x1, RectOut.y1,
151 RectOut.x2, RectOut.y2,
152 RectOut.x3, RectOut.y3,
153 RectOut.x4, RectOut.y4,
154 RectOut.x5, RectOut.y5);
155 fprintf(fpr, "&\n");
156 }
157 }
158 }
159 fclose(fpr);
160 /* Free the list, and exit. */
161 if (list1 != NULL) LALFree (list1);
162 LALDDestroyVector( &status, &(coarseIn.shf.data) );
164 return(0);
165}
166/** \endcond */
void LALCheckMemoryLeaks(void)
#define LALFree(p)
#define fprintf
double REAL8
uint32_t UINT4
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
@ 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)
EOB
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 theta
Angle from tau0 to semi-major axis of the ellipse.
REAL8 t3
1.5 post-Newtonian chirp time in seconds (input/output)
Definition: LALInspiral.h:296
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().
LALDict * params
int main(int argc, char **argv)
Definition: version.c:32