00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #if 0
00026 <lalLaTeX>
00027 \subsection{Module \texttt{LALInspiralMomentsIntegrand.c}}
00028
00029 \subsubsection*{Prototypes}
00030 \vspace{0.1in}
00031 \input{LALInspiralMomentsIntegrandCP}
00032 \idx{LALInspiralMomentsIntegrand()}
00033 \begin{itemize}
00034 \item \texttt{integrand,} Output, the value of the integrand
00035 \item \texttt{x,} Input, the point where the integrand is required
00036 \item \texttt{params,} Input, of type \texttt{InspiralMomentsIn} containing the details
00037 required in moments calculation
00038 \end{itemize}
00039
00040 \subsubsection*{Description}
00041
00042 The moments of the noise curve are defined as
00043 \begin{equation}
00044 I(q) \equiv S_{h}(f_{0}) \int^{f_{c}/f_{0}}_{f_{s}/f_{0}}
00045 \frac{x^{-q/3}}{S_{h}(x)} \, dx \,.
00046 \end{equation}
00047 This function calculates the integrand of this integral, i.e.\ for a given $x$
00048 it calculates
00049 \begin{equation}
00050 \frac{x^{-q/3}}{S_{h}(x)} \,\,.
00051 \end{equation}
00052 by interpolating the frequency series containing $S_h(f)$.
00053
00054 \subsubsection*{Algorithm}
00055
00056 \subsubsection*{Uses}
00057 LALDPolynomialInterpolation
00058
00059 \subsubsection*{Notes}
00060
00061 \vfill{\footnotesize\input{LALInspiralMomentsIntegrandCV}}
00062
00063 </lalLaTeX>
00064 #endif
00065
00066 #include <lal/Interpolate.h>
00067 #include <lal/LALInspiralBank.h>
00068
00069 NRCSID(LALINSPIRALMOMENTSINTEGRANDC, "$Id: LALInspiralMomentsIntegrand.c,v 1.10 2007/06/08 14:41:42 bema Exp $");
00070
00071
00072 void
00073 LALInspiralMomentsIntegrand(
00074 LALStatus *status,
00075 REAL8 *integrand,
00076 REAL8 x,
00077 void *params
00078 )
00079
00080 {
00081 InspiralMomentsIn *integrandParams;
00082
00083 DInterpolateOut interpOutput;
00084 DInterpolatePar interpParams;
00085
00086 UINT4 numInterpPts = 4;
00087 REAL8 f[4];
00088 REAL8 fMin;
00089 REAL8 fMax;
00090 REAL8 deltaF;
00091 UINT8 freqIndex;
00092
00093 INITSTATUS( status, "LALInspiralMomentsIntegrand",
00094 LALINSPIRALMOMENTSINTEGRANDC );
00095 ATTATCHSTATUSPTR( status );
00096
00097 ASSERT( params, status,
00098 LALINSPIRALBANKH_ENULL, LALINSPIRALBANKH_MSGENULL );
00099
00100 integrandParams = (InspiralMomentsIn *) params;
00101
00102
00103 ASSERT( integrandParams->shf, status,
00104 LALINSPIRALBANKH_ENULL, LALINSPIRALBANKH_MSGENULL );
00105 ASSERT( integrandParams->shf->data, status,
00106 LALINSPIRALBANKH_ENULL, LALINSPIRALBANKH_MSGENULL );
00107 ASSERT( integrandParams->shf->data->data, status,
00108 LALINSPIRALBANKH_ENULL, LALINSPIRALBANKH_MSGENULL );
00109
00110
00111 deltaF = integrandParams->shf->deltaF;
00112 fMin = integrandParams->shf->f0 + deltaF;
00113 fMax = integrandParams->shf->f0 +
00114 ((REAL8) integrandParams->shf->data->length - 2 ) * deltaF;
00115
00116
00117 if ( x <= fMin )
00118 {
00119 freqIndex = 1;
00120 }
00121 else if ( x >= fMax )
00122 {
00123 freqIndex = integrandParams->shf->data->length - 3;
00124 }
00125 else
00126 {
00127 freqIndex = (UINT8) floor( (x - integrandParams->shf->f0) / deltaF );
00128 }
00129
00130
00131 f[0] = (REAL8)(freqIndex - 1) * deltaF;
00132 f[1] = (REAL8)(freqIndex) * deltaF;
00133 f[2] = (REAL8)(freqIndex + 1) * deltaF;
00134 f[3] = (REAL8)(freqIndex + 2) * deltaF;
00135
00136
00137 interpParams.n = numInterpPts;
00138 interpParams.x = f;
00139 interpParams.y = integrandParams->shf->data->data + freqIndex - 1;
00140
00141
00142 LALDPolynomialInterpolation( status->statusPtr, &interpOutput, x,
00143 &interpParams );
00144 CHECKSTATUSPTR( status );
00145
00146
00147 if ( interpOutput.y < 0 )
00148 {
00149 ABORT( status, 999, "interpolation output is negative" );
00150 }
00151
00152
00153 *integrand = pow( x, -(integrandParams->ndx) ) / interpOutput.y;
00154
00155 DETATCHSTATUSPTR(status);
00156 RETURN(status);
00157 }