Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALInspiral 5.0.3.1-ea7c608
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
BandPassInspiralTemplate.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007 Anand Sengupta
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 *
22 * File Name: BandPassInspiralTemplate.c
23 *
24 * Author: Anand Sengupta
25 *
26 *---------------------------------------------------------------------------*/
27
28#include <lal/LALStdio.h>
29#include <lal/LALStdlib.h>
30#include <lal/LALError.h>
31#include <lal/LALDatatypes.h>
32#include <lal/AVFactories.h>
33#include <lal/LALConstants.h>
34
35#include <lal/BandPassTimeSeries.h>
36#include <lal/LALInspiralBank.h>
37#include <lal/RealFFT.h>
38#include <lal/SeqFactories.h>
39
40/**
41 * \author Anand Sengupta
42 */
44 REAL4Sequence *sequence,
45 REAL4 fLow,
46 REAL4 fHigh,
47 REAL4 fSampling
48 )
49{
50 REAL4TimeSeries *signalvec = NULL;
51 PassBandParamStruc signalHighpassParam;
52 PassBandParamStruc signalLowpassParam;
53
54 /* Check that the input makes sense */
55 if ( !sequence || sequence->length <= 0 || !sequence->data ||
56 fLow > fHigh || fLow <= 0.0 || fHigh >= fSampling/2.0 )
58
59 /* Initialize signal */
60 signalvec = (REAL4TimeSeries *)
61 LALCalloc(1, sizeof(REAL4TimeSeries));
62
63 signalvec->deltaT = 1.0/fSampling;
64 signalvec->data = sequence;
65
66 /* Now first high pass the time series beyond fSeismic */
67 signalHighpassParam.nMax = 10;
68 signalHighpassParam.f1 = -1.0;
69 signalHighpassParam.a1 = -1.0;
70 signalHighpassParam.f2 = fLow;
71 signalHighpassParam.a2 = 0.98;
72
73 /* Call the Butterworth routine and check its success */
75 signalvec, &signalHighpassParam ) != XLAL_SUCCESS )
76 {
77 if (signalvec) LALFree( signalvec );
79 }
80
81 /* Now first low pass the time series below fFinal */
82 signalLowpassParam.nMax = 10;
83 signalLowpassParam.f1 = fHigh;
84 signalLowpassParam.a1 = 0.02;
85 signalLowpassParam.f2 = -1.0;
86 signalLowpassParam.a2 = -1.0;
87
88 /* Call the Butterworth routine and check its success */
90 signalvec, &signalLowpassParam ) != XLAL_SUCCESS)
91 {
92 if (signalvec) LALFree( signalvec );
94 }
95
96 /* That's it - we are done and can now free the signal */
97 if (signalvec) LALFree( signalvec );
98
99 return XLAL_SUCCESS;
100
101}
int XLALBandPassInspiralTemplate(REAL4Sequence *sequence, REAL4 fLow, REAL4 fHigh, REAL4 fSampling)
int XLALButterworthREAL4TimeSeries(REAL4TimeSeries *series, PassBandParamStruc *params)
#define LALCalloc(m, n)
#define LALFree(p)
float REAL4
#define XLAL_ERROR(...)
XLAL_SUCCESS
XLAL_EFAULT
XLAL_EFUNC
REAL4Sequence * data
REAL4 * data