LALPulsar  6.1.0.1-b72065a
SemiAnalyticF.c
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2007 Chris Messenger, Iraj Gholami, Holger Pletsch, Reinhard Prix, Xavier Siemens
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 /**
21  * Author: Chris Messenger, Iraj Gholami, Holger Pletsch, Reinhard Prix, Xavier Siemens
22  *
23  * Semi-Analytic calculation of the F-statistic
24  */
25 
26 /************************************************************************
27  ** WARNING: THIS CODE OUTPUTS 'F' INSTEAD OF '2F' WHICH WOULD BE OUR USUAL
28  ** CONVENTION FOR THE "F-STATISTIC"
29  ************************************************************************
30  **
31  ** An attempt to change this to 2F to make it consistent with the other
32  ** pulgroup codes was rejected by pulgroup. This warning has been put in place
33  ** instead: http://blip.phys.uwm.edu/twiki/bin/save/CW/ProposedCodePatches
34  **
35  ************************************************************************/
36 
37 
38 /*********************************************************************************/
39 /* Semi-Analytic calculation of the F-statistic */
40 /* */
41 /* X. Siemens */
42 /* */
43 /* UWM - February 2003 */
44 /*********************************************************************************/
45 
46 #include "config.h"
47 
48 #include <errno.h>
49 
50 #include <lal/LALString.h>
51 #include <lal/AVFactories.h>
52 #include <lal/UserInput.h>
53 #include <lal/LALStdio.h>
54 #include <lal/LALBarycenter.h>
55 #include <lal/LALInitBarycenter.h>
56 #include <lal/LALComputeAM.h>
57 #include <lal/SFTfileIO.h>
58 #include <lal/LALPulsarVCSInfo.h>
59 
60 /*---------- error-codes ---------- */
61 #define SEMIANALYTIC_ENORM 0
62 #define SEMIANALYTIC_ESUB 1
63 #define SEMIANALYTIC_EINPUT 2
64 #define SEMIANALYTIC_EBAD 3
65 #define SEMIANALYTIC_EFILE 4
66 #define SEMIANALYTIC_ENOARG 5
67 #define SEMIANALYTIC_EMEM 6
68 #define SEMIANALYTIC_EREADFILE 8
69 
70 #define SEMIANALYTIC_MSGENORM "Normal exit"
71 #define SEMIANALYTIC_MSGESUB "Subroutine failed"
72 #define SEMIANALYTIC_MSGEINPUT "Invalid input"
73 #define SEMIANALYTIC_MSGEBAD "Bad argument values"
74 #define SEMIANALYTIC_MSGEFILE "File IO error"
75 #define SEMIANALYTIC_MSGENOARG "Missing argument"
76 #define SEMIANALYTIC_MSGEMEM "Out of memory..."
77 #define SEMIANALYTIC_MSGEREADFILE "Error reading in file"
78 
79 /*---------- defines ---------- */
80 #define TRUE (1==1)
81 #define FALSE (1==0)
82 
83 #define SQ(x) ((x)*(x))
84 
85 /*---------- local types ---------- */
104  /* ----- deprecated ----- */
108 
109 /*---------- global variables ---------- */
112 
113 extern int vrbflg;
114 
115 /*---------- local prototypes ---------- */
116 void InitUserVars( LALStatus *status, struct CommandLineArgsTag *CLA );
117 void ReadUserInput( LALStatus *, struct CommandLineArgsTag *CLA, int argc, char *argv[] );
118 void Freemem( LALStatus * );
119 void Initialize( LALStatus *status, struct CommandLineArgsTag *CLA );
120 void ComputeF( LALStatus *, struct CommandLineArgsTag CLA );
121 
122 void CheckUserInput( LALStatus *, struct CommandLineArgsTag *CLA );
123 
124 static void LALComputeAM( LALStatus *, AMCoeffs *coe, LIGOTimeGPS *ts, AMCoeffsParams *params );
125 
126 /*---------- function definitions ---------- */
127 int main( int argc, char *argv[] )
128 {
129  LALStatus XLAL_INIT_DECL( status ); /* initialize status */
130 
131  vrbflg = 1; /* verbose error-messages */
132 
133  /* set LAL error-handler */
134  lal_errhandler = LAL_ERR_EXIT; /* exit with returned status-code on error */
135 
136  /* register all user-variables */
138 
139  /* read cmdline & cfgfile */
140  BOOLEAN should_exit = 0;
142  if ( should_exit ) {
143  return EXIT_FAILURE;
144  }
146 
148 
149  /*---------- central function: compute F-statistic ---------- */
151 
152 
153  /* Free remaining memory */
154  LAL_CALL( LALSDestroyVector( &status, &( amc.a ) ), &status );
155  LAL_CALL( LALSDestroyVector( &status, &( amc.b ) ), &status );
157 
159 
160  return 0;
161 
162 } /* main() */
163 
164 
165 void
167 {
168 
169  REAL8 A, B, C, A1, A2, A3, A4, To, Sh, F;
170  REAL8 aPlus, aCross;
171  REAL8 twopsi, twophi;
172 
173  INITSTATUS( status );
175 
176  A = amc.A;
177  B = amc.B;
178  C = amc.C;
179 
180  twophi = 2.0 * CLA.phi0;
181  twopsi = 2.0 * CLA.psi;
182 
183  aPlus = CLA.aPlus;
184  aCross = CLA.aCross;
185 
186  A1 = aPlus * cos( twopsi ) * cos( twophi ) - aCross * sin( twopsi ) * sin( twophi );
187  A2 = aPlus * sin( twopsi ) * cos( twophi ) + aCross * cos( twopsi ) * sin( twophi );
188  A3 = -aPlus * cos( twopsi ) * sin( twophi ) - aCross * sin( twopsi ) * cos( twophi );
189  A4 = -aPlus * sin( twopsi ) * sin( twophi ) + aCross * cos( twopsi ) * cos( twophi );
190 
191  To = CLA.nTsft * CLA.Tsft;
192 
193  Sh = pow( CLA.sqrtSh, 2 );
194 
195  F = A * ( SQ( A1 ) + SQ( A3 ) ) + 2.0 * C * ( A1 * A2 + A3 * A4 ) + B * ( SQ( A2 ) + SQ( A4 ) );
196  F *= To / ( 4.0 * Sh );
197 
198  /* Note: the expectation-value of 2F is 4 + lambda ==> add 2 to Fstat*/
199  F += 2.0;
200 
201  fprintf( stdout, "%g\n", F );
202 
204  RETURN( status );
205 
206 } /* ComputeF() */
207 
208 
209 /**
210  * register all our "user-variables"
211  */
212 void
214 {
215 
216  INITSTATUS( status );
218 
219  /* Initialize default values */
220  CLA->Tsft = 1800;
221  CLA->nTsft = 0;
222  CLA->timestamps = NULL;
223  CLA->gpsStart = -1;
224  CLA->sqrtSh = 1.0;
225 
226  /** Default year-span of ephemeris-files to be used */
227  CLA->ephemEarth = XLALStringDuplicate( "earth00-40-DE405.dat.gz" );
228  CLA->ephemSun = XLALStringDuplicate( "sun00-40-DE405.dat.gz" );
229 
230  /* ---------- register all our user-variable ---------- */
231  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->Alpha ), "Alpha", REAL8, 'a', OPTIONAL, "Sky position Alpha (equatorial coordinates) in radians" ) == XLAL_SUCCESS, XLAL_EFUNC );
232  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->Alpha ), "longitude", REAL8, 0, DEVELOPER, "[DEPRECATED] Use --Alpha instead!" ) == XLAL_SUCCESS, XLAL_EFUNC );
233 
234  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->Delta ), "Delta", REAL8, 'd', OPTIONAL, "Sky position Delta (equatorial coordinates) in radians" ) == XLAL_SUCCESS, XLAL_EFUNC );
235  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->Delta ), "latitude", REAL8, 0, DEVELOPER, "[DEPRECATED] Use --Delta instead!" ) == XLAL_SUCCESS, XLAL_EFUNC );
236 
237  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->phi0 ), "phi0", REAL8, 'Q', OPTIONAL, "Phi_0: Initial phase in radians" ) == XLAL_SUCCESS, XLAL_EFUNC );
238 
239  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->psi ), "psi", REAL8, 'Y', OPTIONAL, "Polarisation in radians" ) == XLAL_SUCCESS, XLAL_EFUNC );
240 
241  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->cosi ), "cosi", REAL8, 'i', OPTIONAL, "Cos(iota)" ) == XLAL_SUCCESS, XLAL_EFUNC );
242  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->cosiota ), "cosiota", REAL8, 0, DEVELOPER, "[DEPRECATED] Use --cosi instead" ) == XLAL_SUCCESS, XLAL_EFUNC );
243 
244  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->h0 ), "h0", REAL8, 's', OPTIONAL, "Strain amplitude h_0" ) == XLAL_SUCCESS, XLAL_EFUNC );
245  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->sqrtSh ), "sqrtSh", REAL8, 'N', OPTIONAL, "Noise floor: one-sided sqrt(Sh) in 1/sqrt(Hz)" ) == XLAL_SUCCESS, XLAL_EFUNC );
246 
247  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->timestamps ), "timestampsFile", STRING, 'T', OPTIONAL, "Name of timestamps file" ) == XLAL_SUCCESS, XLAL_EFUNC );
248 
249  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->gpsStart ), "startTime", INT4, 'S', OPTIONAL, "GPS start time of continuous observation" ) == XLAL_SUCCESS, XLAL_EFUNC );
250 
251  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->Tsft ), "Tsft", REAL8, 't', OPTIONAL, "Length of an SFT in seconds" ) == XLAL_SUCCESS, XLAL_EFUNC );
252 
253  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->nTsft ), "nTsft", INT4, 'n', OPTIONAL, "Number of SFTs" ) == XLAL_SUCCESS, XLAL_EFUNC );
254 
255  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->IFO ), "IFO", STRING, 'D', OPTIONAL, "Detector: H1, H2, L1, G1, ... " ) == XLAL_SUCCESS, XLAL_EFUNC );
256  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->detector ), "detector", STRING, 0, DEVELOPER, "[DEPRECATED] Use --IFO instead!" ) == XLAL_SUCCESS, XLAL_EFUNC );
257 
258  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->ephemEarth ), "ephemEarth", STRING, 0, OPTIONAL, "Earth ephemeris file to use" ) == XLAL_SUCCESS, XLAL_EFUNC );
259 
260  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->ephemSun ), "ephemSun", STRING, 0, OPTIONAL, "Sun ephemeris file to use" ) == XLAL_SUCCESS, XLAL_EFUNC );
261 
262  /* ----- added for mfd_v4 compatibility ---------- */
263  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->duration ), "duration", REAL8, 0, OPTIONAL, "Duration of requested signal in seconds" ) == XLAL_SUCCESS, XLAL_EFUNC );
264 
265  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->aPlus ), "aPlus", REAL8, 0, OPTIONAL, "Plus polarization amplitude aPlus" ) == XLAL_SUCCESS, XLAL_EFUNC );
266  XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &( CLA->aCross ), "aCross", REAL8, 0, OPTIONAL, "Cross polarization amplitude aCross" ) == XLAL_SUCCESS, XLAL_EFUNC );
267 
268 
270  RETURN( status );
271 } /* InitUserVars() */
272 
273 /**
274  * Handle user-input and check its validity.
275  * Load ephemeris and calculate AM-coefficients (stored globally)
276  */
277 void
279 {
280  EphemerisData *edat = NULL; /* Stores earth/sun ephemeris data for barycentering */
281  BarycenterInput baryinput; /* Stores detector location and other barycentering data */
282  EarthState earth;
283  AMCoeffsParams *amParams;
284  LIGOTimeGPS *midTS = NULL; /* Time stamps for amplitude modulation coefficients */
285  const LALDetector *Detector; /* Our detector*/
286  INT4 k;
287 
288  INITSTATUS( status );
290 
291  if ( XLALUserVarWasSet( &( CLA->nTsft ) ) ) {
292  CLA->duration = 1.0 * CLA->nTsft * CLA->Tsft;
293  }
294 
295  /* read or generate SFT timestamps */
296  if ( XLALUserVarWasSet( &( CLA->timestamps ) ) ) {
298  if ( ( CLA->nTsft > 0 ) && ( ( UINT4 )CLA->nTsft < timestamps->length ) ) { /* truncate if required */
299  timestamps->length = CLA->nTsft;
300  }
301 
302  CLA->nTsft = timestamps->length;
303  } /* if have_timestamps */
304  else {
305  LIGOTimeGPS tStart;
306  tStart.gpsSeconds = CLA->gpsStart;
307  tStart.gpsNanoSeconds = 0;
308 
309  XLAL_CHECK_LAL( status, ( timestamps = XLALMakeTimestamps( tStart, CLA->duration, CLA->Tsft, 0 ) ) != NULL, XLAL_EFUNC );
310  CLA->nTsft = timestamps->length;
311 
312  } /* no timestamps */
313 
314  /*---------- initialize detector ---------- */
315  {
316  BOOLEAN have_IFO = XLALUserVarWasSet( &CLA->IFO );
317  BOOLEAN have_detector = XLALUserVarWasSet( &CLA->detector );
318  CHAR *IFO;
319 
320  if ( !have_IFO && !have_detector ) {
321  fprintf( stderr, "\nNeed to specify the detector (--IFO) !\n\n" );
323  }
324  if ( have_IFO ) {
325  IFO = CLA->IFO;
326  } else {
327  IFO = CLA->detector;
328  }
329 
330  if ( ( Detector = XLALGetSiteInfo( IFO ) ) == NULL ) {
332  }
333  }
334 
335  /* ---------- load ephemeris-files ---------- */
336  {
337  edat = XLALInitBarycenter( CLA->ephemEarth, CLA->ephemSun );
338  if ( !edat ) {
339  XLALPrintError( "XLALInitBarycenter failed: could not load Earth ephemeris '%s' and Sun ephemeris '%s'\n", CLA->ephemEarth, CLA->ephemSun );
341  }
342  } /* ephemeris-reading */
343 
344 
345  /* ---------- calculate AM-coefficients ---------- */
346 
347  /* prepare call to barycentering routing */
348  baryinput.site.location[0] = Detector->location[0] / LAL_C_SI;
349  baryinput.site.location[1] = Detector->location[1] / LAL_C_SI;
350  baryinput.site.location[2] = Detector->location[2] / LAL_C_SI;
351  baryinput.alpha = CLA->Alpha;
352  baryinput.delta = CLA->Delta;
353  baryinput.dInv = 0.e0;
354 
355  /* amParams structure to compute a(t) and b(t) */
356 
357  /* Allocate space for amParams stucture */
358  /* Here, amParams->das is the Detector and Source info */
359  amParams = ( AMCoeffsParams * )LALMalloc( sizeof( AMCoeffsParams ) );
360  amParams->das = ( LALDetAndSource * )LALMalloc( sizeof( LALDetAndSource ) );
361  amParams->das->pSource = ( LALSource * )LALMalloc( sizeof( LALSource ) );
362  /* Fill up AMCoeffsParams structure */
363  amParams->baryinput = &baryinput;
364  amParams->earth = &earth;
365  amParams->edat = edat;
366  amParams->das->pDetector = Detector;
368  amParams->das->pSource->equatorialCoords.longitude = CLA->Alpha;
369  amParams->das->pSource->equatorialCoords.latitude = CLA->Delta;
370  amParams->das->pSource->orientation = 0.0;
371 
372  amParams->polAngle = amParams->das->pSource->orientation ; /* These two have to be the same!!!!!!!!!*/
373 
374  /* Allocate space for AMCoeffs */
375  XLAL_INIT_MEM( amc );
376  TRY( LALSCreateVector( status->statusPtr, &( amc.a ), ( UINT4 ) CLA->nTsft ), status );
377  TRY( LALSCreateVector( status->statusPtr, &( amc.b ), ( UINT4 ) CLA->nTsft ), status );
378 
379  /* Mid point of each SFT */
380  midTS = ( LIGOTimeGPS * )LALCalloc( CLA->nTsft, sizeof( LIGOTimeGPS ) );
381  for ( k = 0; k < CLA->nTsft; k++ ) {
382  /* FIXME: loss of precision; consider
383  midTS[k] = timestamps->data[k];
384  XLALGPSAdd(&midTS[k], 0.5*CLA->Tsft);
385  */
386  REAL8 teemp = 0.0;
387  teemp = XLALGPSGetREAL8( &( timestamps->data[k] ) );
388  teemp += 0.5 * CLA->Tsft;
389  XLALGPSSetREAL8( &( midTS[k] ), teemp );
390  }
391 
392  TRY( LALComputeAM( status->statusPtr, &amc, midTS, amParams ), status );
393 
394  /* Free memory */
396 
397  LALFree( midTS );
399 
400  LALFree( amParams->das->pSource );
401  LALFree( amParams->das );
402  LALFree( amParams );
403 
404 
406  RETURN( status );
407 
408 } /* ParseUserInput() */
409 
410 
411 /**
412  * Check validity of user-input
413  */
414 void
416 {
417 
418  /* set a few abbreviations */
419  BOOLEAN have_timestamps = XLALUserVarWasSet( &( CLA->timestamps ) );
420  BOOLEAN have_gpsStart = XLALUserVarWasSet( &( CLA->gpsStart ) );
421  BOOLEAN have_duration = XLALUserVarWasSet( &( CLA->duration ) );
422  BOOLEAN have_nTsft = XLALUserVarWasSet( &( CLA->nTsft ) );
423 
424  INITSTATUS( status );
425 
426  if ( have_timestamps && ( have_gpsStart || have_duration ) ) {
427  fprintf( stderr, "\nBoth start time/duration and timestamps file specified - just need one !!\n" );
429  }
430 
431  if ( !have_timestamps && !have_gpsStart ) {
432  fprintf( stderr, "\nNeed to specify gpsStart time or a timestamps file !!\n" );
434  }
435 
436  if ( have_duration && have_nTsft ) {
437  fprintf( stderr, "\nSpecify only one of {duration, nTsft}!\n\n" );
439  }
440  if ( !have_duration && !have_nTsft && !have_timestamps ) {
441  fprintf( stderr, "\nDuration has not been specified! Use one of {duration, nTsft, timestamps}!\n\n" );
443  }
444 
445  /* now one can either specify {h0, cosiota} OR {aPlus, aCross} */
446  {
447  BOOLEAN have_h0 = XLALUserVarWasSet( &( CLA->h0 ) );
448  BOOLEAN have_cosi = XLALUserVarWasSet( &( CLA->cosi ) );
449  BOOLEAN have_aPlus = XLALUserVarWasSet( &( CLA->aPlus ) );
450  BOOLEAN have_aCross = XLALUserVarWasSet( &( CLA->aCross ) );
451 
452  if ( ( have_h0 || have_cosi ) && ( have_aPlus || have_aCross ) ) {
453  fprintf( stderr, "\nSpecify EITHER {h0/cosiota} OR {aPlus/aCross}\n\n" );
455  }
456 
457  if ( ( have_h0 && !have_cosi ) || ( !have_h0 && have_cosi ) ) {
458  fprintf( stderr, "\nYou need to specify both --h0 and --cosi\n\n" );
460  }
461  if ( ( have_aPlus && !have_aCross ) || ( !have_aPlus && have_aCross ) ) {
462  fprintf( stderr, "\nYou need to specify both --aPlus and --aCross\n\n" );
464  }
465  if ( ( CLA->cosi < -1.0 ) || ( CLA->cosi > 1.0 ) ) {
466  fprintf( stderr, "\nIncorrect value for cos(iota)\n\n" );
468  }
469 
470  /* hack, hack... */
471  if ( have_h0 ) { /* internally only use aPlus, aCross */
472  CLA->aPlus = 0.5 * CLA->h0 * ( 1.0 + SQ( CLA->cosi ) );
473  CLA->aCross = CLA->h0 * CLA->cosi;
474  }
475  }
476 
477  RETURN( status );
478 
479 } /* CheckUserInput() */
480 
481 
482 /**
483  * Original antenna-pattern function by S Berukoff
484  */
486  AMCoeffs *coe,
487  LIGOTimeGPS *ts,
489 {
490 
491  REAL4 zeta; /* sine of angle between detector arms */
492  INT4 i; /* temporary loop index */
493  LALDetAMResponse response; /* output of LALComputeDetAMResponse */
494 
495  REAL4 sumA2 = 0.0;
496  REAL4 sumB2 = 0.0;
497  REAL4 sumAB = 0.0; /* variables to store scalar products */
498  INT4 length = coe->a->length; /* length of input time series */
499 
500  REAL4 cos2psi;
501  REAL4 sin2psi; /* temp variables */
502 
503  INITSTATUS( status );
505 
506  /* Must put an ASSERT checking that ts vec and coe vec are same length */
507 
508  /* Compute the angle between detector arms, then the reciprocal */
509  {
510  LALFrDetector det = params->das->pDetector->frDetector;
511  zeta = 1.0 / ( sin( det.xArmAzimuthRadians - det.yArmAzimuthRadians ) );
512  if ( params->das->pDetector->type == LALDETECTORTYPE_CYLBAR ) {
513  zeta = 1.0;
514  }
515  }
516 
517  cos2psi = cos( 2.0 * params->polAngle );
518  sin2psi = sin( 2.0 * params->polAngle );
519 
520  /* Note the length is the same for the b vector */
521  for ( i = 0; i < length; ++i ) {
522  REAL4 *a = coe->a->data;
523  REAL4 *b = coe->b->data;
524 
525  /* Compute F_plus, F_cross */
526  LALComputeDetAMResponse( status->statusPtr, &response, params->das, &ts[i] );
527 
528  /* Compute a, b from JKS eq 10,11
529  * a = zeta * (F_plus*cos(2\psi)-F_cross*sin(2\psi))
530  * b = zeta * (F_cross*cos(2\psi)+Fplus*sin(2\psi))
531  */
532  a[i] = zeta * ( response.plus * cos2psi - response.cross * sin2psi );
533  b[i] = zeta * ( response.cross * cos2psi + response.plus * sin2psi );
534 
535  /* Compute scalar products */
536  sumA2 += SQ( a[i] ); /* A */
537  sumB2 += SQ( b[i] ); /* B */
538  sumAB += ( a[i] ) * ( b[i] ); /* C */
539  }
540 
541  {
542  /* Normalization factor */
543  REAL8 L = 2.0 / ( REAL8 )length;
544 
545  /* Assign output values and normalise */
546  coe->A = L * sumA2;
547  coe->B = L * sumB2;
548  coe->C = L * sumAB;
549  coe->D = ( coe->A * coe->B - SQ( coe->C ) );
550  /* protection against case when AB=C^2 */
551  if ( coe->D == 0 ) {
552  coe->D = 1.0e-9;
553  }
554  }
555 
556  /* Normal exit */
557 
559  RETURN( status );
560 
561 } /* LALComputeAM() */
#define STRING(a)
#define IFO
REAL8 zeta
lal_errhandler_t lal_errhandler
int LAL_ERR_EXIT(LALStatus *stat, const char *func, const char *file, const int line, volatile const char *id)
#define LAL_CALL(function, statusptr)
int k
void LALCheckMemoryLeaks(void)
#define LALCalloc(m, n)
#define LALMalloc(n)
#define LALFree(p)
const LALVCSInfoList lalPulsarVCSInfoList
NULL-terminated list of VCS and build information for LALPulsar and its dependencies
#define ABORT(statusptr, code, mesg)
#define XLAL_CHECK_LAL(sp, assertion,...)
#define TRY(func, statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
#define L(i, j)
UINT2 A
Definition: SFTnaming.c:46
UINT2 B
Definition: SFTnaming.c:47
LIGOTimeGPSVector * timestamps
static void LALComputeAM(LALStatus *, AMCoeffs *coe, LIGOTimeGPS *ts, AMCoeffsParams *params)
Original antenna-pattern function by S Berukoff.
void ReadUserInput(LALStatus *, struct CommandLineArgsTag *CLA, int argc, char *argv[])
int main(int argc, char *argv[])
struct CommandLineArgsTag CommandLineArgs
AMCoeffs amc
void ComputeF(LALStatus *, struct CommandLineArgsTag CLA)
void Freemem(LALStatus *)
#define SEMIANALYTIC_EINPUT
Definition: SemiAnalyticF.c:63
void CheckUserInput(LALStatus *, struct CommandLineArgsTag *CLA)
Check validity of user-input.
void Initialize(LALStatus *status, struct CommandLineArgsTag *CLA)
Handle user-input and check its validity.
int vrbflg
defined in lal/lib/std/LALError.c
void InitUserVars(LALStatus *status, struct CommandLineArgsTag *CLA)
register all our "user-variables"
#define SQ(x)
Definition: SemiAnalyticF.c:83
#define SEMIANALYTIC_MSGEINPUT
Definition: SemiAnalyticF.c:72
#define fprintf
void LALComputeDetAMResponse(LALStatus *status, LALDetAMResponse *pResponse, const LALDetAndSource *pDetAndSrc, const LIGOTimeGPS *gps)
void XLALDestroyEphemerisData(EphemerisData *edat)
Destructor for EphemerisData struct, NULL robust.
EphemerisData * XLALInitBarycenter(const CHAR *earthEphemerisFile, const CHAR *sunEphemerisFile)
XLAL interface to reading ephemeris files 'earth' and 'sun', and return ephemeris-data in old backwar...
unsigned char BOOLEAN
#define XLAL_INIT_MEM(x)
double REAL8
#define XLAL_INIT_DECL(var,...)
char CHAR
uint32_t UINT4
int32_t INT4
float REAL4
LALDETECTORTYPE_CYLBAR
char char * XLALStringDuplicate(const char *s)
static const INT4 a
const LALDetector * XLALGetSiteInfo(const CHAR *name)
Find the site geometry-information 'LALDetector' for given a detector name (or prefix).
Definition: SFTnaming.c:218
LIGOTimeGPSVector * XLALMakeTimestamps(LIGOTimeGPS tStart, REAL8 Tspan, REAL8 Tsft, REAL8 Toverlap)
Given a start-time, Tspan, Tsft and Toverlap, returns a list of timestamps covering this time-stretch...
LIGOTimeGPSVector * XLALReadTimestampsFile(const CHAR *fname)
backwards compatible wrapper to XLALReadTimestampsFileConstrained() without GPS-time constraints
void XLALDestroyTimestampVector(LIGOTimeGPSVector *vect)
De-allocate a LIGOTimeGPSVector.
Definition: SFTtimestamps.c:69
COORDINATESYSTEM_EQUATORIAL
int XLALUserVarReadAllInput(BOOLEAN *should_exit, int argc, char *argv[], const LALVCSInfoList vcs_list)
void XLALDestroyUserVars(void)
#define XLALRegisterNamedUvar(cvar, name, type, option, category,...)
int XLALUserVarWasSet(const void *cvar)
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALSCreateVector(LALStatus *, REAL4Vector **, UINT4)
#define XLAL_CHECK_MAIN(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
XLAL_SUCCESS
XLAL_EFUNC
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
ts
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
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
Basic input structure to LALBarycenter.c.
REAL8 alpha
Source right ascension in ICRS J2000 coords (radians).
REAL8 dInv
1/(distance to source), in 1/sec.
REAL8 delta
Source declination in ICRS J2000 coords (radians)
LALDetector site
detector site info.
Basic output structure of LALBarycenterEarth.c.
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
LALSource * pSource
const LALDetector * pDetector
REAL8 location[3]
REAL4 xArmAzimuthRadians
REAL4 yArmAzimuthRadians
SkyPosition equatorialCoords
REAL8 orientation
INT4 gpsNanoSeconds
A vector of 'timestamps' of type LIGOTimeGPS.
Definition: SFTfileIO.h:188
LIGOTimeGPS * data
array of timestamps
Definition: SFTfileIO.h:193
UINT4 length
number of timestamps
Definition: SFTfileIO.h:192
REAL4 * data
REAL8 longitude
REAL8 latitude
CoordinateSystem system