LALPulsar  6.1.0.1-89842e6
LFTandTSutils.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Reinhard Prix
3  * Copyright (C) 2009 Reinhard Prix, Chris Messenger, Pinkesh Patel
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 /**
22  * \defgroup LFTandTSutils_h Header LFTandTSutils.h
23  * \ingroup lalpulsar_sft
24  * \author Reinhard Prix, Chris Messenger
25  * \date 2009
26  * \brief Utility functions for working with Long Fourier Transforms and Time Series.
27  */
28 /** @{ */
29 
30 #ifndef _LFTANDTSUTILS_H /* Double-include protection. */
31 #define _LFTANDTSUTILS_H
32 
33 #ifdef __cplusplus /* C++ protection. */
34 extern "C" {
35 #endif
36 
37 /*---------- exported INCLUDES ----------*/
38 #include <lal/SFTfileIO.h>
39 #include <lal/LALDatatypes.h>
40 #include <lal/LALComputeAM.h>
41 #include <lal/SSBtimes.h>
42 
43 /*---------- exported DEFINES ----------*/
44 
45 /*---------- exported MACROS ----------*/
46 #define NhalfPosDC(N) ( (UINT4)( N / 2 ) + 1 )
47 #define NhalfNeg(N) ( (N) - NhalfPosDC(N) ) /* making sure NhalfPosDC(N) + NhalfNeg(N) = N */
48 
49 /*---------- exported types ----------*/
50 
51 /** Multi-IFO container for COMPLEX8 resampled timeseries */
52 typedef struct tagMultiCOMPLEX8TimeSeries {
53  UINT4 length; /**< number of IFOs */
54  COMPLEX8TimeSeries **data; /**< array of COMPLEX8TimeSeries (pointers) */
56 
57 
58 /** Struct holding the results of comparing two floating-point vectors (real-valued or complex),
59  * using various different comparison metrics
60  */
61 typedef struct tagVectorComparison {
62  REAL4 relErr_L1; ///< relative error between vectors using L1 norm \f$ r_1(x,y) \equiv \frac{|x - y|_1}{0.5(|x|_1 + |y|_1)} \f$
63  REAL4 relErr_L2; ///< relative error between vectors using L2 norm \f$ r_2(x,y) \equiv \frac{|x - y|_2}{0.5(|x|_2 + |y|_2)} \f$
64  REAL4 angleV; ///< angle between the two vectors, according to \f$ \cos\theta = \frac{\Re(x\cdot y^*)}{|x|_2 \, |y|_2} \f$
65  REAL4 relErr_atMaxAbsx; ///< single-sample relative error *at* maximum |sample-value| of first vector 'x'
66  REAL4 relErr_atMaxAbsy; ///< single-sample relative error *at* maximum |sample-value| of second vector 'x'
68 
69 /*---------- exported Global variables ----------*/
70 
71 /*---------- exported prototypes [API] ----------*/
72 
75 SFTtype *XLALSFTVectorToLFT( SFTVector *sfts, REAL8 upsampling );
76 
79 int XLALTimeShiftSFT( SFTtype *sft, REAL8 shift );
80 
83 
85 
90 
92 
93 int XLALSincInterpolateCOMPLEX8TimeSeries( COMPLEX8Vector *y_out, const REAL8Vector *t_out, const COMPLEX8TimeSeries *ts_in, UINT4 Dterms );
95 SFTtype *XLALSincInterpolateSFT( const SFTtype *sft_in, REAL8 f0Out, REAL8 dfOut, UINT4 numBinsOut, UINT4 Dterms );
96 COMPLEX8Vector *XLALrefineCOMPLEX8Vector( const COMPLEX8Vector *in, UINT4 refineby, UINT4 Dterms );
97 
101 
102 /** @} */
103 
104 #ifdef __cplusplus
105 }
106 #endif /* C++ protection. */
107 
108 #endif /* Double-include protection. */
REAL8 tol
double REAL8
uint32_t UINT4
float REAL4
SFTtype * XLALSFTVectorToLFT(SFTVector *sfts, REAL8 upsampling)
Turn the given multi-IFO SFTvectors into one long Fourier transform (LFT) over the total observation ...
Definition: LFTandTSutils.c:64
int XLALReorderFFTWtoSFT(COMPLEX8Vector *X)
Change frequency-bin order from fftw-convention to a 'SFT' ie.
MultiCOMPLEX8TimeSeries * XLALMultiSFTVectorToCOMPLEX8TimeSeries(const MultiSFTVector *multisfts)
Turn the given multiSFTvector into multiple long COMPLEX8TimeSeries, properly dealing with gaps.
int XLALSincInterpolateCOMPLEX8TimeSeries(COMPLEX8Vector *y_out, const REAL8Vector *t_out, const COMPLEX8TimeSeries *ts_in, UINT4 Dterms)
Interpolate a given regularly-spaced COMPLEX8 timeseries 'ts_in = x_in(j * dt)' onto new samples 'y_o...
int XLALFrequencyShiftMultiCOMPLEX8TimeSeries(MultiCOMPLEX8TimeSeries *x, const REAL8 shift)
Multi-detector wrapper for XLALFrequencyShiftCOMPLEX8TimeSeries NOTE: this modifies the MultiCOMPLEX8...
int XLALTimeShiftSFT(SFTtype *sft, REAL8 shift)
Time-shift the given SFT by an amount of 'shift' seconds, using the frequency-domain expression ,...
int XLALFrequencyShiftCOMPLEX8TimeSeries(COMPLEX8TimeSeries *x, const REAL8 shift)
Freq-shift the given COMPLEX8Timeseries by an amount of 'shift' Hz, using the time-domain expression ...
COMPLEX8TimeSeries * XLALSFTVectorToCOMPLEX8TimeSeries(const SFTVector *sftsIn)
Turn the given SFTvector into one long time-series, properly dealing with gaps.
int XLALCopyMultiCOMPLEX8TimeSeries(MultiCOMPLEX8TimeSeries *multiTimesOut, MultiCOMPLEX8TimeSeries *multiTimesIn)
Copies a MultiCOMPLEX8TimeSeries structure, output must be allocated of identical size as input!
int XLALCheckVectorComparisonTolerances(const VectorComparison *result, const VectorComparison *tol)
Check VectorComparison result against specified tolerances, to allow for standardized comparison and ...
int XLALReorderSFTtoFFTW(COMPLEX8Vector *X)
Change frequency-bin order from 'SFT' to fftw-convention ie.
int XLALCompareREAL4Vectors(VectorComparison *result, const REAL4Vector *x, const REAL4Vector *y, const VectorComparison *tol)
Compare two REAL4 vectors using various different comparison metrics.
int XLALCompareCOMPLEX8Vectors(VectorComparison *result, const COMPLEX8Vector *x, const COMPLEX8Vector *y, const VectorComparison *tol)
Compare two COMPLEX8 vectors using various different comparison metrics.
COMPLEX8TimeSeries * XLALDuplicateCOMPLEX8TimeSeries(COMPLEX8TimeSeries *ttimes)
Duplicates a COMPLEX8TimeSeries structure.
int XLALSpinDownCorrectionMultiTS(MultiCOMPLEX8TimeSeries *multiTimeSeries, const PulsarDopplerParams *doppler)
Apply a spin-down correction to the complex8 timeseries using the time-domain expression y(t) = x(t) ...
MultiCOMPLEX8TimeSeries * XLALDuplicateMultiCOMPLEX8TimeSeries(MultiCOMPLEX8TimeSeries *multiTimes)
Duplicates a MultiCOMPLEX8TimeSeries structure.
int XLALCopyCOMPLEX8TimeSeries(COMPLEX8TimeSeries *ts_out, COMPLEX8TimeSeries *ts_in)
Copies a COMPLEX8TimeSeries structure, output must be allocated of identical size as input!
SFTtype * XLALSincInterpolateSFT(const SFTtype *sft_in, REAL8 f0Out, REAL8 dfOut, UINT4 numBinsOut, UINT4 Dterms)
(Complex)Sinc-interpolate an input SFT to an output SFT.
int XLALSincInterpolateCOMPLEX8FrequencySeries(COMPLEX8Vector *y_out, const REAL8Vector *f_out, const COMPLEX8FrequencySeries *fs_in, UINT4 Dterms)
Interpolate a given regularly-spaced COMPLEX8 frequency-series 'fs_in = x_in( k * df)' onto new sampl...
COMPLEX8Vector * XLALrefineCOMPLEX8Vector(const COMPLEX8Vector *in, UINT4 refineby, UINT4 Dterms)
Interpolate frequency-series to newLen frequency-bins.
void XLALDestroyMultiCOMPLEX8TimeSeries(MultiCOMPLEX8TimeSeries *multiTimes)
Destroy a MultiCOMPLEX8TimeSeries structure.
A vector of COMPLEX8FrequencySeries.
Multi-IFO container for COMPLEX8 resampled timeseries.
Definition: LFTandTSutils.h:52
COMPLEX8TimeSeries ** data
array of COMPLEX8TimeSeries (pointers)
Definition: LFTandTSutils.h:54
UINT4 length
number of IFOs
Definition: LFTandTSutils.h:53
A collection of SFT vectors – one for each IFO in a multi-IFO search.
Definition: SFTfileIO.h:179
Type containing the 'Doppler-parameters' affecting the time-evolution of the phase.
Struct holding the results of comparing two floating-point vectors (real-valued or complex),...
Definition: LFTandTSutils.h:61
REAL4 relErr_L2
relative error between vectors using L2 norm
Definition: LFTandTSutils.h:63
REAL4 angleV
angle between the two vectors, according to
Definition: LFTandTSutils.h:64
REAL4 relErr_L1
relative error between vectors using L1 norm
Definition: LFTandTSutils.h:62
REAL4 relErr_atMaxAbsy
single-sample relative error at maximum |sample-value| of second vector 'x'
Definition: LFTandTSutils.h:66
REAL4 relErr_atMaxAbsx
single-sample relative error at maximum |sample-value| of first vector 'x'
Definition: LFTandTSutils.h:65