LALPulsar 7.1.2.1-bf6a62b
ComputePSD.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007, 2010 Karl Wette
3* Copyright (C) 2007 Badri Krishnan, Iraj Gholami, Reinhard Prix, Alicia Sintes
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 * \file
23 * \ingroup lalpulsar_bin_SFTTools
24 * \author Badri Krishnan, Iraj Gholami, Reinhard Prix, Alicia Sintes, Karl Wette
25 * \brief Compute power spectral densities
26 */
27
28#include "config.h"
29
30#include <glob.h>
31#include <stdlib.h>
32#include <math.h>
33#include <stdio.h>
34#include <stdlib.h>
35#include <string.h>
36
37#include <gsl/gsl_sort.h>
38#include <gsl/gsl_math.h>
39
40#include <lal/LALStdlib.h>
41#include <lal/LALConstants.h>
42#include <lal/AVFactories.h>
43#include <lal/SeqFactories.h>
44#include <lal/SFTfileIO.h>
45#include <lal/Random.h>
46#include <lal/PulsarDataTypes.h>
47#include <lal/UserInput.h>
48#include <lal/NormalizeSFTRngMed.h>
49#include <lal/LALInitBarycenter.h>
50#include <lal/SFTClean.h>
51#include <lal/Segments.h>
52#include <lal/FrequencySeries.h>
53#include <lal/Units.h>
54#include <lal/LogPrintf.h>
55#include <lal/LALPulsarVCSInfo.h>
56
57/* ---------- Error codes and messages ---------- */
58#define COMPUTEPSDC_ENORM 0
59#define COMPUTEPSDC_ESUB 1
60#define COMPUTEPSDC_EARG 2
61#define COMPUTEPSDC_EBAD 3
62#define COMPUTEPSDC_EFILE 4
63#define COMPUTEPSDC_ENULL 5
64#define COMPUTEPSDC_EMEM 6
65
66#define COMPUTEPSDC_MSGENORM "Normal exit"
67#define COMPUTEPSDC_MSGESUB "Subroutine failed"
68#define COMPUTEPSDC_MSGEARG "Error parsing arguments"
69#define COMPUTEPSDC_MSGEBAD "Bad argument values"
70#define COMPUTEPSDC_MSGEFILE "Could not create output file"
71#define COMPUTEPSDC_MSGENULL "Null Pointer"
72#define COMPUTEPSDC_MSGEMEM "Out of memory"
73
74/*---------- local defines ---------- */
75
76#define TRUE (1==1)
77#define FALSE (1==0)
78
79/* ----- Macros ----- */
80
81/* ---------- local types ---------- */
82
83/** user input variables */
84typedef struct {
85 CHAR *inputData; /**< directory for input sfts */
86 CHAR *outputPSD; /**< directory for output sfts */
88
89 REAL8 Freq; /**< *physical* start frequency to compute PSD for (excluding rngmed wings) */
90 REAL8 FreqBand; /**< *physical* frequency band to compute PSD for (excluding rngmed wings) */
91
92 REAL8 startTime; /**< earliest SFT-timestamp to include */
93 REAL8 endTime; /**< last SFT-timestamp to include */
94 CHAR *IFO;
97 INT4 blocksRngMed; /**< number of running-median bins to use */
99
100 INT4 PSDmthopSFTs; /**< for PSD, type of math. operation over SFTs */
101 INT4 PSDmthopIFOs; /**< for PSD, type of math. operation over IFOs */
102 BOOLEAN PSDnormByTotalNumSFTs; /**< apply normalization factor from total number of SFTs over all IFOs */
103
104 BOOLEAN outputNormSFT; /**< output normalised SFT power? */
105 INT4 nSFTmthopSFTs; /**< for norm. SFT, type of math. operation over SFTs */
106 INT4 nSFTmthopIFOs; /**< for norm. SFT, type of math. operation over IFOs */
107
108 REAL8 binSizeHz; /**< output PSD bin size in Hz */
109 INT4 binSize; /**< output PSD bin size in no. of bins */
110 INT4 PSDmthopBins; /**< for PSD, type of math. operation over bins */
111 INT4 nSFTmthopBins; /**< for norm. SFT, type of math. operation over bins */
112 REAL8 binStepHz; /**< output PSD bin step in Hz */
113 INT4 binStep; /**< output PSD bin step in no. of bins */
114 BOOLEAN outFreqBinEnd; /**< output the end frequency of each bin? */
115
116 BOOLEAN dumpMultiPSDVector; /**< output multi-PSD vector over IFOs, timestamps, and frequencies into file(s) */
117 CHAR *outputQ; /**< output the 'data-quality factor' Q(f) into this file */
118
119 REAL8 fStart; /**< Start Frequency to load from SFT and compute PSD, including wings (it is RECOMMENDED to use --Freq instead) */
120 REAL8 fBand; /**< Frequency Band to load from SFT and compute PSD, including wings (it is RECOMMENDED to use --FreqBand instead) */
121
123
124/**
125 * Config variables 'derived' from user-input
126 */
127typedef struct {
128 REAL8 FreqMin; /**< frequency of first PSD bin for output */
129 REAL8 FreqBand; /**< width of frequency band for output */
130 LALSeg dataSegment; /**< the data-segment for which PSD was computed */
132
133/* ---------- global variables ----------*/
134extern int vrbflg;
135
136/* ---------- local prototypes ---------- */
137int initUserVars( int argc, char *argv[], UserVariables_t *uvar );
138void LALfwriteSpectrograms( LALStatus *status, const CHAR *bname, const MultiPSDVector *multiPSD );
140
141int XLALWriteREAL8FrequencySeries_to_file( const REAL8FrequencySeries *series, const char *fname );
142
143/*============================================================
144 * FUNCTION definitions
145 *============================================================*/
146int
147main( int argc, char *argv[] )
148{
149 static LALStatus status; /* LALStatus pointer */
152
153 vrbflg = 1; /* verbose error-messages */
154
155 /* set LAL error-handler */
157
158 /* register and read user variables */
159 if ( initUserVars( argc, argv, &uvar ) != XLAL_SUCCESS ) {
160 return EXIT_FAILURE;
161 }
162
163 MultiSFTVector *inputSFTs = NULL;
164 if ( ( inputSFTs = XLALReadSFTs( &cfg, &uvar ) ) == NULL ) {
165 XLALPrintError( "Call to XLALReadSFTs() failed with xlalErrno = %d\n", xlalErrno );
166 return EXIT_FAILURE;
167 }
168
169 /* clean sfts if required */
170 if ( XLALUserVarWasSet( &uvar.linefiles ) ) {
171 RandomParams *randPar = NULL;
172 FILE *fpRand = NULL;
173 INT4 seed, ranCount;
174
175 if ( ( fpRand = fopen( "/dev/urandom", "r" ) ) == NULL ) {
176 fprintf( stderr, "Error in opening /dev/urandom" );
177 return EXIT_FAILURE;
178 }
179
180 if ( ( ranCount = fread( &seed, sizeof( seed ), 1, fpRand ) ) != 1 ) {
181 fprintf( stderr, "Error in getting random seed" );
182 return EXIT_FAILURE;
183 }
184
185 LAL_CALL( LALCreateRandomParams( &status, &randPar, seed ), &status );
186
187 LAL_CALL( LALRemoveKnownLinesInMultiSFTVector( &status, inputSFTs, uvar.maxBinsClean, uvar.blocksRngMed, uvar.linefiles, randPar ), &status );
188 LAL_CALL( LALDestroyRandomParams( &status, &randPar ), &status );
189 fclose( fpRand );
190 } /* end cleaning */
191
192 /* call the main loop function; output vectors will be allocated inside
193 * NOTE: inputSFTs will be normalized in place for efficiency reasons
194 */
195 REAL8Vector *finalPSD = NULL;
196 MultiPSDVector *multiPSDVector = NULL;
197 REAL8Vector *normSFT = NULL;
198 BOOLEAN returnMultiPSDVector = ( uvar.outputSpectBname || uvar.dumpMultiPSDVector || uvar.outputQ );
200 &multiPSDVector,
201 &normSFT,
202 inputSFTs,
203 returnMultiPSDVector,
204 uvar.outputNormSFT,
205 uvar.blocksRngMed,
206 uvar.PSDmthopSFTs,
207 uvar.PSDmthopIFOs,
208 uvar.nSFTmthopSFTs,
209 uvar.nSFTmthopIFOs,
210 uvar.PSDnormByTotalNumSFTs,
211 cfg.FreqMin,
212 cfg.FreqBand,
213 TRUE // normalizeSFTsInPlace
214 ) == XLAL_SUCCESS, XLAL_EFUNC );
215
216 /* output spectrograms */
217 if ( uvar.outputSpectBname ) {
218 LAL_CALL( LALfwriteSpectrograms( &status, uvar.outputSpectBname, multiPSDVector ), &status );
219 }
220
221 /* ---------- if user requested it, output complete MultiPSDVector over IFOs X, timestamps and freq-bins into ASCI file(s) */
222 if ( uvar.dumpMultiPSDVector ) {
223 if ( XLALDumpMultiPSDVector( uvar.outputPSD, multiPSDVector ) != XLAL_SUCCESS ) {
224 XLALPrintError( "%s: XLALDumpMultiPSDVector() failed, xlalErrnor = %d\n", __func__, xlalErrno );
225 return EXIT_FAILURE;
226 }
227 } /* if uvar.dumpMultiPSDVector */
228
229 /* ----- if requested, compute data-quality factor 'Q' -------------------- */
230 if ( uvar.outputQ ) {
232 if ( ( Q = XLALComputeSegmentDataQ( multiPSDVector, cfg.dataSegment ) ) == NULL ) {
233 XLALPrintError( "%s: XLALComputeSegmentDataQ() failed with xlalErrno = %d\n", __func__, xlalErrno );
234 return EXIT_FAILURE;
235 }
236 if ( XLAL_SUCCESS != XLALWriteREAL8FrequencySeries_to_file( Q, uvar.outputQ ) ) {
237 return EXIT_FAILURE;
238 }
240 } /* if outputQ */
241
242 /* ---------- BINNING if requested ---------- */
243 /* start frequency and frequency spacing */
244 REAL8 Freq0 = inputSFTs->data[0]->data[0].f0;
245 REAL8 dFreq = inputSFTs->data[0]->data[0].deltaF;
246 /* work out bin size */
247 UINT4 finalBinSize;
248 if ( XLALUserVarWasSet( &uvar.binSize ) ) {
249 finalBinSize = uvar.binSize;
250 } else if ( XLALUserVarWasSet( &uvar.binSizeHz ) ) {
251 finalBinSize = ( UINT4 )floor( uvar.binSizeHz / dFreq + 0.5 ); /* round to nearest bin */
252 } else {
253 finalBinSize = 1;
254 }
255
256 /* work out bin step */
257 UINT4 finalBinStep;
258 if ( XLALUserVarWasSet( &uvar.binStep ) ) {
259 finalBinStep = uvar.binStep;
260 } else if ( XLALUserVarWasSet( &uvar.binStepHz ) ) {
261 finalBinStep = ( UINT4 )floor( uvar.binStepHz / dFreq + 0.5 ); /* round to nearest bin */
262 } else {
263 finalBinStep = finalBinSize;
264 }
265
266 /* write final PSD to file */
267 if ( XLALUserVarWasSet( &uvar.outputPSD ) ) {
268 LogPrintf( LOG_DEBUG, "Printing PSD to file ...\n" );
269 FILE *fpOut = NULL;
270 XLAL_CHECK_MAIN( ( fpOut = fopen( uvar.outputPSD, "wb" ) ) != NULL, XLAL_EIO, "Unable to open output file %s for writing", uvar.outputPSD );
272 for ( int a = 0; a < argc; a++ ) { /* write the command-line */
273 fprintf( fpOut, "%%%% argv[%d]: '%s'\n", a, argv[a] );
274 }
275 XLAL_CHECK_MAIN( XLALWritePSDtoFilePointer( fpOut, finalPSD, normSFT, uvar.outputNormSFT, uvar.outFreqBinEnd, uvar.PSDmthopBins, uvar.nSFTmthopBins, finalBinSize, finalBinStep, Freq0, dFreq ) == XLAL_SUCCESS, XLAL_EFUNC );
276 LogPrintfVerbatim( LOG_DEBUG, "done.\n" );
277 fclose( fpOut );
278 }
279
280 /* we are now done with the psd */
281 if ( returnMultiPSDVector ) {
282 XLALDestroyMultiPSDVector( multiPSDVector );
283 }
284 XLALDestroyMultiSFTVector( inputSFTs );
285 XLALDestroyREAL8Vector( finalPSD );
286 XLALDestroyREAL8Vector( normSFT );
287
289
291
292 return EXIT_SUCCESS;
293
294} /* main() */
295
296
297/** register all "user-variables" */
298int
299initUserVars( int argc, char *argv[], UserVariables_t *uvar )
300{
301
302 /* set a few defaults */
303 uvar->maxBinsClean = 100;
304 uvar->blocksRngMed = 101;
305
306 uvar->startTime = 0.0;
307 uvar->endTime = 0.0;
308
309 uvar->inputData = NULL;
310
311 uvar->IFO = NULL;
312
313 /* default: read all SFT bins */
314 uvar->fStart = -1;
315 uvar->fBand = 0;
316
317 uvar->outputPSD = NULL;
318 uvar->outputNormSFT = FALSE;
319 uvar->outFreqBinEnd = FALSE;
320
324
325 uvar->nSFTmthopSFTs = -1;
326 uvar->nSFTmthopIFOs = -1;
327
329
330 uvar->binSizeHz = 0.0;
331 uvar->binSize = 1;
334 uvar->binStep = 0.0;
335 uvar->binStep = 1;
336
337 /* register user input variables */
338 XLALRegisterUvarMember( inputData, STRING, 'i', REQUIRED, "Input SFT pattern. Possibilities are:\n"
339 " - '<SFT file>;<SFT file>;...', where <SFT file> may contain wildcards\n - 'list:<file containing list of SFT files>'" );
340 XLALRegisterUvarMember( outputPSD, STRING, 'o', OPTIONAL, "Output PSD into this file" );
341 XLALRegisterUvarMember( outputQ, STRING, 0, OPTIONAL, "Output the 'data-quality factor' Q(f) into this file" );
342 XLALRegisterUvarMember( outputSpectBname, STRING, 0, OPTIONAL, "Filename-base for (binary) spectrograms (one per IFO)" );
343
344 XLALRegisterUvarMember( Freq, REAL8, 0, OPTIONAL, "physical start frequency to compute PSD for (excluding rngmed wings)" );
345 XLALRegisterUvarMember( FreqBand, REAL8, 0, OPTIONAL, "physical frequency band to compute PSD for (excluding rngmed wings)" );
346
347 XLALRegisterUvarMember( startTime, REAL8, 's', OPTIONAL, "SFT timestamps must be >= this GPS timestamp" );
348 XLALRegisterUvarMember( endTime, REAL8, 'e', OPTIONAL, "SFT timestamps must be < this GPS timestamp" );
349 XLALRegisterUvarMember( timeStampsFile, STRING, 't', OPTIONAL, "Time-stamps file" );
350 XLALRegisterUvarMember( IFO, STRING, 0, OPTIONAL, "Detector filter" );
351
352 XLALRegisterUvarMember( blocksRngMed, INT4, 'w', OPTIONAL, "Running Median window size" );
353
354 XLALRegisterUvarAuxDataMember( PSDmthopSFTs, UserEnum, &MathOpTypeChoices, 'S', OPTIONAL,
355 "For PSD, type of math. operation over SFTs, can be given by string names:\n"
356 " operation name | mathematical description | obsolete option value\n"
357 " --------------- | ------------------------------------- | ---------------------\n"
358 " arithmean | sum(data) / length | 1 \n"
359 " arithmedian | middle element of sorted data | 2 \n"
360 " arithsum | sum(data) | 0 \n"
361 " harmmean | length / sum(1 / data) | 4 \n"
362 " harmsum | 1 / sum(1 / data) | 3 \n"
363 " max | last element of sorted data | 8 \n"
364 " min | first element of sorted data | 7 \n"
365 " powerminus2mean | sqrt(length / sum(1 / (data * data))) | 6 \n"
366 " powerminus2sum | sqrt(1 / sum(1 / (data * data))) | 5 \n"
367 );
368
369 XLALRegisterUvarAuxDataMember( PSDmthopIFOs, UserEnum, &MathOpTypeChoices, 'I', OPTIONAL, "For PSD, type of math. op. over IFOs: "
370 "see --PSDmthopSFTs" );
371 XLALRegisterUvarMember( PSDnormByTotalNumSFTs, BOOLEAN, 'T', OPTIONAL, "For harmsum/powerminus2sum, apply normalization factor from total number of SFTs over all IFOs (mimics harmmean/powerminus2mean over a combined set of all SFTs)" );
372
373 XLALRegisterUvarMember( outputNormSFT, BOOLEAN, 'n', OPTIONAL, "Output normalised SFT power to PSD file" );
374 XLALRegisterUvarAuxDataMember( nSFTmthopSFTs, UserEnum, &MathOpTypeChoices, 'N', NODEFAULT, "For norm. SFT, type of math. op. over SFTs: "
375 "see --PSDmthopSFTs" );
376 XLALRegisterUvarAuxDataMember( nSFTmthopIFOs, UserEnum, &MathOpTypeChoices, 'J', NODEFAULT, "For norm. SFT, type of math. op. over IFOs: "
377 "see --PSDmthopSFTs" );
378
379 XLALRegisterUvarMember( binSize, INT4, 'z', OPTIONAL, "Bin the output into bins of size (in number of bins)" );
380 XLALRegisterUvarMember( binSizeHz, REAL8, 'Z', OPTIONAL, "Bin the output into bins of size (in Hz)" );
381 XLALRegisterUvarAuxDataMember( PSDmthopBins, UserEnum, &MathOpTypeChoices, 'A', OPTIONAL, "If binning, for PSD type of math. op. over bins: "
382 "see --PSDmthopSFTs" );
383 XLALRegisterUvarAuxDataMember( nSFTmthopBins, UserEnum, &MathOpTypeChoices, 'B', OPTIONAL, "If binning, for norm. SFT type of math. op. over bins: "
384 "see --PSDmthopSFTs" );
385 XLALRegisterUvarMember( binStep, INT4, 'p', OPTIONAL, "If binning, step size to move bin along "
386 "(in number of bins, default is bin size)" );
387 XLALRegisterUvarMember( binStepHz, REAL8, 'P', OPTIONAL, "If binning, step size to move bin along "
388 "(in Hz, default is bin size)" );
389 XLALRegisterUvarMember( outFreqBinEnd, BOOLEAN, 'E', OPTIONAL, "Output the end frequency of each bin" );
390
391 XLALRegisterUvarMember( maxBinsClean, INT4, 'm', OPTIONAL, "Maximum Cleaning Bins" );
392 XLALRegisterUvarMember( linefiles, STRINGVector, 0, OPTIONAL, "Comma separated list of linefiles "
393 "(names must contain IFO name)" );
394
395 XLALRegisterUvarMember( dumpMultiPSDVector, BOOLEAN, 'd', OPTIONAL, "Output multi-PSD vector over IFOs, timestamps, and frequencies into file(s) '<outputPSD>-IFO'" );
396
397 /* ----- developer options ---------- */
398 XLALRegisterUvarMember( fStart, REAL8, 'f', DEVELOPER, "Start Frequency to load from SFT and compute PSD, including rngmed wings (BETTER: use --Freq instead)" );
399 XLALRegisterUvarMember( fBand, REAL8, 'b', DEVELOPER, "Frequency Band to load from SFT and compute PSD, including rngmed wings (BETTER: use --FreqBand instead)" );
400
401
402 /* read all command line variables */
403 BOOLEAN should_exit = 0;
405 if ( should_exit ) {
406 exit( 1 );
407 }
408
409 /* check user-input consistency */
410 if ( UVAR_ANYSET3( PSDmthopSFTs, PSDmthopIFOs, PSDnormByTotalNumSFTs ) && !UVAR_ALLSET3( PSDmthopSFTs, PSDmthopIFOs, PSDnormByTotalNumSFTs ) ) {
411 XLALPrintError( "ERROR: --PSDmthopSFTs(-S), --PSDmthopIFOs(-I), and --PSDnormByTotalNumSFTs(-T) must all be set\n" );
412 return XLAL_FAILURE;
413 }
414 if ( uvar->PSDnormByTotalNumSFTs && !( ( uvar->PSDmthopSFTs == MATH_OP_HARMONIC_SUM || uvar->PSDmthopSFTs == MATH_OP_POWERMINUS2_SUM ) && uvar->PSDmthopIFOs == uvar->PSDmthopSFTs ) ) {
415 const char *PSDmthopSFTs_str = "???";
416 const char *PSDmthopIFOs_str = "???";
417 for ( size_t i = 0; i < MATH_OP_LAST; ++i ) {
418 if ( MathOpTypeChoices[i].val == uvar->PSDmthopSFTs ) {
419 PSDmthopSFTs_str = MathOpTypeChoices[i].name;
420 }
421 if ( MathOpTypeChoices[i].val == uvar->PSDmthopIFOs ) {
422 PSDmthopIFOs_str = MathOpTypeChoices[i].name;
423 }
424 }
425 XLALPrintError( "ERROR: invalid values for --PSDmthopSFTs(-S)=%s, --PSDmthopIFOs(-I)=%s when --PSDnormByTotalNumSFTs(-T) is true\n", PSDmthopSFTs_str, PSDmthopIFOs_str );
426 return XLAL_FAILURE;
427 }
428 if ( uvar->outputNormSFT && !UVAR_ALLSET2( nSFTmthopSFTs, nSFTmthopIFOs ) ) {
429 XLALPrintError( "ERROR: --nSFTmthopSFTs(-N), --nSFTmthopIFOs(-J) must all be set if --outputNormSFT(-n) is true\n" );
430 return XLAL_FAILURE;
431 }
432 if ( XLALUserVarWasSet( &( uvar->binSize ) ) && XLALUserVarWasSet( &( uvar->binSizeHz ) ) ) {
433 XLALPrintError( "ERROR: --binSize(-z) and --binSizeHz(-Z) are mutually exclusive\n" );
434 return XLAL_FAILURE;
435 }
436 if ( XLALUserVarWasSet( &( uvar->binSize ) ) && uvar->binSize <= 0 ) {
437 XLALPrintError( "ERROR: --binSize(-z) must be strictly positive\n" );
438 return XLAL_FAILURE;
439 }
440 if ( XLALUserVarWasSet( &( uvar->binSizeHz ) ) && uvar->binSizeHz <= 0.0 ) {
441 XLALPrintError( "ERROR: --binSizeHz(-Z) must be strictly positive\n" );
442 return XLAL_FAILURE;
443 }
444 if ( XLALUserVarWasSet( &( uvar->binStep ) ) && XLALUserVarWasSet( &( uvar->binStepHz ) ) ) {
445 XLALPrintError( "ERROR: --binStep(-p) and --binStepHz(-P) are mutually exclusive\n" );
446 return XLAL_FAILURE;
447 }
448 if ( XLALUserVarWasSet( &( uvar->binStep ) ) && uvar->binStep <= 0 ) {
449 XLALPrintError( "ERROR: --binStep(-p) must be strictly positive\n" );
450 return XLAL_FAILURE;
451 }
452 if ( XLALUserVarWasSet( &( uvar->binStepHz ) ) && uvar->binStepHz <= 0.0 ) {
453 XLALPrintError( "ERROR: --binStepHz(-P) must be strictly positive\n" );
454 return XLAL_FAILURE;
455 }
456 BOOLEAN have_fStart = XLALUserVarWasSet( &uvar->fStart );
457 BOOLEAN have_Freq = XLALUserVarWasSet( &uvar->Freq );
458 BOOLEAN have_fBand = XLALUserVarWasSet( &uvar->fBand );
459 BOOLEAN have_FreqBand = XLALUserVarWasSet( &uvar->FreqBand );
460 XLAL_CHECK( !( have_fStart && have_Freq ), XLAL_EINVAL, "use only one of --fStart OR --Freq (see --help)" );
461 XLAL_CHECK( !( have_fBand && have_FreqBand ), XLAL_EINVAL, "use only one of --fBand OR --FreqBand (see --help)" );
462 XLAL_CHECK( !( ( have_fStart && have_FreqBand ) || ( have_Freq && have_fBand ) ), XLAL_EINVAL, "don't mix {--fStart,--fBand} with {--Freq,--FreqBand} inputs (see --help)" );
463
464 return XLAL_SUCCESS;
465
466} /* initUserVars() */
467
468
469/**
470 * Write a multi-PSD into spectrograms for each IFO.
471 * Using gnuplot 'binary' matrix format
472 * The filename for each IFO is generated as 'bname-IFO'
473 */
474void
475LALfwriteSpectrograms( LALStatus *status, const CHAR *bname, const MultiPSDVector *multiPSD )
476{
477 CHAR *fname;
478 float num, *row_data; /* cast to float for writing (gnuplot binary format) */
479 FILE *fp;
480
483
484 if ( !bname || !multiPSD || multiPSD->length == 0 ) {
486 }
487
488 /* loop over IFOs */
489 for ( UINT4 X = 0; X < multiPSD->length ; X ++ ) {
490 UINT4 len = strlen( bname ) + 4; /* append '-XN' to get IFO-specific filename */
491 const CHAR *tmp;
492 REAL8 f0, df;
493
494 UINT4 numSFTs = multiPSD->data[X]->length;
495 UINT4 numBins = multiPSD->data[X]->data[0].data->length;
496
497 /* allocate memory for data row-vector */
498 if ( ( row_data = LALMalloc( numBins * sizeof( float ) ) ) == NULL ) {
500 }
501
502 if ( ( fname = LALMalloc( len * sizeof( CHAR ) ) ) == NULL ) {
503 LALFree( row_data );
505 }
506 tmp = multiPSD->data[X]->data[0].name;
507 sprintf( fname, "%s-%c%c", bname, tmp[0], tmp[1] );
508
509 if ( ( fp = fopen( fname, "wb" ) ) == NULL ) {
510 LogPrintf( LOG_CRITICAL, "Failed to open spectrogram file '%s' for writing!\n", fname );
511 goto failed;
512 }
513
514 /* write number of columns: i.e. frequency-bins */
515 num = ( float )numBins;
516 if ( ( fwrite( ( char * ) &num, sizeof( float ), 1, fp ) ) != 1 ) {
517 LogPrintf( LOG_CRITICAL, "Failed to fwrite() to spectrogram file '%s'\n", fname );
518 goto failed;
519 }
520
521 /* write frequencies as column-titles */
522 f0 = multiPSD->data[X]->data[0].f0;
523 df = multiPSD->data[X]->data[0].deltaF;
524 for ( UINT4 k = 0; k < numBins; k ++ ) {
525 row_data[k] = ( float )( f0 + 1.0 * k * df );
526 }
527 if ( fwrite( ( char * ) row_data, sizeof( float ), numBins, fp ) != numBins ) {
528 LogPrintf( LOG_CRITICAL, "Failed to fwrite() to spectrogram file '%s'\n", fname );
529 goto failed;
530 }
531
532 /* write PSDs of successive SFTs in rows, first column is GPS-time in seconds */
533 for ( UINT4 j = 0; j < numSFTs ; j ++ ) {
534 num = ( float ) multiPSD->data[X]->data[j].epoch.gpsSeconds;
535 for ( UINT4 k = 0; k < numBins; k ++ ) {
536 row_data[k] = ( float ) sqrt( multiPSD->data[X]->data[j].data->data[k] );
537 }
538
539 if ( ( fwrite( ( char * ) &num, sizeof( float ), 1, fp ) != 1 ) ||
540 ( fwrite( ( char * ) row_data, sizeof( float ), numBins, fp ) != numBins ) ) {
541 LogPrintf( LOG_CRITICAL, "Failed to fwrite() to spectrogram file '%s'\n", fname );
542 goto failed;
543 }
544
545 } /* for j < numSFTs */
546
547 fclose( fp );
548 LALFree( fname );
549 LALFree( row_data );
550
551 } /* for X < numIFOs */
552
554 RETURN( status );
555
556 /* cleanup and exit on write-error */
557failed:
558 if ( fname ) {
559 LALFree( fname );
560 }
561 if ( row_data ) {
562 LALFree( row_data );
563 }
564 if ( fp ) {
565 fclose( fp );
566 }
568
569} /* LALfwriteSpectrograms() */
570
571
572/**
573 * Load all SFTs according to user-input, returns multi-SFT vector.
574 * \return cfg:
575 * Returns 'effective' range of SFT-bins [firstBin, lastBin], which which the PSD will be estimated:
576 * - if the user input {fStart, fBand} then these are loaded from SFTs and directly translated into bins
577 * - if user input {Freq, FreqBand}, we load a wider frequency-band ADDING running-median/2 on either side
578 * from the SFTs, and firstBind, lastBin correspond to {Freq,FreqBand} (rounded to closest bins)
579 * Also returns the 'data-segment' for which SFTs were loaded
580 *
581 */
583XLALReadSFTs( ConfigVariables_t *cfg, /**< [out] return derived configuration info (firstBin, lastBin, segment) */
584 const UserVariables_t *uvar /**< [in] complete user-input */
585 )
586{
587 SFTCatalog *catalog = NULL;
588 SFTConstraints XLAL_INIT_DECL( constraints );
589 LIGOTimeGPS startTimeGPS = {0, 0}, endTimeGPS = {0, 0};
590 LIGOTimeGPSVector *inputTimeStampsVector = NULL;
591
592 /* check input */
593 if ( !uvar || !uvar->inputData ) {
594 XLALPrintError( "%s: invalid NULL input 'uvar' or 'uvar->inputData'\n", __func__ );
596 }
597 if ( !cfg ) {
598 XLALPrintError( "%s: invalid NULL input 'cfg'\n", __func__ );
600 }
601
602 /* set detector constraint */
603 if ( XLALUserVarWasSet( &uvar->IFO ) ) {
604 constraints.detector = uvar->IFO;
605 } else {
606 constraints.detector = NULL;
607 }
608
609 if ( XLALUserVarWasSet( &uvar->startTime ) ) {
610 XLALGPSSetREAL8( &startTimeGPS, uvar->startTime );
611 constraints.minStartTime = &startTimeGPS;
612 }
613
614 if ( XLALUserVarWasSet( &uvar->endTime ) ) {
615 XLALGPSSetREAL8( &endTimeGPS, uvar->endTime );
616 constraints.maxStartTime = &endTimeGPS;
617 }
618
619 if ( XLALUserVarWasSet( &uvar->timeStampsFile ) ) {
620 if ( ( inputTimeStampsVector = XLALReadTimestampsFile( uvar->timeStampsFile ) ) == NULL ) {
622 }
623
624 constraints.timestamps = inputTimeStampsVector;
625 }
626
627 /* get sft catalog */
628 LogPrintf( LOG_DEBUG, "Finding all SFTs to load ... " );
629 if ( ( catalog = XLALSFTdataFind( uvar->inputData, &constraints ) ) == NULL ) {
630 XLALPrintError( "%s: XLALSFTdataFind() failed with xlalErrno = %d\n", __func__, xlalErrno );
632 }
633 if ( ( catalog == NULL ) || ( catalog->length == 0 ) ) {
634 XLALPrintError( "%s: Unable to match any SFTs with pattern '%s'\n", __func__, uvar->inputData );
636 }
637 LogPrintfVerbatim( LOG_DEBUG, "done (found %i SFTs).\n", catalog->length );
638
639 /* now we can free the inputTimeStampsVector */
640 if ( inputTimeStampsVector ) {
641 XLALDestroyTimestampVector( inputTimeStampsVector );
642 }
643
644 /* ---------- figure out the right frequency-band to read from the SFTs, depending on user-input ----- */
645 REAL8 fMin, fMax;
646 if ( XLALUserVarWasSet( &uvar->Freq ) ) {
647 REAL8 dFreq = catalog->data[0].header.deltaF;
648 /* rngmed bin offset from start and end */
649 UINT4 rngmedSideBandBins = uvar->blocksRngMed / 2 + 1; /* truncates down plus add one bin extra safety! */
650 REAL8 rngmedSideBand = rngmedSideBandBins * dFreq;
651 fMin = uvar->Freq - rngmedSideBand;
652 fMax = uvar->Freq + uvar->FreqBand + rngmedSideBand;
653 cfg->FreqMin = uvar->Freq;
654 cfg->FreqBand = uvar->FreqBand;
655 } else {
656 /* if no user-input on freq-band, we fall back to defaults on {fStart, fBand} */
657 /* (no truncation of rngmed sidebands) */
658 fMin = uvar->fStart;
659 fMax = uvar->fStart + uvar->fBand;
660 cfg->FreqMin = uvar->fStart;
661 cfg->FreqBand = uvar->fBand;
662 }
663
664 /* ----- figure out the data-segment span from the user-input and SFT-catalog ----- */
665 /* if used passed these, then 'startTimeGPS' and 'endTimeGPS' are already set */
666 if ( startTimeGPS.gpsSeconds == 0 ) {
667 startTimeGPS = catalog->data[0].header.epoch;
668 }
669 if ( endTimeGPS.gpsSeconds == 0 ) {
670 endTimeGPS = catalog->data[catalog->length - 1].header.epoch;
671 }
672 /* SFT 'constraints' only refer to SFT *start-times*, for segment we need the end-time */
673 REAL8 deltaF = catalog->data[0].header.deltaF;
674 REAL8 Tsft = 1.0 / deltaF;
675 XLALGPSAdd( &endTimeGPS, Tsft );
676
677 /* ---------- read the sfts ---------- */
678 LogPrintf( LOG_DEBUG, "Loading all SFTs over frequency band [%f,%f]...\n", fMin, fMax );
679 MultiSFTVector *multi_sfts;
680 if ( ( multi_sfts = XLALLoadMultiSFTs( catalog, fMin, fMax ) ) == NULL ) {
681 XLALPrintError( "%s: XLALLoadMultiSFTs( %f, %f ) failed with xlalErrno = %d\n", __func__, fMin, fMax, xlalErrno );
683 }
684 XLALDestroySFTCatalog( catalog );
685 LogPrintfVerbatim( LOG_DEBUG, "done.\n" );
686 /* ---------- end loading SFTs ---------- */
687
688 /* return results */
689 cfg->dataSegment.start = startTimeGPS;
690 cfg->dataSegment.end = endTimeGPS;
691
692 UINT4 numBins = multi_sfts->data[0]->data[0].data->length;
693 REAL8 f0sfts = multi_sfts->data[0]->data[0].f0;
694 LogPrintf( LOG_DEBUG, "Loaded SFTs have %d bins, sampled at %fHz, covering frequency band [%f, %f]\n", numBins, deltaF, f0sfts, f0sfts + numBins * deltaF );
695
696 return multi_sfts;
697
698} /* XLALReadSFTs() */
699
700
701/**
702 * Write given REAL8FrequencySeries into file
703 */
704int
705XLALWriteREAL8FrequencySeries_to_file( const REAL8FrequencySeries *series, /**< [in] frequency-series to write to file */
706 const char *fname /**< [in] filename to write into */
707 )
708{
709 /* check input consistency */
710 if ( !series || !fname ) {
711 XLALPrintError( "%s: invalid NULL input.\n", __func__ );
713 }
714
715 FILE *fp;
716 if ( ( fp = fopen( fname, "wb" ) ) == NULL ) {
717 XLALPrintError( "%s: failed to open file '%s' for writing.\n", __func__, fname );
719 }
720
721 /* write header info in comments */
722 if ( XLAL_SUCCESS != XLALOutputVCSInfo( fp, lalPulsarVCSInfoList, 0, "%% " ) ) {
724 }
725
726 fprintf( fp, "%%%% name = '%s'\n", series->name );
727 fprintf( fp, "%%%% epoch = {%d, %d}\n", series->epoch.gpsSeconds, series->epoch.gpsNanoSeconds );
728 fprintf( fp, "%%%% f0 = %f Hz\n", series->f0 );
729 fprintf( fp, "%%%% deltaF = %g Hz\n", series->deltaF );
730
731 CHAR unitStr[1024];
732 if ( XLALUnitAsString( &unitStr[0], sizeof( unitStr ) - 1, &series->sampleUnits ) == NULL ) {
733 XLALPrintError( "%s: XLALUnitAsString() failed with xlalErrno = %d.\n", __func__, xlalErrno );
735 }
736 fprintf( fp, "%%%% Units = %s\n", unitStr );
737
738 fprintf( fp, "%%%% Freq [Hz] Data(Freq)\n" );
739 UINT4 numBins = series->data->length;
740 for ( UINT4 iFreq = 0; iFreq < numBins; iFreq ++ ) {
741 REAL8 thisFreq = series->f0 + iFreq * series->deltaF;
742 fprintf( fp, "%20.16f %20.16g\n", thisFreq, series->data->data[iFreq] );
743 }
744
745 fclose( fp );
746
747 return XLAL_SUCCESS;
748
749} /* XLALWriteREAL8FrequencySeries_to_file() */
int main(int argc, char *argv[])
Definition: ComputePSD.c:147
MultiSFTVector * XLALReadSFTs(ConfigVariables_t *cfg, const UserVariables_t *uvar)
Load all SFTs according to user-input, returns multi-SFT vector.
Definition: ComputePSD.c:583
#define COMPUTEPSDC_EFILE
Definition: ComputePSD.c:62
int initUserVars(int argc, char *argv[], UserVariables_t *uvar)
register all "user-variables"
Definition: ComputePSD.c:299
#define COMPUTEPSDC_EMEM
Definition: ComputePSD.c:64
int XLALWriteREAL8FrequencySeries_to_file(const REAL8FrequencySeries *series, const char *fname)
Write given REAL8FrequencySeries into file.
Definition: ComputePSD.c:705
int vrbflg
defined in lal/lib/std/LALError.c
#define TRUE
Definition: ComputePSD.c:76
#define FALSE
Definition: ComputePSD.c:77
#define COMPUTEPSDC_MSGEFILE
Definition: ComputePSD.c:70
#define COMPUTEPSDC_ENULL
Definition: ComputePSD.c:63
#define COMPUTEPSDC_MSGENULL
Definition: ComputePSD.c:71
#define COMPUTEPSDC_MSGEMEM
Definition: ComputePSD.c:72
void LALfwriteSpectrograms(LALStatus *status, const CHAR *bname, const MultiPSDVector *multiPSD)
Write a multi-PSD into spectrograms for each IFO.
Definition: ComputePSD.c:475
#define __func__
log an I/O error, i.e.
#define IFO
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 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 ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
#define STRING(a)
#define fprintf
const double Q
void XLALDestroyREAL8FrequencySeries(REAL8FrequencySeries *series)
unsigned char BOOLEAN
double REAL8
#define XLAL_INIT_DECL(var,...)
char CHAR
uint32_t UINT4
int32_t INT4
int XLALOutputVCSInfo(FILE *fp, const LALVCSInfoList vcs_list, const int verbose, const char *prefix)
void void LogPrintfVerbatim(LogLevel_t, const char *format,...) _LAL_GCC_PRINTF_FORMAT_(2
void LogPrintf(LogLevel_t, const char *format,...) _LAL_GCC_PRINTF_FORMAT_(2
LOG_CRITICAL
LOG_DEBUG
int XLALDumpMultiPSDVector(const CHAR *outbname, const MultiPSDVector *multiPSDVect)
Dump complete multi-PSDVector over IFOs, timestamps and frequency-bins into per-IFO ASCII output-file...
Definition: PSDutils.c:963
int XLALWritePSDtoFilePointer(FILE *fpOut, REAL8Vector *PSDVect, REAL8Vector *normSFTVect, BOOLEAN outputNormSFT, BOOLEAN outFreqBinEnd, INT4 PSDmthopBins, INT4 nSFTmthopBins, INT4 binSize, INT4 binStep, REAL8 Freq0, REAL8 dFreq)
Write a PSD vector as an ASCII table to an open output file pointer.
Definition: PSDutils.c:1083
const UserChoices MathOpTypeChoices
Definition: PSDutils.c:41
void XLALDestroyMultiPSDVector(MultiPSDVector *multvect)
Destroy a multi PSD-vector.
Definition: PSDutils.c:102
int XLALComputePSDandNormSFTPower(REAL8Vector **finalPSD, MultiPSDVector **multiPSDVector, REAL8Vector **normSFT, MultiSFTVector *inputSFTs, const BOOLEAN returnMultiPSDVector, const BOOLEAN returnNormSFT, const UINT4 blocksRngMed, const MathOpType PSDmthopSFTs, const MathOpType PSDmthopIFOs, const MathOpType nSFTmthopSFTs, const MathOpType nSFTmthopIFOs, const BOOLEAN PSDnormByTotalNumSFTs, const REAL8 FreqMin, const REAL8 FreqBand, const BOOLEAN normalizeSFTsInPlace)
Compute the PSD (power spectral density) and the "normalized power" over a MultiSFTVector.
Definition: PSDutils.c:703
REAL8FrequencySeries * XLALComputeSegmentDataQ(const MultiPSDVector *multiPSDVect, LALSeg segment)
Compute the "data-quality factor" over the given SFTs.
Definition: PSDutils.c:375
@ MATH_OP_HARMONIC_SUM
Definition: PSDutils.h:86
@ MATH_OP_POWERMINUS2_SUM
Definition: PSDutils.h:88
@ MATH_OP_MAXIMUM
Definition: PSDutils.h:91
@ MATH_OP_LAST
Definition: PSDutils.h:92
@ MATH_OP_ARITHMETIC_MEDIAN
Definition: PSDutils.h:85
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
char * XLALUnitAsString(char *string, UINT4 length, const LALUnit *input)
#define UVAR_ANYSET3(n1, n2, n3)
int XLALUserVarReadAllInput(BOOLEAN *should_exit, int argc, char *argv[], const LALVCSInfoList vcs_list)
void XLALDestroyUserVars(void)
#define UVAR_ALLSET2(n1, n2)
#define XLALRegisterUvarMember(name, type, option, category,...)
#define UVAR_ALLSET3(n1, n2, n3)
int XLALUserVarWasSet(const void *cvar)
#define XLALRegisterUvarAuxDataMember(name, type, cdata, option, category,...)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
#define XLAL_ERROR_NULL(...)
#define xlalErrno
#define XLAL_ERROR(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_MAIN(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
XLAL_SUCCESS
XLAL_EFUNC
XLAL_EIO
XLAL_ESYS
XLAL_EINVAL
XLAL_EFAILED
XLAL_FAILURE
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
int deltaF
fStart
COMPLEX8Sequence * data
COMPLEX8FrequencySeries * data
Pointer to the data array.
Config variables 'derived' from user-input.
Definition: ComputePSD.c:127
LALSeg dataSegment
the data-segment for which PSD was computed
Definition: ComputePSD.c:130
REAL8 FreqMin
frequency of first PSD bin for output
Definition: ComputePSD.c:128
REAL8 FreqBand
width of frequency band for output
Definition: ComputePSD.c:129
LIGOTimeGPS end
LIGOTimeGPS start
INT4 gpsNanoSeconds
A vector of 'timestamps' of type LIGOTimeGPS.
Definition: SFTfileIO.h:188
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
UINT4 length
number of ifos
Definition: PSDutils.h:66
A collection of SFT vectors – one for each IFO in a multi-IFO search.
Definition: SFTfileIO.h:179
SFTVector ** data
sftvector for each ifo
Definition: SFTfileIO.h:184
REAL8Sequence * data
CHAR name[LALNameLength]
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
SFTtype header
SFT-header info.
Definition: SFTfileIO.h:228
const char * name
user input variables
Definition: compareFstats.c:51
INT4 PSDmthopSFTs
for PSD, type of math.
Definition: ComputePSD.c:100
INT4 binSize
output PSD bin size in no.
Definition: ComputePSD.c:109
BOOLEAN PSDnormByTotalNumSFTs
apply normalization factor from total number of SFTs over all IFOs
Definition: ComputePSD.c:102
REAL8 endTime
last SFT-timestamp to include
Definition: ComputePSD.c:93
INT4 blocksRngMed
number of running-median bins to use
Definition: ComputePSD.c:97
CHAR * outputSpectBname
Definition: ComputePSD.c:87
REAL8 binStepHz
output PSD bin step in Hz
Definition: ComputePSD.c:112
INT4 nSFTmthopIFOs
for norm.
Definition: ComputePSD.c:106
LALStringVector * linefiles
Definition: ComputePSD.c:96
INT4 PSDmthopBins
for PSD, type of math.
Definition: ComputePSD.c:110
REAL8 startTime
earliest SFT-timestamp to include
Definition: ComputePSD.c:92
BOOLEAN outputNormSFT
output normalised SFT power?
Definition: ComputePSD.c:104
REAL8 fStart
Start Frequency to load from SFT and compute PSD, including wings (it is RECOMMENDED to use –Freq ins...
Definition: ComputePSD.c:119
CHAR * outputQ
output the 'data-quality factor' Q(f) into this file
Definition: ComputePSD.c:117
REAL8 binSizeHz
output PSD bin size in Hz
Definition: ComputePSD.c:108
BOOLEAN outFreqBinEnd
output the end frequency of each bin?
Definition: ComputePSD.c:114
REAL8 Freq
physical start frequency to compute PSD for (excluding rngmed wings)
LIGOTimeGPS startTime
Start-time of requested signal in detector-frame (GPS seconds)
CHAR * timeStampsFile
Definition: ComputePSD.c:95
BOOLEAN dumpMultiPSDVector
output multi-PSD vector over IFOs, timestamps, and frequencies into file(s)
Definition: ComputePSD.c:116
INT4 binStep
output PSD bin step in no.
Definition: ComputePSD.c:113
INT4 nSFTmthopBins
for norm.
Definition: ComputePSD.c:111
CHAR * inputData
directory for input sfts
Definition: ComputePSD.c:85
CHAR * outputPSD
directory for output sfts
Definition: ComputePSD.c:86
INT4 PSDmthopIFOs
for PSD, type of math.
Definition: ComputePSD.c:101
REAL8 FreqBand
physical frequency band to compute PSD for (excluding rngmed wings)
Definition: ComputePSD.c:90
REAL8 fBand
Frequency Band to load from SFT and compute PSD, including wings (it is RECOMMENDED to use –FreqBand ...
Definition: ComputePSD.c:120
INT4 nSFTmthopSFTs
for norm.
Definition: ComputePSD.c:105
CHAR * IFO
Detector: H1, L1, H2, V1, ...
double df