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
MetricTest.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/LALStdio.h>
50#include <lal/AVFactories.h>
51#include <lal/SeqFactories.h>
52
53
54static void
57 InspiralMomentsEtc *moments,
60
61void
64 InspiralMetric *metric,
67);
68
69int
70main(void)
71{
72 static LALStatus status; /* top-level status structure */
73
74 static InspiralMetric metric;
76 UINT4 numPSDpts=65536;
78 REAL8 samplingRate;
79 void (*noisemodel)(LALStatus*,REAL8*,REAL8) = LALLIGOIPsd;
80 InspiralMomentsEtc moments;
81 REAL8 mismatch;
82 FILE *fpr;
83
84
85 fpr = fopen("MetricTest.out", "w");
86
87 mismatch = 0.10L;
88
89 params.OmegaS = 0.;
90 params.Theta = 0.;
91 params.ieta=1;
92 params.mass1=1.;
93 params.mass2=1.;
94 params.startTime=0.0;
95 params.startPhase=0.0;
96 params.fLower=40.0;
97 params.fCutoff=2000.00;
98 params.tSampling=4096.0;
99 params.order=4;
100 params.approximant=TaylorT3;
101 params.signalAmplitude=1.0;
102 params.nStartPad=0;
103 params.nEndPad=1000;
104 params.massChoice=m1Andm2;
107
108 params.psi0 = 132250.;
109 params.psi3 = -1314.2;
110 params.alpha = 0.528;
111 params.fFinal = 868.7;
112 metric.space = Tau0Tau3;
113
114 samplingRate = params.tSampling;
115 memset( &(shf), 0, sizeof(REAL8FrequencySeries) );
116 shf.f0 = 0;
117 LALDCreateVector( &status, &(shf.data), numPSDpts );
118 shf.deltaF = samplingRate / (2.*(REAL8) shf.data->length + 1.L);
119 LALNoiseSpectralDensity (&status, shf.data, noisemodel, shf.deltaF );
120
121 /* compute the metric at this point, update bankPars and add the params to the list */
122
123 GetInspiralMoments (&status, &moments, &shf, &params);
124 LALInspiralComputeMetric(&status, &metric, &params, &moments);
125 fprintf(fpr, "#%e %e %e\n", metric.G00, metric.G01, metric.G11);
126 fprintf(fpr, "#%e %e %e\n", metric.g00, metric.g11, metric.theta);
127 fprintf(fpr, "#dP0=%e dP1=%e\n", sqrt (mismatch/metric.G00), sqrt (mismatch/metric.G11));
128 fprintf(fpr, "#dp0=%e dp1=%e\n", sqrt (mismatch/metric.g00), sqrt (mismatch/metric.g11));
129 {
130 double MM;
131 double dp0, dp1;
132 long n=100;
133 double dp0min=-0.1;
134 double dp0max=0.1;
135 double dp1min=-0.1;
136 double dp1max=0.1;
137 double d0=(dp0max-dp0min)/(double)n;
138 double d1=(dp1max-dp1min)/(double)n;
139 for ( dp0= dp0min; dp0<=dp0max+d0 ; dp0+=d0)
140 {
141 for ( dp1= dp1min; dp1<=dp1max+d1 ; dp1+=d1)
142 {
143
144 MM = 1. - (metric.G00 * dp0 * dp0 + metric.G01 * dp0 * dp1
145 + metric.G01 * dp1 * dp0 + metric.G11 * dp1 * dp1);
146 fprintf(fpr, "%f %f %f\n", dp0, dp1, MM);
147 }
148 fprintf(fpr,"\n");
149 }
150 }
151 fclose(fpr);
152 LALDDestroyVector(&status, &(shf.data));
154 return 0;
155}
156
157
158static void
161 InspiralMomentsEtc *moments,
164{
165
166 UINT4 k;
168
171
172 ASSERT (params, status, LALINSPIRALBANKH_ENULL, LALINSPIRALBANKH_MSGENULL);
173 ASSERT (params->fLower>0, status, LALINSPIRALBANKH_ENULL, LALINSPIRALBANKH_MSGENULL);
174 ASSERT (moments, status, LALINSPIRALBANKH_ENULL, LALINSPIRALBANKH_MSGENULL);
175 ASSERT (psd, status, LALINSPIRALBANKH_ENULL, LALINSPIRALBANKH_MSGENULL);
176
177 moments->a01 = 3.L/5.L;
178 moments->a21 = 11.L * LAL_PI/12.L;
179 moments->a22 = 743.L/2016.L * pow(25.L/(2.L*LAL_PI*LAL_PI), 1.L/3.L);
180 moments->a31 = -3.L/2.L;
181 moments->a41 = 617.L * LAL_PI * LAL_PI / 384.L;
182 moments->a42 = 5429.L/5376.L * pow ( 25.L * LAL_PI/2.L, 1.L/3.L);
183 moments->a43 = 1.5293365L/1.0838016L * pow(5.L/(4.L*pow(LAL_PI,4.L)), 1.L/3.L);
184
185 /* setup the input structure needed in the computation of the moments */
186
187 in.shf = psd;
188 in.shf->f0 /= params->fLower;
189 in.shf->deltaF /= params->fLower;
190 in.xmin = params->fLower/params->fLower;
191 in.xmax = params->fCutoff/params->fLower;
192
193 /* First compute the norm */
194
195 in.norm = 1.L;
196 in.ndx = 7.L/3.L;
197 LALInspiralMoments(status->statusPtr, &moments->j[7], in);
199 in.norm = moments->j[7];
200
202 {
203 fprintf (stderr, "a01=%e a21=%e a22=%e a31=%e a41=%e a42=%e a43=%e \n",
204 moments->a01, moments->a21, moments->a22, moments->a31,
205 moments->a41, moments->a42, moments->a43);
206
207 fprintf(stderr, "j7=%e\n", moments->j[7]);
208 }
209
210 /* Normalised moments of the noise PSD from 1/3 to 17/3. */
211
212 for (k=1; k<=17; k++)
213 {
214 in.ndx = (REAL8) k /3.L;
215 LALInspiralMoments(status->statusPtr,&moments->j[k],in);
217 }
218 in.shf->deltaF *= params->fLower;
219 in.shf->f0 *= params->fLower;
220
222 RETURN (status);
223}
void LALInspiralParameterCalc(LALStatus *status, InspiralTemplate *params)
void LALCheckMemoryLeaks(void)
#define CHECKSTATUSPTR(statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
static void GetInspiralMoments(LALStatus *status, InspiralMomentsEtc *moments, REAL8FrequencySeries *psd, InspiralTemplate *params)
Definition: MetricTest.c:159
void LALInspiralComputeBCVMetric(LALStatus *status, InspiralMetric *metric, REAL8FrequencySeries *shf, InspiralTemplate *params)
int main(void)
Definition: MetricTest.c:70
#define fprintf
#define LAL_C_SI
#define LAL_PI
#define LAL_PC_SI
double REAL8
uint32_t UINT4
#define lalDebugLevel
LALINFO
@ m1Andm2
component masses
Definition: LALInspiral.h:179
#define LALINSPIRALBANKH_ENULL
Null pointer.
void LALInspiralMoments(LALStatus *status, REAL8 *moment, InspiralMomentsIn pars)
void LALInspiralComputeMetric(LALStatus *status, InspiralMetric *metric, InspiralTemplate *params, InspiralMomentsEtc *moments)
@ 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)
TaylorT3
void LALDCreateVector(LALStatus *, REAL8Vector **, UINT4)
void LALDDestroyVector(LALStatus *, REAL8Vector **)
int n
Structure to store metric at various points the signal manifold.
REAL8 g11
11-component of the diagonalised metric
CoordinateSpace space
The enum describing the coordinate space in which the metric is computed.
REAL8 G01
01-component of the metric in coordinates
REAL8 g00
00-component of the diagonalised metric
REAL8 theta
Angle from tau0 to semi-major axis of the ellipse.
REAL8 G00
00-component of the metric in coordinates
REAL8 G11
11-component of the metric in coordinates
Parameter structure that holds the moments of the PSD and other useful constants required in the comp...
REAL8 j[18]
The required moments are all computed once and stored in this array; The required moments are from J(...
Inputs to the function that computes the moments of the PSD.
REAL8FrequencySeries * shf
the frequency series containing the noise psd
REAL8 norm
norm to be used in computing the moment, the returned value is the above integral divided by the norm
REAL8 ndx
index (without the negative sign) in the moment integral as above
REAL8 xmax
upper limit of the integral
REAL8 xmin
lower limit of the integral
The inspiral waveform parameter structure containing information about the waveform to be generated.
Definition: LALInspiral.h:205
REAL8Sequence * data
double distance