LALPulsar  6.1.0.1-fe68b98
DetectorStates.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006 Reinhard Prix
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 #ifndef _DETECTORSTATES_H /* Double-include protection. */
20 #define _DETECTORSTATES_H
21 
22 /* C++ protection. */
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /**
28  * \author Reinhard Prix
29  * \defgroup DetectorStates_h Header DetectorStates.h
30  * \ingroup lalpulsar_general
31  * \date 2005
32  * \brief API for the DetectorStates.c functions.
33  *
34  */
35 /** @{ */
36 
37 /*---------- exported INCLUDES ----------*/
38 #include <lal/PulsarDataTypes.h>
39 #include <lal/SeqFactories.h>
40 #include <lal/LALBarycenter.h>
41 #include <lal/SFTfileIO.h>
42 
43 /*---------- exported DEFINES ----------*/
44 
45 /** \name Error-codes */
46 /** @{ */
47 #define DETECTORSTATES_ENULL 1
48 #define DETECTORSTATES_ENONULL 2
49 #define DETECTORSTATES_EINPUT 3
50 #define DETECTORSTATES_EMEM 4
51 #define DETECTORSTATES_EXLAL 5
52 #define DETECTORSTATES_EIEEE 6
53 
54 #define DETECTORSTATES_MSGENULL "Arguments contained an unexpected null pointer"
55 #define DETECTORSTATES_MSGENONULL "Output pointer is non-NULL"
56 #define DETECTORSTATES_MSGEINPUT "Invalid input"
57 #define DETECTORSTATES_MSGEMEM "Out of memory. Bad."
58 #define DETECTORSTATES_MSGEXLAL "XLAL function call failed"
59 #define DETECTORSTATES_MSGEIEEE "Floating point failure"
60 /** @} */
61 
62 /*---------- exported types ----------*/
63 
64 /**
65  * A symmetric 3x3 tensor (such as detector-tensors), storing only the upper triangle.
66  */
67 typedef struct tagSymmTensor3 {
74 } SymmTensor3;
75 
76 
77 /**
78  * A symmetric 3x3 tensor (such as detector-tensors), storing only the upper triangle, using REAL8 precision
79  */
80 typedef struct tagSymmTensor3d {
87 } SymmTensor3d;
88 
89 
90 /**
91  * Struct containing pre-computed quantites describing a
92  * single detector arm: unit-vector along detector-arm, arm-length,
93  * and arm "basis-tensor" n x n. This is used to speed up the
94  * computation of LISA detector tensors in the rigid-adiabatic approximation.
95  */
96 typedef struct tagDetectorArm {
97  REAL4 n[3]; /**< unit vector pointing along this arm */
98  SymmTensor3 basisT; /**< arm "basis-tensor" (n x n) */
99  REAL4 armlength_c; /**< armlengths in seconds L / c */
100 } DetectorArm;
101 
102 typedef DetectorArm Detector3Arms[3]; /**< used to allow functions some type/size checking */
103 
104 /**
105  * array of detectors definitions 'LALDetector'
106  *
107  */
108 typedef struct tagMultiLALDetector {
109  UINT4 length; //!< number of detectors \f$ N \f$
110  LALDetector sites[PULSAR_MAX_DETECTORS]; //!< array of site information
112 
113 //! array of detector-specific 'noise floors' (ie PSD values), assumed constant
114 //! over the frequency-band of interest
115 typedef struct tagMultiNoiseFloor {
116  UINT4 length; //!< number of detectors \f$ N_{\mathrm{det}} \f$
117  REAL8 sqrtSn[PULSAR_MAX_DETECTORS]; //!< per-IFO sqrt(PSD) values \f$ \sqrt{S_X} \f$ , where
118  //!< \f$ S_X^{-1}\equiv\frac{1}{N_{\mathrm{sft}}^X} \sum_{\alpha=0}^{N_{\mathrm{sft}}^X-1} S_{X\alpha}^{-1} \f$
119  //!< with \f$ N_{\mathrm{sft}}^X \f$ the number of SFTs (labeled by \f$ \alpha \f$ ) from detector \f$ X \f$
121 
122 /* ----- Output types for XLALGetDetectorStates() */
123 /**
124  * State-info about position, velocity and LMST of a detector together
125  * with corresponding EarthState.
126  */
127 typedef struct tagDetectorState {
128  LIGOTimeGPS tGPS; /**< GPS timestamps corresponding to this entry */
129  REAL8 rDetector[3]; /**< Cartesian coords of detector position in ICRS J2000. Units=sec */
130  REAL8 vDetector[3]; /**< Cart. coords. of detector velocity, in dimensionless units (v/c)*/
131  REAL8 LMST; /**< local mean sidereal time at the detector-location in radians */
132  EarthState earthState; /**< EarthState information */
133  Detector3Arms detArms; /**< include up to three arms to allow describing LISA */
134  SymmTensor3 detT; /**< Detector-tensor components in SSB-fixed, Cartesian coordinates */
135 } DetectorState;
136 
137 
138 /**
139  * Timeseries of DetectorState's, representing the detector-info at different timestamps.
140  * In addition to the standard 'vector'-fields we also store the detector-info in here.
141  */
142 typedef struct tagDetectorStateSeries {
143 #ifdef SWIG /* SWIG interface directives */
144  SWIGLAL( ARRAY_1D( DetectorStateSeries, DetectorState, data, UINT4, length ) );
145 #endif /* SWIG */
146  UINT4 length; /**< total number of entries */
147  DetectorState *data; /**< array of DetectorState entries */
148  LALDetector detector; /**< detector-info corresponding to this timeseries */
149  CoordinateSystem system; /**< The coordinate system used for detector's position/velocity and detector-tensor */
150  REAL8 deltaT; /**< timespan centered on each timestamp (e.g. typically Tsft) */
152 
153 /** Multi-IFO time-series of DetectorStates */
154 typedef struct tagMultiDetectorStateSeries {
155 #ifdef SWIG /* SWIG interface directives */
156  SWIGLAL( ARRAY_1D( MultiDetectorStateSeries, DetectorStateSeries *, data, UINT4, length ) );
157 #endif /* SWIG */
158  UINT4 length; /**< number of detectors */
159  DetectorStateSeries **data; /**< vector of pointers to DetectorStateSeries */
160  // LIGOTimeGPS startTime; /**< (earliest) startTime of the observation */
161  //REAL8 Tspan; /**< total spanned duration of the observation */
163 
164 /*---------- exported Global variables ----------*/
165 
166 /*---------- exported prototypes [API] ----------*/
168 
172 
173 int XLALParseMultiLALDetector( MultiLALDetector *multiIFO, const LALStringVector *detNames );
174 int XLALParseMultiNoiseFloor( MultiNoiseFloor *multiNoiseFloor, const LALStringVector *sqrtSX, UINT4 numDetectors );
175 int XLALParseMultiNoiseFloorMapped( MultiNoiseFloor *multiNoiseFloor, const LALStringVector *multiNoiseFloorDetNames, const LALStringVector *sqrtSX, const LALStringVector *sqrtSXDetNames );
178 
179 int XLALAddSymmTensor3s( SymmTensor3 *sum, const SymmTensor3 *aT, const SymmTensor3 *bT );
180 int XLALSubtractSymmTensor3s( SymmTensor3 *diff, const SymmTensor3 *aT, const SymmTensor3 *bT );
181 int XLALScaleSymmTensor3( SymmTensor3 *mult, const SymmTensor3 *aT, REAL4 factor );
182 int XLALTensorSquareVector3( SymmTensor3 *vxv, REAL4 v[3] );
183 int XLALSymmetricTensorProduct3( SymmTensor3 *vxw, REAL4 v[3], REAL4 w[3] );
184 REAL4 XLALContractSymmTensor3s( const SymmTensor3 *T1, const SymmTensor3 *T2 );
185 
188 
189 /** @} */
190 
191 #ifdef __cplusplus
192 }
193 #endif
194 /* C++ protection. */
195 
196 #endif /* Double-include protection. */
LIGOTimeGPSVector * timestamps
int XLALParseMultiNoiseFloorMapped(MultiNoiseFloor *multiNoiseFloor, const LALStringVector *multiNoiseFloorDetNames, const LALStringVector *sqrtSX, const LALStringVector *sqrtSXDetNames)
Parse string-vectors (typically input by user) of N detector noise-floors for detectors ,...
int XLALTensorSquareVector3(SymmTensor3 *vxv, REAL4 v[3])
Compute the "squared-tensor" v x v for given vector v, the result is returned in a "detectorTensor" s...
int XLALAddSymmTensor3s(SymmTensor3 *sum, const SymmTensor3 *aT, const SymmTensor3 *bT)
Convenience function for adding two SymmTensor3s: aT + bT NOTE: it is safe to have sum point to the s...
DetectorStateSeries * XLALCreateDetectorStateSeries(UINT4 length)
Create a DetectorStateSeries with length entries.
int XLALParseMultiLALDetector(MultiLALDetector *detInfo, const LALStringVector *detNames)
Parse string-vectors (typically input by user) of N detector-names for detectors ,...
void XLALDestroyMultiDetectorStateSeries(MultiDetectorStateSeries *mdetStates)
Helper function to get rid of a multi-IFO DetectorStateSeries Note, this is "NULL-robust" in the sens...
int XLALMultiLALDetectorFromMultiSFTs(MultiLALDetector *multiIFO, const MultiSFTVector *multiSFTs)
Extract multi detector-info from a given multi SFTCatalog view.
MultiDetectorStateSeries * XLALGetMultiDetectorStates(const MultiLIGOTimeGPSVector *multiTS, const MultiLALDetector *multiIFO, const EphemerisData *edat, REAL8 tOffset)
Get the detector-time series for the given MultiLIGOTimeGPSVector.
void XLALDestroyDetectorStateSeries(DetectorStateSeries *detStates)
Get rid of a DetectorStateSeries.
int XLALSymmetricTensorProduct3(SymmTensor3 *vxw, REAL4 v[3], REAL4 w[3])
Compute the symmetrized tensor product T = v x w + w x v.
REAL4 XLALContractSymmTensor3s(const SymmTensor3 *T1, const SymmTensor3 *T2)
Contract two symmetric tensors over both indices T1 : T2.
MultiDetectorStateSeries * XLALGetMultiDetectorStatesFromMultiSFTs(const MultiSFTVector *multiSFTs, const EphemerisData *edat, REAL8 tOffset)
Get the 'detector state' (ie detector-tensor, position, velocity, etc) for the given multi-vector of ...
int XLALSubtractSymmTensor3s(SymmTensor3 *diff, const SymmTensor3 *aT, const SymmTensor3 *bT)
Convenience function for subtracting two SymmTensor3s: aT - bT NOTE: it is safe to have diff point to...
DetectorStateSeries * XLALGetDetectorStates(const LIGOTimeGPSVector *timestamps, const LALDetector *detector, const EphemerisData *edat, REAL8 tOffset)
Get the 'detector state' (ie detector-tensor, position, velocity, etc) for the given vector of timest...
int XLALMultiLALDetectorFromMultiSFTCatalogView(MultiLALDetector *multiIFO, const MultiSFTCatalogView *multiView)
Extract multi detector-info from a given multi SFTCatalog view.
int XLALScaleSymmTensor3(SymmTensor3 *mult, const SymmTensor3 *aT, REAL4 factor)
Convenience function for multiplying a SymmTensor3 by a scalar factor.
DetectorArm Detector3Arms[3]
used to allow functions some type/size checking
int XLALParseMultiNoiseFloor(MultiNoiseFloor *multiNoiseFloor, const LALStringVector *sqrtSX, UINT4 numDetectors)
Parse string-vectors (typically input by user) of N detector noise-floors for detectors ,...
double REAL8
uint32_t UINT4
float REAL4
#define PULSAR_MAX_DETECTORS
maximal number of detectors we can handle (for static arrays of detector quantities)
CoordinateSystem
n
Struct containing pre-computed quantites describing a single detector arm: unit-vector along detector...
SymmTensor3 basisT
arm "basis-tensor" (n x n)
REAL4 armlength_c
armlengths in seconds L / c
State-info about position, velocity and LMST of a detector together with corresponding EarthState.
EarthState earthState
EarthState information.
Detector3Arms detArms
include up to three arms to allow describing LISA
LIGOTimeGPS tGPS
GPS timestamps corresponding to this entry.
SymmTensor3 detT
Detector-tensor components in SSB-fixed, Cartesian coordinates.
REAL8 LMST
local mean sidereal time at the detector-location in radians
Timeseries of DetectorState's, representing the detector-info at different timestamps.
REAL8 deltaT
timespan centered on each timestamp (e.g.
CoordinateSystem system
The coordinate system used for detector's position/velocity and detector-tensor.
DetectorState * data
array of DetectorState entries
UINT4 length
total number of entries
LALDetector detector
detector-info corresponding to this timeseries
Basic output structure of LALBarycenterEarth.c.
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
A vector of 'timestamps' of type LIGOTimeGPS.
Definition: SFTfileIO.h:188
Multi-IFO time-series of DetectorStates.
UINT4 length
number of detectors
DetectorStateSeries ** data
vector of pointers to DetectorStateSeries
array of detectors definitions 'LALDetector'
UINT4 length
number of detectors
A collection of (multi-IFO) LIGOTimeGPSVector time-stamps vectors.
Definition: SFTfileIO.h:198
array of detector-specific 'noise floors' (ie PSD values), assumed constant over the frequency-band o...
UINT4 length
number of detectors
A multi-SFT-catalogue "view": a multi-IFO vector of SFT-catalogs.
Definition: SFTfileIO.h:255
A collection of SFT vectors – one for each IFO in a multi-IFO search.
Definition: SFTfileIO.h:179
A symmetric 3x3 tensor (such as detector-tensors), storing only the upper triangle.
A symmetric 3x3 tensor (such as detector-tensors), storing only the upper triangle,...