BinaryPulsarTiming.h

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Bernd Machenschalk, Jolien Creighton, Matt Pitkin
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 /**
00021  * \author Matt Pitkin, Bernd Machenschalk
00022  * \date 2007
00023  * \file
00024  * \ingroup pulsar
00025  * \brief Functions to calculate binary system time delays and read TEMPO pulsar parameter files
00026  *
00027  * $Id: BinaryPulsarTiming.h,v 1.13 2008/04/21 17:48:58 mpitkin Exp $
00028  *
00029  * The main function in this code - <tt>XLALBinaryPulsarDeltaT</tt> - is for
00030  *  calculating the time delay on a pulsar signal caused by its orbit within a
00031  * binary system. It tranforms a signal from the binary system barycentre to the
00032  * pulsar proper time. It is equivalent to the <tt>LALBarycenter()</tt>
00033  * functions for transforming the Earth reference frame to the solar system
00034  * barycentre. It copies the functions from the standard pulsar timing software
00035  * <tt>TEMPO</tt> and can use the various binary system models BT, BT1P, BT2P,
00036  * BTX, ELL1, DD and MSS.
00037  *
00038  * Included is a function to read in a set of pulsar parameters from a
00039  * standard <tt>TEMPO</tt> parameter (.par) file -
00040  * <tt>XLALReadTEMPOParFile</tt>.
00041  *
00042  * Also included are function to convert times given in the TT, TDB or TCB
00043  * frames (given as a modified Julian Date - MJD) into a GPS time.
00044  */
00045 
00046 /* LAL code to take into account binary pulsar motion */
00047 /*  for definitions of different models see Taylor and Weisberg (1989)
00048     and TEMPO software documentation 
00049     
00050     Also contains function to read TEMPO .par files to obtain parameters
00051     and errors on parameters (if available) */
00052 /* <lalVerbatim file="BinaryPulsarTimingHV">
00053    Author: Pitkin, M. D.
00054    $Id: BinaryPulsarTiming.h,v 1.13 2008/04/21 17:48:58 mpitkin Exp $
00055 */
00056 /* Matt Pitkin 29/04/04 */
00057 
00058 /* <lalLaTeX>
00059    \section{Header \texttt{BinaryPulsarTiming.h}}
00060    label{ss:BinaryPulsarTiming.h}
00061    
00062    Calculates time delay to a signal from a pulsar in a binary system.
00063    
00064    \subsection*{Synopsis}
00065    \begin{verbatim}
00066    #include <lal/BinaryPulsarTiming.h>
00067    \end{verbatim}
00068    
00069    \noindent This header covers routines for calculating the time delay to a
00070    signal from a pulsar in a binary system. The are also routines for reading
00071    pulsar data from TEMPO .par file formats.
00072    </lalLaTeX> */
00073 
00074 #ifndef _BINARYPULSARTIMING_H
00075 #define _BINARYPULSARTIMING_H
00076 
00077 #include <lal/LALStdlib.h>
00078 
00079 NRCSID (BINARYPULSARTIMINGH,"$Id: BinaryPulsarTiming.h,v 1.13 2008/04/21 17:48:58 mpitkin Exp $");
00080 
00081 #ifdef __cplusplus
00082 extern "C" {
00083 #endif
00084 
00085 /* <lalLaTeX>
00086    \subsection*{Error conditions}
00087    </lalLaTeX> */
00088 
00089 /* <lalErrTable> */
00090 #define BINARYPULSARTIMINGH_ENULLINPUT 1
00091 #define BINARYPULSARTIMINGH_ENULLOUTPUT 2
00092 #define BINARYPULSARTIMINGH_ENULLPARAMS 3
00093 #define BINARYPULSARTIMINGH_ENULLBINARYMODEL 4
00094 #define BINARYPULSARTIMINGH_ENULLPULSARANDPATH 5
00095 #define BINARYPULSARTIMINGH_EPARFILEERROR 6
00096 #define BINARYPULSARTIMINGH_EFAIL 7
00097 #define BINARYPULSARTIMINGH_ENAN 8
00098 #define BINARYPULSARTIMINGH_EPARFAIL 9
00099 
00100 #define BINARYPULSARTIMINGH_MSGENULLINPUT "Input was Null"
00101 #define BINARYPULSARTIMINGH_MSGENULLOUTPUT "Output was Null"
00102 #define BINARYPULSARTIMINGH_MSGENULLPARAMS "Params was Null"
00103 #define BINARYPULSARTIMINGH_MSGNULLBINARYMODEL "Binary model is Null or not specified - you should\
00104 not be in the binary timing routine"
00105 #define BINARYPULSARTIMINGH_MSGENULLPULSARANDPATH "Path to pulsar.par file not specified"
00106 #define BINARYPULSARTIMINGH_MSGEPARFILEERROR ".par file path is wrong or file doesn't exist"
00107 #define BINARYPULSARTIMINGH_MSGEFAIL "Time delay computation failed"
00108 #define BINARYPULSARTIMINGH_MSGENAN "Output is NaN!"
00109 #define BINARYPULSARTIMINGH_MSGEPARFAIL "Failed to read in .par file"
00110 
00111 /* </lalErrTable> */
00112 
00113 /* <lalLaTeX>
00114    \subsection*{Structures}
00115    \idx[Type]{BinaryPulsarParams}
00116    \idx[Type]{BinaryPulsarInput}
00117    \idx[Type]{BinaryPulsarOutput}
00118    
00119    \begin{verbatim}
00120    typedef struct tagBinaryPulsarParams BinaryPulsarParams;
00121    \end{verbatim}
00122    
00123    This structure contains all the pulsars parameters. The structure does not
00124    have to be used for a binary pulsar, but can just contain the parameters for
00125    an isolated pulsar. All parameters are in the same units as given by TEMPO.
00126  
00127    \begin{verbatim}
00128    typedef struct tagBinaryPulsarInput BinaryPulsarInput;
00129    \end{verbatim}
00130    
00131    This structure contains the input time at which the binary correction needs
00132    to be calculated.
00133    
00134    \begin{verbatim}
00135    typedef struct tagBinaryPulsarOutput BinaryPulsarOutput;
00136    \end{verbatim}
00137    
00138    This structure contains the binary time delay for the input time.
00139  
00140    </lalLaTeX> */
00141 
00142 /**** DEFINE STRUCTURES ****/
00143 /** A structure to contain all pulsar parameters and associated errors */
00144 typedef struct
00145 tagBinaryPulsarParams
00146 {
00147   CHAR *name;   /**< pulsar name */
00148   
00149   CHAR *model;  /**< TEMPO binary model e.g. BT, DD, ELL1 */
00150 
00151   REAL8 f0;     /**< spin frequency (Hz) */
00152   REAL8 f1;     /**< frequency first derivative (Hz/s) */
00153   REAL8 f2;     /**< frequency second derivative (Hz/s^2) */
00154   REAL8 f3;     /**< frequency third derivative (Hz/s^3) */
00155 
00156   REAL8 ra;     /**< right ascension (rads) */
00157   REAL8 dec;    /**< declination (rads) */
00158   REAL8 pmra;   /**< proper motion in RA (rads/s) */
00159   REAL8 pmdec;  /**< proper motion in dec (rads/s) */
00160   
00161   REAL8 posepoch; /**< position epoch */
00162   REAL8 pepoch;   /**< period/frequency epoch */
00163 
00164   /* all parameters will be in the same units as used in TEMPO */
00165 
00166   /* Keplerian parameters */
00167   REAL8 e;      /**< orbital eccentricity */
00168   REAL8 Pb;     /**< orbital period (days) */
00169   REAL8 w0;     /**< logitude of periastron (deg) */
00170   REAL8 x;      /**< projected semi-major axis/speed of light (light secs) */
00171   REAL8 T0;     /**< time of orbital perisastron as measured in TDB (MJD) */
00172   
00173   /* add extra parameters for the BT1P and BT2P models which contain two and
00174      three orbits respectively (only the first one can be relativistic, so the
00175      others only have the Keplerian parameters) */
00176   REAL8 e2, e3;
00177   REAL8 Pb2, Pb3;
00178   REAL8 w02, w03;
00179   REAL8 x2, x3;
00180   REAL8 T02, T03;
00181 
00182   REAL8 xpbdot; /**< (10^-12) */
00183 
00184   /* for low eccentricity orbits (ELL1 model) use Laplace parameters */
00185   /* (eps1 = e*sin(w), eps2 = e*cos(w)) instead of e, w.             */
00186   /* see Appendix A, Ch. Lange etal, MNRAS (2001)                    */
00187   REAL8 eps1;       /**< e*sin(w) */
00188   REAL8 eps2;       /**< e*cos(w) */
00189   REAL8 eps1dot;
00190   REAL8 eps2dot;
00191   REAL8 Tasc;  /**< time of the ascending node (used rather than T0) */
00192   UINT4 nEll;  /**< set to zero if have eps time derivs (default) set to 1 if have wdot */
00193 
00194   /* Post-Keplarian parameters */
00195   /* for Blandford-Teukolsky (BT) model */
00196   REAL8 wdot;   /**< precesion of longitude of periastron w = w0 + wdot(tb-T0) (degs/year) */
00197   REAL8 gamma;  /**< gravitational redshift and time dilation parameter (s)*/
00198   REAL8 Pbdot;  /**< rate of change of Pb (dimensionless 10^-12) */
00199   REAL8 xdot;   /**< rate of change of x(=asini/c) - optional (10^-12)*/
00200   REAL8 edot;   /**< rate of change of e (10^-12)*/
00201 
00202   /* for Epstein-Haugan (EH) model */
00203   REAL8 s; /**< Shapiro 'shape' parameter sin i */
00204 
00205   /* for Damour-Deruelle (DD) model */
00206   /*REAL8 r; Shapiro 'range' parameter - defined internally as Gm2/c^3 */
00207   REAL8 dr;
00208   REAL8 dth;    /* (10^-6) */
00209   REAL8 a0, b0; /**< abberation delay parameters */
00210 
00211   /* for DD (General Relativity) (DDGR) - assumes GR is correct model */
00212   /* we do not need wdot, gamma, Pbdot, s, r, xdot and edot */
00213   REAL8 M;      /**< M = m1 + m2 (m1 = pulsar mass, m2 = companion mass) */
00214   REAL8 m2;     /**< companion mass */
00215 
00216   /* orbital frequency coefficients for BTX model (only for one orbit at the
00217      moment i.e. a two body system) */
00218   REAL8 fb[12]; /**> orbital frequency coefficients for BTX model */
00219   INT4 nfb; /**> the number of fb coefficients */
00220 
00221   /******** errors read in from a .par file **********/
00222   REAL8 f0Err;
00223   REAL8 f1Err;
00224   REAL8 f2Err;
00225   REAL8 f3Err;
00226   
00227   REAL8 pepochErr;
00228   REAL8 posepochErr;
00229   
00230   REAL8 raErr;
00231   REAL8 decErr;
00232   REAL8 pmraErr;
00233   REAL8 pmdecErr;
00234 
00235   REAL8 eErr, e2Err, e3Err;
00236   REAL8 PbErr, Pb2Err, Pb3Err;
00237   REAL8 w0Err, w02Err, w03Err;
00238   REAL8 xErr, x2Err, x3Err;
00239   REAL8 T0Err, T02Err, T03Err;
00240 
00241   REAL8 xpbdotErr;      
00242 
00243   REAL8 eps1Err;
00244   REAL8 eps2Err;
00245   REAL8 eps1dotErr;
00246   REAL8 eps2dotErr;
00247   REAL8 TascErr;
00248 
00249   REAL8 wdotErr;
00250   REAL8 gammaErr;
00251   REAL8 PbdotErr;
00252   REAL8 xdotErr;
00253   REAL8 edotErr;
00254   
00255   REAL8 sErr;
00256   
00257   /*REAL8 rErr; Shapiro 'range' parameter - defined internally as Gm2/c^3 */
00258   REAL8 drErr;
00259   REAL8 dthErr;
00260   REAL8 a0Err, b0Err;
00261 
00262   REAL8 MErr;
00263   REAL8 m2Err;
00264 
00265   REAL8 fbErr[12];
00266 
00267 }BinaryPulsarParams;
00268 
00269 /** structure containing the input parameters for the binary delay function */ 
00270 typedef struct
00271 tagBinaryPulsarInput
00272 {
00273   REAL8 tb;    /**< Time of arrival (TOA) at the SSB */
00274 }BinaryPulsarInput;
00275 
00276 /** structure containing the output parameters for the binary delay function */ 
00277 typedef struct
00278 tagBinaryPulsarOutput
00279 {
00280   REAL8 deltaT; /**< deltaT to add to TDB in order to account for binary */
00281 }BinaryPulsarOutput;
00282 
00283 /* <lalLaTeX>
00284    \newpage\input{BinaryPulsarTimingC}
00285    </lalLaTeX> */
00286 
00287 /**** DEFINE FUNCTIONS ****/
00288 /** function to calculate the binary system delay 
00289  */
00290 void 
00291 XLALBinaryPulsarDeltaT( BinaryPulsarOutput   *output,
00292                         BinaryPulsarInput    *input,
00293                         BinaryPulsarParams   *params );
00294 
00295 void
00296 LALBinaryPulsarDeltaT( LALStatus            *status,
00297                        BinaryPulsarOutput   *output,
00298                        BinaryPulsarInput    *input,
00299                        BinaryPulsarParams   *params );
00300 
00301 /** function to read in a TEMPO parameter file 
00302  */
00303 void
00304 XLALReadTEMPOParFile( BinaryPulsarParams    *output,
00305                       CHAR                  *pulsarAndPath );
00306 
00307 void
00308 LALReadTEMPOParFile( LALStatus              *status,
00309                      BinaryPulsarParams    *output,
00310                      CHAR                  *pulsarAndPath );
00311 
00312 /** A function to convert RA and Dec in format dd:mm:ss.ss or ddmmss.ss into the
00313  * number of degrees as a float degs is the string containing the
00314  * dd/hh:mm:ss.sss coords is either ra/RA or dec/DEC.
00315  */
00316 REAL8
00317 LALDegsToRads(CHAR *degs, const CHAR *coords);
00318 
00319 /** Functions for converting times given in Terrestrial time TT, TDB, or TCB in
00320  * MJD to times in GPS - this is important for epochs given in <tt>.par</tt>
00321  * files which are in TDB(MJD). TT and GPS are different by a factor of 51.184
00322  * secs, this is just the historical factor of 32.184 secs between TT and TAI
00323  * (International Atomic Time) and the other 19 seconds come from the leap
00324  * seonds added between the TAI and UTC up to the point of definition of GPS
00325  * time at UTC 01/01/1980. 
00326  */
00327 REAL8
00328 LALTTMJDtoGPS(REAL8 MJD);
00329 
00330 REAL8
00331 LALTDBMJDtoGPS(REAL8 MJD);
00332 
00333 REAL8
00334 LALTCBMJDtoGPS(REAL8 MJD);
00335 
00336 /** function to print out all the pulsar parameters read in from a par file 
00337  */
00338 void
00339 PrintPulsarParameters( BinaryPulsarParams params );
00340 
00341 #ifdef __cplusplus
00342 }
00343 #endif
00344 
00345 #endif /* _BINARYPULSARTIMING_H */

Generated on Fri Sep 5 03:06:33 2008 for LAL by  doxygen 1.5.2