Loading [MathJax]/extensions/TeX/AMSsymbols.js
LAL 7.7.0.1-3a66518
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALNoiseSpectralDensity.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#include <lal/LALNoiseModels.h>
21
22/**
23 * \author Sathyaprakash, B. S.
24 * \ingroup LALNoiseModels_h
25 *
26 * \brief This function generates an array of size specified in the vector \c psd, that is <tt>psd.length</tt>.
27 * The inputs are
28 * <ol>
29 * <li> The lenght of the psd array required: this must be
30 * given as a non-zero positive integer by setting the \c length
31 * of the \c psd vector to the desired value;</li>
32 * <li> Frequency resolution \c df in Hz.</li>
33 * <li> Pointer to a function that should be used in generating the
34 * power spectral density values in units of Hz\f$^{-1}.\f$ This function
35 * must necessarily be of the type:
36 * <tt> void (*NoisePsd)(LALStatus *status, REAL8 *shf, REAL8 f).</tt></li>
37 * </ol>
38 * Presently, there are four such functions in the \c noisemodels
39 * package. These are <tt>LALGEOPsd, LALLIGOIPsd, LALTAMAPsd, LALVIRGOPsd.</tt>
40 * These four packages return a scaled PSD while this module returns the
41 * correctly scaled version. It is assumed that new PSD modules return
42 * unscaled versions. (Note, however, that it might be better to use the
43 * scaled versions of the PSD when computing the metric on the signal
44 * manifold; this is because computing the metric involves calculation of
45 * many moments of the noise PSD and one might encounter round-off errors
46 * if un-scaled version of PSD is used; I have not checked this to be
47 * the case but suspect that there might be some problems.)
48 *
49 */
50void
52 (
54 REAL8Vector *psd,
55 void (*NoisePsd)(LALStatus *status, REAL8 *shf, REAL8 f),
56 REAL8 df
57 )
58{
59
60 REAL8 f, shf, fs, s0;
61 INT4 i, n;
62
65
66 ASSERT (psd->data, status, LALNOISEMODELSH_ENULL, LALNOISEMODELSH_MSGENULL);
67 ASSERT (NoisePsd, status, LALNOISEMODELSH_ENULL, LALNOISEMODELSH_MSGENULL);
68 ASSERT (df > 0., status, LALNOISEMODELSH_ESIZE, LALNOISEMODELSH_MSGESIZE);
69 ASSERT (psd->length > 1, status, LALNOISEMODELSH_ESIZE, LALNOISEMODELSH_MSGESIZE);
70
71 /*
72 switch (NoisePsd)
73 {
74 case LALGEOPsd:
75 s0 = 1.e-46;
76 fs = 10.;
77 break;
78 case LALLIGOIPsd:
79 s0 = 9.0e-46;
80 fs = 10.;
81 break;
82 case LALVIRGOPsd:
83 s0 = 3.24e-46;
84 fs = 10.;
85 break;
86 case LALTAMAPsd:
87 s0 = 75.e-46;
88 fs = 75.;
89 break;
90 default:
91 s0 = 1.;
92 fs = 0.;
93 break;
94 }
95 */
96 if (NoisePsd == LALGEOPsd) {
97 s0 = 1.e-46;
98 fs = 30.;
99 } else if(NoisePsd == LALLIGOIPsd) {
100 s0 = 9.0e-46;
101 fs = 10.;
102 } else if(NoisePsd == LALTAMAPsd) {
103 s0 = 75.e-46;
104 fs = 75.;
105 } else if(NoisePsd == LALVIRGOPsd) {
106 s0 = 1;
107 fs = 10.;
108 } else if(NoisePsd == LALAdvLIGOPsd) {
109 s0 = 1e-49;
110 fs = 10.;
111 } else {
112 s0 = 1.;
113 fs = 0.;
114 }
115
116 n = (INT4) psd->length-1;
117
118 /*
119 * Set DC and Nyquist components to zero
120 */
121
122 psd->data[0] = 0.;
123
124 for (i=0; i<=n; i++)
125 {
126 f = i*df;
127
128 if (f>=fs)
129 {
130 (*NoisePsd)(status->statusPtr, &shf, f);
131 psd->data[i] = s0 * shf;
132
133 } else {
134
135 psd->data[i] = 0.;
136 }
137 }
139 RETURN(status);
140}
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
static double f(double theta, double y, double xi)
Definition: XLALMarcumQ.c:258
double REAL8
Double precision real floating-point number (8 bytes).
int32_t INT4
Four-byte signed integer.
void LALTAMAPsd(LALStatus *status, REAL8 *shf, REAL8 x)
void LALAdvLIGOPsd(LALStatus UNUSED *status, REAL8 *psd, REAL8 f)
Module to calculate the noise power spectral density for the initial LIGO detector.
Definition: LALAdvLIGOPsd.c:50
#define LALNOISEMODELSH_ENULL
Arguments contained an unexpected null pointer.
void LALGEOPsd(LALStatus UNUSED *status, REAL8 *psd, REAL8 f)
Module to calculate the expected noise power spectral density for the GEO600 detector.
Definition: LALGEOPsd.c:52
void LALNoiseSpectralDensity(LALStatus *status, REAL8Vector *psd, void(*NoisePsd)(LALStatus *status, REAL8 *shf, REAL8 f), REAL8 f)
This function generates an array of size specified in the vector psd, that is psd....
void LALLIGOIPsd(LALStatus UNUSED *status, REAL8 *psd, REAL8 f)
Legacy LAL wrapper of XLALLIGOIPsd().
Definition: LALLIGOIPsd.c:65
void LALVIRGOPsd(LALStatus *status, REAL8 *shf, REAL8 x)
#define LALNOISEMODELSH_ESIZE
Invalid input size.
LAL status structure, see The LALStatus structure for more details.
Definition: LALDatatypes.h:947
Vector of type REAL8, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:154
REAL8 * data
Pointer to the data array.
Definition: LALDatatypes.h:159
UINT4 length
Number of elements in array.
Definition: LALDatatypes.h:158