LALPulsar 7.1.2.1-bf6a62b
MultiWeights.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2005 Badri Krishnan, Alicia Sintes
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 * \file MultiWeights.c
22 * \ingroup lalpulsar_bin_Hough
23 * \author Badri Krishnan, Alicia Sintes
24 * \brief Utility code for calculating some properties of the noise weights
25 * for the multi-IFO Hough search
26 *
27 * History: Created by Sintes and Krishnan July 04, 2003
28 * Modifications for S4 January 2006
29 *
30 */
31
32#include "DriveHoughColor.h"
33
34/* globals, constants and defaults */
35
36/* boolean global variables for controlling output */
38
39#define EARTHEPHEMERIS "./earth05-09.dat"
40#define SUNEPHEMERIS "./sun05-09.dat"
41
42/* #define EARTHEPHEMERIS "./earth00-04.dat" */
43/* #define SUNEPHEMERIS "./sun00-04.dat" */
44
45#define MAXFILENAMELENGTH 512 /* maximum # of characters of a filename */
46
47#define DIROUT "./outMulti" /* output directory */
48#define BASENAMEOUT "HM" /* prefix file output */
49#define TEMPOUT "./tempout" /* output file */
50
51#define THRESHOLD 1.6 /* thresold for peak selection, with respect to the
52 the averaged power in the search band */
53#define FALSEALARM 1.0e-9 /* Hough false alarm for candidate selection */
54#define SKYFILE "./sky1"
55#define F0 505.0 /* frequency to build the LUT and start search */
56#define FBAND 0.05 /* search frequency band (in Hz) */
57#define NFSIZE 51 /* n-freq. span of the cylinder, to account for spin-down search */
58#define BLOCKSRNGMED 101 /* Running median window size */
60#define TRUE (1==1)
61#define FALSE (1==0)
62
63/* local function prototype */
64void PrintLogFile( LALStatus *status, LALStringVector *linefiles, CHAR *executable );
65
66
67
68/*******************************************************/
70int main( int argc, char *argv[] )
71{
72
73 /* LALStatus pointer */
74 static LALStatus status;
75
76 REAL8 scalepow = 1.0e40;
77
78 /* ephemeris */
79 EphemerisData *edat = NULL;
80
81 /* standard pulsar sft types */
82 MultiSFTVector *inputSFTs = NULL;
83
84 /* sft constraint variables */
85 LIGOTimeGPS startTimeGPS, endTimeGPS;
86 LIGOTimeGPSVector *inputTimeStampsVector = NULL;
87
88
89 /* information about all the ifos */
90 MultiDetectorStateSeries *mdetStates = NULL;
91 UINT4 numifo;
92
93 /* vector of weights */
94 REAL8Vector weightsV;
95
96 UINT4 numsft;
97 INT4 k;
98
99 /* miscellaneous */
100 UINT4 mObsCoh;
102
103 /* user input variables */
104 BOOLEAN uvar_printLog;
105 BOOLEAN uvar_weighAM, uvar_weighNoise;
106 BOOLEAN uvar_dumpAllW, uvar_dumpRelW, uvar_dumpNoise;
107 CHAR *uvar_sftDir = NULL;
109 CHAR *uvar_timeStampsFile = NULL;
110 LALStringVector *uvar_linefiles = NULL;
111 REAL8 uvar_AlphaWeight, uvar_DeltaWeight;
112 CHAR *uvar_earthEphemeris = NULL;
113 CHAR *uvar_sunEphemeris = NULL;
114 INT4 uvar_blocksRngMed, uvar_nfSizeCylinder, uvar_maxBinsClean;
115 REAL8 uvar_f0, uvar_fSearchBand;
116 CHAR *uvar_outfile = NULL;
117
118 /* Set up the default parameters */
119
120 /* LAL error-handler */
122
123 uvar_printLog = FALSE;
124 uvar_weighAM = FALSE;
125 uvar_weighNoise = FALSE;
126 uvar_dumpAllW = FALSE;
127 uvar_dumpRelW = FALSE;
128 uvar_dumpNoise = TRUE;
130 uvar_f0 = F0;
131 uvar_fSearchBand = FBAND;
132 uvar_maxBinsClean = 100;
133 uvar_startTime = 0;
135
136 /* nfsizecylinder is really not required here but retained
137 just to make sure that the number of bins read in the sft
138 is the same as in the driver */
139 uvar_nfSizeCylinder = NFSIZE;
140 uvar_AlphaWeight = 1.0;
141 uvar_DeltaWeight = 1.0;
142
143 uvar_outfile = ( CHAR * )LALCalloc( MAXFILENAMELENGTH, sizeof( CHAR ) );
144 strcpy( uvar_outfile, TEMPOUT );
145
146 uvar_earthEphemeris = ( CHAR * )LALCalloc( MAXFILENAMELENGTH, sizeof( CHAR ) );
147 strcpy( uvar_earthEphemeris, EARTHEPHEMERIS );
148
149 uvar_sunEphemeris = ( CHAR * )LALCalloc( MAXFILENAMELENGTH, sizeof( CHAR ) );
150 strcpy( uvar_sunEphemeris, SUNEPHEMERIS );
151
152 /* register user input variables */
153 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_f0, "f0", REAL8, 'f', OPTIONAL, "Start search frequency" ) == XLAL_SUCCESS, XLAL_EFUNC );
154 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_fSearchBand, "fSearchBand", REAL8, 'b', OPTIONAL, "Search frequency band" ) == XLAL_SUCCESS, XLAL_EFUNC );
155 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_printLog, "printLog", BOOLEAN, 0, OPTIONAL, "Print Log file" ) == XLAL_SUCCESS, XLAL_EFUNC );
156 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_sftDir, "sftDir", STRING, 'D', REQUIRED, "SFT filename pattern. Possibilities are:\n"
157 " - '<SFT file>;<SFT file>;...', where <SFT file> may contain wildcards\n - 'list:<file containing list of SFT files>'" ) == XLAL_SUCCESS, XLAL_EFUNC );
158 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_linefiles, "linefiles", STRINGVector, 0, OPTIONAL, "Comma separated List of linefiles (filenames must contain IFO name)" ) == XLAL_SUCCESS, XLAL_EFUNC );
159 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_startTime, "startTime", REAL8, 0, OPTIONAL, "GPS start time of observation (SFT timestamps must be >= this)" ) == XLAL_SUCCESS, XLAL_EFUNC );
160 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_endTime, "endTime", REAL8, 0, OPTIONAL, "GPS end time of observation (SFT timestamps must be < this)" ) == XLAL_SUCCESS, XLAL_EFUNC );
161 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_timeStampsFile, "timeStampsFile", STRING, 0, OPTIONAL, "Input time-stamps file" ) == XLAL_SUCCESS, XLAL_EFUNC );
162 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_weighAM, "weightAM", BOOLEAN, 0, OPTIONAL, "Use amplitude modulation weights" ) == XLAL_SUCCESS, XLAL_EFUNC );
163 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_weighNoise, "weightNoise", BOOLEAN, 0, OPTIONAL, "Use SFT noise weights" ) == XLAL_SUCCESS, XLAL_EFUNC );
164 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_dumpAllW, "dumpAllWeights", BOOLEAN, 0, OPTIONAL, "Dump all weights" ) == XLAL_SUCCESS, XLAL_EFUNC );
165 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_dumpRelW, "dumpRelativeWeights", BOOLEAN, 0, OPTIONAL, "Dump IFO relative weights" ) == XLAL_SUCCESS, XLAL_EFUNC );
166 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_dumpNoise, "dumpNoise", BOOLEAN, 0, OPTIONAL, "Dump Noise estimate" ) == XLAL_SUCCESS, XLAL_EFUNC );
167 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_earthEphemeris, "earthEphemeris", STRING, 'E', OPTIONAL, "Earth Ephemeris file" ) == XLAL_SUCCESS, XLAL_EFUNC );
168 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_sunEphemeris, "sunEphemeris", STRING, 'S', OPTIONAL, "Sun Ephemeris file" ) == XLAL_SUCCESS, XLAL_EFUNC );
169 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_AlphaWeight, "AlphaWeight", REAL8, 0, OPTIONAL, "sky Alpha for weight calculation" ) == XLAL_SUCCESS, XLAL_EFUNC );
170 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_DeltaWeight, "DeltaWeight", REAL8, 0, OPTIONAL, "sky Delta for weight calculation" ) == XLAL_SUCCESS, XLAL_EFUNC );
171 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_outfile, "outfile", STRING, 0, OPTIONAL, "output file name" ) == XLAL_SUCCESS, XLAL_EFUNC );
172 /* developer input variables */
173 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_blocksRngMed, "blocksRngMed", INT4, 0, DEVELOPER, "Running Median block size" ) == XLAL_SUCCESS, XLAL_EFUNC );
174 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_maxBinsClean, "maxBinsClean", INT4, 0, DEVELOPER, "Maximum number of bins in cleaning" ) == XLAL_SUCCESS, XLAL_EFUNC );
175 XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_nfSizeCylinder, "nfSizeCylinder", INT4, 0, DEVELOPER, "Size of cylinder of PHMDs" ) == XLAL_SUCCESS, XLAL_EFUNC );
176
177 /* read all command line variables */
178 BOOLEAN should_exit = 0;
180 if ( should_exit ) {
181 exit( 1 );
182 }
183
184 /* very basic consistency checks on user input */
185 if ( uvar_f0 < 0 ) {
186 fprintf( stderr, "start frequency must be positive\n" );
187 exit( 1 );
188 }
189
190 if ( uvar_fSearchBand < 0 ) {
191 fprintf( stderr, "search frequency band must be positive\n" );
192 exit( 1 );
193 }
194
195 /* write log file with command line arguments, cvs tags, and contents of skypatch file */
196 if ( uvar_printLog ) {
197 LAL_CALL( PrintLogFile( &status, uvar_linefiles, argv[0] ), &status );
198 }
199
200 /* read sfts and clean them */
201 {
202 /* new SFT I/O data types */
203 SFTCatalog *catalog = NULL;
204 static SFTConstraints constraints;
205
206 REAL8 doppWings, f_min, f_max;
207
208 /* set detector constraint */
209 constraints.detector = NULL;
210
212 XLALGPSSetREAL8( &startTimeGPS, uvar_startTime );
213 constraints.minStartTime = &startTimeGPS;
214 }
215
217 XLALGPSSetREAL8( &endTimeGPS, uvar_endTime );
218 constraints.maxStartTime = &endTimeGPS;
219 }
220
221 if ( XLALUserVarWasSet( &uvar_timeStampsFile ) ) {
222 XLAL_CHECK_MAIN( ( inputTimeStampsVector = XLALReadTimestampsFile( uvar_timeStampsFile ) ) != NULL, XLAL_EFUNC );
223 constraints.timestamps = inputTimeStampsVector;
224 }
225
226 /* get sft catalog */
227 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( uvar_sftDir, &constraints ) ) != NULL, XLAL_EFUNC );
228 if ( ( catalog == NULL ) || ( catalog->length == 0 ) ) {
229 fprintf( stderr, "Unable to match any SFTs with pattern '%s'\n", uvar_sftDir );
230 exit( 1 );
231 }
232
233 /* now we can free the inputTimeStampsVector */
234 if ( XLALUserVarWasSet( &uvar_timeStampsFile ) ) {
235 XLALDestroyTimestampVector( inputTimeStampsVector );
236 }
237
238 /* catalog is ordered in time so we can get start, end time and tObs*/
239 mObsCoh = catalog->length; /* not always correct number of sfts */
240 deltaF = catalog->data->header.deltaF; /* frequency resolution */
241
242 /* add wings for Doppler modulation and running median block size*/
243 doppWings = ( uvar_f0 + uvar_fSearchBand ) * VTOT;
244 f_min = uvar_f0 - doppWings - ( uvar_blocksRngMed + uvar_nfSizeCylinder ) * deltaF;
245 f_max = uvar_f0 + uvar_fSearchBand + doppWings + ( uvar_blocksRngMed + uvar_nfSizeCylinder ) * deltaF;
246
247 /* read the sfts */
248 XLAL_CHECK_MAIN( ( inputSFTs = XLALLoadMultiSFTs( catalog, f_min, f_max ) ) != NULL, XLAL_EFUNC );
249 numifo = inputSFTs->length;
250
251 /* find number of sfts */
252 /* mObsCoh = catalog->length; not always correct number of sfts */
253 /* loop over ifos and calculate number of sfts */
254 /* note that we can't use the catalog to determine the number of SFTs
255 because SFTs might be segmented in frequency */
256 mObsCoh = 0; /* initialization */
257 for ( k = 0; k < ( INT4 )numifo; k++ ) {
258 mObsCoh += inputSFTs->data[k]->length;
259 }
260
261 /* clean sfts if required */
262 if ( XLALUserVarWasSet( &uvar_linefiles ) ) {
263 RandomParams *randPar = NULL;
264 FILE *fpRand = NULL;
265 INT4 seed, ranCount;
266
267 if ( ( fpRand = fopen( "/dev/urandom", "r" ) ) == NULL ) {
268 fprintf( stderr, "Error in opening /dev/urandom" );
269 exit( 1 );
270 }
271
272 if ( ( ranCount = fread( &seed, sizeof( seed ), 1, fpRand ) ) != 1 ) {
273 fprintf( stderr, "Error in getting random seed" );
274 exit( 1 );
275 }
276
277 LAL_CALL( LALCreateRandomParams( &status, &randPar, seed ), &status );
278
279 LAL_CALL( LALRemoveKnownLinesInMultiSFTVector( &status, inputSFTs, uvar_maxBinsClean, uvar_blocksRngMed, uvar_linefiles, randPar ), &status );
280
281 LAL_CALL( LALDestroyRandomParams( &status, &randPar ), &status );
282 fclose( fpRand );
283 } /* end cleaning */
284
285 XLALDestroySFTCatalog( catalog );
286
287 } /* end of sft reading block */
288
289 /*******************************************************/
290
291 /* get detector velocities, positions, weights vector */
292 {
293 MultiNoiseWeights *multweight = NULL;
294 MultiPSDVector *multPSD = NULL;
295 UINT4 iIFO, iSFT, j;
296
297 /* get ephemeris */
298 XLAL_CHECK_MAIN( ( edat = XLALInitBarycenter( uvar_earthEphemeris, uvar_sunEphemeris ) ) != NULL, XLAL_EFUNC );
299
300 /* set up weights */
301 weightsV.length = mObsCoh;
302 weightsV.data = ( REAL8 * )LALCalloc( 1, mObsCoh * sizeof( REAL8 ) );
303
304 /* initialize all weights to unity */
306
307
308 /* get information about all detectors including velocity and timestamps */
309 /* note that this function returns the velocity at the
310 mid-time of the SFTs -- should not make any difference */
311 const REAL8 tOffset = 0.5 / inputSFTs->data[0]->data[0].deltaF;
312 XLAL_CHECK_MAIN( ( mdetStates = XLALGetMultiDetectorStatesFromMultiSFTs( inputSFTs, edat, tOffset ) ) != NULL, XLAL_EFUNC );
313
314 /* normalize sfts and get power running-median rngmed[ |data|^2] from SFTs */
315 XLAL_CHECK_MAIN( ( multPSD = XLALNormalizeMultiSFTVect( inputSFTs, uvar_blocksRngMed, NULL ) ) != NULL, XLAL_EFUNC );
316
317 if ( uvar_weighNoise ) {
318 /* compute multi noise weights if required */
319 XLAL_CHECK_MAIN( ( multweight = XLALComputeMultiNoiseWeights( multPSD, uvar_blocksRngMed, 0 ) ) != NULL, XLAL_EFUNC );
320 /* copy the weights */
321 for ( j = 0, iIFO = 0; iIFO < numifo; iIFO++ ) {
322 numsft = mdetStates->data[iIFO]->length;
323 for ( iSFT = 0; iSFT < numsft; iSFT++, j++ ) {
324 weightsV.data[j] = multweight->data[iIFO]->data[iSFT];
325 } /* loop over SFTs */
326 } /* loop over IFOs */
327
329 XLALDestroyMultiNoiseWeights( multweight );
330 }
331
332 if ( uvar_dumpNoise ) {
333 /* calculate (1/ (sum of 1/Sn^2) )^(1/4) where Sn is avg psd of each sft */
334 REAL8 sumSn, normPSD, sumSnInv = 0.0;
335 INT8 binsSFT;
336
337 /* nomalization factor to get proper single-sided PSD: Sn=(2/Tsft) rngmed[ |data|^2]*/
338 normPSD = 2.0 * deltaF;
339
340 for ( iIFO = 0; iIFO < numifo; iIFO++ ) {
341 numsft = multPSD->data[iIFO]->length;
342
343 for ( iSFT = 0; iSFT < numsft; iSFT++ ) {
344 binsSFT = multPSD->data[iIFO]->data[iSFT].data->length;
345 sumSn = 0.0;
346 /* use a scale to make numbers closer to unity */
347 for ( j = 0; j < binsSFT; j++ ) {
348 sumSn += scalepow * multPSD->data[iIFO]->data[iSFT].data->data[j];
349 }
350
351 sumSnInv += binsSFT * binsSFT / ( sumSn * sumSn );
352 } /* end loop over sfts */
353 } /* end loop over IFOs */
354
355 sumSnInv = sqrt( sumSnInv );
356 sumSnInv *= ( scalepow / normPSD );
357 sumSnInv = sqrt( sumSnInv );
358 fprintf( stdout, "%f %g\n", uvar_f0, 1.0 / sumSnInv );
359 } /* end block for Sn-weights calculation */
360
361 /* we are now done with the psd */
362 XLALDestroyMultiPSDVector( multPSD );
363
364 } /* end block for noise weights, velocity and time */
365
366
367 /* calculate amplitude modulation weights if required */
368 if ( uvar_weighAM ) {
369 MultiAMCoeffs *multiAMcoef = NULL;
370 UINT4 iIFO, iSFT;
371 SkyPosition skypos;
372
373 /* get the amplitude modulation coefficients */
374 skypos.longitude = uvar_AlphaWeight;
375 skypos.latitude = uvar_DeltaWeight;
377 XLAL_CHECK_MAIN( ( multiAMcoef = XLALComputeMultiAMCoeffs( mdetStates, NULL, skypos ) ) != NULL, XLAL_EFUNC );
378
379 /* loop over the weights and multiply them by the appropriate
380 AM coefficients */
381 for ( k = 0, iIFO = 0; iIFO < numifo; iIFO++ ) {
382 numsft = mdetStates->data[iIFO]->length;
383
384 for ( iSFT = 0; iSFT < numsft; iSFT++, k++ ) {
385 REAL8 a, b;
386
387 a = multiAMcoef->data[iIFO]->a->data[iSFT];
388 b = multiAMcoef->data[iIFO]->b->data[iSFT];
389 weightsV.data[k] *= ( a * a + b * b );
390 } /* loop over SFTs */
391 } /* loop over IFOs */
392
394
395 XLALDestroyMultiAMCoeffs( multiAMcoef );
396 } /* end AM weights calculation */
397
398 /*******************************************************/
399 /* dump weight vector if required */
400 if ( uvar_dumpAllW ) {
401 FILE *fp = NULL;
402
403 fp = fopen( uvar_outfile, "w" );
404 setvbuf( fp, ( char * )NULL, _IOLBF, 0 );
405
406 for ( k = 0; k < ( INT4 )mObsCoh; k++ ) {
407 fprintf( fp, "%g \n", weightsV.data[k] );
408 }
409 fclose( fp );
410 }
411
412 /*******************************************************/
413
414 /* print relative weights of ifos to stdout if required */
415 if ( uvar_dumpRelW ) {
416 REAL8 *sumweights = NULL;
417 sumweights = ( REAL8 * )LALCalloc( 1, numifo * sizeof( REAL8 ) );
418 UINT4 j, iIFO, iSFT;
419 for ( j = 0, iIFO = 0; iIFO < numifo; iIFO++ ) {
420 numsft = mdetStates->data[iIFO]->length;
421
422 for ( iSFT = 0; iSFT < numsft; iSFT++, j++ ) {
423 sumweights[iIFO] += weightsV.data[j];
424 }
425
426 } /* end loop over IFOs */
427
428 /*print relative sum of weights */
429 for ( iIFO = 0; iIFO < numifo; iIFO++ ) {
430 fprintf( stdout, "%s %f\n", inputSFTs->data[iIFO]->data[0].name, sumweights[iIFO] / mObsCoh );
431 }
432
433 LALFree( sumweights );
434
435 } /* end printing of relative weights */
436
437 /*******************************************************/
438
439 /* free memory and exit */
440 LALFree( weightsV.data );
442
444
445 XLALDestroyMultiSFTVector( inputSFTs );
446
448
450
451 if ( lalDebugLevel ) {
453 }
454
455 return status.statusCode;
456}
457
458/*******************************************************/
461 LALStringVector *linefiles,
462 CHAR *executable )
463{
464 CHAR *fnameLog = NULL;
465 FILE *fpLog = NULL;
466 CHAR *logstr = NULL;
467 UINT4 k;
468
471
472 /* open log file for writing */
473 fnameLog = ( CHAR * )LALCalloc( MAXFILENAMELENGTH, sizeof( CHAR ) );
474 strcpy( fnameLog, "./MultiWeight.log" );
475
476 /* open the log file for writing */
477 if ( ( fpLog = fopen( fnameLog, "w" ) ) == NULL ) {
478 fprintf( stderr, "Unable to open file %s for writing\n", fnameLog );
479 LALFree( fnameLog );
480 exit( 1 );
481 }
482
483 /* get the log string */
485
486 fprintf( fpLog, "## LOG FILE FOR Hough Driver\n\n" );
487 fprintf( fpLog, "# User Input:\n" );
488 fprintf( fpLog, "#-------------------------------------------\n" );
489 fprintf( fpLog, "%s", logstr );
490 LALFree( logstr );
491
492 fclose( fpLog );
493
494
495 /* copy contents of linefile if necessary */
496 if ( linefiles ) {
497
498 for ( k = 0; k < linefiles->length; k++ ) {
499
500 if ( ( fpLog = fopen( fnameLog, "a" ) ) != NULL ) {
501 CHAR command[1024] = "";
502 fprintf( fpLog, "\n\n# Contents of linefile %s :\n", linefiles->data[k] );
503 fprintf( fpLog, "# -----------------------------------------\n" );
504 fclose( fpLog );
505 sprintf( command, "cat %s >> %s", linefiles->data[k], fnameLog );
506 if ( system( command ) ) {
507 fprintf( stderr, "\nsystem('%s') returned non-zero status!\n\n", command );
508 }
509 }
510 }
511 }
512
513 /* append an ident-string defining the exact CVS-version of the code used */
514 if ( ( fpLog = fopen( fnameLog, "a" ) ) != NULL ) {
515 CHAR command[1024] = "";
516 fprintf( fpLog, "\n\n# CVS-versions of executable:\n" );
517 fprintf( fpLog, "# -----------------------------------------\n" );
518 fclose( fpLog );
519
520 sprintf( command, "ident %s | sort -u >> %s", executable, fnameLog );
521 /* we don't check this. If it fails, we assume that */
522 /* one of the system-commands was not available, and */
523 /* therefore the CVS-versions will not be logged */
524 if ( system( command ) ) {
525 fprintf( stderr, "\nsystem('%s') returned non-zero status!\n\n", command );
526 }
527 }
528
529 LALFree( fnameLog );
530
532 /* normal exit */
533 RETURN( status );
534}
Header file for non-demodulated Hough search.
#define LAL_INT4_MAX
void REPORTSTATUS(LALStatus *status)
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 j
int k
void LALCheckMemoryLeaks(void)
#define LALCalloc(m, n)
#define LALFree(p)
const LALVCSInfoList lalPulsarVCSInfoList
NULL-terminated list of VCS and build information for LALPulsar and its dependencies
#define XLAL_CHECK_LAL(sp, assertion,...)
#define ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
int main(int argc, char *argv[])
Definition: MultiWeights.c:69
BOOLEAN uvar_printSigma
Definition: MultiWeights.c:37
#define F0
Definition: MultiWeights.c:54
#define NFSIZE
Definition: MultiWeights.c:56
#define TEMPOUT
Definition: MultiWeights.c:49
#define EARTHEPHEMERIS
Definition: MultiWeights.c:39
BOOLEAN uvar_printTemplates
Definition: MultiWeights.c:37
void PrintLogFile(LALStatus *status, LALStringVector *linefiles, CHAR *executable)
Definition: MultiWeights.c:459
#define TRUE
Definition: MultiWeights.c:59
#define FALSE
Definition: MultiWeights.c:60
BOOLEAN uvar_printStats
Definition: MultiWeights.c:37
BOOLEAN uvar_printMaps
Definition: MultiWeights.c:37
BOOLEAN uvar_printEvents
Definition: MultiWeights.c:37
#define BLOCKSRNGMED
Definition: MultiWeights.c:57
#define FBAND
Definition: MultiWeights.c:55
#define SUNEPHEMERIS
Definition: MultiWeights.c:40
#define MAXFILENAMELENGTH
Definition: MultiWeights.c:45
#define STRING(a)
#define fprintf
void XLALDestroyMultiDetectorStateSeries(MultiDetectorStateSeries *mdetStates)
Helper function to get rid of a multi-IFO DetectorStateSeries Note, this is "NULL-robust" in the sens...
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 ...
EphemerisData * XLALInitBarycenter(const CHAR *earthEphemerisFile, const CHAR *sunEphemerisFile)
XLAL interface to reading ephemeris files 'earth' and 'sun', and return ephemeris-data in old backwar...
void XLALDestroyEphemerisData(EphemerisData *edat)
Destructor for EphemerisData struct, NULL robust.
void XLALDestroyMultiAMCoeffs(MultiAMCoeffs *multiAMcoef)
Destroy a MultiAMCoeffs structure.
Definition: LALComputeAM.c:469
MultiAMCoeffs * XLALComputeMultiAMCoeffs(const MultiDetectorStateSeries *multiDetStates, const MultiNoiseWeights *multiWeights, SkyPosition skypos)
Multi-IFO version of XLALComputeAMCoeffs().
Definition: LALComputeAM.c:379
unsigned char BOOLEAN
double REAL8
int64_t INT8
char CHAR
uint32_t UINT4
int32_t INT4
#define lalDebugLevel
void LALHOUGHNormalizeWeights(LALStatus *status, REAL8Vector *weightV)
Normalizes weight factors so that their sum is N.
Definition: DriveHough.c:668
void LALHOUGHInitializeWeights(LALStatus *status, REAL8Vector *weightV)
Initializes weight factors to unity.
Definition: DriveHough.c:633
#define VTOT
Total detector velocity/c TO BE CHANGED DEPENDING ON DETECTOR.
Definition: LUT.h:207
MultiPSDVector * XLALNormalizeMultiSFTVect(MultiSFTVector *multsft, UINT4 blockSize, const MultiNoiseFloor *assumeSqrtSX)
Function for normalizing a multi vector of SFTs in a multi IFO search and returns the running-median ...
void XLALDestroyMultiPSDVector(MultiPSDVector *multvect)
Destroy a multi PSD-vector.
Definition: PSDutils.c:102
MultiNoiseWeights * XLALComputeMultiNoiseWeights(const MultiPSDVector *rngmed, UINT4 blocksRngMed, UINT4 excludePercentile)
Computes weight factors arising from MultiSFTs with different noise floors.
Definition: PSDutils.c:285
void XLALDestroyMultiNoiseWeights(MultiNoiseWeights *weights)
Destroy a MultiNoiseWeights object.
Definition: PSDutils.c:172
void LALCreateRandomParams(LALStatus *status, RandomParams **params, INT4 seed)
static const INT4 a
void LALDestroyRandomParams(LALStatus *status, RandomParams **params)
void LALRemoveKnownLinesInMultiSFTVector(LALStatus *status, MultiSFTVector *MultiSFTVect, INT4 width, INT4 window, LALStringVector *linefiles, RandomParams *randPar)
top level function to remove lines from a multi sft vector given a list of files containing list of k...
Definition: lib/SFTClean.c:953
void XLALDestroySFTCatalog(SFTCatalog *catalog)
Free an 'SFT-catalogue'.
Definition: SFTcatalog.c:329
MultiSFTVector * XLALLoadMultiSFTs(const SFTCatalog *inputCatalog, REAL8 fMin, REAL8 fMax)
Function to load a catalog of SFTs from possibly different detectors.
Definition: SFTfileIO.c:416
void XLALDestroyMultiSFTVector(MultiSFTVector *multvect)
Destroy a multi SFT-vector.
Definition: SFTtypes.c:424
SFTCatalog * XLALSFTdataFind(const CHAR *file_pattern, const SFTConstraints *constraints)
Find the list of SFTs matching the file_pattern and satisfying the given constraints,...
Definition: SFTcatalog.c:71
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)
void CHAR * XLALUserVarGetLog(UserVarLogFormat format)
#define XLALRegisterNamedUvar(cvar, name, type, option, category,...)
int XLALUserVarWasSet(const void *cvar)
UVAR_LOGFMT_CFGFILE
#define XLAL_CHECK_MAIN(assertion,...)
XLAL_SUCCESS
XLAL_EFUNC
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
int deltaF
CHAR * uvar_sftDir
REAL8 uvar_startTime
REAL8 uvar_f0
INT4 uvar_blocksRngMed
REAL8 uvar_endTime
REAL4Vector * b
(weighted) per-SFT antenna-pattern function
Definition: LALComputeAM.h:65
REAL4Vector * a
(weighted) per-SFT antenna-pattern function
Definition: LALComputeAM.h:64
CHAR name[LALNameLength]
COMPLEX8FrequencySeries * data
Pointer to the data array.
UINT4 length
Number of elements in array.
UINT4 length
total number of entries
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 container for antenna-pattern coefficients and atenna-pattern matrix .
Definition: LALComputeAM.h:137
AMCoeffs ** data
noise-weighted AM-coeffs , and
Definition: LALComputeAM.h:142
Multi-IFO time-series of DetectorStates.
DetectorStateSeries ** data
vector of pointers to DetectorStateSeries
One noise-weight (number) per SFT (therefore indexed over IFOs and SFTs.
Definition: PSDutils.h:71
REAL8Vector ** data
weights-vector for each detector
Definition: PSDutils.h:76
A collection of PSD vectors – one for each IFO in a multi-IFO search.
Definition: PSDutils.h:62
PSDVector ** data
sftvector for each ifo
Definition: PSDutils.h:67
A collection of SFT vectors – one for each IFO in a multi-IFO search.
Definition: SFTfileIO.h:179
UINT4 length
number of ifos
Definition: SFTfileIO.h:183
SFTVector ** data
sftvector for each ifo
Definition: SFTfileIO.h:184
REAL4 * data
REAL8Sequence * data
REAL8FrequencySeries * data
Pointer to the data array.
UINT4 length
Number of elements in array.
REAL8 * data
An "SFT-catalogue": a vector of SFTdescriptors, as returned by XLALSFTdataFind()
Definition: SFTfileIO.h:238
SFTDescriptor * data
array of data-entries describing matched SFTs
Definition: SFTfileIO.h:243
UINT4 length
number of SFTs in catalog
Definition: SFTfileIO.h:242
'Constraints' for SFT-matching: which detector, within which time-stretch and which timestamps exactl...
Definition: SFTfileIO.h:212
CHAR * detector
2-char channel-prefix describing the detector (eg 'H1', 'H2', 'L1', 'G1' etc)
Definition: SFTfileIO.h:213
LIGOTimeGPSVector * timestamps
list of timestamps
Definition: SFTfileIO.h:216
LIGOTimeGPS * maxStartTime
only include SFTs whose epoch is < maxStartTime
Definition: SFTfileIO.h:215
LIGOTimeGPS * minStartTime
only include SFTs whose epoch is >= minStartTime
Definition: SFTfileIO.h:214
SFTtype header
SFT-header info.
Definition: SFTfileIO.h:228
REAL8 longitude
REAL8 latitude
CoordinateSystem system
double f_min
double f_max