LALPulsar  6.1.0.1-89842e6
LALComputeAM.c
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, Xavier Siemens
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 
21 /**
22  * \author S.J. Berukoff, Reinhard Prix, John Whelan
23  * \date 2007
24  * \addtogroup LALComputeAM_h
25  * \brief Computes quantities for amplitude demodulation.
26  *
27  * This routine computes the quantities \f$ a(t) \f$ and \f$ b(t) \f$ as defined in
28  * Jaranowski, Krolak, and Schutz \cite JKS98 , hereafter JKS. These
29  * functions quantify the dependence of the detector output on the
30  * beam-pattern functions \f$ F_{+} \f$ and \f$ F_{\times} \f$ ; in fact, \f$ a(t) \f$ and
31  * \f$ b(t) \f$ <i>are</i> the beam-pattern functions, without the dependence
32  * on polarization angle and detector arm angle. Since the
33  * LALDemod() suite is an attempt to compute an optimal statistic,
34  * it is necessary to include these quantities in the computation.
35  * Otherwise, the motion of the Earth as it revolves about its axis will
36  * smear the signal into several neighboring bins centered about the
37  * search frequency, consequently losing valuable SNR.
38  *
39  * ### Algorithm ###
40  *
41  * The routine is really simple. From JKS,
42  * \f{eqnarray*}
43  * F_{+} &=& \sin\zeta [ a(t) \cos 2 \psi + b(t) \sin 2 \psi ] \\
44  * F_{\times} &=& \sin\zeta [ b(t) \cos 2 \psi - a(t) \sin 2 \psi ]
45  * \f}
46  * We use the routine LALComputeDetAMResponse() to calculate
47  * \f$ F_{+} \f$ and \f$ F_{\times} \f$ for a given polarization angle, and then
48  * extract \f$ a(t) \f$ and \f$ b(t) \f$ , once for each timestamp \f$ t \f$ . Additionally,
49  * computation of the optimal statistic requires that we compute inner
50  * products of these two quantities for later use.
51  *
52  */
53 
54 /*---------- INCLUDES ----------*/
55 #include <lal/LALComputeAM.h>
56 #include <lal/SinCosLUT.h>
57 
58 /*---------- local DEFINES and macros ----------*/
59 
60 #define SQ(x) (x) * (x)
61 
64 
65 /*---------- internal types ----------*/
66 
67 /*---------- internal prototypes ----------*/
69 
70 /*==================== FUNCTION DEFINITIONS ====================*/
71 
72 /**
73  * Compute single time-stamp antenna-pattern coefficients a(t), b(t)
74  * Note: this function uses REAL8 precision, so this can be used in
75  * high-precision integration of the F-metric
76  *
77  */
78 int
79 XLALComputeAntennaPatternCoeffs( REAL8 *ai, /**< [out] antenna-pattern function a(t) */
80  REAL8 *bi, /**< [out] antenna-pattern function b(t) */
81  const SkyPosition *skypos, /**< [in] skyposition {alpha, delta} */
82  const LIGOTimeGPS *tGPS, /**< [in] GPS time t */
83  const LALDetector *site, /**< [in] detector */
84  const EphemerisData *edat /**< [in] ephemeris-data */
85  )
86 {
88  EarthState XLAL_INIT_DECL( earth );
89 
90  if ( !ai || !bi || !skypos || !tGPS || !site || !edat ) {
92  }
93 
95 
96  /* ---------- compute the detector tensor ---------- */
97  REAL8 sinG, cosG, sinGcosG, sinGsinG, cosGcosG;
98  SymmTensor3d detT;
99 
100  sinG = sin( earth.gmstRad );
101  cosG = cos( earth.gmstRad );
102 
103  sinGsinG = sinG * sinG;
104  sinGcosG = sinG * cosG;
105  cosGcosG = cosG * cosG;
106 
107  detT.d11 = site->response[0][0] * cosGcosG
108  - 2 * site->response[0][1] * sinGcosG
109  + site->response[1][1] * sinGsinG;
110  detT.d22 = site->response[0][0] * sinGsinG
111  + 2 * site->response[0][1] * sinGcosG
112  + site->response[1][1] * cosGcosG;
113  detT.d12 = ( site->response[0][0] - site->response[1][1] ) * sinGcosG
114  + site->response[0][1] * ( cosGcosG - sinGsinG );
115  detT.d13 = site->response[0][2] * cosG
116  - site->response[1][2] * sinG;
117  detT.d23 = site->response[0][2] * sinG
118  + site->response[1][2] * cosG;
119  detT.d33 = site->response[2][2];
120 
121 
122  /*---------- We write components of xi and eta vectors in SSB-fixed coords */
123  REAL8 delta, alpha;
124  REAL8 sin1delta, cos1delta;
125  REAL8 sin1alpha, cos1alpha;
126 
127  REAL8 xi1, xi2;
128  REAL8 eta1, eta2, eta3;
129 
130 
131  alpha = skypos->longitude;
132  delta = skypos->latitude;
133 
134  sin1delta = sin( delta );
135  cos1delta = cos( delta );
136 
137  sin1alpha = sin( alpha );
138  cos1alpha = cos( alpha );
139 
140  xi1 = - sin1alpha;
141  xi2 = cos1alpha;
142  eta1 = sin1delta * cos1alpha;
143  eta2 = sin1delta * sin1alpha;
144  eta3 = - cos1delta;
145 
146  /*---------- Compute the a(t_i) and b(t_i) ---------- */
147  ( *ai ) = detT.d11 * ( xi1 * xi1 - eta1 * eta1 )
148  + 2 * detT.d12 * ( xi1 * xi2 - eta1 * eta2 )
149  - 2 * detT.d13 * eta1 * eta3
150  + detT.d22 * ( xi2 * xi2 - eta2 * eta2 )
151  - 2 * detT.d23 * eta2 * eta3
152  - detT.d33 * eta3 * eta3;
153 
154  ( *bi ) = detT.d11 * 2 * xi1 * eta1
155  + 2 * detT.d12 * ( xi1 * eta2 + xi2 * eta1 )
156  + 2 * detT.d13 * xi1 * eta3
157  + detT.d22 * 2 * xi2 * eta2
158  + 2 * detT.d23 * xi2 * eta3;
159 
160 
161  return XLAL_SUCCESS;
162 
163 } /* XLALComputeAntennaPatternCoeffs() */
164 
165 
166 /**
167  * <b>Replace</b> AM-coeffs by weighted AM-coeffs, i.e.
168  * \f$ a_{X\alpha} \rightarrow \widehat{a}_{X\alpha} \equiv a_{X\alpha} \sqrt{w_{X\alpha}} \f$ , and
169  * \f$ b_{X\alpha} \rightarrow \widehat{b}_{X\alpha} \equiv a_{X\alpha} \sqrt{w_{X\alpha}} \f$ ,
170  * where \f$ w_{X\alpha} \f$ are the \a multiWeights for SFT \f$ \alpha \f$ and detector \f$ X \f$ .
171  *
172  * Also compute the resulting per-detector \f$ X \f$ antenna-pattern matrix coefficients
173  * \f$ \widehat{A}_X \equiv \sum_{\alpha} \widehat{a}^2_{X\alpha} \f$ ,
174  * \f$ \widehat{B}_X \equiv \sum_{\alpha} \widehat{b}^2_{X\alpha} \f$ ,
175  * \f$ \widehat{C}_X \equiv \sum_{\alpha} \widehat{a}_{X\alpha}\widehat{b}_{X\alpha} \f$ ,
176  *
177  * and corresponding multi-detector antenna-pattern matrix coefficients
178  * \f$ \widehat{A} \equiv \sum_{X} \widehat{A}_X \f$ ,
179  * \f$ \widehat{B} \equiv \sum_{X} \widehat{B}_X \f$ ,
180  * \f$ \widehat{C} \equiv \sum_{X} \widehat{C}_X \f$ .
181  *
182  * See Sec.4.1 in CFSv2.pdf notes https://dcc.ligo.org/cgi-bin/DocDB/ShowDocument?docid=T0900149&version=4
183  *
184  * \note *) this function modifies the input AMCoeffs->{a,b,c} *in place* !
185  * \note *) if multiWeights = NULL, we assume unit-weights.
186  */
187 int
188 XLALWeightMultiAMCoeffs( MultiAMCoeffs *multiAMcoef, const MultiNoiseWeights *multiWeights )
189 {
190 
191  /* ----- input sanity checks ----- */
192  if ( !multiAMcoef ) {
193  XLALPrintError( "%s: illegal NULL input received in 'multiAMcoefs'.\n", __func__ );
195  }
196  UINT4 numDetectors = multiAMcoef->length;
197  /* make sure identical number of detectors in amCoefs and weights */
198  if ( multiWeights && ( multiWeights->length != numDetectors ) ) {
199  XLALPrintError( "%s: multiWeights must be NULL or have the same number of detectors (numDet=%d) as mulitAMcoef (numDet=%d)!\n", __func__, multiWeights->length, numDetectors );
201  }
202  /* make sure identical number of timesteps in a_X, b_X and (if given) weights w_X, respectively */
203  UINT4 X;
204  for ( X = 0; X < numDetectors; X ++ ) {
205  UINT4 numStepsX = multiAMcoef->data[X]->a->length;
206  if ( numStepsX != multiAMcoef->data[X]->b->length ) {
207  XLALPrintError( "%s: per-SFT antenna-pattern series have different length: a_alpha (len=%d), b_alpha (len=%d)\n", __func__, numStepsX, multiAMcoef->data[X]->b->length );
209  }
210  if ( multiWeights && ( multiWeights->data[X]->length != numStepsX ) ) {
211  XLALPrintError( "%s: multiWeights[X=%d] must be NULL or have the same length (len=%d) as mulitAMcoef[X] (len=%d)!\n", __func__, X, multiWeights->data[X]->length, numStepsX );
213  }
214  } // for X < numDetectors
215 
216  REAL4 Ad = 0, Bd = 0, Cd = 0, Ed = 0; // multi-IFO values
217  /* ---------- main loop over detectors X ---------- */
218  for ( X = 0; X < numDetectors; X ++ ) {
219  AMCoeffs *amcoeX = multiAMcoef->data[X];
220  UINT4 numStepsX = amcoeX->a->length;
221 
222  /* ----- if given, apply noise-weights to all Antenna-pattern coefficients from detector X ----- */
223  if ( multiWeights ) {
224  REAL8Vector *weightsX = multiWeights->data[X];
225  UINT4 alpha; // SFT-index
226  REAL8 ooSinv_Tsft = 1.0 / multiWeights->Sinv_Tsft;
227  for ( alpha = 0; alpha < numStepsX; alpha++ ) {
228  REAL8 weight = multiWeights->isNotNormalized ? weightsX->data[alpha] * ooSinv_Tsft : weightsX->data[alpha];
229  REAL8 Sqwi = sqrt( weight );
230  /* apply noise-weights, *replace* original a, b by noise-weighed version! */
231  amcoeX->a->data[alpha] *= Sqwi;
232  amcoeX->b->data[alpha] *= Sqwi;
233  } // for alpha < numSteps
234  } // if weights
235 
236  UINT4 alpha; // SFT-index
237  REAL4 AdX = 0, BdX = 0, CdX = 0, EdX = 0; // single-IFO values
238  /* compute single-IFO antenna-pattern coefficients AX,BX,CX, by summing over time-steps 'alpha' */
239  for ( alpha = 0; alpha < numStepsX; alpha++ ) {
240  REAL4 ahat = amcoeX->a->data[alpha];
241  REAL4 bhat = amcoeX->b->data[alpha];
242 
243  AdX += ahat * ahat;
244  BdX += bhat * bhat;
245  CdX += ahat * bhat;
246  // EdX = 0; // trivial for real-values a,b
247  } /* for alpha < numStepsX */
248 
249  /* store those */
250  amcoeX->A = AdX;
251  amcoeX->B = BdX;
252  amcoeX->C = CdX;
253  amcoeX->D = XLALComputeAntennaPatternSqrtDeterminant( AdX, BdX, CdX, EdX );
254 
255  /* compute multi-IFO antenna-pattern coefficients A,B,C,E by summing over IFOs X */
256  Ad += AdX;
257  Bd += BdX;
258  Cd += CdX;
259  // Ed = 0; // trivial for real-valued a,b
260  } /* for X < numDetectors */
261 
262  multiAMcoef->Mmunu.Ad = Ad;
263  multiAMcoef->Mmunu.Bd = Bd;
264  multiAMcoef->Mmunu.Cd = Cd;
265  multiAMcoef->Mmunu.Dd = XLALComputeAntennaPatternSqrtDeterminant( Ad, Bd, Cd, Ed );
266 
267  if ( multiWeights ) {
268  multiAMcoef->Mmunu.Sinv_Tsft = multiWeights->Sinv_Tsft;
269  }
270 
271  return XLAL_SUCCESS;
272 
273 } /* XLALWeightMultiAMCoeffs() */
274 
275 
276 /**
277  * Compute the 'amplitude coefficients' \f$ a(t)\sin\zeta \f$ ,
278  * \f$ b(t)\sin\zeta \f$ as defined in \cite JKS98 for a series of
279  * timestamps.
280  *
281  * The input consists of the DetectorState-timeseries, which contains
282  * the detector-info and the LMST's corresponding to the different times.
283  *
284  * \note This implementation is based on the geometrical definition of
285  * \f$ a\sin\zeta \f$ and \f$ b\sin\zeta \f$ as detector response
286  * coefficients in a preferred polarization basis. (It is thereby
287  * more general than the JKS expressions and could be used e.g., with
288  * the response tensor of a bar detector with no further modification
289  * needed.)
290  *
291  * \note The fields AMCoeffs->{A, B, C, D} are not computed by this function,
292  * as they require correct SFT noise-weights. These fields would be computed, for
293  * example by XLALWeightMultiAMCoeffs().
294  *
295  */
296 AMCoeffs *
297 XLALComputeAMCoeffs( const DetectorStateSeries *DetectorStates, /**< timeseries of detector states */
298  SkyPosition skypos /**< {alpha,delta} of the source */
299  )
300 {
301  /* ---------- check input consistency ---------- */
302  if ( !DetectorStates ) {
303  XLALPrintError( "%s: invalid NULL input 'DetectorStates'\n", __func__ );
305  }
306 
307  /* currently requires sky-pos to be in equatorial coordinates (FIXME) */
308  if ( skypos.system != COORDINATESYSTEM_EQUATORIAL ) {
309  XLALPrintError( "%s: only equatorial coordinates currently supported in 'skypos'\n", __func__ );
311  }
312 
313  /*---------- We write components of xi and eta vectors in SSB-fixed coords */
314  REAL4 alpha = skypos.longitude;
315  REAL4 delta = skypos.latitude;
316 
317  REAL4 sin1delta, cos1delta;
318  REAL4 sin1alpha, cos1alpha;
319  XLAL_CHECK_NULL( XLALSinCosLUT( &sin1delta, &cos1delta, delta ) == XLAL_SUCCESS, XLAL_EFUNC );
320  XLAL_CHECK_NULL( XLALSinCosLUT( &sin1alpha, &cos1alpha, alpha ) == XLAL_SUCCESS, XLAL_EFUNC );
321 
322  REAL4 xi1 = - sin1alpha;
323  REAL4 xi2 = cos1alpha;
324  REAL4 eta1 = sin1delta * cos1alpha;
325  REAL4 eta2 = sin1delta * sin1alpha;
326  REAL4 eta3 = - cos1delta;
327 
328  /* prepare output vector */
329  UINT4 numSteps = DetectorStates->length;
330  AMCoeffs *coeffs;
331  if ( ( coeffs = XLALCreateAMCoeffs( numSteps ) ) == NULL ) {
332  XLALPrintError( "%s: XLALCreateAMCoeffs(%d) failed\n", __func__, numSteps );
334  }
335 
336  /*---------- Compute the a(t_i) and b(t_i) ---------- */
337  UINT4 i;
338  for ( i = 0; i < numSteps; i++ ) {
339  REAL4 ai, bi;
340 
341  SymmTensor3 *d = &( DetectorStates->data[i].detT );
342 
343  ai = d->d11 * ( xi1 * xi1 - eta1 * eta1 )
344  + 2 * d->d12 * ( xi1 * xi2 - eta1 * eta2 )
345  - 2 * d->d13 * eta1 * eta3
346  + d->d22 * ( xi2 * xi2 - eta2 * eta2 )
347  - 2 * d->d23 * eta2 * eta3
348  - d->d33 * eta3 * eta3;
349 
350  bi = d->d11 * 2 * xi1 * eta1
351  + 2 * d->d12 * ( xi1 * eta2 + xi2 * eta1 )
352  + 2 * d->d13 * xi1 * eta3
353  + d->d22 * 2 * xi2 * eta2
354  + 2 * d->d23 * xi2 * eta3;
355 
356  coeffs->a->data[i] = ai;
357  coeffs->b->data[i] = bi;
358 
359  } /* for i < numSteps */
360 
361  /* return the result */
362  return coeffs;
363 
364 } /* XLALComputeAMCoeffs() */
365 
366 /**
367  * Multi-IFO version of XLALComputeAMCoeffs().
368  * Computes noise-weighted combined multi-IFO antenna pattern functions.
369  *
370  * This function applies
371  * the noise-weights and computes the multi-IFO antenna-pattern matrix components
372  * {A, B, C}, and single-IFO matrix components {A_X,B_X,C_X} for detector X.
373  *
374  * Therefore: DONT use XLALWeightMultiAMCoeffs() on the result!
375  *
376  * \note *) an input of multiWeights = NULL corresponds to unit-weights
377  */
379 XLALComputeMultiAMCoeffs( const MultiDetectorStateSeries *multiDetStates, /**< [in] detector-states at timestamps t_i */
380  const MultiNoiseWeights *multiWeights, /**< [in] noise-weigths at timestamps t_i (can be NULL) */
381  SkyPosition skypos /**< source sky-position [in equatorial coords!] */
382  )
383 {
384  /* check input consistency */
385  if ( !multiDetStates ) {
386  XLALPrintError( "%s: invalid NULL input argument 'multiDetStates'\n", __func__ );
388  }
389 
390  UINT4 numDetectors = multiDetStates->length;
391 
392  /* prepare output vector */
393  MultiAMCoeffs *ret;
394  if ( ( ret = XLALCalloc( 1, sizeof( *ret ) ) ) == NULL ) {
395  XLALPrintError( "%s: failed to XLALCalloc( 1, %zu)\n", __func__, sizeof( *ret ) );
397  }
398 
399  ret->length = numDetectors;
400  if ( ( ret->data = XLALCalloc( numDetectors, sizeof( *ret->data ) ) ) == NULL ) {
401  XLALPrintError( "%s: failed to XLALCalloc(%d, %zu)\n", __func__, numDetectors, sizeof( *ret->data ) );
402  XLALFree( ret );
404  }
405 
406  /* loop over detectors and generate AMCoeffs for each one */
407  UINT4 X;
408  for ( X = 0; X < numDetectors; X ++ ) {
409  if ( ( ret->data[X] = XLALComputeAMCoeffs( multiDetStates->data[X], skypos ) ) == NULL ) {
410  XLALPrintError( "%s: call to XLALComputeAMCoeffs() failed with xlalErrno = %d\n", __func__, xlalErrno );
413  }
414 
415  } /* for X < numDetectors */
416 
417  /* apply noise-weights and compute antenna-pattern matrix {A,B,C} */
418  if ( XLALWeightMultiAMCoeffs( ret, multiWeights ) != XLAL_SUCCESS ) {
419  XLALPrintError( "%s: call to XLALWeightMultiAMCoeffs() failed with xlalErrno = %d\n", __func__, xlalErrno );
422  }
423 
424  /* return result */
425  return ret;
426 
427 } /* XLALComputeMultiAMCoeffs() */
428 
429 
430 /* ---------- creators/destructors for AM-coeffs -------------------- */
431 /**
432  * Create an AMCeoffs vector for given number of timesteps
433  */
434 AMCoeffs *
436 {
437  AMCoeffs *ret;
438 
439  if ( ( ret = XLALCalloc( 1, sizeof( *ret ) ) ) == NULL ) {
440  XLALPrintError( "%s: failed to XLALCalloc ( 1, %zu )\n", __func__, sizeof( *ret ) );
442  }
443 
444  if ( ( ret->a = XLALCreateREAL4Vector( numSteps ) ) == NULL ) {
445  XLALPrintError( "%s: XLALCreateREAL4Vector(%d) failed.\n", __func__, numSteps );
446  XLALDestroyAMCoeffs( ret );
448  }
449 
450  if ( ( ret->b = XLALCreateREAL4Vector( numSteps ) ) == NULL ) {
451  XLALPrintError( "%s: XLALCreateREAL4Vector(%d) failed.\n", __func__, numSteps );
452  XLALDestroyAMCoeffs( ret );
454  }
455 
456  return ret;
457 
458 } /* XLALCreateAMCoeffs() */
459 
460 
461 /**
462  * Destroy a MultiAMCoeffs structure.
463  *
464  * Note, this is "NULL-robust" in the sense that it will not crash
465  * on NULL-entries anywhere in this struct, so it can be used
466  * for failure-cleanup even on incomplete structs
467  */
468 void
470 {
471  UINT4 X;
472 
473  if ( ! multiAMcoef ) {
474  return;
475  }
476 
477  if ( multiAMcoef->data ) {
478  for ( X = 0; X < multiAMcoef->length; X ++ ) {
479  XLALDestroyAMCoeffs( multiAMcoef->data[X] );
480  } /* for X < numDetectors */
481  LALFree( multiAMcoef->data );
482  }
483  LALFree( multiAMcoef );
484 
485  return;
486 
487 } /* XLALDestroyMultiAMCoeffs() */
488 
489 /**
490  * Destroy a AMCoeffs structure.
491  *
492  * \note This function is "NULL-robust" in the sense that it will not crash
493  * on NULL-entries anywhere in this struct, so it can be used
494  * for failure-cleanup even on incomplete structs
495  */
496 void
498 {
499  if ( ! amcoef ) {
500  return;
501  }
502 
503  if ( amcoef->a ) {
504  XLALDestroyREAL4Vector( amcoef->a );
505  }
506  if ( amcoef->b ) {
507  XLALDestroyREAL4Vector( amcoef->b );
508  }
509 
510  LALFree( amcoef );
511 
512  return;
513 
514 } /* XLALDestroyAMCoeffs() */
515 
516 /// estimate condition number for given antenna-pattern matrix
517 static inline REAL4
519 {
520  REAL4 sumAB = A + B;
521  REAL4 diffAB = A - B;
522  REAL4 disc = sqrt( SQ( diffAB ) + 4.0 * ( SQ( C ) + SQ( E ) ) );
523 
524  REAL4 denom = sumAB - disc;
525 
526  REAL4 cond = ( denom > 0 ) ? ( ( sumAB + disc ) / denom ) : INFINITY;
527  return cond;
528 }
529 
530 
531 /// Compute (sqrt of) determinant of the antenna-pattern matrix
532 /// Mmunu = [ A, C, 0, -E;
533 /// C B E, 0;
534 /// 0 E A C;
535 /// -Ed 0 C B; ]
536 /// which is det(Mmunu) = ( A B - C^2 - E^2 )^2;
537 ///
538 /// in addition this function checks if the condition number exceeds
539 /// a module-local tolerance value 'AntennaPatternMaxCond' and outputs a warning
540 /// and returns NAN if it does.
541 /// Use XLALSetAntennaPatternMaxCond() to change the acceptable tolerance value.
542 ///
543 REAL4
545 {
546  XLAL_CHECK_REAL4( ( A >= 0 ) && ( B >= 0 ), XLAL_EINVAL );
547 
549  REAL4 det;
550  if ( cond > AntennaPatternMaxCond ) {
551  XLALPrintWarning( "WARNING: Antenna-pattern matrix condition number exceeds maximum allowed value:\n" );
552  XLALPrintWarning( "cond{A=%.16g, B=%.16g, C=%.16g, E=%.16g} = %.2e > %.2e ==> setting derminant = %.16g\n",
555  } else {
556  det = A * B - SQ( C ) - SQ( E );
557  }
558 
559  return det;
560 }
561 
562 /// Set a new module-local maximal acceptable condition number of computing
563 /// antenna-pattern matrix determinant
564 void
566 {
567  AntennaPatternMaxCond = max_cond;
568 }
569 
570 /// Set the 'fallback' determinant to use for ill-conditioned antenna-pattern
571 /// matrix. Use 'INFINITY' (=default) to allow 2F-calculation to continue by
572 /// 'turning off' the 2F value, or 'NAN' to force an error-condition to terminate
573 /// the code.
574 void
576 {
577  AntennaPatternIllCondDeterminant = illCondDeterminant;
578 }
#define __func__
log an I/O error, i.e.
static REAL4 AntennaPatternMaxCond
Definition: LALComputeAM.c:62
static REAL4 estimateAntennaPatternConditionNumber(REAL4 A, REAL4 B, REAL4 C, REAL4 E)
estimate condition number for given antenna-pattern matrix
Definition: LALComputeAM.c:518
#define SQ(x)
Definition: LALComputeAM.c:60
static REAL4 AntennaPatternIllCondDeterminant
Definition: LALComputeAM.c:63
#define LALFree(p)
static double double delta
UINT2 A
Definition: SFTnaming.c:46
UINT2 B
Definition: SFTnaming.c:47
const WeaveSearchTimingDenominator denom
Definition: SearchTiming.c:95
const double xi2
int XLALBarycenterEarth(EarthState *earth, const LIGOTimeGPS *tGPS, const EphemerisData *edat)
Computes the position and orientation of the Earth, at some arrival time , specified LIGOTimeGPS inp...
Definition: LALBarycenter.c:78
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
#define XLAL_INIT_DECL(var,...)
uint32_t UINT4
float REAL4
void * XLALCalloc(size_t m, size_t n)
void XLALFree(void *p)
int XLALSinCosLUT(REAL4 *sinx, REAL4 *cosx, REAL8 x)
Calculate sin(x) and cos(x) to roughly 1e-7 precision using a lookup-table and Taylor-expansion.
Definition: SinCosLUT.c:83
COORDINATESYSTEM_EQUATORIAL
void XLALDestroyREAL4Vector(REAL4Vector *vector)
REAL4Vector * XLALCreateREAL4Vector(UINT4 length)
#define XLAL_ERROR_NULL(...)
#define xlalErrno
#define XLAL_ERROR(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_REAL4(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK_NULL(assertion,...)
XLAL_ENOMEM
XLAL_SUCCESS
XLAL_EFUNC
XLAL_EINVAL
double alpha
size_t numDetectors
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
REAL8 Sinv_Tsft
normalization-factor (using single-sided PSD!)
Definition: LALComputeAM.h:133
REAL4 Dd
determinant factor , such that
Definition: LALComputeAM.h:132
SymmTensor3 detT
Detector-tensor components in SSB-fixed, Cartesian coordinates.
Timeseries of DetectorState's, representing the detector-info at different timestamps.
DetectorState * data
array of DetectorState entries
UINT4 length
total number of entries
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.
UINT4 length
number of detectors
DetectorStateSeries ** data
vector of pointers to DetectorStateSeries
One noise-weight (number) per SFT (therefore indexed over IFOs and SFTs.
Definition: PSDutils.h:71
REAL8 Sinv_Tsft
normalization factor used: (using single-sided PSD!)
Definition: PSDutils.h:77
UINT4 length
number of detectors
Definition: PSDutils.h:75
REAL8Vector ** data
weights-vector for each detector
Definition: PSDutils.h:76
BOOLEAN isNotNormalized
if true: weights are saved unnormalized (divide by Sinv_Tsft to get normalized version).
Definition: PSDutils.h:78
REAL4 * data
REAL8 * data
REAL8 longitude
REAL8 latitude
CoordinateSystem system
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,...
enum @4 site