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
LALInspiralWaveLength.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 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 Sathyaprakash, B. S.
22 * \file
23 * \ingroup LALInspiral_h
24 *
25 * \brief Module to calculate the number of data points (to the nearest power of 2)
26 * needed to store a waveform.
27 *
28 * ### Prototypes ###
29 *
30 * <tt>LALInspiralWaveLength()</tt>
31 * <ul>
32 * <li> \c length: output, number of bins to the nearest power of 2
33 * greater than the minimum length required to store a wave of parameters as in \c params.</li>
34 * <li> \c params: input, parameters of the binary system.</li>
35 * </ul>
36 *
37 * ### Description ###
38 *
39 * This module first calls LALInspiralChooseModel(), which gives the length of the
40 * waveform in seconds. That function returns an estimated waveform length. However, the
41 * length might not be appropriate in some extreme cases (large masses and large lower
42 * cut-off frequency). It is especially true in the EOB case. Therefore, we introduce
43 * two constants namely LALINSPIRAL_LENGTHOVERESTIMATION (in percentage) which
44 * overestimate the length of the waveform and LALINSPIRAL_MINIMALWAVELENGTH which is
45 * the minimal waveform length in seconds. Multiplying this by the sampling rate
46 * <tt>params.tSampling</tt> gives the minimum number of samples needed to hold the waveform.
47 * To this are added the number of bins of leading and trailing zeroes requested by the user in
48 * <tt>params.nStartPad</tt> and <tt>params.nEndPad.</tt> The resulting number is rounded to
49 * an upward power of 2 and returned in \c length.
50 *
51 * ### Algorithm ###
52 *
53 *
54 * ### Uses ###
55 *
56 * This function calls:
57 * \code
58 * LALInspiralSetup()
59 * LALInspiralChooseModel()
60 * \endcode
61 *
62 */
63
64#include <math.h>
65#include <lal/LALInspiral.h>
66#include <lal/LALStdlib.h>
67
68#define LALINSPIRAL_LENGTHOVERESTIMATION 0.1 /* 10 % */
69#define LALINSPIRAL_MINIMALWAVELENGTH 0.03125 /* 64 bins with a 2048Hz sampling*/
70
71void
74 UINT4 *length,
76 )
77{
78
79 INT4 ndx;
80 REAL8 x;
81 CHAR message[256];
82 expnCoeffs ak;
83 expnFunc func;
84
87
88 ASSERT (params.nStartPad >= 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
89 ASSERT (params.nEndPad >= 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
90 ASSERT (params.tSampling > 0, status, LALINSPIRALH_ESIZE, LALINSPIRALH_MSGESIZE);
91
92 LALInspiralSetup (status->statusPtr, &ak, &params);
94
95 LALInspiralChooseModel(status->statusPtr, &func, &ak, &params);
96 /* not checkstatus before but we check if everything is fine,
97 then we return the length otherwise length is zero*/
98 if (status->statusPtr->statusCode == 0){
99 /*we add a minimal value and 10 % of overestimation */
101 + params.nStartPad + params.nEndPad;
102 ndx = ceil(log10(x)/log10(2.));
103 *length = pow(2, ndx);
104
106 RETURN(status);
107 }
108 else {
109 sprintf(message,
110 "size is zero for the following waveform: totalMass = %f, fLower = %f, approximant = %d @ %fPN"
111 , params.mass1 + params.mass2, params.fLower, params.approximant, params.order/2.);
112 LALWarning(status, message);
113 *length = 0;
114
116 RETURN(status);
117 }
118}
void LALInspiralSetup(LALStatus *status, expnCoeffs *ak, InspiralTemplate *params)
void LALInspiralChooseModel(LALStatus *status, expnFunc *func, expnCoeffs *ak, InspiralTemplate *params)
#define LALINSPIRAL_MINIMALWAVELENGTH
void LALInspiralWaveLength(LALStatus *status, UINT4 *length, InspiralTemplate params)
#define LALINSPIRAL_LENGTHOVERESTIMATION
#define CHECKSTATUSPTR(statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
double REAL8
char CHAR
uint32_t UINT4
int32_t INT4
int LALWarning(LALStatus *status, const char *warning)
#define LALINSPIRALH_ESIZE
Invalid input range.
Definition: LALInspiral.h:59
x
The inspiral waveform parameter structure containing information about the waveform to be generated.
Definition: LALInspiral.h:205
This structure contains various post-Newtonian and P-approximant expansion coefficients; the meanings...
Definition: LALInspiral.h:399
Structure to hold the pointers to the generic functions defined above.
Definition: LALInspiral.h:546