packages/pulsar/include/HeterodynePulsar.h

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Jolien Creighton
00003 *
00004 *  This program is free software; you can redistribute it and/or modify
00005 *  it under the terms of the GNU General Public License as published by
00006 *  the Free Software Foundation; either version 2 of the License, or
00007 *  (at your option) any later version.
00008 *
00009 *  This program is distributed in the hope that it will be useful,
00010 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 *  GNU General Public License for more details.
00013 *
00014 *  You should have received a copy of the GNU General Public License
00015 *  along with with program; see the file COPYING. If not, write to the
00016 *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00017 *  MA  02111-1307  USA
00018 */
00019 
00020 /********************************* <lalVerbatim file="HeterodynePulsarHV">
00021 Author: Dupuis, R. J.
00022 $Id: HeterodynePulsar.h,v 1.3 2007/06/08 14:41:50 bema Exp $
00023 ********************************** </lalVerbatim> */
00024 
00025 /********************************* <lalLaTeX>
00026 
00027 \section{Header \texttt{HeterodynePulsar.h}}
00028 
00029 Provides routines to heterodyne, average, and resample the data as required for time domain known pulsar search.
00030 
00031 \subsection*{Synopsis}
00032 \begin{verbatim}
00033 #include <lal/HeterodynePulsar.h>
00034 \end{verbatim}
00035 The gravitational wave signal from a non-precessing pulsar at twice its frequency can be modeled as
00036 
00037 \begin{equation}
00038 h(t) = F_{+}(t;\psi)h_{0}(1 + \cos^{2}\iota)\cos 2 \Psi(t) + 2 F_{\times} h_{0}\cos \iota \sin 2 \Psi(t)
00039 \end{equation}
00040 
00041 where $F_{+,\times}$ are the amplitude responses of the detectors, $\psi$ is the polarization angle,
00042 $\iota$ describes the inclination of the pulsar with respect to the line of sight, and $\Psi(t) =
00043 \phi_{0} + \phi(t)$ describes the phase of the pulsar.
00044 
00045 The phase $\Psi(t)$ of the pulsar is calculated as 
00046 \begin{equation}
00047 \Psi(t) = \phi_{0} +2\pi \left(f_{0}(T - T_{0}) + 
00048 \frac{1}{2}\dot{f_{0}} (T - T_{0})^{2} + 
00049 \frac{1}{6}\ddot{f_{0}}(T - T_{0})^{3}\right)
00050 \end{equation}
00051 where 
00052 \begin{equation}
00053 T = t + \delta t= t + \frac{\vec{r} \cdot \vec{n}}{c}  + \Delta_{E\odot}
00054 \end{equation}
00055 where {\emph T} is the time in a frame inertial with respect to the pulsar and $\phi_{0}$ is the phase of at time $T_{0}$.
00056  The time difference $\delta t$ due to the motion of the earth in the solar system is calculated using
00057  \texttt{LALBarycenter()}.
00058 
00059 The function \texttt{LALCoarseHeterodyne()} heterodynes, averages, and resamples the data at a fixed frequency
00060 near the signal. 
00061 
00062 Let the calibrated data from the inteferometer be $d(t) = h(t) + n(t)$ where $n(t)$ is the noise.  The first step is to mix the
00063 time series with $e^{-2\pi if_{h}}$ where $f_{h}$ is a fixed frequency near the signal.
00064 
00065 \begin{equation}
00066 V_{h}(t) = d(t)e^{-2\pi if_{h}}
00067 \end{equation}
00068 
00069 The function \texttt{LALFineHeterodyneToPulsar()} applies a second heterodyne to the data which removes the spindown
00070 and the Doppler shifts.
00071 
00072 After applying \texttt{LALCoarseHeterodyne()} and \texttt{LALFineHeterodyneToPulsar()} to the data we have
00073 
00074 \begin{equation}
00075 d(t)' = n(t)' + F_{+}(t;\psi)h_{0}(1 + \cos^{2}\iota) e^{i 2\phi_{0}} + 2 F_{\times} h_{0}\cos \iota e^{i 2\phi_{0}}.
00076 \end{equation}
00077 
00078 
00079 More documentation soon.
00080 
00081 \begin{verbatim}
00082 void
00083 LALCoarseHeterodyne(        LALStatus                   *status,
00084                             CoarseHeterodyneOutput      *output,
00085                             CoarseHeterodyneInput       *input,
00086                             CoarseHeterodyneParams      *params );
00087                      
00088 void
00089 LALFineHeterodyneToPulsar(  LALStatus                   *status,
00090                             FineHeterodyneOutput        *output,
00091                             FineHeterodyneInput         *input,
00092                             FineHeterodyneParams        *params );      
00093 \end{verbatim}
00094 
00095 \subsection*{Error conditions}
00096 \input{HeterodynePulsarHE}
00097 
00098 \subsection*{Types}
00099 
00100 \subsubsection*{Structure \texttt{CoarseHeterodyneInput}}
00101 \idx[Type]{CoarseHeterodyneInput}
00102 
00103 \noindent This structure stores the original calibrated gw data.
00104  
00105 \begin{description}
00106 \item[\texttt{REAL4TimeSeries V}] calibrated strain data from detector
00107 
00108 \item[\texttt{REAL4 f0}] heterodyning base frequency
00109 
00110 \end{description}
00111 
00112 \subsubsection*{Structure \texttt{CoarseHeterodyneOutput}}
00113 \idx[Type]{CoarseHeterodyneOutput}
00114 
00115 \noindent This structure stores the output of the heterodyned data.
00116 
00117 \begin{description}
00118 \item[\texttt{COMPLEX8TimeSeries Vh}] heterodyned data
00119 
00120 \item[\texttt{COMPLEX16 varh}] variance of Vh
00121 
00122 \item[\texttt{REAL4 phase}] phase of the reference signal f0 at t0
00123 
00124 \item[\texttt{COMPLEX16 avg}] average of Vh
00125 
00126 \item[\texttt{COMPLEX16 kurt}] kurtosis of Vh
00127 
00128 \item[\texttt{COMPLEX16 skew}] skewness of Vh
00129 
00130 \item[\texttt{COMPLEX16 covar}] first term of covariance of Vh
00131 \end{description}
00132 
00133 \subsubsection*{Structure \texttt{CoarseHeterodyneParams}}
00134 \idx[Type]{CoarseHeterodyneParams}
00135 
00136 \noindent This structure stores parameters for the coarse heterodyne.
00137 
00138 \begin{description}
00139 \item[\texttt{UINT4 boxM}] first decimation factor (and order of boxcar)
00140 
00141 \item[\texttt{REAL4IIRFilter *iirFilter1Re}] first IIR filter to be applied to real part of complex heterodyned data
00142 
00143 \item[\texttt{REAL4IIRFilter *iirFilter1Im}] first IIR filter to be applied to imaginary part of complex heterodyned data
00144 
00145 \item[\texttt{UINT4 iirM}] second decimation factor
00146 
00147 \item[\texttt{REAL4IIRFilter *iirFilter2Re}] second IIR filter to be applied to real part of complex heterodyned data
00148 
00149 \item[\texttt{REAL4IIRFilter *iirFilter2Im}] second IIR filter to be applied to imaginary part of complex heterodyned data
00150 
00151 \item[\texttt{UINT4 stats}] set to 1 to calculate only Vh and variance; 2 for Vh, var, kurt, skew, covar; 0 else
00152 \end{description}
00153 
00154 \subsubsection*{Structure \texttt{FineHeterodyneInput}}
00155 \idx[Type]{FineHeterodyneInput}
00156 \noindent This structure stores the input for the fine heterodyne.
00157 
00158 \begin{description}
00159 \item[\texttt{COMPLEX8TimeSeries Vh}]    heterodyned, averaged and resampled data 
00160 \item[\texttt{COMPLEX8TimeSeries varh}]   variance of corresponding Vh
00161 \item[\texttt{REAL4 f0}]  frequency of the signal 
00162 \item[\texttt{REAL4 f1}]  first time derivative of frequency 
00163 \item[\texttt{REAL4 f2}] second time derivative of frequency 
00164 \item[\texttt{REAL8 fEpochGPS}] epoch of the frequency
00165 \item[\texttt{SkyPosition source}] location of pulsar in sky - equatorial coordinate system 
00166 \item[\texttt{REAL4 pmRA}] proper motion RA (radians / year)
00167 \item[\texttt{REAL4 pmDEC}] proper motion DEC (radians / year)
00168 \item[\texttt{REAL8 posEpochGPS}] epoch of RA and DEC
00169 \item[\texttt{UINT4 model}] 0 for isolated pulsar, 1 for binary
00170 \item[\texttt{REAL8 e}] eccentricity of orbit
00171 \item[\texttt{REAL8 w}]
00172 \item[\texttt{REAL8 T0}]
00173 \item[\texttt{REAL8 Pb}]
00174 \item[\texttt{REAL8 x}]
00175 \item[\texttt{REAL8 lg}]
00176 \end{description}
00177 
00178 \subsubsection*{Structure \texttt{FineHeterodyneOutput}}
00179 \idx[Type]{FineHeterodyneOutput}
00180 \noindent This structure stores the output of the fine heterodyne.
00181 
00182 \begin{description}
00183 \item[\texttt{COMPLEX8TimeSeries B}] bin value 
00184 \item[\texttt{COMPLEX8TimeSeries var}]  variance 
00185 \item[\texttt{REAL4 phase}] phase
00186 \end{description}
00187 
00188 
00189 
00190 \subsubsection*{Structure \texttt{FineHeterodyneParams}}
00191 \idx[Type]{FineHeterodyneParams}
00192 
00193 \noindent This structure stores the params of the fine heterodyne.
00194 
00195 \begin{description}
00196 \item[\texttt{EphemerisData *edat}]
00197 \item[\texttt{LALDetector detector}]
00198 \item[\texttt{REAL4IIRFilter *iirFilterRe}] IIR filter to be applied to real part of complex heterodyned data 
00199 \item[\texttt{REAL4IIRFilter *iirFilterIm}] IIR filter to be applied to imaginary part of complex heterodyned data 
00200 \item[\texttt{UINT4 M}]  decimation factor
00201 \item[\texttt{UINT2 iirFlag}]  1 to apply iir filter, 0 for no iir filter
00202 \end{description}
00203 
00204 \vfill{\footnotesize\input{HeterodynePulsarHV}}
00205 \newpage\input{HeterodynePulsarC}
00206 \newpage\input{HeterodynePulsarTestC}
00207 
00208 ********************************** </lalLaTeX> */
00209 
00210 #ifndef _HETERODYNEPULSAR_H
00211 #define _HETERODYNEPULSAR_H
00212 
00213 #include <lal/LALStdlib.h>
00214 /******* INCLUDE ANY OTHER LAL HEADERS needed for header (NOT module) ****/
00215 
00216 #include <lal/IIRFilter.h>
00217 #include <lal/ZPGFilter.h>
00218 #include <lal/LALBarycenter.h>
00219 #include <lal/SkyCoordinates.h> 
00220 #include <lal/AVFactories.h>
00221 #include <lal/BinaryPulsarTiming.h>
00222 
00223 #ifdef  __cplusplus
00224 extern "C" {
00225 #endif
00226 
00227 NRCSID (HETERODYNEPULSARH, "$Id: HeterodynePulsar.h,v 1.3 2007/06/08 14:41:50 bema Exp $");
00228 
00229 /******************************** <lalErrTable file="HeterodynePulsarHE"> */
00230 #define HETERODYNEPULSARH_ENULLINPUT 1
00231 #define HETERODYNEPULSARH_ENULLOUTPUT 2
00232 #define HETERODYNEPULSARH_ENULLPARAMS 3
00233 #define HETERODYNEPULSARH_ERFACTOR 4
00234 #define HETERODYNEPULSARH_EINVALIDF0 5
00235 #define HETERODYNEPULSARH_ELENGTH 6
00236 #define HETERODYNEPULSARH_EBINARY 7
00237 
00238 #define HETERODYNEPULSARH_MSGENULLINPUT "Input was Null"
00239 #define HETERODYNEPULSARH_MSGENULLOUTPUT "Output was Null"
00240 #define HETERODYNEPULSARH_MSGENULLPARAMS "Params was Null"
00241 #define HETERODYNEPULSARH_MSGERFACTOR "The decimation factor supplied was invalid"
00242 #define HETERODYNEPULSARH_MSGEINVALIDF0 "Invalid input f0"
00243 #define HETERODYNEPULSARH_MSGELENGTH "Input vectors were not the same length"
00244 #define HETERODYNEPULSARH_MSGEBINARY "Binary model not yet implemented"
00245 
00246 /************************************ </lalErrTable> */
00247 
00248 /****** DEFINE NEW STRUCTURES AND TYPES ************/
00249 typedef struct
00250 tagCoarseHeterodyneInput
00251 {
00252   REAL4TimeSeries       V;              /* calibrated strain data from detector */
00253   REAL4                 f0;             /* heterodyning base frequency*/
00254 } CoarseHeterodyneInput;
00255 
00256 typedef struct
00257 tagCoarseHeterodyneOutput
00258 {
00259   COMPLEX8TimeSeries    Vh;             /* heterodyned, averaged and resampled data */
00260   REAL4                 phase;          /* phase of the reference signal f0 at t0 */  
00261   COMPLEX16             varh;           /* variance */
00262   COMPLEX16             avg;            /* average */
00263   COMPLEX16             kurt;           /* kurtosis */
00264   COMPLEX16             skew;           /* skewness */
00265   COMPLEX16             covar;          /* covariance */
00266   
00267 } CoarseHeterodyneOutput;
00268 
00269 typedef struct
00270 tagCoarseHeterodyneParams
00271 {  
00272   UINT4                 boxM;           /* 1st decimation factor */
00273   REAL4IIRFilter        *iirFilter1Re;   /* IIR filter to be applied to real part of complex heterodyned data */
00274   REAL4IIRFilter        *iirFilter1Im;   /* IIR filter to be applied to imaginary part of complex heterodyned data */
00275   UINT4                 iirM;           /* 2nd decimation factor */
00276   REAL4IIRFilter        *iirFilter2Re;   /* IIR filter to be applied to real part of complex heterodyned data */
00277   REAL4IIRFilter        *iirFilter2Im;   /* IIR filter to be applied to imaginary part of complex heterodyned data */
00278   UINT4                 stats;          /* set 1 for var; to 2 to calculate var, average, kurtosis, and skewness; 0
00279   else */
00280 } CoarseHeterodyneParams;
00281 
00282 
00283 typedef struct
00284 tagFineHeterodyneInput
00285 {
00286   COMPLEX8TimeSeries    Vh;             /* heterodyned, averaged and resampled data */
00287   COMPLEX8TimeSeries    varh;           /* variance of the rFactor points that were averaged */
00288   REAL4                 f0;             /* frequency of the signal */
00289   REAL4                 f1;             /* first time derivative of frequency */
00290   REAL4                 f2;             /* second time derivative of frequency */
00291   REAL8                 fEpochGPS;      /* epoch of the frequency at SSB */
00292   SkyPosition           source;         /* location of pulsar in sky - equatorial coordinate system */
00293   REAL4                 pmRA;           /* proper motion RA radians / year */
00294   REAL4                 pmDEC;          /* proper motion DEC radians / year*/
00295   REAL8                 posEpochGPS;    /* epoch of RA and DEC */
00296   INT4                  model;          /* 0 for isolated, 1 for keplerian , 2 for ... */
00297   REAL8                 e;
00298   REAL8                 w;
00299   REAL8                 T0;
00300   REAL4                 Pb;
00301   REAL8                 x;
00302   REAL8                 lg;
00303 } FineHeterodyneInput;
00304 
00305 typedef struct
00306 tagFineHeterodyneOutput
00307 {
00308   COMPLEX16TimeSeries   B;              /* bin value */
00309   COMPLEX16TimeSeries   var;            /* variance */
00310   REAL4                 phase;          /* phase */
00311 } FineHeterodyneOutput;
00312 
00313 typedef struct
00314 tagFineHeterodyneParams
00315 {  
00316   EphemerisData *edat;
00317   LALDetector detector;
00318   REAL4IIRFilter        *iirFilterRe;    /* IIR filter to be applied to real part of complex heterodyned data */
00319   REAL4IIRFilter        *iirFilterIm;    /* IIR filter to be applied to imaginary part of complex heterodyned data */
00320   UINT4                 M;              /* decimation factor */
00321   UINT2                 iirFlag;        /* if 1 iir, if 0 no iir */
00322 } FineHeterodyneParams;
00323 
00324 /****** INCLUDE EXTERNAL GLOBAL VARIABLES ************/
00325 
00326 void
00327 LALCoarseHeterodyne( LALStatus                   *status,
00328                      CoarseHeterodyneOutput      *output,
00329                      CoarseHeterodyneInput       *input,
00330                      CoarseHeterodyneParams      *params );
00331 
00332 void
00333 LALFineHeterodyneToPulsar ( LALStatus                   *status,
00334                             FineHeterodyneOutput        *output,
00335                             FineHeterodyneInput         *input,
00336                             FineHeterodyneParams        *params );                   
00337 
00338 #ifdef  __cplusplus
00339 }
00340 #endif
00341 
00342 #endif /* _HETERODYNEPULSAR_H */

Generated on Mon Oct 13 02:31:42 2008 for LAL by  doxygen 1.5.2