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
LALInspiralInit.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 Thomas Cokelaer, Drew Keppel
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 Cokelaer T.
22 * \file
23 * \ingroup LALInspiral_h
24 *
25 * \brief Module to initialize some parameters for waveform generation.
26 *
27 * ### Description ###
28 *
29 * The input parameters is an InspiralTemplate structure which provides the waveform parameters
30 * such as masses, lower frequency ... . The function \c LALInspiralInit calls the
31 * \c LALInspiralParameterCalc function in order to compute all the mass parameters. Then,
32 * \c XLALInspiralRestrictedAmplitude function is called to get the restricted newtonian
33 * amplitude. LALInspiralWavelength, LALInspiralSetup and LALInspiralChooseModel are also called
34 * in order to estimate the waveform length which is stored in an output structure called
35 * \c InspiralInit. We also stored Energy, flux and evolution function of flux and energy in
36 * that structure.
37 *
38 * The \c LALInspiralChooseModel function might failed or send a non zero status code.
39 * That function force it to be zero therefore the codes which use LALInspiralInit (mainly
40 * injection code right now) won't stopped. Of course, if status code is non zero, we have to keep
41 * trace of it. Thus, the length of the waveform is fixed to zero in case of problems such as
42 * negative length, cutoff frequency lower than the lower cutoff frequency ... .
43 *
44 * ### Uses ###
45 *
46 * \code
47 * LALInspiralParameterCalc
48 * XLALInspiralRestrictedAmplitude
49 * LALInspiralWaveLength
50 * LALInspiralChooseModel
51 * LALInspiralSetup
52 * \endcode
53 *
54 * ### Notes ###
55 *
56 * There is only one assert on the InspiralTemplate variable since all relevant asserts
57 * are already included in the different functions which are called throughout the LALInspiralInit
58 * function.
59 *
60 */
61
62
63#include <math.h>
64#include <lal/LALInspiral.h>
65#define LALINSPIRALINIT_LENGTHOVERESTIMATION 0.1 /* 10 % */
66
67void
70 InspiralInit *paramsInit)
71{
72 XLAL_PRINT_DEPRECATION_WARNING("XLALInspiralInit");
73
76
77 if ( XLALInspiralInit(params, paramsInit) == XLAL_FAILURE )
78 {
80 }
81
84}
85
86int
88 InspiralInit *paramsInit)
89{
90 UINT4 ndx;
91 REAL8 x;
92
93
94 if (params == NULL)
96
98 {
100 }
101
103 {
105 }
106
107 if ( XLALInspiralSetup(&(paramsInit->ak), params) == XLAL_FAILURE )
108 {
110 }
111 if ( XLALInspiralChooseModel(&(paramsInit->func), &(paramsInit->ak), params)
112 == XLAL_FAILURE )
113 {
115 }
116
117 /* The parameters have been initialized now. However, we can have some problems
118 with the LALInspiralChooseModel related to bad estimation of the length.
119
120 We first need to check that the length is not wrong.
121 Then, to check that flso is > fLow
122
123 keep a security length higher than the one given by ChooseModel
124 */
125
126 if( params->fCutoff < params->fLower){
127 XLALPrintWarning(LALINSPIRALH_MSGEFLOWER);
128 paramsInit->nbins = 0;
129
130 XLALPrintInfo("XLAL Info - %s: Estimated Length (seconds) requested = %f | fCutoff = %f\n", __func__, paramsInit->ak.tn, params->fCutoff);
131
132 return XLAL_SUCCESS;
133 }
134
135 if( paramsInit->ak.tn <=0 || params->tC <= 0){
136 XLALPrintWarning(LALINSPIRALH_MSGESIZE);
137 paramsInit->nbins = 0;
138 XLALPrintInfo("XLAL Info - %s: Estimated Length (seconds) requested = %f\n", __func__, paramsInit->ak.tn);
139
140 return XLAL_SUCCESS;
141 }
142
143 /* if everything is fine is ChooseModel then we
144 * estimate the waveform length. */
145 /* we add a minimal value and 10 % of overestimation */
146
148 * (paramsInit->ak.tn + 1 ) * params->tSampling
149 + params->nStartPad + params->nEndPad ;
150 ndx = ceil(log10(x)/log10(2.));
151 paramsInit->nbins = pow(2, ndx) ;
152
153 XLALPrintInfo("XLAL Info - %s: Estimated Length (seconds)= %f | Allocated length (bins) = %d\n", __func__, paramsInit->ak.tn, paramsInit->nbins);
154
155
156 return XLAL_SUCCESS;
157}
int XLALInspiralParameterCalc(InspiralTemplate *params)
int XLALInspiralRestrictedAmplitude(InspiralTemplate *params)
int XLALInspiralSetup(expnCoeffs *ak, InspiralTemplate *params)
int XLALInspiralChooseModel(expnFunc *func, expnCoeffs *ak, InspiralTemplate *params)
#define LALINSPIRALINIT_LENGTHOVERESTIMATION
void LALInspiralInit(LALStatus *status, InspiralTemplate *params, InspiralInit *paramsInit)
int XLALInspiralInit(InspiralTemplate *params, InspiralInit *paramsInit)
#define ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
#define ABORTXLAL(sp)
double REAL8
uint32_t UINT4
int int int XLALPrintInfo(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_ERROR(...)
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_PRINT_DEPRECATION_WARNING(replacement)
XLAL_SUCCESS
XLAL_EFAULT
XLAL_EFUNC
XLAL_FAILURE
x
expnFunc func
Definition: LALInspiral.h:680
expnCoeffs ak
Definition: LALInspiral.h:679
The inspiral waveform parameter structure containing information about the waveform to be generated.
Definition: LALInspiral.h:205