LALPulsar  6.1.0.1-fe68b98
LALComputeAM.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2007 John Whelan, Reinhard Prix
3 * Copyright (C) 2007 Jolien Creighton, Maria Alessandra Papa, Steve Berukoff
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with with program; see the file COPYING. If not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301 USA
19 */
20 #ifndef _LALCOMPUTEAM_H
21 #define _LALCOMPUTEAM_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /**
28  * \defgroup LALComputeAM_h Header LALComputeAM.h
29  * \ingroup lalpulsar_coh
30  * \author S.J. Berukoff, Reinhard Prix, John Whelan
31  * \date 2007
32  *
33  * \brief Header-file for computing antenna-pattern components for amplitude demodulation.
34  *
35  * <tt>\#include <lal/LALComputeAM.h></tt>
36  *
37  * In order to compute the optimal statistic for pulsar searches, one must take account of the
38  * various modulations that change the emitted, (fairly) simple sinusoid into a non-trivial function
39  * of parameters. The frequency evolution of the signal (spindown effects, Doppler modulation, etc.)
40  * have already been accounted for; this routine filters the amplitude modulation effects.
41  */
42 /** @{ */
43 
44 /*---------- exported INCLUDES ----------*/
45 #include <math.h>
46 #include <lal/DetResponse.h>
47 #include <lal/DetectorSite.h>
48 #include <lal/LALBarycenter.h>
49 #include <lal/DetectorStates.h>
50 #include <lal/PSDutils.h>
51 
52 /* ---------- exported data types -------------------- */
53 
54 /**
55  * This structure contains the per-SFT (weighted) antenna-pattern functions
56  * \f$ \widehat{a}_{X\alpha}, \widehat{b}_{X\alpha} \f$ ,
57  * with \f$ \alpha \f$ the SFT-index, and \f$ X \f$ the IFO index. The per-IFO summed antenna-pattern coefficients
58  * for detector X are
59  * \f$ \widehat{A}_X,\widehat{B}_X,\widehat{C}_X \f$ and their determinant \f$ \widehat{D}_X=\widehat{A}_X \widehat{B}_X - \widehat{C}_X^2 \f$ .
60  *
61  * \p See Sec.4.1 in CFSv2 notes (https://dcc.ligo.org/cgi-bin/DocDB/ShowDocument?docid=T0900149&version=4)
62  */
63 typedef struct tagAMCoeffs {
64  REAL4Vector *a; /**< (weighted) per-SFT \f$ X\alpha \f$ antenna-pattern function \f$ \widehat{a}_{X\alpha} \f$ */
65  REAL4Vector *b; /**< (weighted) per-SFT \f$ X\alpha \f$ antenna-pattern function \f$ \widehat{b}_{X\alpha} \f$ */
66  REAL4 A; /**< summed antenna-pattern matrix coefficient: \f$ \widehat{A}_X = \sum_{\alpha} \widehat{a}^2_{X\alpha} \f$ */
67  REAL4 B; /**< summed antenna-pattern matrix coefficient: \f$ \widehat{B}_X = \sum_{\alpha} \widehat{b}^2_{X\alpha} \f$ */
68  REAL4 C; /**< summed antenna-pattern matrix coefficient: \f$ \widehat{C}_X = \sum_{\alpha} \widehat{a}_{X\alpha}\,\widehat{b}_{X\alpha} \f$ */
69  REAL4 D; /**< determinant \f$ \widehat{D}_X = \widehat{A}_X \widehat{B}_X - \widehat{C}_X^2 \f$ */
70 } AMCoeffs;
71 
72 /**
73  * This structure contains the parameters for the routine. They include:
74  */
75 typedef struct tagAMCoeffsParams {
76  BarycenterInput *baryinput; /**< data from Barycentring routine */
77  EarthState *earth; /**< from XLALBarycenter() */
78  EphemerisData *edat; /**< the ephemerides */
79  LALDetAndSource *das; /**< det and source information */
80  LALFrDetector *det; /**< detector geometry */
81  REAL4 polAngle; /**< polarization angle */
83 
84 /**
85  * Struct holding the "antenna-pattern" matrix \f$ \mathcal{M}_{\mu\nu} \equiv \left( \mathbf{h}_\mu|\mathbf{h}_\nu\right) \f$ ,
86  * in terms of the multi-detector scalar product.
87 
88  \f[
89  \newcommand{\Ad}{\widehat{A}}
90  \newcommand{\Bd}{\widehat{B}}
91  \newcommand{\Cd}{\widehat{C}}
92  \newcommand{\Ed}{\widehat{E}}
93  \newcommand{\Dd}{\widehat{D}}
94  \newcommand{\ah}{\hat{a}}
95  \newcommand{\bh}{\hat{b}}
96  \newcommand{\M}{\mathcal{M}}
97  \newcommand{\S}{\mathcal{S}}
98  \newcommand{\Tsft}{T_{\mathrm{sft}}}
99  \newcommand{\Nsft}{N_{\mathrm{sft}}}
100  \f]
101 
102 This matrix can be shown to be generally expressible as
103  * \f{equation}{
104  * \M_{\mu\nu} = \S^{-1}\,\Tsft\,\begin{pmatrix}
105  * \Ad & \Cd & 0 & -\Ed \\
106  * \Cd & \Bd & \Ed & 0 \\
107  * 0 & \Ed & \Ad & \Cd \\
108  * -\Ed & 0 & \Cd & \Bd \\
109  * \end{pmatrix}
110  * \f}
111  * where \f$ \S^{-1} \equiv \frac{1}{\Nsft}\sum_{X\alpha} S^{-1}_{X\alpha} \f$ characterizes the overall multi-detector noise-floor.
112  * The sum is over all detectors \f$ X \f$ and all SFTs \f$ \alpha \f$ from each detector. The nonzero matrix coefficients are expressible as
113  * \f{align}{
114  * \Ad &\equiv \sum_{X\alpha} \left|\ah_{X\alpha}\right|^2 \,,\\
115  * \Bd &\equiv \sum_{X\alpha} \left|\bh_{X\alpha}\right|^2 \,,\\
116  * \Cd &\equiv \mathrm{Re} \sum_{X\alpha} \ah_{X\alpha}^{\,*} \,\bh_{X\alpha} \,,\\
117  * \Ed &\equiv \mathrm{Im} \sum_{X\alpha} \ah_{X\alpha}^{\,*} \,\bh_{X\alpha} \,,\\
118  * \f}
119  * in terms of the noise-weighted atenna-functions are \f$ \ah_{X\alpha} \equiv \sqrt{w_{X\alpha}}\,a_{X\alpha} \f$ ,
120  * and \f$ \bh_{X\alpha} = \sqrt{w_{X\alpha}}\,b_{X\alpha} \f$ , with per-SFT noise-weights
121  * \f$ w_{X\alpha} \equiv \frac{S^{-1}_{X\alpha}}{\S^{-1}} \f$ .
122  *
123  * \note One reason for storing the un-normalized \f$ \{\Ad,\,\Bd,\,\Cd,\,\Ed\} \f$ and the normalization-factor \f$ \S^{-1}\,\Tsft \f$ separately
124  * is that the former are of order one, while the latter is generally very large, and so it has numerical advantages for parameter-estimation
125  * to use that fact.
126  */
127 typedef struct tagAntennaPatternMatrix {
128  REAL4 Ad; //!< \f$ \Ad \f$
129  REAL4 Bd; //!< \f$ \Bd \f$
130  REAL4 Cd; //!< \f$ \Cd \f$
131  REAL4 Ed; //!< \f$ \Ed \f$
132  REAL4 Dd; //!< determinant factor \f$ \Dd \equiv \Ad \Bd - \Cd^2 - \Ed^2 \f$ , such that \f$ \det\M = \Dd^2 \f$
133  REAL8 Sinv_Tsft; //!< normalization-factor \f$ \S^{-1}\,\Tsft \f$ (using single-sided PSD!)
135 
136 /** Multi-IFO container for antenna-pattern coefficients \f$ a_{X\alpha}, b_{X\alpha} \f$ and atenna-pattern matrix \f$ \mathcal{M}_{\mu\nu} \f$ */
137 typedef struct tagMultiAMCoeffs {
138  UINT4 length; /**< number of IFOs */
139  AMCoeffs **data; /**< noise-weighted AM-coeffs \f$ \widehat{a}_{X\alpha} \f$ , and \f$ \widehat{b}_{X\alpha} \f$ */
140  AntennaPatternMatrix Mmunu; /**< antenna-pattern matrix \f$ \mathcal{M}_{\mu\nu} \f$ */
141 } MultiAMCoeffs;
142 
143 
144 /*---------- exported Global variables ----------*/
145 
146 /*---------- exported prototypes [API] ----------*/
147 
148 int XLALComputeAntennaPatternCoeffs( REAL8 *ai, REAL8 *bi, const SkyPosition *skypos, const LIGOTimeGPS *tGPS, const LALDetector *site, const EphemerisData *edat );
149 
150 int XLALWeightMultiAMCoeffs( MultiAMCoeffs *multiAMcoef, const MultiNoiseWeights *multiWeights );
151 
152 AMCoeffs *XLALComputeAMCoeffs( const DetectorStateSeries *DetectorStates, SkyPosition skypos );
153 MultiAMCoeffs *XLALComputeMultiAMCoeffs( const MultiDetectorStateSeries *multiDetStates, const MultiNoiseWeights *multiWeights, SkyPosition skypos );
154 
155 AMCoeffs *XLALCreateAMCoeffs( UINT4 numSteps );
156 void XLALDestroyMultiAMCoeffs( MultiAMCoeffs *multiAMcoef );
157 void XLALDestroyAMCoeffs( AMCoeffs *amcoef );
159 void XLALSetAntennaPatternMaxCond( REAL4 max_cond );
160 void XLALSetAntennaPatternIllCondDeterminant( REAL4 illCondDeterminant );
161 
162 /** @} */
163 
164 #ifdef __cplusplus
165 }
166 #endif
167 
168 #endif /* _LALCOMPUTEAM_H */
UINT2 A
Definition: SFTnaming.c:46
UINT2 B
Definition: SFTnaming.c:47
AMCoeffs * XLALComputeAMCoeffs(const DetectorStateSeries *DetectorStates, SkyPosition skypos)
Compute the 'amplitude coefficients' , as defined in for a series of timestamps.
Definition: LALComputeAM.c:297
void XLALDestroyMultiAMCoeffs(MultiAMCoeffs *multiAMcoef)
Destroy a MultiAMCoeffs structure.
Definition: LALComputeAM.c:469
int XLALComputeAntennaPatternCoeffs(REAL8 *ai, REAL8 *bi, const SkyPosition *skypos, const LIGOTimeGPS *tGPS, const LALDetector *site, const EphemerisData *edat)
Compute single time-stamp antenna-pattern coefficients a(t), b(t) Note: this function uses REAL8 prec...
Definition: LALComputeAM.c:79
AMCoeffs * XLALCreateAMCoeffs(UINT4 numSteps)
Create an AMCeoffs vector for given number of timesteps.
Definition: LALComputeAM.c:435
int XLALWeightMultiAMCoeffs(MultiAMCoeffs *multiAMcoef, const MultiNoiseWeights *multiWeights)
Replace AM-coeffs by weighted AM-coeffs, i.e.
Definition: LALComputeAM.c:188
void XLALSetAntennaPatternMaxCond(REAL4 max_cond)
Set a new module-local maximal acceptable condition number of computing antenna-pattern matrix determ...
Definition: LALComputeAM.c:565
void XLALDestroyAMCoeffs(AMCoeffs *amcoef)
Destroy a AMCoeffs structure.
Definition: LALComputeAM.c:497
void XLALSetAntennaPatternIllCondDeterminant(REAL4 illCondDeterminant)
Set the 'fallback' determinant to use for ill-conditioned antenna-pattern matrix.
Definition: LALComputeAM.c:575
REAL4 XLALComputeAntennaPatternSqrtDeterminant(REAL4 A, REAL4 B, REAL4 C, REAL4 E)
Compute (sqrt of) determinant of the antenna-pattern matrix Mmunu = [ A, C, 0, -E; C B E,...
Definition: LALComputeAM.c:544
MultiAMCoeffs * XLALComputeMultiAMCoeffs(const MultiDetectorStateSeries *multiDetStates, const MultiNoiseWeights *multiWeights, SkyPosition skypos)
Multi-IFO version of XLALComputeAMCoeffs().
Definition: LALComputeAM.c:379
double REAL8
uint32_t UINT4
float REAL4
This structure contains the per-SFT (weighted) antenna-pattern functions , with the SFT-index,...
Definition: LALComputeAM.h:63
REAL4 B
summed antenna-pattern matrix coefficient:
Definition: LALComputeAM.h:67
REAL4Vector * b
(weighted) per-SFT antenna-pattern function
Definition: LALComputeAM.h:65
REAL4 A
summed antenna-pattern matrix coefficient:
Definition: LALComputeAM.h:66
REAL4 C
summed antenna-pattern matrix coefficient:
Definition: LALComputeAM.h:68
REAL4Vector * a
(weighted) per-SFT antenna-pattern function
Definition: LALComputeAM.h:64
REAL4 D
determinant
Definition: LALComputeAM.h:69
This structure contains the parameters for the routine.
Definition: LALComputeAM.h:75
LALDetAndSource * das
det and source information
Definition: LALComputeAM.h:79
LALFrDetector * det
detector geometry
Definition: LALComputeAM.h:80
REAL4 polAngle
polarization angle
Definition: LALComputeAM.h:81
EarthState * earth
from XLALBarycenter()
Definition: LALComputeAM.h:77
EphemerisData * edat
the ephemerides
Definition: LALComputeAM.h:78
BarycenterInput * baryinput
data from Barycentring routine
Definition: LALComputeAM.h:76
Struct holding the "antenna-pattern" matrix , in terms of the multi-detector scalar product.
Definition: LALComputeAM.h:127
REAL8 Sinv_Tsft
normalization-factor (using single-sided PSD!)
Definition: LALComputeAM.h:133
REAL4 Dd
determinant factor , such that
Definition: LALComputeAM.h:132
Basic input structure to LALBarycenter.c.
Timeseries of DetectorState's, representing the detector-info at different timestamps.
Basic output structure of LALBarycenterEarth.c.
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
Multi-IFO container for antenna-pattern coefficients and atenna-pattern matrix .
Definition: LALComputeAM.h:137
UINT4 length
number of IFOs
Definition: LALComputeAM.h:138
AMCoeffs ** data
noise-weighted AM-coeffs , and
Definition: LALComputeAM.h:139
AntennaPatternMatrix Mmunu
antenna-pattern matrix
Definition: LALComputeAM.h:140
Multi-IFO time-series of DetectorStates.
One noise-weight (number) per SFT (therefore indexed over IFOs and SFTs.
Definition: PSDutils.h:71