Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALPulsar 7.1.1.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
fscanutils.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2023 Evan Goetz
3*
4* This program is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation; either version 2 of the License, or
7* (at your option) any later version.
8*
9* This program is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12* GNU General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with with program; see the file COPYING. If not, write to the
16* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17* MA 02110-1301 USA
18*/
19
20/**
21* \file
22* \ingroup lalpulsar_bin_fscan
23*/
24
25#include <lal/SFTfileIO.h>
26#include <lal/LALStdio.h>
27
28#include "fscanutils.h"
29
30/* Extract a single SFT from an SFTCatalog: the SFT indicated by GPS start time with band f_min to f_max*/
31SFTVector *extract_one_sft( const SFTCatalog *full_catalog, const LIGOTimeGPS starttime, const REAL8 f_min, const REAL8 f_max )
32{
33 // Initialize an SFTCatalog
34 SFTCatalog XLAL_INIT_DECL( catalogSlice );
35
36 //Set start time
37 //Set end time just 0.01 seconds after the start time. This is sufficiently small to get just one SFT
38 LIGOTimeGPS thisSFTendtime = starttime;
39 XLAL_CHECK_NULL( XLALGPSAdd( &thisSFTendtime, 0.01 ) != NULL, XLAL_EFUNC );
40
41 // Get the catalog of the single SFT from the full catalog
42 XLAL_CHECK_NULL( XLALSFTCatalogTimeslice( &catalogSlice, full_catalog, &starttime, &thisSFTendtime ) == XLAL_SUCCESS, XLAL_EFUNC );
43
44 // Check that we got one SFT
45 XLAL_CHECK_NULL( catalogSlice.length == 1, XLAL_EFUNC, "Found no unique SFT starting at %d", starttime.gpsSeconds );
46
47 //Extract the SFT
48 SFTVector *sft_vect = NULL;
49 XLAL_CHECK_NULL( ( sft_vect = XLALLoadSFTs( &catalogSlice, f_min, f_max ) ) != NULL, XLAL_EFUNC );
50
51 //Check we got only zero or one SFT; no more
52 XLAL_CHECK_NULL( sft_vect->length == 1, XLAL_EBADLEN, "SFT in catalog could not cover [%.2f, %.2f) Hz", f_min, f_max );
53
54 return sft_vect;
55}
SFTVector * extract_one_sft(const SFTCatalog *full_catalog, const LIGOTimeGPS starttime, const REAL8 f_min, const REAL8 f_max)
Definition: fscanutils.c:31
double REAL8
#define XLAL_INIT_DECL(var,...)
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
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
#define XLAL_CHECK_NULL(assertion,...)
XLAL_EBADLEN
XLAL_SUCCESS
XLAL_EFUNC
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
A vector of COMPLEX8FrequencySeries.
UINT4 length
Number of elements in array.
An "SFT-catalogue": a vector of SFTdescriptors, as returned by XLALSFTdataFind()
Definition: SFTfileIO.h:238
double f_min
double f_max