Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALPulsar 7.1.1.1-b246709
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
SFTfileIOTest.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 Karl Wette
3 * Copyright (C) 2004, 2005 R. Prix, B. Machenschalk, A.M. 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/*---------- INCLUDES ----------*/
22#include <config.h>
23
24#include <lal/LALStdio.h>
25#include <lal/SFTfileIO.h>
26#include <lal/Units.h>
27
28/*---------- DEFINES ----------*/
29/**
30 * \file
31 * \ingroup SFTfileIO_h
32 * \author R. Prix, B. Machenschalk, A.M. Sintes
33 *
34 * \brief Test-code for SFT-fileIO library
35 *
36 */
37
38/** \cond DONT_DOXYGEN */
39
40#define GPS2REAL8(gps) (1.0 * (gps).gpsSeconds + 1.e-9 * (gps).gpsNanoSeconds )
41
42/*---------- Global variables ----------*/
43
44/* ----------------------------------------------------------------------*/
45
46static int CompareSFTVectors( SFTVector *sft_vect, SFTVector *sft_vect2 );
47static int CompareSFTVectors( SFTVector *sft_vect, SFTVector *sft_vect2 )
48{
49 UINT4 sft, bin;
50 if ( sft_vect->length != sft_vect2->length ) {
51 XLALPrintError( "CompareSFTVectors(): vector lengths differ!\n" );
52 return ( -1 );
53 }
54 for ( sft = 0; sft < sft_vect->length; sft++ ) {
55 SFTtype sft1 = sft_vect->data[sft];
56 SFTtype sft2 = sft_vect2->data[sft];
57 if ( ( sft1.epoch.gpsSeconds != sft2.epoch.gpsSeconds ) ||
58 ( sft1.epoch.gpsNanoSeconds != sft2.epoch.gpsNanoSeconds ) ) {
59 XLALPrintError( "CompareSFTVectors(): SFT#%u epochs differ (%f/%f)!\n",
60 sft, GPS2REAL8( sft1.epoch ), GPS2REAL8( sft2.epoch ) );
61 return ( -1 );
62 }
63 if ( strncmp( sft1.name, sft2.name, sizeof( sft1.name ) ) ) {
64 XLALPrintError( "CompareSFTVectors(): SFT#%u names differ!\n", sft );
65 return ( -1 );
66 }
67 if ( sft1.f0 != sft2.f0 ) {
68 XLALPrintError( "CompareSFTVectors(): f0 of SFT#%u differ (%f/%f)!\n",
69 sft, sft1.f0, sft2.f0 );
70 return ( -1 );
71 }
72 if ( sft1.deltaF != sft2.deltaF ) {
73 XLALPrintError( "CompareSFTVectors(): deltaF of SFT#%u differ (%f/%f)!\n",
74 sft, sft1.deltaF, sft2.deltaF );
75 return ( -1 );
76 }
77 if ( XLALUnitCompare( &sft1.sampleUnits, &sft2.sampleUnits ) ) {
78 CHAR buf1[256], buf2[256];
79 if ( !XLALUnitAsString( buf1, 256, &sft1.sampleUnits ) ) {
80 *buf1 = '\0';
81 }
82 if ( !XLALUnitAsString( buf2, 256, &sft2.sampleUnits ) ) {
83 *buf2 = '\0';
84 }
85 XLALPrintError( "CompareSFTVectors(): Units of SFT#%u differ (%s/%s)!\n",
86 sft, buf1, buf2 );
87 return ( -1 );
88 }
89 if ( sft1.data->length != sft2.data->length ) {
90 XLALPrintError( "CompareSFTVectors(): lengths of SFT#%u differ!\n", sft );
91 return ( -1 );
92 }
93 for ( bin = 0; bin < sft1.data->length; bin++ ) {
94 if ( ( crealf( sft1.data->data[bin] ) != crealf( sft2.data->data[bin] ) ) ||
95 ( cimagf( sft1.data->data[bin] ) != cimagf( sft2.data->data[bin] ) ) ) {
96 XLALPrintError( "CompareSFTVectors(): bins %u of SFT#%u differ!\n", sft, bin );
97 return ( -1 );
98 }
99 }
100 }
101 return ( 0 );
102}
103
104int main( void )
105{
106 const char *fn = __func__;
107
108 SFTCatalog *catalog = NULL;
109 SFTConstraints XLAL_INIT_DECL( constraints );
110 SFTVector *sft_vect = NULL;
111 SFTVector *sft_vect2 = NULL;
112 MultiSFTVector *multsft_vect = NULL;
113 MultiSFTVector *multsft_vect2 = NULL;
114 CHAR detector[] = "H1";
115 BOOLEAN crc_check;
116
117 /* check that mal-formated SFTs are properly detected */
118 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad1", NULL ) ) == NULL, XLAL_EFUNC );
120 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad2", NULL ) ) == NULL, XLAL_EFUNC );
122 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad3", NULL ) ) == NULL, XLAL_EFUNC );
124 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad4", NULL ) ) == NULL, XLAL_EFUNC );
126 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad5", NULL ) ) == NULL, XLAL_EFUNC );
128
129 /* the following (SFT-bad6) has a wrong CRC64 checksum. However, this is
130 * not checked in XLALSFTdataFind, so it should succeed! */
131 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad6", NULL ) ) != NULL, XLAL_EFUNC );
133 XLALDestroySFTCatalog( catalog );
134
135 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad7", NULL ) ) == NULL, XLAL_EFUNC );
137 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad8", NULL ) ) == NULL, XLAL_EFUNC );
139 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad9", NULL ) ) == NULL, XLAL_EFUNC );
141 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad10", NULL ) ) == NULL, XLAL_EFUNC );
143 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad11", NULL ) ) == NULL, XLAL_EFUNC );
145 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad12", NULL ) ) == NULL, XLAL_EFUNC );
147 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad13", NULL ) ) == NULL, XLAL_EFUNC );
149 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad14", NULL ) ) == NULL, XLAL_EFUNC );
151
152 /* now check some crc-checksums */
153 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-test1", NULL ) ) != NULL, XLAL_EFUNC );
155 XLALDestroySFTCatalog( catalog );
156 if ( !crc_check ) {
157 XLALPrintError( "\nLALCheckSFTs(): SFT-test1 has correct checksum but LALCheckSFTs claimed it hasn't.\n\n" );
158 return EXIT_FAILURE;
159 }
160 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-bad6", NULL ) ) != NULL, XLAL_EFUNC );
162 XLALDestroySFTCatalog( catalog );
163 if ( crc_check ) {
164 XLALPrintError( "\nLALCheckSFTs() failed to catch invalid CRC checksum in SFT-bad6 \n\n" );
165 return EXIT_FAILURE;
166 }
167
168 /* check that proper SFTs are read-in properly */
169 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-test1", NULL ) ) != NULL, XLAL_EFUNC );
171 XLALDestroySFTCatalog( catalog );
172 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-test2", NULL ) ) != NULL, XLAL_EFUNC );
174 XLALDestroySFTCatalog( catalog );
175 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-test3", NULL ) ) != NULL, XLAL_EFUNC );
177 XLALDestroySFTCatalog( catalog );
178 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-test4", NULL ) ) != NULL, XLAL_EFUNC );
180 XLALDestroySFTCatalog( catalog );
181 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-test5", NULL ) ) != NULL, XLAL_EFUNC );
183 XLALDestroySFTCatalog( catalog );
184 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-test6", NULL ) ) != NULL, XLAL_EFUNC );
186 XLALDestroySFTCatalog( catalog );
187 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-test7", NULL ) ) != NULL, XLAL_EFUNC );
189 XLALDestroySFTCatalog( catalog );
190
191 /* now completely read-in a merged-SFT */
192 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-test*", NULL ) ) == NULL, XLAL_EFUNC );
194 /* skip sft nr 4 with has Tsft=50 instead of Tsft=60 */
195 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-test[123567]*", NULL ) ) != NULL, XLAL_EFUNC );
196 XLALDestroySFTCatalog( catalog );
197 /* try the same with a ";" separated list of files and of patterns */
198 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind(
199 TEST_DATA_DIR "SFT-test1;"
200 TEST_DATA_DIR "SFT-test2;"
201 TEST_DATA_DIR "SFT-test3;"
202 TEST_DATA_DIR "SFT-test5;"
203 TEST_DATA_DIR "SFT-test6;"
204 TEST_DATA_DIR "SFT-test7", NULL ) ) != NULL, XLAL_EFUNC );
205 XLALDestroySFTCatalog( catalog );
206 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( TEST_DATA_DIR "SFT-test[123]*;" TEST_DATA_DIR "SFT-test[5]*", NULL ) ) != NULL, XLAL_EFUNC );
207
208 /* load once as a single SFT-vector (mix of detectors) */
209 XLAL_CHECK_MAIN( ( sft_vect = XLALLoadSFTs( catalog, -1, -1 ) ) != NULL, XLAL_EFUNC );
210
211 /* load once as a multi-SFT vector */
212 XLAL_CHECK_MAIN( ( multsft_vect = XLALLoadMultiSFTs( catalog, -1, -1 ) ) != NULL, XLAL_EFUNC );
213 /* load again, using XLAL API */
214 if ( ( multsft_vect2 = XLALLoadMultiSFTs( catalog, -1, -1 ) ) == NULL ) {
215 XLALPrintError( "%s: XLALLoadMultiSFTs (cat, -1, -1) failed with xlalErrno = %d\n", fn, xlalErrno );
216 return EXIT_FAILURE;
217 }
218 XLALDestroySFTCatalog( catalog );
219
220 /* 6 SFTs from 2 IFOs should have been read */
221 if ( ( sft_vect->length != 4 ) /* either as a single SFTVector */
222 || ( multsft_vect->length != 2 ) /* or separated by detector */
223 || ( multsft_vect->data[0]->length != 3 ) || ( multsft_vect->data[1]->length != 1 ) ) {
224 XLALPrintError( "\nFailed to read in multi-SFT from 2 IFOs 'SFT-test*'!\n\n" );
225 return EXIT_FAILURE;
226 }
227
228 /* compare results from XLALLoadMultiSFTs() and XLALLoadMultiSFTs() */
229 {
230 UINT4 numIFOs = multsft_vect->length;
231 UINT4 X;
232 for ( X = 0; X < numIFOs; X ++ ) {
233 if ( CompareSFTVectors( multsft_vect->data[X], multsft_vect2->data[X] ) ) {
234 XLALPrintError( "%s: comparing (X)XLALLoadMultiSFTs(): sft-vectors differ for X=%d\n", fn, X );
235 return EXIT_FAILURE;
236 }
237 } /* for X < numIFOs */
238 } /* ------ */
239
240 /* ----- SFT writing ----- */
242 XLAL_CHECK_MAIN( XLALFillSFTFilenameSpecStrings( &spec, ".", NULL, NULL, "tukey", NULL, NULL, NULL ) == XLAL_SUCCESS, XLAL_EFUNC );
243 spec.window_param = 0.5; // SFT aren't actually windowed; just testing that window-spec is correctly written and read
244
245 /* write SFT to disk */
246 strcpy( spec.privMisc, "test" );
247 XLAL_CHECK_MAIN( XLALWriteSFT2NamedFile( &( multsft_vect->data[0]->data[0] ), "outputsft_r1.sft", spec.window_type, spec.window_param, "A SFT file for testing!" ) == XLAL_SUCCESS, XLAL_EFUNC );
248 XLAL_CHECK_MAIN( XLALWriteSFTVector2StandardFile( multsft_vect->data[0], &spec, "A SFT file for testing!", 0 ) == XLAL_SUCCESS, XLAL_EFUNC );
249
250 /* write SFT to single file */
251 {
252 const CHAR *currSingleSFT = NULL;
253 UINT4 i = 0;
254 FILE *fpConcat = NULL, *fpSingle = NULL;
255 int concat = 0, single = 0;
256
257 xlalErrno = 0;
258 strcpy( spec.privMisc, "testconcat" );
259 if ( XLAL_SUCCESS != XLALWriteSFTVector2StandardFile( multsft_vect->data[0], &spec, "A SFT file for testing!", 1 ) ) {
260 LALPrintError( "\n XLALWriteSFTVector2StandardFile failed to write multi-SFT vector to file!\n\n" );
261 return EXIT_FAILURE;
262 }
263 /* check that the single file SFT is the same as the single SFTs */
264 const UINT4 numSingleSFTs = 3;
265 const CHAR *singleSFTs[] = {
266 "H-1_H1_60SFT_test-000012345-61.sft",
267 "H-1_H1_60SFT_test-000012465-61.sft",
268 "H-1_H1_60SFT_test-000012585-61.sft"
269 };
270 printf( "*** Comparing single and concatenated SFTs ***\n" );
271 /* try to open concatenated SFT */
272 const CHAR *concatSFT = "H-3_H1_60SFT_testconcat-000012345-302.sft";
273 if ( ( fpConcat = fopen( concatSFT, "rb" ) ) == NULL ) {
274 LALPrintError( "\n Cound not open SFT '%s'!\n\n", concatSFT );
275 return EXIT_FAILURE;
276 }
277 /* do loop while concat. SFT has data */
278 while ( !feof( fpConcat ) ) {
279 /* get character from concat. SFT */
280 concat = fgetc( fpConcat );
281 if ( ferror( fpConcat ) ) {
282 LALPrintError( "\n IO error reading '%s'!\n\n", concatSFT );
283 return EXIT_FAILURE;
284 }
285 /* get character from single SFT */
286 while ( 1 ) {
287 /* need to open next single SFT file */
288 if ( fpSingle == NULL ) {
289 /* break if we've run out of single SFTs */
290 if ( i == numSingleSFTs ) {
291 break;
292 }
293 /* try to open single SFT */
294 if ( ( fpSingle = fopen( singleSFTs[i], "rb" ) ) == NULL ) {
295 LALPrintError( "\n Cound not open SFT '%s'!\n\n", singleSFTs[i] );
296 return EXIT_FAILURE;
297 }
298 currSingleSFT = singleSFTs[i];
299 }
300 /* get character from single SFT */
301 single = fgetc( fpSingle );
302 if ( ferror( fpSingle ) ) {
303 LALPrintError( "\n IO error reading '%s'!\n\n", singleSFTs[i] );
304 return EXIT_FAILURE;
305 }
306 /* if single SFT is out of data, close it (open next one at beginning of loop) */
307 if ( feof( fpSingle ) ) {
308 fclose( fpSingle );
309 fpSingle = NULL;
310 ++i;
311 }
312 /* otherwise we have a valid character */
313 else {
314 break;
315 }
316 }
317 /* do character-by-character comparison */
318 if ( concat != single ) {
319 LALPrintError( "\n Comparison failed between '%s'(last char = %i) and '%s'(last char = %i)!!\n\n",
320 concatSFT, concat, currSingleSFT, single );
321 return EXIT_FAILURE;
322 }
323 }
324 fclose( fpConcat );
325 printf( "*** Comparing was successful!!! ***\n" );
326 }
327
328 /* write SFT again */
329 multsft_vect->data[0]->data[0].epoch.gpsSeconds += 60; /* shift start-time so they don't look like segmented SFTs! */
330 XLAL_CHECK_MAIN( XLALWriteSFT2NamedFile( &( multsft_vect->data[0]->data[0] ), "outputsft_r2.sft", spec.window_type, spec.window_param, "A SFT file for testing!" ) == XLAL_SUCCESS, XLAL_EFUNC );
331
332 XLALDestroySFTVector( sft_vect );
333 sft_vect = NULL;
334 XLALDestroyMultiSFTVector( multsft_vect );
335 multsft_vect = NULL;
336 XLALDestroyMultiSFTVector( multsft_vect2 );
337 multsft_vect2 = NULL;
338
339 /* ----- read the previous SFTs back */
340 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( "outputsft_r*.sft", NULL ) ) != NULL, XLAL_EFUNC );
341 XLALDestroySFTCatalog( catalog );
342 constraints.detector = detector;
343 XLAL_CHECK_MAIN( ( catalog = XLALSFTdataFind( "outputsft_r*.sft", &constraints ) ) != NULL, XLAL_EFUNC );
344
345 if ( catalog->length != 2 ) {
346 if ( lalDebugLevel ) {
347 XLALPrintError( "\nFailed to find 'outputsft_r*.sft' in catalog\n\n" );
348 }
349 return EXIT_FAILURE;
350 }
351
352 XLAL_CHECK_MAIN( strcmp( catalog->data[0].window_type, spec.window_type ) == 0,
353 XLAL_EFAILED, "catalog window type '%s' should be '%s'",
354 catalog->data[0].window_type, spec.window_type );
355 XLAL_CHECK_MAIN( catalog->data[0].window_param == spec.window_param,
356 XLAL_EFAILED, "catalog window parameter %g should be %g",
357 catalog->data[0].window_param, spec.window_param );
358
359 XLAL_CHECK_MAIN( ( sft_vect = XLALLoadSFTs( catalog, -1, -1 ) ) != NULL, XLAL_EFUNC );
360
361 if ( sft_vect->length != 2 ) {
362 if ( lalDebugLevel ) {
363 XLALPrintError( "\nFailed to read back in 'outputsft_r*.sft'\n\n" );
364 }
365 return EXIT_FAILURE;
366 }
367
368 sft_vect2 = XLALLoadSFTs( catalog, -1, -1 );
369 if ( !sft_vect2 ) {
370 XLALPrintError( "\nXLALLoadSFTs() call failed (where it should have succeeded)!\n\n" );
371 return EXIT_FAILURE;
372 }
373
374 /* compare the SFT vectors just read */
375 if ( CompareSFTVectors( sft_vect, sft_vect2 ) ) {
376 return EXIT_FAILURE;
377 }
378
379 XLALDestroySFTVector( sft_vect2 );
380 sft_vect2 = NULL;
381 XLALDestroySFTVector( sft_vect );
382 sft_vect = NULL;
383 XLALDestroySFTCatalog( catalog );
384
385 /* ---------- test timestamps-reading functions by comparing LAL- and XLAL-versions against each other ---------- */
386 {
387#define TS_FNAME "testTimestamps.dat"
388#define TS_FNAME_NEW "testTimestampsNew.dat"
389 LIGOTimeGPSVector *ts2 = NULL, *ts3 = NULL;
390
391 /* ----- load timestamps w new XLAL function */
392 XLAL_CHECK_MAIN( ( ts2 = XLALReadTimestampsFile( TEST_DATA_DIR TS_FNAME ) ) != NULL, XLAL_EFUNC );
393 XLAL_CHECK_MAIN( ( ts3 = XLALReadTimestampsFile( TEST_DATA_DIR TS_FNAME_NEW ) ) != NULL, XLAL_EFUNC );
394
395 /* ----- compare the 3 */
396 XLAL_CHECK_MAIN( ts2->length == ts3->length, XLAL_EFAILED, "Read timestamps-lists differ in length %d != %d\n", ts2->length, ts3->length );
397
398 XLAL_CHECK_MAIN( ts2->deltaT == ts3->deltaT, XLAL_EFAILED, "Read timestamps-lists differ in deltaT %g != %g\n", ts2->deltaT, ts3->deltaT );
399
400 UINT4 numTS = ts2->length;
401 char buf1[256], buf2[256];
402 for ( UINT4 i = 0; i < numTS; i ++ ) {
403 XLAL_CHECK_MAIN( XLALGPSDiff( &ts2->data[i], &ts3->data[i] ) == 0, XLAL_EFAILED,
404 "Timestamps-lists differ in entry %" LAL_UINT4_FORMAT ": %s != %s\n", i + 1, XLALGPSToStr( buf1, &ts2->data[i] ), XLALGPSToStr( buf2, &ts3->data[i] ) );
405 } /* for i < numTS */
406
407 /* free mem */
410 }
411
412 /* ------------------------------ */
414
415 XLALPrintError( "\n\n--------------------------------------------------------------------------------\n" );
416 XLALPrintError( "\n OK. All tests passed correctly ! (error-messages above are OK!)\n" );
417 XLALPrintError( "\n--------------------------------------------------------------------------------\n" );
418
419
420 return EXIT_SUCCESS;
421}
422/** \endcond */
#define __func__
log an I/O error, i.e.
#define GPS2REAL8(gps)
convert GPS-time to REAL8
void LALCheckMemoryLeaks(void)
int main(int argc, char **argv)
char * XLALGPSToStr(char *s, const LIGOTimeGPS *t)
unsigned char BOOLEAN
#define XLAL_INIT_DECL(var,...)
char CHAR
uint32_t UINT4
int LALPrintError(const char *fmt,...)
void XLALDestroySFTVector(SFTVector *vect)
XLAL interface to destroy an SFTVector.
Definition: SFTtypes.c:300
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
int XLALCheckCRCSFTCatalog(BOOLEAN *crc_check, SFTCatalog *catalog)
This function reads in the SFTs in the catalog and validates their CRC64 checksums.
Definition: SFTcatalog.c:524
SFTVector * XLALLoadSFTs(const SFTCatalog *catalog, REAL8 fMin, REAL8 fMax)
Load the given frequency-band [fMin, fMax) (half-open) from the SFT-files listed in the SFT-'catalogu...
Definition: SFTfileIO.c:87
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
int XLALWriteSFTVector2StandardFile(const SFTVector *sftVect, SFTFilenameSpec *SFTfnspec, const CHAR *SFTcomment, const BOOLEAN merged)
Write the given SFTVector to SFT file(s) with a standard () filename(s).
Definition: SFTfileIO.c:755
LIGOTimeGPSVector * XLALReadTimestampsFile(const CHAR *fname)
backwards compatible wrapper to XLALReadTimestampsFileConstrained() without GPS-time constraints
int XLALWriteSFT2NamedFile(const SFTtype *sft, const CHAR *SFTfilename, const CHAR *SFTwindowtype, const REAL8 SFTwindowparam, const CHAR *SFTcomment)
Write the given SFTtype to a SFT file with the supplied filename.
Definition: SFTfileIO.c:598
int XLALFillSFTFilenameSpecStrings(SFTFilenameSpec *spec, const CHAR *path, const CHAR *extn, const CHAR *detector, const CHAR *window_type, const CHAR *privMisc, const CHAR *pubObsKind, const CHAR *pubChannel)
Convenience function for filling out the string fields in a SFTFilenameSpec.
Definition: SFTnaming.c:257
void XLALDestroyTimestampVector(LIGOTimeGPSVector *vect)
De-allocate a LIGOTimeGPSVector.
Definition: SFTtimestamps.c:69
int XLALUnitCompare(const LALUnit *unit1, const LALUnit *unit2)
char * XLALUnitAsString(char *string, UINT4 length, const LALUnit *input)
#define xlalErrno
#define XLAL_CHECK_MAIN(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int XLALClearErrno(void)
XLAL_SUCCESS
XLAL_EFUNC
XLAL_EFAILED
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
CHAR name[LALNameLength]
COMPLEX8Sequence * data
A vector of COMPLEX8FrequencySeries.
COMPLEX8FrequencySeries * data
Pointer to the data array.
UINT4 length
Number of elements in array.
COMPLEX8 * data
INT4 gpsNanoSeconds
A vector of 'timestamps' of type LIGOTimeGPS.
Definition: SFTfileIO.h:188
REAL8 deltaT
'length' of each timestamp (e.g.
Definition: SFTfileIO.h:194
LIGOTimeGPS * data
array of timestamps
Definition: SFTfileIO.h:193
UINT4 length
number of timestamps
Definition: SFTfileIO.h:192
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
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
const char * window_type
window function applied to SFT
Definition: SFTfileIO.h:229
REAL8 window_param
parameter of window function, if required
Definition: SFTfileIO.h:230
Structure specifying an SFT file name, following the convention in .
Definition: SFTfileIO.h:266