LALPulsar  6.1.0.1-b72065a
SFDBfileIO.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Rodrigo Tenorio
3  * Copyright (C) 2020 Pep Covas
4  * Copyright (C) 2019, 2020 David Keitel
5  * Copyright (C) 2014, 2022 Karl Wette
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with with program; see the file COPYING. If not, write to the
19  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  * MA 02110-1301 USA
21  */
22 
23 /*---------- includes ----------*/
24 
25 #include "SFTinternal.h"
26 
27 /*---------- constants ----------*/
28 
29 /* detector numbers as defined in Rome SFDBs
30  * 0 is Nautilus but we won't support that
31  */
32 typedef enum tagSFDBDetectors {
39 
40 const char *const SFDB_detector_names[] = {
41  [SFDB_DET_V1] = "V1",
42  [SFDB_DET_H1] = "H1",
43  [SFDB_DET_L1] = "L1"
44 };
45 
46 /*---------- internal types ----------*/
47 
48 /* header contents of SFDBs, many fields unused
49  */
50 typedef struct tagSFDBHeader {
51  INT4 det; // Index of the detector (0=V1, 1=H1, 2=L1)
52  INT4 gps_sec; // GPS time of this SFDB
54  REAL8 tbase; // Coherent time of the SFDB
56  INT4 nsamples; // Number of frequency bins
57  INT4 red; // Reduction factor
60  REAL4 einstein; // Normalization factor to get back to 10^{-20} units
62  INT4 nfft; // Number of FFTs in a SFDB
64  REAL4 normd; // Normalization factor
65  REAL4 normw; // Window normalization factor
66  REAL8 frinit; // Initial frequency
67  REAL8 tsamplu; // Sampling time
68  REAL8 deltanu; // Frequency resolution
69  REAL8 vx_eq; // Velocity vector of the detector at this GPS time
72  REAL8 px_eq; // Position vector of the detector at this GPS time
78 } SFDBHeader;
79 
80 /*---------- internal prototypes ----------*/
81 
82 static int read_SFDB_header_from_fp( FILE *fp, SFDBHeader *header );
84 
85 /*========== function definitions ==========*/
86 
87 /// \addtogroup SFTfileIO_h
88 /// @{
89 
90 /**
91  * Return a MultiSFTVector struct from an input set of SFDBs, possibly from more than one detector.
92  *
93  * An SFDB (Short Fourier DataBase) is the frequency-domain data format created by the Rome group. It has a time-domain cleaning, which is described in \cite Astone2014.
94  *
95  * In order to only use SFDBs within science segments, it is possible to input files for each detector which have the science segments. Two files for each detector are needed, one with the starting timestamps and the other with the ending timestamps. The format for these files is one timestamp per line. If not needed, the timestamp inputs can be NULL.
96  *
97  * The returned SFTs in the standard LALSuite format are sorted by increasing GPS-epochs!
98  */
101  REAL8 f_min, // Minimum frequency to be read
102  REAL8 f_max, // Maximum frequency to be read
103  const CHAR *file_pattern, // String of SFDB files (possibly from more than one detector, separated by a ;)
104  const CHAR *timeStampsStarting, // File(s) containing the starting timestamps of science segments (possibly from more than one detector, separated by a ;)
105  const CHAR *timeStampsFinishing // File(s) containing the finishing timestamps of science segments (possibly from more than one detector, separated by a ;)
106 )
107 {
108 
109  /* ------ Basic Setup ------ */
110  LALStringVector *fnamesSFDB;
111  XLAL_CHECK_NULL( ( fnamesSFDB = XLALFindFiles( file_pattern ) ) != NULL, XLAL_EFUNC, "Failed to find filelist matching pattern '%s'.\n\n", file_pattern );
112  UINT4 numSFDBFiles = fnamesSFDB->length;
113 
114  BOOLEAN flag_timestamps; /* This flag is FALSE if no timestamps are used, and TRUE if timestamps to only load SFDBs within science segments are used */
115  LALStringVector *fnamesStartTS = NULL; /* There is one pair (startTS, endTS) for each IFO: #IFOs == startingTS->length == endingTS->length */
116  LALStringVector *fnamesEndTS = NULL;
117  MultiLIGOTimeGPSVector *startingTS = NULL;
118  MultiLIGOTimeGPSVector *endingTS = NULL;
119 
120  LALStringVector *detectors = NULL; /* Only used if flag_timestamps == True */
121 
122  INT4 Tsft = 0;
123 
124  if ( timeStampsStarting && timeStampsFinishing ) {
125  flag_timestamps = TRUE;
126  } else if ( timeStampsStarting && timeStampsFinishing == NULL ) {
127  XLAL_ERROR_NULL( XLAL_EFUNC, "Must give two files with initial and finishing timestamps, missing finishing timestamps\n" );
128  } else if ( timeStampsStarting == NULL && timeStampsFinishing ) {
129  XLAL_ERROR_NULL( XLAL_EFUNC, "Must give two files with initial and finishing timestamps, missing starting timestamps\n" );
130  } else {
131  flag_timestamps = FALSE;
132  }
133 
134  if ( flag_timestamps ) {
135  XLAL_CHECK_NULL( ( fnamesStartTS = XLALFindFiles( timeStampsStarting ) ) != NULL, XLAL_EFUNC, "Failed to find filelist matching pattern '%s'.\n\n", timeStampsStarting );
136  XLAL_CHECK_NULL( ( fnamesEndTS = XLALFindFiles( timeStampsFinishing ) ) != NULL, XLAL_EFUNC, "Failed to find filelist matching pattern '%s'.\n\n", timeStampsFinishing );
137  UINT4 numTSFiles = fnamesStartTS->length;
138  XLAL_CHECK_NULL( numTSFiles == fnamesEndTS->length, XLAL_EINVAL );
139  XLAL_CHECK_NULL( numTSFiles > 0, XLAL_EINVAL );
140 
141  startingTS = XLALReadMultiTimestampsFiles( fnamesStartTS );
142  endingTS = XLALReadMultiTimestampsFiles( fnamesEndTS );
143 
144  for ( UINT4 X = 0; X < numTSFiles; ++X ) {
145 
146  /* Retrieve IFO names following the SFDB convention */
147  CHAR *filenameSt = fnamesStartTS->data[X];
148  BOOLEAN detectorWasFound = 0;
149  for ( UINT4 Y = SFDB_DET_FIRST; Y < SFDB_DET_LAST; Y++ ) {
150  if ( strstr( filenameSt, SFDB_detector_names[Y] ) ) {
154  ) != NULL,
155  XLAL_EFUNC
156  );
157  detectorWasFound = 1;
158  }
159  }
161  detectorWasFound,
162  XLAL_EINVAL,
163  "No matching IFO name was found for time stamp file %s",
164  filenameSt
165  );
166 
167  /* Time stamp stanity check */
168  UINT4 numStartStamps = startingTS->data[X]->length;
169  UINT4 numEndStamps = endingTS->data[X]->length;
171  numStartStamps == numEndStamps,
172  XLAL_EINVAL,
173  "Got %u starting and %u finishing timestamps at %s, lengths must be equal.",
174  numStartStamps,
175  numEndStamps,
176  filenameSt
177  );
178 
179  }/* -- IFO < numTSfiles -- */
180 
181  }/* -- if flag_timestamps -- */
182 
183  /* ------ First Step: Count SFDB files (and IFOs if required by time stamps) to allocate enough memory ------ */
184 
185  /* Y indices loop over the SFDB detector ordering convention (regardless of whether data is actually present or not) */
186  UINT4 numSFTsY[SFDB_DET_LAST];
187  XLAL_INIT_MEM( numSFTsY );
188  for ( UINT4 i = 0; i < numSFDBFiles; i++ ) {
189  const CHAR *filename = fnamesSFDB->data[i];
190  FILE *fpPar = NULL;
191  XLAL_CHECK_NULL( ( fpPar = fopen( filename, "r" ) ) != NULL, XLAL_EIO, "Failed to open SFDB file '%s' for reading.", filename );
192  setvbuf( fpPar, ( CHAR * )NULL, _IOLBF, 0 );
193 
194  REAL8 count; /* Index of an SFDBs in the file (a SFDB file can have more than one SFDB) */
195  while ( fread( &count, sizeof( REAL8 ), 1, fpPar ) == 1 ) {
196 
198  XLAL_CHECK_NULL( read_SFDB_header_from_fp( fpPar, &header ) == 0, XLAL_EIO, "Failed to parse SFDB header." );
199 
200  /* If time stamps are given, only count science mode SFDBs */
201  numSFTsY[header.det] += ( flag_timestamps ) ?
202  CheckIfSFDBInScienceMode( &header, detectors, startingTS, endingTS ) :
203  1;
204 
205  Tsft = header.tbase;
206 
207  /* Skip number of bytes corresponding to the actual data content */
208  INT4 lavespOrRed = 0;
209  UINT4 lsps = 0;
210  if ( header.lavesp > 0 ) {
211  lavespOrRed = header.lavesp;
212  lsps = header.lavesp;
213  } else {
214  lavespOrRed = header.red;
215  lsps = header.nsamples / header.red;
216  }
217  XLAL_CHECK_NULL( fseek( fpPar, lavespOrRed * sizeof( REAL4 ), SEEK_CUR ) == 0, XLAL_EIO );
218  XLAL_CHECK_NULL( fseek( fpPar, ( lsps + 2 * header.nsamples ) * sizeof( REAL4 ), SEEK_CUR ) == 0, XLAL_EIO );
219 
220  }/* -- while fread(...) == 1 -- */
221 
222  fclose( fpPar );
223 
224  }/* -- while i < numSFDBFiles -- */
225 
226  /* ------ Second Step: Reformat retrieved information ------ */
227 
228  UINT4 numSFTsTotal = 0;
229  for ( UINT4 Y = SFDB_DET_FIRST; Y < SFDB_DET_LAST; Y++ ) {
230  numSFTsTotal += numSFTsY[Y];
231  }
232  XLAL_CHECK_NULL( numSFTsTotal > 0, XLAL_EINVAL, "No SFTs found for any detector." );
233 
234  /* Prepare a lookup table containing detectors present in the SFDBs */
235  INT4 detectorLookupYtoX[SFDB_DET_LAST];
236  CHAR detectorNames[SFDB_DET_LAST][3];
237  XLAL_INIT_MEM( detectorNames );
238  for ( UINT4 Y = 0; Y < SFDB_DET_LAST; Y++ ) {
239  detectorLookupYtoX[Y] = -1;
240  strncpy( detectorNames[Y], "XX", 3 );
241  }
242 
243  /* Count IFOs and SFTs per IFO */
244  /* To do so, loop over everything, retrieve present */
245  /* information and re-format it into an array. */
246  UINT4 numIFOs = 0;
247  UINT4Vector *auxNumSFTsX = NULL;
248  auxNumSFTsX = XLALCreateUINT4Vector( SFDB_DET_LAST );
249  for ( UINT4 Y = SFDB_DET_FIRST; Y < SFDB_DET_LAST; Y++ ) {
250  if ( numSFTsY[Y] > 0 ) {
251  /* numIFOs is used here as an internal loop variable */
252  /* of actually present detectors (equivalent to X later) */
253  /* and will be equal to the total number at the end of the loop */
254  strncpy( detectorNames[numIFOs], SFDB_detector_names[Y], 3 );
255  auxNumSFTsX->data[numIFOs] = numSFTsY[Y];
256  detectorLookupYtoX[Y] = numIFOs;
257  numIFOs += 1;
258  }
259  }
260 
261  /* X indices loop over the actually present detectors */
262  UINT4Vector *numSFTsX = NULL;
263  numSFTsX = XLALCreateUINT4Vector( numIFOs );
264  XLALPrintInfo( "Number of SFTs we'll load from the SFDBs:\n" );
265  for ( UINT4 X = 0; X < numIFOs; X++ ) {
266  numSFTsX->data[X] = auxNumSFTsX->data[X];
267  XLALPrintInfo( "%s: %d\n", detectorNames[X], numSFTsX->data[X] );
268  }
269 
270  /* Allocate memory for the SFT structure */
271  /* Calling XLALFindCoveringSFTBins() guarantees we use the same bandwidth */
272  /* conventions as e.g. XLALCWMakeFakeMultiData() */
273  UINT4 firstBinExt, numBinsExt;
274  XLAL_CHECK_NULL( XLALFindCoveringSFTBins( &firstBinExt, &numBinsExt, f_min, f_max - f_min, Tsft ) == XLAL_SUCCESS, XLAL_EFUNC );
275  MultiSFTVector *outputSFTs = NULL;
276  outputSFTs = XLALCreateMultiSFTVector( numBinsExt, numSFTsX );
277 
278  /* Clean up auxiliar variables */
279  XLALDestroyUINT4Vector( numSFTsX );
280  XLALDestroyUINT4Vector( auxNumSFTsX );
281 
282  /* ------ Third Step: Fill up SFTs using SFDB data ------ */
283 
284  UINT4 numSFTsLoadedInX[numIFOs];
285  XLAL_INIT_MEM( numSFTsLoadedInX );
286  for ( UINT4 i = 0; i < numSFDBFiles; i++ ) {
287  const CHAR *filename = fnamesSFDB->data[i];
288  FILE *fpPar = NULL;
289  XLAL_CHECK_NULL( ( fpPar = fopen( filename, "r" ) ) != NULL, XLAL_EIO, "Failed to open SFDB file '%s' for reading.", filename );
290  setvbuf( fpPar, ( CHAR * )NULL, _IOLBF, 0 );
291 
292  REAL8 count;
293  while ( fread( &count, sizeof( REAL8 ), 1, fpPar ) == 1 ) { /* Read SFDBs one by one */
294 
296  XLAL_CHECK_NULL( read_SFDB_header_from_fp( fpPar, &header ) == 0, XLAL_EIO, "Failed to parse SFDB header." );
297 
298 
299  /* Read the actual binary data */
300  /* This is needed regardless of this data falling inside science mode */
301  /* since fread is what moves the pointer forwards! */
302  INT4 lavespOrRed = 0;
303  UINT4 lsps = 0;
304  REAL4 *buffer1 = NULL, *buffer2 = NULL, *buffer3 = NULL;
305  if ( header.lavesp > 0 ) {
306  lavespOrRed = header.lavesp;
307  lsps = header.lavesp;
308  } else {
309  lavespOrRed = header.red;
310  lsps = header.nsamples / header.red;
311  }
312 
313  XLAL_CHECK_NULL( ( buffer1 = XLALCalloc( lavespOrRed, sizeof( REAL4 ) ) ) != NULL, XLAL_ENOMEM );
314  XLAL_CHECK_NULL( fread( buffer1, lavespOrRed * sizeof( REAL4 ), 1, fpPar ) == 1, XLAL_EIO );
315 
316  XLAL_CHECK_NULL( ( buffer2 = XLALCalloc( lsps, sizeof( REAL4 ) ) ) != NULL, XLAL_ENOMEM );
317  XLAL_CHECK_NULL( fread( buffer2, lsps * sizeof( REAL4 ), 1, fpPar ) == 1, XLAL_EIO );
318 
319  XLAL_CHECK_NULL( ( buffer3 = XLALCalloc( 2 * header.nsamples, sizeof( REAL4 ) ) ) != NULL, XLAL_ENOMEM );
320  XLAL_CHECK_NULL( fread( buffer3, 2 * header.nsamples * sizeof( REAL4 ), 1, fpPar ) == 1, XLAL_EIO );
321 
322  if ( flag_timestamps ? CheckIfSFDBInScienceMode( &header, detectors, startingTS, endingTS ) : 1 ) {
323  XLAL_CHECK_NULL( detectorLookupYtoX[header.det] >= 0, XLAL_EDOM, "Cannot match detector %d, as read from file, with first run.", header.det );
324  UINT4 X = detectorLookupYtoX[header.det];
325  numSFTsLoadedInX[X] += 1;
326 
327  /* Fill up this SFT */
328  SFTtype *thisSFT = NULL;
329  thisSFT = outputSFTs->data[X]->data + numSFTsLoadedInX[X] - 1;
330 
331  XLALGPSSetREAL8( &( thisSFT->epoch ), header.gps_sec );
332  strncpy( thisSFT->name, detectorNames[X], 3 );
333  thisSFT->f0 = f_min;
334  thisSFT->deltaF = header.deltanu;
335 
336  /* Copy to the SFT structure the complex values in the frequency bins (multiplied by some normalization factors in order to agree with the SFT specification) */
337  UINT4 thisSFTLength = thisSFT->data->length;
338  COMPLEX8 *thisSFTData;
339  thisSFTData = thisSFT->data->data;
340  for ( UINT4 thisBin = firstBinExt; thisBin < ( thisSFTLength + firstBinExt ); thisBin++ ) {
341  *thisSFTData = crectf( buffer3[2 * thisBin], buffer3[2 * thisBin + 1] ) * header.einstein * header.tsamplu * header.normw;
342  ++thisSFTData;
343  }
344  }
345 
346  XLALFree( buffer1 );
347  XLALFree( buffer2 );
348  XLALFree( buffer3 );
349 
350  }/* while fread(...) == 1 */
351 
352  fclose( fpPar );
353  }/* -- i < numSFDBFiles -- */
354 
355  XLALDestroyStringVector( fnamesSFDB );
356  XLALDestroyStringVector( fnamesStartTS );
357  XLALDestroyStringVector( fnamesEndTS );
359  XLALDestroyMultiTimestamps( startingTS );
360  XLALDestroyMultiTimestamps( endingTS );
361 
362  /* Sort the SFDBs from lower GPS timestamp to higher GPS timestamp */
363  for ( UINT4 X = 0; X < numIFOs; X++ ) {
364  qsort( ( void * )outputSFTs->data[X]->data, outputSFTs->data[X]->length, sizeof( outputSFTs->data[X]->data[0] ), compareSFTepoch );
365  }
366 
367  return outputSFTs;
368 } /* XLALReadSFDB() */
369 
370 
371 static int
373 {
374 
375  XLAL_CHECK( fread( &header->det, sizeof( INT4 ), 1, fp ) == 1, XLAL_EIO ); // see SFDBDetectors for numbering convention
376  XLAL_CHECK( header->det > 0, XLAL_EIO, "Unsupported detector number %d in SFDB.", header->det );
377  XLAL_CHECK( header->det < SFDB_DET_LAST, XLAL_EIO, "Unsupported detector number %d in SFDB, highest known number is %d.", header->det, SFDB_DET_LAST - 1 );
378 
379  XLAL_CHECK( fread( &header->gps_sec, sizeof( INT4 ), 1, fp ) == 1, XLAL_EIO ); // GPS time of this SFDB
380  XLAL_CHECK( fread( &header->gps_nsec, sizeof( INT4 ), 1, fp ) == 1, XLAL_EIO );
381  XLAL_CHECK( fread( &header->tbase, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO ); // Coherent time of the SFDB
382  XLAL_CHECK( fread( &header->firstfrind, sizeof( INT4 ), 1, fp ) == 1, XLAL_EIO );
383  XLAL_CHECK( fread( &header->nsamples, sizeof( INT4 ), 1, fp ) == 1, XLAL_EIO ); // Number of frequency bins
384  XLAL_CHECK( fread( &header->red, sizeof( INT4 ), 1, fp ) == 1, XLAL_EIO ); // Reductions factor
385  XLAL_CHECK( fread( &header->typ, sizeof( INT4 ), 1, fp ) == 1, XLAL_EIO );
386  XLAL_CHECK( fread( &header->n_flag, sizeof( REAL4 ), 1, fp ) == 1, XLAL_EIO );
387  XLAL_CHECK( fread( &header->einstein, sizeof( REAL4 ), 1, fp ) == 1, XLAL_EIO );
388  XLAL_CHECK( fread( &header->mjdtime, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO );
389  XLAL_CHECK( fread( &header->nfft, sizeof( INT4 ), 1, fp ) == 1, XLAL_EIO );
390  XLAL_CHECK( fread( &header->wink, sizeof( INT4 ), 1, fp ) == 1, XLAL_EIO );
391  XLAL_CHECK( fread( &header->normd, sizeof( REAL4 ), 1, fp ) == 1, XLAL_EIO );
392  XLAL_CHECK( fread( &header->normw, sizeof( REAL4 ), 1, fp ) == 1, XLAL_EIO ); // Normalization factors
393  XLAL_CHECK( fread( &header->frinit, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO );
394  XLAL_CHECK( fread( &header->tsamplu, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO ); // Sampling time
395  XLAL_CHECK( fread( &header->deltanu, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO ); // Frequency resolution
396  XLAL_CHECK( fread( &header->vx_eq, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO );
397  XLAL_CHECK( fread( &header->vy_eq, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO );
398  XLAL_CHECK( fread( &header->vz_eq, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO );
399  XLAL_CHECK( fread( &header->px_eq, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO );
400  XLAL_CHECK( fread( &header->py_eq, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO );
401  XLAL_CHECK( fread( &header->pz_eq, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO );
402  XLAL_CHECK( fread( &header->n_zeroes, sizeof( INT4 ), 1, fp ) == 1, XLAL_EIO );
403  XLAL_CHECK( fread( &header->sat_howmany, sizeof( REAL8 ), 1, fp ) == 1, XLAL_EIO );
404  XLAL_CHECK( fseek( fp, 3 * sizeof( REAL8 ), SEEK_CUR ) == 0, XLAL_EIO ); // spare fields
405  XLAL_CHECK( fseek( fp, 3 * sizeof( REAL4 ), SEEK_CUR ) == 0, XLAL_EIO ); // spare fields
406  XLAL_CHECK( fread( &header->lavesp, sizeof( INT4 ), 1, fp ) == 1, XLAL_EIO );
407  XLAL_CHECK( fseek( fp, 2 * sizeof( INT4 ), SEEK_CUR ) == 0, XLAL_EIO ); // more spare spares
408 
409  return 0;
410 
411 } // read_SFDB_header_from_fp
412 
413 
414 static BOOLEAN
417  LALStringVector *detectors,
418  MultiLIGOTimeGPSVector *startingTS,
419  MultiLIGOTimeGPSVector *endingTS
420 )
421 {
422 
423  /* Get detector index */
424  UINT4 detectorIndex = 0;
425  while ( strcmp( SFDB_detector_names[header->det],
426  detectors->data[detectorIndex] ) != 0
427  ) {
428  ++detectorIndex;
429  }
430 
431  /* Check if SFDB's epoch falls within time stamps */
432  /* FIXME: Maybe a binary search is faster? */
433  BOOLEAN SFDBWithinScienceMode = 0;
434  UINT4 tsIndex = 0;
435  REAL8 SFDBEndTime = header->gps_sec + header->tbase;
436  while ( header->gps_sec >= startingTS->data[detectorIndex]->data[tsIndex].gpsSeconds ) {
437  if ( SFDBEndTime < endingTS->data[detectorIndex]->data[tsIndex].gpsSeconds ) {
438  SFDBWithinScienceMode = 1;
439  break;
440  }
441  ++tsIndex;
442  }
443 
444  return SFDBWithinScienceMode;
445 }
446 
447 /// @}
SFDBDetectors
Definition: SFDBfileIO.c:32
@ SFDB_DET_H1
Definition: SFDBfileIO.c:35
@ SFDB_DET_FIRST
Definition: SFDBfileIO.c:33
@ SFDB_DET_LAST
Definition: SFDBfileIO.c:37
@ SFDB_DET_L1
Definition: SFDBfileIO.c:36
@ SFDB_DET_V1
Definition: SFDBfileIO.c:34
const char *const SFDB_detector_names[]
Definition: SFDBfileIO.c:40
Internal SFT types and functions.
unsigned char BOOLEAN
#define XLAL_INIT_MEM(x)
double REAL8
#define crectf(re, im)
char CHAR
uint32_t UINT4
float complex COMPLEX8
int32_t INT4
float REAL4
void * XLALCalloc(size_t m, size_t n)
void XLALFree(void *p)
static BOOLEAN CheckIfSFDBInScienceMode(SFDBHeader *SFDBHeader, LALStringVector *detectors, MultiLIGOTimeGPSVector *startingTS, MultiLIGOTimeGPSVector *endingTS)
Definition: SFDBfileIO.c:415
int XLALFindCoveringSFTBins(UINT4 *firstBin, UINT4 *numBins, REAL8 fMinIn, REAL8 BandIn, REAL8 Tsft)
Return the 'effective' frequency-band [fMinEff, fMaxEff] = [firstBin, lastBin] * 1/Tsft,...
Definition: SFTtypes.c:106
static int read_SFDB_header_from_fp(FILE *fp, SFDBHeader *header)
Definition: SFDBfileIO.c:372
LALStringVector * XLALFindFiles(const CHAR *globstring)
Returns a list of filenames matching the input argument, which may be one of the following:
Definition: FindFiles.c:61
MultiSFTVector * XLALCreateMultiSFTVector(UINT4 length, UINT4Vector *numsft)
Create a multi-IFO SFT vector with a given number of bins per SFT and number of SFTs per IFO (which w...
Definition: SFTtypes.c:362
MultiSFTVector * XLALReadSFDB(REAL8 f_min, REAL8 f_max, const CHAR *file_pattern, const CHAR *timeStampsStarting, const CHAR *timeStampsFinishing)
Return a MultiSFTVector struct from an input set of SFDBs, possibly from more than one detector.
Definition: SFDBfileIO.c:100
void XLALDestroyMultiTimestamps(MultiLIGOTimeGPSVector *multiTS)
Destroy a MultiLIGOTimeGPSVector timestamps vector.
MultiLIGOTimeGPSVector * XLALReadMultiTimestampsFiles(const LALStringVector *fnames)
backwards compatible wrapper to XLALReadMultiTimestampsFilesConstrained() without GPS-time constraint...
int compareSFTepoch(const void *ptr1, const void *ptr2)
Definition: SFTtypes.c:1231
LALStringVector * XLALAppendString2Vector(LALStringVector *vect, const CHAR *string)
void XLALDestroyStringVector(LALStringVector *vect)
void XLALDestroyUINT4Vector(UINT4Vector *vector)
UINT4Vector * XLALCreateUINT4Vector(UINT4 length)
#define XLAL_ERROR_NULL(...)
int int int XLALPrintInfo(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_NULL(assertion,...)
XLAL_ENOMEM
XLAL_SUCCESS
XLAL_EFUNC
XLAL_EDOM
XLAL_EIO
XLAL_EINVAL
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
long long count
Definition: hwinject.c:371
gpsSeconds
#define TRUE
#define FALSE
LALDetector detectors[LAL_NUM_DETECTORS]
CHAR name[LALNameLength]
COMPLEX8Sequence * data
COMPLEX8FrequencySeries * data
Pointer to the data array.
UINT4 length
Number of elements in array.
COMPLEX8 * data
LIGOTimeGPS * data
array of timestamps
Definition: SFTfileIO.h:193
UINT4 length
number of timestamps
Definition: SFTfileIO.h:192
A collection of (multi-IFO) LIGOTimeGPSVector time-stamps vectors.
Definition: SFTfileIO.h:198
LIGOTimeGPSVector ** data
timestamps vector for each ifo
Definition: SFTfileIO.h:203
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
INT4 nfft
Definition: SFDBfileIO.c:62
INT4 lavesp
Definition: SFDBfileIO.c:77
REAL8 px_eq
Definition: SFDBfileIO.c:72
REAL8 pz_eq
Definition: SFDBfileIO.c:74
REAL8 vx_eq
Definition: SFDBfileIO.c:69
REAL8 sat_howmany
Definition: SFDBfileIO.c:76
REAL8 frinit
Definition: SFDBfileIO.c:66
REAL8 py_eq
Definition: SFDBfileIO.c:73
REAL8 deltanu
Definition: SFDBfileIO.c:68
REAL8 tbase
Definition: SFDBfileIO.c:54
REAL4 n_flag
Definition: SFDBfileIO.c:59
REAL4 normd
Definition: SFDBfileIO.c:64
INT4 gps_sec
Definition: SFDBfileIO.c:52
INT4 wink
Definition: SFDBfileIO.c:63
REAL8 vy_eq
Definition: SFDBfileIO.c:70
INT4 red
Definition: SFDBfileIO.c:57
INT4 firstfrind
Definition: SFDBfileIO.c:55
INT4 typ
Definition: SFDBfileIO.c:58
INT4 n_zeroes
Definition: SFDBfileIO.c:75
REAL4 normw
Definition: SFDBfileIO.c:65
INT4 det
Definition: SFDBfileIO.c:51
REAL8 vz_eq
Definition: SFDBfileIO.c:71
REAL8 mjdtime
Definition: SFDBfileIO.c:61
INT4 nsamples
Definition: SFDBfileIO.c:56
REAL4 einstein
Definition: SFDBfileIO.c:60
INT4 gps_nsec
Definition: SFDBfileIO.c:53
REAL8 tsamplu
Definition: SFDBfileIO.c:67
UINT4 * data
double f_min
double f_max