Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALPulsar 7.1.1.1-00ddc7f
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
SFTfileIO.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Rodrigo Tenorio
3 * Copyright (C) 2020 David Keitel
4 * Copyright (C) 2019 Pep Covas
5 * Copyright (C) 2010--2016, 2019--2022 Karl Wette
6 * Copyright (C) 2009 Chris Messenger
7 * Copyright (C) 2004--2006, 2008--2011, 2013, 2014, 2018 Reinhard Prix
8 * Copyright (C) 2004, 2005 Bernd Machenschalk
9 * Copyright (C) 2004, 2005 Alicia Sintes
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with with program; see the file COPYING. If not, write to the
23 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24 * MA 02110-1301 USA
25 */
26
27#ifndef _SFTFILEIO_H /* Double-include protection. */
28#define _SFTFILEIO_H
29
30#ifdef __cplusplus /* C++ protection. */
31extern "C" {
32#endif
33
34/* includes */
35#include <stdlib.h>
36#include <math.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <string.h>
40
41#include <lal/LALStdlib.h>
42#include <lal/LALConstants.h>
43#include <lal/AVFactories.h>
44#include <lal/SeqFactories.h>
45#include <lal/StringVector.h>
46#include <lal/Date.h>
47#include <lal/Segments.h>
48#include <lal/DetectorSite.h>
49#include <lal/SkyCoordinates.h>
50#include <lal/LALRunningMedian.h>
51#include <lal/RngMedBias.h>
52#include <lal/UserInputParse.h>
53#include <lal/PulsarDataTypes.h>
54
55/**
56 * \defgroup SFTfileIO_h Header SFTfileIO.h
57 * \ingroup lalpulsar_sft
58 * \author R. Prix, B. Machenschalk, A.M. Sintes, B. Krishnan, I. Gholami,
59 * C. Messenger, K. Wette, P. Covas, D. Keitel, R. Tenorio
60 *
61 * \brief Module for reading/writing/manipulating SFTs (Short Fourier Transforms)
62 *
63 * This implements the SFT (Short Fourier Transforms) standard defined
64 * in \cite SFT-spec . It contains various helper functions to create, handle,
65 * combine, and destroy SFTs and related data structures, including SFTtype,
66 * SFTVector, SFTCatalog (and their multi-detector generalizations) as well as
67 * tools for dealing with SFT timestamps and semicoherent analysis segments.
68 *
69 * <p>
70 * <h2>Overview</h2>
71 * - \ref Time-freq-convention-func "Time range/frequency bin convention functions".
72 * - SFT types:
73 * \ref SFT-type-cdtor-func "create/destroy functions",
74 * \ref SFT-type-mod-func "modify functions",
75 * \ref SFT-type-prop-func "property functions".
76 * - SFT timestamp types:
77 * \ref SFT-timestamp-cdtor-func "create/destroy functions",
78 * \ref SFT-timestamp-prop-func "property functions",
79 * \ref SFT-timestamp-gen-func "generation functions".
80 * - SFT catalog types:
81 * \ref SFT-catalog-cdtor-func "create/destroy functions",
82 * \ref SFT-catalog-prop-func "property functions",
83 * \ref SFT-catalog-gen-func "generation functions".
84 * - SFT files:
85 * \ref SFT-file-naming-func "file naming convention functions",
86 * \ref SFT-file-read-func "file reading functions",
87 * \ref SFT-file-write-func "file writing functions".
88 *
89 * <p>
90 * <h2>Usage: Reading of SFT-files</h2>
91 *
92 * The basic operation of <b>reading SFTs</b> from files proceeds in two simple steps:
93 *
94 * - XLALSFTdataFind(): get an SFTCatalog of SFTs matching certain requirements (free with XLALDestroySFTCatalog())
95 * - XLALLoadSFTs(): load a frequency-band into a single-IFO SFTVector defined by the catalogue, OR <br>
96 * XLALLoadMultiSFTs(): load a frequency-band into a MultiSFTVector defined by the catalogue
97 *
98 * <b>Note 1:</b> currently supported SFT file-formats are (merged or single) SFT files.
99 * This might be extended in the future to support further file-formats (frames?).
100 * None of the following API depends on the details of the underlying file-format. This will ensure that
101 * codes using the following functions will NOT have to be changed irrespective of SFT file-format used.
102 *
103 * <b>Note 2:</b> irrespective of the underlying SFT file-format, the returned SFTs (SFTVector) will
104 * <em>ALWAYS</em> be normalized according the the LAL-specification for frequency-series
105 * (<tt>LIGO-T010095-00</tt>), that is the pure DFT of the time-series \f$ x_j \f$ is <em>multiplied</em>
106 * by the time-step \f$ \Delta t \f$ :
107 * \f[
108 * \mathrm{data}[k] = X^\mathrm{d}_k = \Delta t \,\sum_{j=0}^{N-1} x_j \,e^{-i2\pi \,k \,j / N}
109 * \f]
110 *
111 * <h4>Details to 1: find matching SFTs and get the SFTCatalog:</h4>
112 *
113 * Thes function XLALSFTdataFind() returns an SFTCatalog of matching SFTs for a given file-pattern
114 * (e.g. "SFT.*", "SFT.000", "/some/path/some_files_[0-9]?.sft", etc ) and additional, optional SFTConstraints.
115 *
116 * The optional constraints are:
117 * - detector-prefix (e.g. "H1", "H2", "L1", "G1", "V1", etc..)
118 * - GPS start-time + end-time
119 * - a list of GPS-timestamps
120 *
121 * <b>Note 1:</b> Any constraint can be specified as \c NULL, all given constraints will be
122 * combined by logical \c AND.
123 *
124 * <b>Note 2:</b> if a timestamps-list is given, *ALL* timestamps within
125 * <tt>[minStartTime, maxStartTime)</tt> MUST be found!]
126 *
127 * <b>Note 3:</b> XLALSFTdataFind() will refuse to return any SFTs without their detector-name
128 * properly set.
129 *
130 * The returned SFTCatalog is a vector of SFTDescriptor describing one SFT, with the fields
131 * - \c locator: an opaque data-type describing where to read this SFT from.
132 * - \c header: the SFts header
133 * - \c comment: the comment-string found in the SFT, if any
134 * - \c numBins: the number of frequency-bins in the SFT
135 * - \c version: version-number of SFT file-format
136 * - \c crc64: the crc64 checksum reported by this SFT
137 *
138 * One can use the following catalog-handling API functions:
139 * - XLALDestroySFTCatalog(): free up a complete SFTCatalog
140 * - XLALSFTtimestampsFromCatalog(): extract the list of SFT timestamps found in the SFTCatalog
141 * - XLALDestroyTimestampVector(): free up a timestamps-vector (\c LIGOTimeGPSVector)
142 * - XLALshowSFTLocator(): [*debugging only*] show a static string describing the 'locator'
143 *
144 * <b>NOTE:</b> The SFTs in the returned catalogue are \em guaranteed to
145 * - be sorted in order of increasing GPS-epoch
146 * - contain a valid detector-name
147 *
148 * <h4>Details to 2: load frequency-band from SFTs described in an SFTCatalog</h4>
149 *
150 * The function XLALLoadSFTs() takes an SFTCatalog and reads the smallest frequency-band containing <tt>[fMin, fMax]</tt>
151 * from the SFTs, returning the resulting SFTVector. Note that this function will return an error if the
152 * SFTCatalog contains SFTs from different detectors, for which XLALLoadMultiSFTs() must be used.
153 *
154 * The frequency-bounds are optional and \c -1 can be used to specify an 'open bound', i.e.<br>
155 * <tt>[-1, fMax]</tt>: read from first frequency-bin in the SFT up to \c fMax.<br>
156 * <tt>[fMin, -1]</tt>: read from \c fMin up to last frequency-bin in the SFTS<br>
157 * <tt>[-1, -1]</tt>: read ALL frequency-bins from SFT.
158 *
159 * The function XLALLoadMultiSFTs() is similar to the above, except that it accepts an SFTCatalog with different detectors,
160 * and returns corresponding multi-IFO vector of SFTVectors.
161 *
162 * <p><h2>Usage: Writing of SFT-files</h2>
163 *
164 * For <b>writing SFTs</b>:
165 * - XLALWriteSFT2file(): write a single SFT (SFTtype) into an SFT-file following the specification \cite SFT-spec .
166 */
167
168/** @{ */
169
170/*---------- exported types ----------*/
171
172/** A so-called 'SFT' (short-Fourier-transform) will be stored in a COMPLEX8FrequencySeries */
174
175/** The corresponding vector-type to hold a vector of 'SFTs' */
177
178/** A collection of SFT vectors -- one for each IFO in a multi-IFO search */
179typedef struct tagMultiSFTVector {
180#ifdef SWIG /* SWIG interface directives */
181 SWIGLAL( ARRAY_1D( MultiSFTVector, SFTVector *, data, UINT4, length ) );
182#endif /* SWIG */
183 UINT4 length; /**< number of ifos */
184 SFTVector **data; /**< sftvector for each ifo */
186
187/** A vector of 'timestamps' of type LIGOTimeGPS */
188typedef struct tagLIGOTimeGPSVector {
189#ifdef SWIG /* SWIG interface directives */
190 SWIGLAL( ARRAY_1D( LIGOTimeGPSVector, LIGOTimeGPS, data, UINT4, length ) );
191#endif /* SWIG */
192 UINT4 length; /**< number of timestamps */
193 LIGOTimeGPS *data; /**< array of timestamps */
194 REAL8 deltaT; /**< 'length' of each timestamp (e.g. typically Tsft) */
196
197/** A collection of (multi-IFO) LIGOTimeGPSVector time-stamps vectors */
198typedef struct tagMultiLIGOTimeGPSVector {
199#ifdef SWIG /* SWIG interface directives */
200 SWIGLAL( ARRAY_1D( MultiLIGOTimeGPSVector, LIGOTimeGPSVector *, data, UINT4, length ) );
201#endif /* SWIG */
202 UINT4 length; /**< number of timestamps vectors or ifos */
203 LIGOTimeGPSVector **data; /**< timestamps vector for each ifo */
205
206/**
207 * 'Constraints' for SFT-matching: which detector, within which time-stretch and which
208 * timestamps exactly should be loaded ?
209 * Any of the entries is optional, and they will be combined by logical AND.
210 * Note however, that *ALL* timestamps within [minStartTime, maxStartTime) MUST be found if specified.
211 */
212typedef struct tagSFTConstraints {
213 CHAR *detector; /**< 2-char channel-prefix describing the detector (eg 'H1', 'H2', 'L1', 'G1' etc) */
214 LIGOTimeGPS *minStartTime; /**< only include SFTs whose epoch is >= minStartTime */
215 LIGOTimeGPS *maxStartTime; /**< only include SFTs whose epoch is < maxStartTime */
216 LIGOTimeGPSVector *timestamps; /**< list of timestamps */
218
219/**
220 * A 'descriptor' of an SFT: basically containing the header-info plus an opaque description
221 * of where exactly to load this SFT from.
222 */
223#ifdef SWIG /* SWIG interface directives */
224SWIGLAL( IMMUTABLE_MEMBERS( tagSFTDescriptor, window_type ) );
225#endif /* SWIG */
226typedef struct tagSFTDescriptor {
227 struct tagSFTLocator *locator; /**< *internal* description of where to find this SFT [opaque!] */
228 SFTtype header; /**< SFT-header info */
229 const char *window_type; /**< window function applied to SFT */
230 REAL8 window_param; /**< parameter of window function, if required */
231 CHAR *comment; /**< comment-entry in SFT-header */
232 UINT4 numBins; /**< number of frequency-bins in this SFT */
233 UINT4 version; /**< SFT-specification version */
234 UINT8 crc64; /**< crc64 checksum */
236
237/** An "SFT-catalogue": a vector of SFTdescriptors, as returned by XLALSFTdataFind() */
238typedef struct tagSFTCatalog {
239#ifdef SWIG /* SWIG interface directives */
240 SWIGLAL( ARRAY_1D( SFTCatalog, SFTDescriptor, data, UINT4, length ) );
241#endif /* SWIG */
242 UINT4 length; /**< number of SFTs in catalog */
243 SFTDescriptor *data; /**< array of data-entries describing matched SFTs */
244} SFTCatalog;
245
246/**
247 * A multi-SFT-catalogue "view": a multi-IFO vector of SFT-catalogs
248 *
249 * Note: this is only a multi-IFO "view" of an existing SFTCatalog,
250 * various allocated memory of the original catalog is only
251 * pointed to, not duplicated!
252 * This means one must not free the original catalog
253 * while this multi-view is still in use!
254 */
255typedef struct tagMultiSFTCatalogView {
256#ifdef SWIG /* SWIG interface directives */
257 SWIGLAL( ARRAY_1D( MultiSFTCatalogView, SFTCatalog, data, UINT4, length ) );
258#endif /* SWIG */
259 UINT4 length; /**< number of detectors */
260 SFTCatalog *data; /**< array of SFT-catalog pointers */
262
263/**
264 * Structure specifying an SFT file name, following the convention in \cite SFT-spec .
265 */
266typedef struct tagSFTFilenameSpec {
267 CHAR path[4096]; /**< Path to the SFT file */
268 CHAR extn[32]; /**< Extension of the SFT file; defaults to 'sft' */
269 UINT4 numSFTs; /**< Number of SFTs in the file; set by \c XLALWriteSFT[Vector]2StandardFile() */
270 CHAR detector[3]; /**< 2-character detector prefix (e.g. 'H1', 'L1', 'V1'); set by \c XLALWriteSFT[Vector]2StandardFile() */
271 UINT4 SFTtimebase; /**< Timebase in seconds of the SFT; set by \c XLALWriteSFT[Vector]2StandardFile() */
272 CHAR window_type[32]; /**< window function applied to SFT */
273 REAL8 window_param; /**< parameter of window function, if required */
274 UINT4 gpsStart; /**< GPS time in seconds at the beginning of the first SFT in the file; set by \c XLALWriteSFT[Vector]2StandardFile() */
275 UINT4 SFTspan; /**< Total time interval in seconds covered by SFT file; set by \c XLALWriteSFT[Vector]2StandardFile() */
276 CHAR privMisc[256]; /**< For private SFTs: miscellaneous description field */
277 UINT4 pubObsRun; /**< For public SFTs: observing run number */
278 CHAR pubObsKind[4]; /**< For public SFTs: kind of data ('RUN', 'AUX', 'SIM', 'DEV') */
279 UINT4 pubRevision; /**< For public SFTs: revision number of SFT production */
280 CHAR pubChannel[256]; /**< For public SFTs: channel name of data used to make SFTs */
281 UINT4 nbFirstBinFreq; /**< For narrow-band SFTs: SFT first bin frequency divided by SFT time base, rounded down */
282 UINT4 nbFirstBinRem; /**< For narrow-band SFTs: remainder of division of SFT first bin frequency by SFT time base */
283 UINT4 nbBinWidthFreq; /**< For narrow-band SFTs: SFT bandwidth divided by SFT time base, rounded down */
284 UINT4 nbBinWidthRem; /**< For narrow-band SFTs: remainder of division of SFT bandwidth by SFT time base */
286
287/*---------- exported prototypes [API] ----------*/
288
289/**
290 * \name Time range/frequency bin convention functions
291 * \anchor Time-freq-convention-func
292 */
293/** @{ */
294
295// These functions are defined in SFTtypes.c
296
297int XLALCWGPSinRange( const LIGOTimeGPS gps, const LIGOTimeGPS *minGPS, const LIGOTimeGPS *maxGPS );
298
301
302int XLALFindCoveringSFTBins( UINT4 *firstBin, UINT4 *numBins, REAL8 fMinIn, REAL8 BandIn, REAL8 Tsft );
303
304/** @} */
305
306/**
307 * \name SFT type create/destroy functions
308 * \anchor SFT-type-cdtor-func
309 */
310/** @{ */
311
312// These functions are defined in SFTtypes.c
313
315void XLALDestroySFT( SFTtype *sft );
316int XLALCopySFT( SFTtype *dest, const SFTtype *src );
317
320void XLALDestroySFTVector( SFTVector *vect );
322
326
327int XLALExtractBandFromSFT( SFTtype **outSFT, const SFTtype *inSFT, REAL8 fMin, REAL8 Band );
330
331int XLALExtractStrictBandFromSFT( SFTtype **outSFT, const SFTtype *inSFT, REAL8 fMin, REAL8 Band );
334
335/** @} */
336
337/**
338 * \name SFT type modify functions
339 * \anchor SFT-type-mod-func
340 */
341/** @{ */
342
343// These functions are defined in SFTtypes.c
344
345int XLALAppendSFT2Vector( SFTVector *vect, const SFTtype *sft );
346
348
349int XLALSFTAdd( SFTtype *a, const SFTtype *b );
350int XLALSFTVectorAdd( SFTVector *a, const SFTVector *b );
352
356
357/** @} */
358
359/**
360 * \name SFT type property functions
361 * \anchor SFT-type-prop-func
362 */
363/** @{ */
364
365// These functions are defined in SFTtypes.c
366
367int XLALEarliestMultiSFTsample( LIGOTimeGPS *out, const MultiSFTVector *multisfts );
368int XLALLatestMultiSFTsample( LIGOTimeGPS *out, const MultiSFTVector *multisfts );
369
372
373/** @} */
374
375/**
376 * \name SFT timestamp type create/destroy functions
377 * \anchor SFT-timestamp-cdtor-func
378 */
379/** @{ */
380
381// These functions are defined in SFTtimestamps.c
382
386
389
390/** @} */
391
392/**
393 * \name SFT timestamp type property functions
394 * \anchor SFT-timestamp-prop-func
395 */
396/** @{ */
397
398// These functions are defined in SFTtimestamps.c
399
400int XLALFindTimesliceBounds( UINT4 *iStart, UINT4 *iEnd, const LIGOTimeGPSVector *timestamps, const LIGOTimeGPS *minStartGPS, const LIGOTimeGPS *maxStartGPS );
401
402/** @} */
403
404/**
405 * \name SFT timestamp generation functions
406 * \anchor SFT-timestamp-gen-func
407 */
408/** @{ */
409
410// These functions are defined in SFTtimestamps.c
411
414
417
418LIGOTimeGPSVector *XLALReadTimestampsFileConstrained( const CHAR *fname, const LIGOTimeGPS *minGPS, const LIGOTimeGPS *maxGPS );
420
423
426
427LALSegList *XLALReadSegmentsFromFile( const char *fname );
428
430
431/** @} */
432
433/**
434 * \name SFT catalog create/destroy functions
435 * \anchor SFT-catalog-cdtor-func
436 */
437/** @{ */
438
439// These functions are defined in SFTcatalog.c
440
441SFTCatalog *XLALSFTdataFind( const CHAR *file_pattern, const SFTConstraints *constraints );
442void XLALDestroySFTCatalog( SFTCatalog *catalog );
443
446
447/** @} */
448
449/**
450 * \name SFT catalog property functions
451 * \anchor SFT-catalog-prop-func
452 */
453/** @{ */
454
455// These functions are defined in SFTcatalog.c
456
457int XLALCheckCRCSFTCatalog( BOOLEAN *crc_check, SFTCatalog *catalog );
458
460INT4 XLALCountIFOsInCatalog( const SFTCatalog *catalog );
461
462const CHAR *XLALshowSFTLocator( const struct tagSFTLocator *locator );
463
464#ifndef SWIG // exclude from SWIG interface
465int XLALSFTCatalogTimeslice( SFTCatalog *slice, const SFTCatalog *catalog, const LIGOTimeGPS *minStartGPS, const LIGOTimeGPS *maxStartGPS );
466#endif
467#ifdef SWIG // SWIG interface directives
468SWIGLAL( RETURN_OWNED_BY_1ST_ARG( SFTCatalog *, XLALReturnSFTCatalogTimeslice ) );
469#endif
470SFTCatalog *XLALReturnSFTCatalogTimeslice( const SFTCatalog *catalog, const LIGOTimeGPS *minStartGPS, const LIGOTimeGPS *maxStartGPS );
471
472/** @} */
473
474/**
475 * \name SFT catalog generation functions
476 * \anchor SFT-catalog-gen-func
477 */
478/** @{ */
479
480// These functions are defined in SFTcatalog.c
481
484
485/** @} */
486
487/**
488 * \name SFT file naming convention functions
489 * \anchor SFT-file-naming-func
490 */
491/** @{ */
492
493// These functions are defined in SFTnaming.c
494
495int XLALRegisterSpecialCWDetector( const LALDetector *specialDetector );
496int XLALFindCWDetector( CHAR **prefix, INT4 *lalCachedIndex, const CHAR *name, const BOOLEAN exactMatch );
499const LALDetector *XLALGetSiteInfo( const CHAR *name );
500
501int 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 );
503int XLALParseSFTFilenameIntoSpec( SFTFilenameSpec *spec, const char *SFTpath );
504int XLALCheckValidDescriptionField( const char *desc );
505int XLALCompareSFTWindows( const CHAR *type1, const REAL8 param1, const CHAR *type2, const REAL8 param2 );
506
507/** @} */
508
509/**
510 * \name SFT file reading functions
511 * \anchor SFT-file-read-func
512 */
513/** @{ */
514
515// These functions are defined in FindFiles.c
516
517LALStringVector *XLALFindFiles( const CHAR *globstring );
518
519// These functions are defined in SFTfileIO.c
520
521SFTVector *XLALLoadSFTs( const SFTCatalog *catalog, REAL8 fMin, REAL8 fMax );
522
525
526// These functions are defined in SFDBfileIO.c
527
528MultiSFTVector *XLALReadSFDB( REAL8 f_min, REAL8 f_max, const CHAR *file_pattern, const CHAR *timeStampsStarting, const CHAR *timeStampsFinishing );
529
530/** @} */
531
532/**
533 * \name SFT file writing functions
534 * \anchor SFT-file-write-func
535 */
536/** @{ */
537
538// These functions are defined in SFTfileIO.c
539
540int XLALWriteSFT2FilePointer( const SFTtype *sft, FILE *fp, const CHAR *SFTwindowtype, const REAL8 SFTwindowparam, const CHAR *SFTcomment );
541int XLALWriteSFT2NamedFile( const SFTtype *sft, const CHAR *SFTfilename, const CHAR *SFTwindowtype, const REAL8 SFTwindowparam, const CHAR *SFTcomment );
542int XLALWriteSFT2StandardFile( const SFTtype *sft, SFTFilenameSpec *SFTfnspec, const CHAR *SFTcomment );
543
544int XLALWriteSFTVector2NamedFile( const SFTVector *sftVect, const CHAR *SFTfilename, const CHAR *SFTwindowtype, const REAL8 SFTwindowparam, const CHAR *SFTcomment );
545int XLALWriteSFTVector2StandardFile( const SFTVector *sftVect, SFTFilenameSpec *SFTfnspec, const CHAR *SFTcomment, const BOOLEAN merged );
546
547int XLALCheckSFTFileIsValid( const char *fname );
548
549/** @} */
550
551/** @} */
552
553#ifdef __cplusplus
554} /* Close C++ protection */
555#endif
556
557#endif /* Close double-include protection */
const char * window_type
Definition: SFTnaming.c:44
const char * name
Definition: SearchTiming.c:93
LIGOTimeGPSVector * timestamps
unsigned char BOOLEAN
uint64_t UINT8
double REAL8
char CHAR
uint32_t UINT4
int32_t INT4
static const INT4 a
int XLALSFTVectorResizeBand(SFTVector *SFTs, REAL8 f0, REAL8 Band)
Resize the frequency-band of a given SFT vector to [f0, f0+Band].
Definition: SFTtypes.c:917
SFTtype * XLALCreateSFT(UINT4 numBins)
XLAL function to create one SFT-struct.
Definition: SFTtypes.c:152
SFTVector * XLALDuplicateSFTVector(const SFTVector *sftsIn)
Create a complete copy of an SFT vector.
Definition: SFTtypes.c:328
const LALDetector * XLALGetSiteInfo(const CHAR *name)
Find the site geometry-information 'LALDetector' for given a detector name (or prefix).
Definition: SFTnaming.c:218
int XLALRegisterSpecialCWDetector(const LALDetector *specialDetector)
Register a special detector for use with CW codes.
Definition: SFTnaming.c:73
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
LIGOTimeGPSVector * XLALMakeTimestamps(LIGOTimeGPS tStart, REAL8 Tspan, REAL8 Tsft, REAL8 Toverlap)
Given a start-time, Tspan, Tsft and Toverlap, returns a list of timestamps covering this time-stretch...
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 XLALDestroyMultiSFTCatalogView(MultiSFTCatalogView *multiView)
Destroys a MultiSFTCatalogView, without freeing the original catalog that the 'view' was referring to...
Definition: SFTcatalog.c:496
COMPLEX8FrequencySeries SFTtype
A so-called 'SFT' (short-Fourier-transform) will be stored in a COMPLEX8FrequencySeries.
Definition: SFTfileIO.h:173
int XLALSFTVectorAdd(SFTVector *a, const SFTVector *b)
Adds SFT-data from SFTvector 'b' to elements of SFTVector 'a'.
Definition: SFTtypes.c:811
void XLALDestroyMultiSFTVector(MultiSFTVector *multvect)
Destroy a multi SFT-vector.
Definition: SFTtypes.c:424
LIGOTimeGPSVector * XLALExtractTimestampsFromSFTs(const SFTVector *sfts)
Extract timstamps-vector from the given SFTVector.
MultiLIGOTimeGPSVector * XLALReadMultiTimestampsFilesConstrained(const LALStringVector *fnames, const LIGOTimeGPS *minGPS, const LIGOTimeGPS *maxGPS)
Load several timestamps files, return a MultiLIGOTimeGPSVector struct, allocated here.
MultiLIGOTimeGPSVector * XLALMakeMultiTimestamps(LIGOTimeGPS tStart, REAL8 Tspan, REAL8 Tsft, REAL8 Toverlap, UINT4 numDet)
Same as XLALMakeTimestamps() just for several detectors, additionally specify the number of detectors...
MultiSFTVector * XLALExtractStrictBandFromMultiSFTVector(const MultiSFTVector *inSFTs, REAL8 fMin, REAL8 Band)
Return a copy of a MultiSFT vector containing only the bins in [fMin, fMin+Band).
Definition: SFTtypes.c:691
COMPLEX8FrequencySeriesVector SFTVector
The corresponding vector-type to hold a vector of 'SFTs'.
Definition: SFTfileIO.h:176
CHAR * XLALGetChannelPrefix(const CHAR *name)
Find the valid CW detector prefix.
Definition: SFTnaming.c:203
SFTCatalog * XLALMultiAddToFakeSFTCatalog(SFTCatalog *catalog, const LALStringVector *detectors, const MultiLIGOTimeGPSVector *timestamps)
Multi-detector and multi-timestamp wrapper of XLALAddToFakeSFTCatalog().
Definition: SFTcatalog.c:749
SFTCatalog * XLALReturnSFTCatalogTimeslice(const SFTCatalog *catalog, const LIGOTimeGPS *minStartGPS, const LIGOTimeGPS *maxStartGPS)
Definition: SFTcatalog.c:670
int XLALExtractBandFromSFT(SFTtype **outSFT, const SFTtype *inSFT, REAL8 fMin, REAL8 Band)
Return an SFTs containing only the bins in [fMin, fMin+Band].
Definition: SFTtypes.c:456
MultiSFTVector * XLALExtractBandFromMultiSFTVector(const MultiSFTVector *inSFTs, REAL8 fMin, REAL8 Band)
Return a MultiSFT vector containing only the bins in [fMin, fMin+Band].
Definition: SFTtypes.c:572
int XLALExtractStrictBandFromSFT(SFTtype **outSFT, const SFTtype *inSFT, REAL8 fMin, REAL8 Band)
Return a copy of an SFT containing only the bins in [fMin, fMin+Band).
Definition: SFTtypes.c:601
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
MultiSFTCatalogView * XLALGetMultiSFTCatalogView(const SFTCatalog *catalog)
Return a MultiSFTCatalogView generated from an input SFTCatalog.
Definition: SFTcatalog.c:380
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
int XLALMultiSFTVectorResizeBand(MultiSFTVector *multiSFTs, REAL8 f0, REAL8 Band)
Resize the frequency-band of a given multi-SFT vector to [f0, f0+Band].
Definition: SFTtypes.c:946
int XLALFindTimesliceBounds(UINT4 *iStart, UINT4 *iEnd, const LIGOTimeGPSVector *timestamps, const LIGOTimeGPS *minStartGPS, const LIGOTimeGPS *maxStartGPS)
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
int XLALSFTResizeBand(SFTtype *SFT, REAL8 f0, REAL8 Band)
Resize the frequency-band of a given SFT to [f0, f0+Band].
Definition: SFTtypes.c:878
int XLALWriteSFT2FilePointer(const SFTtype *sft, FILE *fp, const CHAR *SFTwindowtype, const REAL8 SFTwindowparam, const CHAR *SFTcomment)
Write the given SFTtype to a FILE pointer.
Definition: SFTfileIO.c:488
int XLALAppendSFT2Vector(SFTVector *vect, const SFTtype *sft)
Append the given SFTtype to the SFT-vector (no SFT-specific checks are done!)
Definition: SFTtypes.c:716
SFTVector * XLALCreateEmptySFTVector(UINT4 numSFTs)
XLAL function to create an SFTVector of numSFT SFTs (which are not allocated).
Definition: SFTtypes.c:276
MultiLIGOTimeGPSVector * XLALTimestampsFromMultiSFTCatalogView(const MultiSFTCatalogView *multiView)
Given a multi-SFTCatalogView, return a MultiLIGOTimeGPSVector holding the SFT timestamps.
LALSegList * XLALReadSegmentsFromFile(const char *fname)
Function to read a segment list from given filename, returns a sorted LALSegList.
MultiSFTVector * XLALExtractMultiSFTVectorWithMultiTimestamps(const MultiSFTVector *multiSFTs, const MultiLIGOTimeGPSVector *multiTimestamps)
Extract a MultiSFTVector from another MultiSFTVector but only those timestamps matching.
Definition: SFTtypes.c:1116
LIGOTimeGPSVector * XLALCreateTimestampVector(UINT4 len)
Allocate a LIGOTimeGPSVector.
Definition: SFTtimestamps.c:47
LALStringVector * XLALListIFOsInCatalog(const SFTCatalog *catalog)
Return a sorted string vector listing the unique IFOs in the given catalog.
Definition: SFTcatalog.c:562
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
MultiSFTVector * XLALLoadMultiSFTsFromView(const MultiSFTCatalogView *multiCatalogView, REAL8 fMin, REAL8 fMax)
This function loads a MultiSFTVector from a given input MultiSFTCatalogView, otherwise the documentat...
Definition: SFTfileIO.c:449
int XLALSFTAdd(SFTtype *a, const SFTtype *b)
Adds SFT-data from SFT 'b' to SFT 'a'.
Definition: SFTtypes.c:775
int XLALCompareSFTWindows(const CHAR *type1, const REAL8 param1, const CHAR *type2, const REAL8 param2)
Check whether two SFT windows, each defined by a type name and parameter value, match.
Definition: SFTnaming.c:667
char * XLALBuildSFTFilenameFromSpec(const SFTFilenameSpec *spec)
Build an SFT file name from the given specification.
Definition: SFTnaming.c:302
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
int XLALCopySFT(SFTtype *dest, const SFTtype *src)
Copy an entire SFT-type into another.
Definition: SFTtypes.c:202
UINT4 XLALRoundFrequencyUpToSFTBin(const REAL8 freq, const REAL8 df)
Round a REAL8 frequency up to the nearest integer SFT bin number.
Definition: SFTtypes.c:82
SFTCatalog * XLALAddToFakeSFTCatalog(SFTCatalog *catalog, const CHAR *detector, const LIGOTimeGPSVector *timestamps)
Create a 'fake' SFT catalog which contains only detector and timestamp information.
Definition: SFTcatalog.c:692
LIGOTimeGPSVector * XLALResizeTimestampVector(LIGOTimeGPSVector *vector, UINT4 length)
Resize a LIGOTimeGPSVector.
Definition: SFTtimestamps.c:85
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
LIGOTimeGPSVector * XLALTimestampsFromSegmentFile(const char *filename, REAL8 Tsft, REAL8 Toverlap, BOOLEAN adjustSegExtraTime, BOOLEAN synchronize)
Extract timestamps-vector from a segment file, with functionality based on MakeSFTDAG The filename sh...
MultiSFTVector * XLALCreateEmptyMultiSFTVector(UINT4Vector *numsft)
Create an empty multi-IFO SFT vector with a given number of SFTs per IFO (which are not allocated).
Definition: SFTtypes.c:394
int XLALLatestMultiSFTsample(LIGOTimeGPS *out, const MultiSFTVector *multisfts)
Find the time of the end of the latest SFT in a multi-SFT data structure.
Definition: SFTtypes.c:1016
int XLALFindCWDetector(CHAR **prefix, INT4 *lalCachedIndex, const CHAR *name, const BOOLEAN exactMatch)
Parses valid CW detector names and prefixes.
Definition: SFTnaming.c:118
UINT4 XLALRoundFrequencyDownToSFTBin(const REAL8 freq, const REAL8 df)
Round a REAL8 frequency down to the nearest integer SFT bin number.
Definition: SFTtypes.c:70
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
const CHAR * XLALshowSFTLocator(const struct tagSFTLocator *locator)
Mostly for debugging purposes: provide a user-API to allow inspecting the SFT-locator [which is an OP...
Definition: SFTcatalog.c:602
void XLALDestroySFT(SFTtype *sft)
Destructor for one SFT.
Definition: SFTtypes.c:176
int XLALReorderMultiSFTVector(MultiSFTVector *multiSFTs, const LALStringVector *IFOs)
Reorder the MultiSFTVector with specified list of IFOs.
Definition: SFTtypes.c:738
int XLALCheckValidDescriptionField(const char *desc)
Check whether given string qualifies as a valid 'description' field of a FRAME filename (per ) or SFT...
Definition: SFTnaming.c:639
int XLALWriteSFTVector2NamedFile(const SFTVector *sftVect, const CHAR *SFTfilename, const CHAR *SFTwindowtype, const REAL8 SFTwindowparam, const CHAR *SFTcomment)
Write the given SFTVector to a single merged SFT file with the supplied filename.
Definition: SFTfileIO.c:712
MultiLIGOTimeGPSVector * XLALExtractMultiTimestampsFromSFTs(const MultiSFTVector *multiSFTs)
Given a multi-SFT vector, return a MultiLIGOTimeGPSVector holding the SFT timestamps.
int XLALMultiSFTVectorAdd(MultiSFTVector *a, const MultiSFTVector *b)
Adds SFT-data from MultiSFTvector 'b' to elements of MultiSFTVector 'a'.
Definition: SFTtypes.c:842
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 XLALCWGPSinRange(const LIGOTimeGPS gps, const LIGOTimeGPS *minGPS, const LIGOTimeGPS *maxGPS)
Defines the official CW convention for whether a GPS time is 'within' a given range,...
Definition: SFTtypes.c:52
int XLALWriteSFT2StandardFile(const SFTtype *sft, SFTFilenameSpec *SFTfnspec, const CHAR *SFTcomment)
Write the given SFTtype to a SFT file with a standard () filename.
Definition: SFTfileIO.c:656
int XLALParseSFTFilenameIntoSpec(SFTFilenameSpec *spec, const char *SFTpath)
Parse a SFT file path and return its specification.
Definition: SFTnaming.c:463
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
void XLALDestroyMultiTimestamps(MultiLIGOTimeGPSVector *multiTS)
Destroy a MultiLIGOTimeGPSVector timestamps vector.
MultiLIGOTimeGPSVector * XLALCreateMultiLIGOTimeGPSVector(UINT4 numDetectors)
Simple creator function for MultiLIGOTimeGPSVector with numDetectors entries.
SFTVector * XLALCreateSFTVector(UINT4 numSFTs, UINT4 numBins)
XLAL function to create an SFTVector of numSFT SFTs with SFTlen frequency-bins (which will be allocat...
Definition: SFTtypes.c:230
int XLALSFTCatalogTimeslice(SFTCatalog *slice, const SFTCatalog *catalog, const LIGOTimeGPS *minStartGPS, const LIGOTimeGPS *maxStartGPS)
Set a SFT catalog 'slice' to a timeslice of a larger SFT catalog 'catalog', with entries restricted t...
Definition: SFTcatalog.c:624
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
SFTVector * XLALExtractBandFromSFTVector(const SFTVector *inSFTs, REAL8 fMin, REAL8 Band)
Return a vector of SFTs containing only the bins in [fMin, fMin+Band].
Definition: SFTtypes.c:527
SFTVector * XLALExtractStrictBandFromSFTVector(const SFTVector *inSFTs, REAL8 fMin, REAL8 Band)
Return a copy of a vector of SFTs containing only the bins in [fMin, fMin+Band).
Definition: SFTtypes.c:658
int XLALCheckSFTFileIsValid(const char *fname)
Verify that the contents of a SFT file are valid.
Definition: SFTfileIO.c:834
void XLALDestroyTimestampVector(LIGOTimeGPSVector *vect)
De-allocate a LIGOTimeGPSVector.
Definition: SFTtimestamps.c:69
MultiLIGOTimeGPSVector * XLALReadMultiTimestampsFiles(const LALStringVector *fnames)
backwards compatible wrapper to XLALReadMultiTimestampsFilesConstrained() without GPS-time constraint...
INT4 XLALCountIFOsInCatalog(const SFTCatalog *catalog)
Count the number of the unique IFOs in the given catalog.
Definition: SFTcatalog.c:582
LIGOTimeGPSVector * XLALReadTimestampsFileConstrained(const CHAR *fname, const LIGOTimeGPS *minGPS, const LIGOTimeGPS *maxGPS)
Load timestamps file 'fname' into LIGOTimeGPSVector struct, allocated here.
int XLALEarliestMultiSFTsample(LIGOTimeGPS *out, const MultiSFTVector *multisfts)
Finds the earliest timestamp in a multi-SFT data structure.
Definition: SFTtypes.c:968
SFTVector * XLALExtractSFTVectorWithTimestamps(const SFTVector *sfts, const LIGOTimeGPSVector *timestamps)
Extract an SFTVector from another SFTVector but only those timestamps matching.
Definition: SFTtypes.c:1076
BOOLEAN XLALIsValidCWDetector(const CHAR *name)
Determine if 'name' is a valid detector name or prefix.
Definition: SFTnaming.c:188
LIGOTimeGPSVector * XLALTimestampsFromSFTCatalog(const SFTCatalog *catalog)
Extract timestamps-vector of unique timestamps from the given SFTCatalog.
float data[BLOCKSIZE]
Definition: hwinject.c:360
path
def SFTCatalog(tstart, Tdata, finputdata)
Definition: pw_fstat.py:151
A vector of COMPLEX8FrequencySeries.
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 (multi-IFO) LIGOTimeGPSVector time-stamps vectors.
Definition: SFTfileIO.h:198
UINT4 length
number of timestamps vectors or ifos
Definition: SFTfileIO.h:202
LIGOTimeGPSVector ** data
timestamps vector for each ifo
Definition: SFTfileIO.h:203
A multi-SFT-catalogue "view": a multi-IFO vector of SFT-catalogs.
Definition: SFTfileIO.h:255
SFTCatalog * data
array of SFT-catalog pointers
Definition: SFTfileIO.h:260
UINT4 length
number of detectors
Definition: SFTfileIO.h:259
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
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
A 'descriptor' of an SFT: basically containing the header-info plus an opaque description of where ex...
Definition: SFTfileIO.h:226
SFTtype header
SFT-header info.
Definition: SFTfileIO.h:228
UINT4 version
SFT-specification version.
Definition: SFTfileIO.h:233
struct tagSFTLocator * locator
internal description of where to find this SFT [opaque!]
Definition: SFTfileIO.h:227
UINT4 numBins
number of frequency-bins in this SFT
Definition: SFTfileIO.h:232
UINT8 crc64
crc64 checksum
Definition: SFTfileIO.h:234
const char * window_type
window function applied to SFT
Definition: SFTfileIO.h:229
CHAR * comment
comment-entry in SFT-header
Definition: SFTfileIO.h:231
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
UINT4 pubRevision
For public SFTs: revision number of SFT production.
Definition: SFTfileIO.h:279
UINT4 SFTtimebase
Timebase in seconds of the SFT; set by XLALWriteSFT[Vector]2StandardFile()
Definition: SFTfileIO.h:271
UINT4 SFTspan
Total time interval in seconds covered by SFT file; set by XLALWriteSFT[Vector]2StandardFile()
Definition: SFTfileIO.h:275
UINT4 nbBinWidthRem
For narrow-band SFTs: remainder of division of SFT bandwidth by SFT time base.
Definition: SFTfileIO.h:284
UINT4 gpsStart
GPS time in seconds at the beginning of the first SFT in the file; set by XLALWriteSFT[Vector]2Standa...
Definition: SFTfileIO.h:274
UINT4 nbBinWidthFreq
For narrow-band SFTs: SFT bandwidth divided by SFT time base, rounded down.
Definition: SFTfileIO.h:283
UINT4 nbFirstBinRem
For narrow-band SFTs: remainder of division of SFT first bin frequency by SFT time base.
Definition: SFTfileIO.h:282
UINT4 numSFTs
Number of SFTs in the file; set by XLALWriteSFT[Vector]2StandardFile()
Definition: SFTfileIO.h:269
UINT4 pubObsRun
For public SFTs: observing run number.
Definition: SFTfileIO.h:277
UINT4 nbFirstBinFreq
For narrow-band SFTs: SFT first bin frequency divided by SFT time base, rounded down.
Definition: SFTfileIO.h:281
REAL8 window_param
parameter of window function, if required
Definition: SFTfileIO.h:273