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
GetOrientationEllipse.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 Bernd Machenschalk, Jolien Creighton, 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 Thomas Cokelaer
22 * \file
23 * \ingroup LALInspiralBank_h
24 *
25 * \brief Test code for the \c bank modules.
26 *
27 * ### Usage ###
28 *
29 * \code
30 * ./getOrientationEllipse
31 * \endcode
32 *
33 * ### Description ###
34 *
35 * This code illustrates the use of several functions such as
36 * \c LALInspiralParameterCalc(), \c LALGetInspiralMoments(),
37 * and \c LALInspiralComputeMetric(). It shows how to defined
38 * a suitable \c InspiralCoarseBankIn structure so as to extract
39 * the metric components for a set of binary parameters. In this
40 * example, we first declare all the relevant parameter needed
41 * (minimum and maximum mass, fLower, design sensitivity curve
42 * and so on), which can be changed by the user before compilation.
43 *
44 * Then, a loop spans a square parameter space defined by tau0 in the
45 * range [.1,40] seconds and tau3 in [1, 2] seconds. For each set of
46 * parameter, the metric is computed and the code prints on stdout
47 * the value of the coordinate used (tau0, tau3) and the orientation
48 * of the metric in degrees. We do not check whether a template is valid
49 * or not in this code but one could have use a function such as
50 * \c LALInspiralValidtemplate to do so.
51 *
52 * ### Notes ###
53 *
54 */
55
56
57#include <stdio.h>
58#include <lal/AVFactories.h>
59#include <lal/LALInspiralBank.h>
60#include <lal/LALNoiseModels.h>
61
62
63int
64main(void)
65{
66 /* top-level status structure */
67 static LALStatus status;
68 /* Structure specifying the nature of the bank needed */
69 static InspiralCoarseBankIn coarseIn;
70 void (*noisemodel)(LALStatus*,REAL8*,REAL8) = LALLIGOIPsd;
71 UINT4 numPSDpts=262144/4/4; /*Size of the vectors*/
72 InspiralTemplate tempPars;
73 InspiralMetric metric;
74 InspiralMomentsEtc moments;
75
76
77 /* In order to use any functions related to the metric, we need to fill the
78 * coarseIn structure which is defined here. The most important are the
79 * mMin, mMax and fLower parameters which influence the size of the
80 * parameter space and metric. Of course, mmCoarse, the minimal match is
81 * also relevant. */
82 coarseIn.LowGM = -2;
83 coarseIn.HighGM = 6;
84 coarseIn.fLower = 40.L;
85 coarseIn.fUpper = 2047.L;
86 coarseIn.tSampling = 4096.L;
87 coarseIn.order = LAL_PNORDER_TWO;
88 coarseIn.space = Tau0Tau3;
89 coarseIn.mmCoarse = 0.97;
90 coarseIn.mmFine = 0.97;
91 coarseIn.iflso = 0.0L;
92 coarseIn.mMin = 3;
93 coarseIn.mMax = 30.0;
94 coarseIn.MMax = coarseIn.mMax * 2.;
96 /* coarseIn.massRange = MinComponentMassMaxTotalMass;*/
97 /* minimum value of eta */
98 coarseIn.etamin = coarseIn.mMin * ( coarseIn.MMax - coarseIn.mMin) / pow(coarseIn.MMax,2.);
99/* coarseIn.psi0Min = 1.e0;
100 coarseIn.psi0Max = 2.5e4;
101 coarseIn.psi3Min = -1e4;
102 coarseIn.psi3Max = -10;
103 coarseIn.alpha = 0.L;
104 coarseIn.numFcutTemplates = 4;
105*/
106
107 /* init the vector for the PSD */
108 memset( &(coarseIn.shf), 0, sizeof(REAL8FrequencySeries) );
109 coarseIn.shf.f0 = 0;
110 LALDCreateVector( &status, &(coarseIn.shf.data), numPSDpts );
111 coarseIn.shf.deltaF = coarseIn.tSampling / (2.*(REAL8) coarseIn.shf.data->length + 1.L);
113 coarseIn.shf.data,
114 noisemodel, coarseIn.shf.deltaF );
115
116
117
118 tempPars.totalMass = coarseIn.MMax;
119 tempPars.eta = 0.25;
120 tempPars.ieta = 1.L;
121 tempPars.fLower = coarseIn.fLower;
122 tempPars.massChoice = totalMassAndEta;
123
124 metric.space = coarseIn.space;
125 LALInspiralSetParams( &status, &tempPars, coarseIn );
126
127
128 /* */
129
130 {
131 REAL4 tau0 = 0.;
132 REAL4 tau3 = 0.;
133 INT4 valid = 0;
134 InspiralBankParams bankPars;
135
136 /* Get the limit of the parameter space*/
137 LALInspiralSetSearchLimits( &status, &bankPars, coarseIn );
138 /* Loop over a rectangle with pre-defined range in tau_0 and tau_3. We will
139 * then check if this is a valid template. */
140 for (tau0=.8; tau0<10; tau0+=0.01){
141 for (tau3=.3; tau3<2; tau3+=0.01){
142 valid = 1;
143 bankPars.x0 = tau0;
144 bankPars.x1 = tau3;
145
146 LALInspiralValidParams(&status, &valid, bankPars, coarseIn );
147 if (valid==1)
148 {
149 tempPars.t0 = tau0;
150 tempPars.t3 = tau3;
151 LALInspiralParameterCalc( &status, &tempPars );
152 /* Even for non physical template, we can get the metric componenents*/
153 LALGetInspiralMoments( &status, &moments, &coarseIn.shf, &tempPars );
154 LALInspiralComputeMetric( &status, &metric, &tempPars, &moments );
155 /*Now, we simply ouput the values we are interested in : t0, t3 and
156 * angle. */
157 printf("%f %f %f\n", tempPars.t0, tempPars.t3, metric.theta*180/3.14159);
158 fflush(stdout);
159 }
160
161 }
162 }
163 }
164
165
166 /* Free the list, and exit. */
167
168 LALDDestroyVector( &status, &(coarseIn.shf.data) );
170 return(0);
171}
int main(void)
void LALInspiralParameterCalc(LALStatus *status, InspiralTemplate *params)
void LALCheckMemoryLeaks(void)
double REAL8
uint32_t UINT4
int32_t INT4
float REAL4
@ totalMassAndEta
total mass and symmetric mass ratio
Definition: LALInspiral.h:180
void LALInspiralValidParams(LALStatus *status, INT4 *valid, InspiralBankParams bankParams, InspiralCoarseBankIn coarseIn)
Function which checks whether or not a pair of parameter values are consistent with the search space.
void LALInspiralSetParams(LALStatus *status, InspiralTemplate *tempPars, InspiralCoarseBankIn coarseIn)
A routine that fills an InspiralTemplate structure based on the values in the InspiralCoarseBankIn st...
void LALInspiralSetSearchLimits(LALStatus *status, InspiralBankParams *bankParams, InspiralCoarseBankIn coarseIn)
Function which calculates the minimum and maximum values of and .
void LALGetInspiralMoments(LALStatus *status, InspiralMomentsEtc *moments, REAL8FrequencySeries *psd, InspiralTemplate *params)
void LALInspiralComputeMetric(LALStatus *status, InspiralMetric *metric, InspiralTemplate *params, InspiralMomentsEtc *moments)
@ 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)
LAL_PNORDER_TWO
void LALDCreateVector(LALStatus *, REAL8Vector **, UINT4)
void LALDDestroyVector(LALStatus *, REAL8Vector **)
This is a structure needed in the inner workings of the LALInspiralCreateCoarseBank code.
REAL8 x1
the second coordinate, chosen to be either or
REAL8 x0
the first coordinate, chosen to be always
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.
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.
REAL8 mmCoarse
Coarse grid minimal match.
CoordinateSpace space
enum that decides whether to use or in constructing the template bank
REAL4 LowGM
UNDOCUMENTED.
Structure to store metric at various points the signal manifold.
CoordinateSpace space
The enum describing the coordinate space in which the metric is computed.
REAL8 theta
Angle from tau0 to semi-major axis of the ellipse.
Parameter structure that holds the moments of the PSD and other useful constants required in the comp...
The inspiral waveform parameter structure containing information about the waveform to be generated.
Definition: LALInspiral.h:205
INT4 ieta
parameter that tells whether the symmetric mass ratio should be set to zero in the PN expansions of ...
Definition: LALInspiral.h:226
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 t3
1.5 post-Newtonian chirp time in seconds (input/output)
Definition: LALInspiral.h:296
REAL8 t0
Newtonain chirp time in seconds (input/output)
Definition: LALInspiral.h:294
InputMasses massChoice
The pair of (mass) parameters given (see structure defining this member for more details) (input)
Definition: LALInspiral.h:323
REAL8 fLower
lower frequency cutoff of the detector in Hz (input)
Definition: LALInspiral.h:217
REAL8Sequence * data