HeterodynePulsarTest.c

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="HeterodynePulsarTestCV">
00021 Author: Dupuis, R. J.
00022 $Id: HeterodynePulsarTest.c,v 1.4 2007/06/08 14:41:52 bema Exp $
00023 ********************************* </lalVerbatim> */
00024 
00025 /********************************************************** <lalLaTeX>
00026 \subsection{Program \texttt{HeterodynePulsarTest.c}}
00027 
00028 This program demonstrates the usage of the functions \texttt{LALCoarseHeterodyne()}
00029 and \texttt{LALFineHeterodyneToPulsar()}.
00030 
00031 \subsubsection*{Usage}
00032 \begin{verbatim}
00033 HeterodynePulsarTest
00034 \end{verbatim}
00035 
00036 \subsubsection*{Description}
00037 
00038 This test program heterodynes, averages, and resamples an artificial signal using the functions 
00039 \texttt{LALCoarseHeterodyne()} and \texttt{LALFineHeterodyneToPulsar()}.
00040 
00041 \subsubsection*{Exit codes}
00042 \input{HeterodynePulsarTestCE}
00043 
00044 \subsubsection*{Uses}
00045 \begin{verbatim}
00046 LALCoarseHeterodyne()
00047 LALFineHeterodyneToPulsar()
00048 \end{verbatim}
00049 
00050 \subsubsection*{Notes}
00051 
00052 \vfill{\footnotesize\input{HeterodynePulsarTestCV}}
00053 ******************************************************* </lalLaTeX> */
00054 
00055 /******* INCLUDE STANDARD LIBRARY HEADERS; ************/
00056 /* note LALStdLib.h already includes stdio.h and stdarg.h */
00057 #include <math.h>
00058 
00059 /******* INCLUDE ANY LDAS LIBRARY HEADERS ************/
00060 
00061 /******* INCLUDE ANY LAL HEADERS ************/
00062 #include <lal/LALStdlib.h>
00063 #include <lal/HeterodynePulsar.h>
00064 #include <lal/AVFactories.h>
00065 #include <lal/Random.h>
00066 #include <lal/IIRFilter.h>
00067 #include <lal/ZPGFilter.h>
00068 
00069 /******* DEFINE RCS ID STRING ************/
00070 
00071 NRCSID( HETERODYNEPULSARTESTC, "$Id: HeterodynePulsarTest.c,v 1.4 2007/06/08 14:41:52 bema Exp $" );
00072 
00073 /******* DEFINE LOCAL CONSTANTS AND MACROS ************/
00074 #define SQRT3_2 0.8660254037844386467637231707529361L
00075 
00076 /***************************** <lalErrTable file="HeterodynePulsarTestCE"> */
00077 #define HETERODYNEPULSARTESTC_ENOM 0
00078 #define HETERODYNEPULSARTESTC_ECHK 1
00079 #define HETERODYNEPULSARTESTC_EFLS 2
00080 
00081 #define HETERODYNEPULSARTESTC_MSGENOM "Nominal exit"
00082 #define HETERODYNEPULSARTESTC_MSGECHK "Error checking failed to catch bad data"
00083 #define HETERODYNEPULSARTESTC_MSGEFLS "Incorrect answer for valid data"
00084 /***************************** </lalErrTable> */
00085 
00086 /* might also wish to define parameters and expected results for test
00087    cases here, for example */
00088 #define HETERODYNEPULSARTEST_FH 0
00089 #define HETERODYNEPULSARTEST_LENGTH 1048576
00090 #define HETERODYNEPULSARTEST_DT 6.1035e-5  /* Jan 1, 2000, 00:00:00 */
00091 #define HETERODYNEPULSARTEST_A0 100
00092 #define HETERODYNEPULSARTEST_T0 630720013  /* Jan 1, 2000, 00:00:00 */
00093 #define HETERODYNEPULSARTEST_BOXM 128
00094 #define HETERODYNEPULSARTEST_IIRM 32
00095 #define HETERODYNEPULSARTEST_FINEIIRM 16
00096 #define HETERODYNEPULSARTEST_FC1 256
00097 #define HETERODYNEPULSARTEST_FC2 4
00098 #define HETERODYNEPULSARTEST_FINEFC 0.25
00099 #define HETERODYNEPULSARTEST_F0 0    /* pulsar frequency */
00100 #define HETERODYNEPULSARTEST_F1 0   /* pulsar spindown */
00101 #define HETERODYNEPULSARTEST_F2 0  /* 2nd time derivative of pulsar frequency */
00102 /******* DECLARE AND SET GLOBAL lalDebugLevel ************/
00103 
00104 int lalDebugLevel = 0;
00105 int main(void)
00106 {
00107   UINT4                 i;
00108   REAL4                 dt = HETERODYNEPULSARTEST_DT; 
00109   REAL4                 a0 = HETERODYNEPULSARTEST_A0;
00110   static LALStatus      status;
00111   static RandomParams   *randomParams;
00112   static REAL4Vector    *noise;
00113   INT4                  seed = 0;
00114   REAL4                 fh = HETERODYNEPULSARTEST_FH;
00115   CoarseHeterodyneOutput      coarseOutput;
00116   CoarseHeterodyneInput       coarseInput;
00117   CoarseHeterodyneParams      coarseParams;
00118   REAL4                 wc;
00119   COMPLEX8ZPGFilter *zpgFilter = NULL;
00120   REAL4IIRFilter *iirFilterRe = NULL; /* IIR filter */
00121   REAL4IIRFilter *iirFilterIm = NULL; /* IIR filter */  
00122   UINT4 npoints = HETERODYNEPULSARTEST_LENGTH / HETERODYNEPULSARTEST_BOXM*HETERODYNEPULSARTEST_IIRM;
00123   REAL4 phase;
00124   FineHeterodyneInput fineInput;
00125   FineHeterodyneOutput fineOutput;
00126   FineHeterodyneParams fineParams;
00127   EphemerisData *edat = NULL;
00128   UINT4 itmp;
00129   char earth[] = "earth00.dat";
00130   char sun[] = "sun00.dat";
00131   
00132 
00133   /******* ALLOCATE MEMORY *************/
00134   
00135   coarseInput.V.data = NULL;
00136   LALCreateVector( &status, &coarseInput.V.data, HETERODYNEPULSARTEST_LENGTH );
00137   
00138   coarseOutput.Vh.data = NULL;
00139   LALCCreateVector( &status, &coarseOutput.Vh.data, npoints);  
00140   
00141   fineInput.Vh.data = NULL;
00142   LALCCreateVector( &status, &fineInput.Vh.data, npoints);
00143   
00144   fineInput.varh.data = NULL;
00145   LALCCreateVector( &status, &fineInput.varh.data, npoints); 
00146   
00147   fineOutput.B.data = NULL;
00148   LALZCreateVector( &status, &fineOutput.B.data, npoints /  HETERODYNEPULSARTEST_FINEIIRM);  
00149   
00150   fineOutput.var.data = NULL;
00151   LALZCreateVector( &status, &fineOutput.var.data, npoints / HETERODYNEPULSARTEST_FINEIIRM);  
00152   
00153   noise = NULL;
00154   LALCreateVector( &status, &noise, HETERODYNEPULSARTEST_LENGTH );
00155   LALCreateRandomParams( &status, &randomParams, seed);
00156 
00157   LALNormalDeviates( &status, noise, randomParams ); 
00158 
00159   if (fh == 0)
00160   {
00161     phase = 0;
00162   }
00163   else
00164   {
00165     phase = 2.0*LAL_PI*HETERODYNEPULSARTEST_T0/fh;
00166    }
00167    
00168    /******** GENERATE FAKE INPUT **********/
00169   for (i = 0;i < HETERODYNEPULSARTEST_LENGTH; i++)  
00170     coarseInput.V.data->data[i] = 100*noise->data[i];
00171     
00172   coarseInput.V.data->length = HETERODYNEPULSARTEST_LENGTH;
00173   coarseInput.f0 =fh;
00174   
00175   coarseInput.V.epoch.gpsSeconds = HETERODYNEPULSARTEST_T0;
00176   coarseInput.V.epoch.gpsNanoSeconds = 0;
00177   
00178   coarseInput.V.deltaT = dt;
00179   
00180   /*******  TEST RESPONSE OF LALCoarseHeterodyne TO VALID DATA  ************/
00181 
00182   /* Create the first IIR filter. */
00183   
00184   wc = tan(LAL_PI * dt * HETERODYNEPULSARTEST_FC1);
00185   
00186   /* First create ZPG filter used to define IIR filter. */
00187     
00188   LALCreateCOMPLEX8ZPGFilter( &status, &zpgFilter, 0, 3 );
00189   zpgFilter->poles->data[0].re = wc*SQRT3_2;
00190   zpgFilter->poles->data[0].im = wc*0.5;
00191   zpgFilter->poles->data[1].re = 0.0;
00192   zpgFilter->poles->data[1].im = wc;
00193   zpgFilter->poles->data[2].re = -wc*SQRT3_2;
00194   zpgFilter->poles->data[2].im = wc*0.5;
00195   zpgFilter->gain.re = 0.0;
00196   zpgFilter->gain.im = wc*wc*wc;
00197   LALWToZCOMPLEX8ZPGFilter( &status, zpgFilter );
00198   LALCreateREAL4IIRFilter( &status, &iirFilterRe, zpgFilter );
00199   LALCreateREAL4IIRFilter( &status, &iirFilterIm, zpgFilter );
00200   LALDestroyCOMPLEX8ZPGFilter( &status, &zpgFilter );
00201   
00202   coarseParams.iirFilter1Re = iirFilterRe;
00203   coarseParams.iirFilter1Im = iirFilterIm;
00204   
00205   /* Create the second IIR filter */
00206   
00207   wc = tan(LAL_PI * dt* HETERODYNEPULSARTEST_BOXM * HETERODYNEPULSARTEST_FC2);
00208   
00209   LALCreateCOMPLEX8ZPGFilter( &status, &zpgFilter, 0, 3 );
00210   zpgFilter->poles->data[0].re = wc*SQRT3_2;
00211   zpgFilter->poles->data[0].im = wc*0.5;
00212   zpgFilter->poles->data[1].re = 0.0;
00213   zpgFilter->poles->data[1].im = wc;
00214   zpgFilter->poles->data[2].re = -wc*SQRT3_2;
00215   zpgFilter->poles->data[2].im = wc*0.5;
00216   zpgFilter->gain.re = 0.0;
00217   zpgFilter->gain.im = wc*wc*wc;
00218   LALWToZCOMPLEX8ZPGFilter( &status, zpgFilter );
00219   LALCreateREAL4IIRFilter( &status, &iirFilterRe, zpgFilter );
00220   LALCreateREAL4IIRFilter( &status, &iirFilterIm, zpgFilter );
00221   LALDestroyCOMPLEX8ZPGFilter( &status, &zpgFilter );
00222   
00223   coarseParams.iirFilter2Re = iirFilterRe;
00224   coarseParams.iirFilter2Im = iirFilterIm;  
00225   
00226   coarseParams.boxM = HETERODYNEPULSARTEST_BOXM;
00227   coarseParams.iirM = HETERODYNEPULSARTEST_IIRM;  
00228 
00229   coarseParams.stats = 2;
00230 
00231   LALCoarseHeterodyne( &status, &coarseOutput, &coarseInput, &coarseParams );
00232   
00233   if(status.statusCode) 
00234   {
00235     printf("Unexpectedly got error code %d and message %s\n",
00236             status.statusCode, status.statusDescription);
00237     return HETERODYNEPULSARTESTC_EFLS;
00238   }
00239 
00240     if(coarseOutput.Vh.data->length != HETERODYNEPULSARTEST_LENGTH / (HETERODYNEPULSARTEST_BOXM * HETERODYNEPULSARTEST_IIRM))
00241   {
00242     printf("Got incorrect length of output vector %d when expecting %d in LALCoarseHeterodyne\n",
00243             coarseOutput.Vh.data->length, HETERODYNEPULSARTEST_LENGTH / (HETERODYNEPULSARTEST_BOXM * HETERODYNEPULSARTEST_IIRM));
00244     return  HETERODYNEPULSARTESTC_EFLS;
00245   }
00246   
00247   /*******  TEST RESPONSE OF LALCoarseHeterodyne TO INVALID DATA  ************/
00248 /* Test that all the error conditions are correctly detected by the function */
00249  
00250 #ifndef LAL_NDEBUG
00251 if ( ! lalNoDebug ) {
00252 
00253  LALCoarseHeterodyne(&status, NULL, &coarseInput, &coarseParams);
00254  
00255   if (status.statusCode != HETERODYNEPULSARH_ENULLOUTPUT
00256        || strcmp(status.statusDescription, HETERODYNEPULSARH_MSGENULLOUTPUT)) 
00257   {
00258     printf( "Got error code %d and message %s\n",
00259             status.statusCode, status.statusDescription);
00260     printf( "Expected error code %d and message %s\n",
00261             HETERODYNEPULSARH_ENULLOUTPUT, HETERODYNEPULSARH_MSGENULLOUTPUT);
00262     return HETERODYNEPULSARTESTC_ECHK;
00263   }  
00264   
00265  LALCoarseHeterodyne(&status, &coarseOutput, NULL, &coarseParams);
00266  
00267   if (status.statusCode != HETERODYNEPULSARH_ENULLINPUT
00268        || strcmp(status.statusDescription, HETERODYNEPULSARH_MSGENULLINPUT)) 
00269   {
00270     printf( "Got error code %d and message %s\n",
00271             status.statusCode, status.statusDescription);
00272     printf( "Expected error code %d and message %s\n",
00273             HETERODYNEPULSARH_ENULLINPUT, HETERODYNEPULSARH_MSGENULLINPUT);
00274     return HETERODYNEPULSARTESTC_ECHK;
00275   }    
00276   
00277  LALCoarseHeterodyne(&status, &coarseOutput, &coarseInput, NULL);
00278  
00279   if (status.statusCode != HETERODYNEPULSARH_ENULLPARAMS
00280        || strcmp(status.statusDescription, HETERODYNEPULSARH_MSGENULLPARAMS)) 
00281   {
00282     printf( "Got error code %d and message %s\n",
00283             status.statusCode, status.statusDescription);
00284     printf( "Expected error code %d and message %s\n",
00285             HETERODYNEPULSARH_ENULLPARAMS, HETERODYNEPULSARH_MSGENULLPARAMS);
00286     return HETERODYNEPULSARTESTC_ECHK;
00287   }      
00288 
00289  itmp = coarseParams.iirM;
00290  coarseParams.iirM -= 1; 
00291   
00292  LALCoarseHeterodyne(&status, &coarseOutput, &coarseInput, &coarseParams);
00293  
00294   if (status.statusCode != HETERODYNEPULSARH_ERFACTOR
00295        || strcmp(status.statusDescription, HETERODYNEPULSARH_MSGERFACTOR)) 
00296   {
00297     printf( "Got error code %d and message %s\n",
00298             status.statusCode, status.statusDescription);
00299     printf( "Expected error code %d and message %s\n",
00300             HETERODYNEPULSARH_ERFACTOR, HETERODYNEPULSARH_MSGERFACTOR);
00301     return HETERODYNEPULSARTESTC_ECHK;
00302   }        
00303   coarseParams.iirM = itmp;
00304   
00305   coarseInput.f0 = -1.0;
00306   
00307   LALCoarseHeterodyne(&status, &coarseOutput, &coarseInput, &coarseParams);
00308  
00309   if (status.statusCode != HETERODYNEPULSARH_EINVALIDF0
00310        || strcmp(status.statusDescription, HETERODYNEPULSARH_MSGEINVALIDF0)) 
00311   {
00312     printf( "Got error code %d and message %s\n",
00313             status.statusCode, status.statusDescription);
00314     printf( "Expected error code %d and message %s\n",
00315             HETERODYNEPULSARH_EINVALIDF0, HETERODYNEPULSARH_MSGEINVALIDF0);
00316     return HETERODYNEPULSARTESTC_ECHK;
00317   }        
00318 
00319 } /* if ( ! lalNoDebug ) */
00320 #endif /* LAL_NDEBUG */
00321   
00322   /*******  TEST RESPONSE OF LALFineHeterodyneToPulsar TO VALID DATA  ************/
00323  
00324   /* set up detector */ 
00325   fineParams.detector = lalCachedDetectors[LALDetectorIndexGEO600DIFF];
00326   
00327   /* set up pointer to ephemeris data */
00328   
00329   edat = (EphemerisData *)LALMalloc(sizeof(EphemerisData));    
00330    
00331   (*edat).ephiles.earthEphemeris = earth;
00332   (*edat).ephiles.sunEphemeris = sun;
00333   (*edat).leap = 12;
00334   
00335   LALInitBarycenter(&status, edat);
00336      
00337   fineParams.edat = edat;
00338   
00339   /******** GENERATE FAKE INPUT **********/
00340   for (i = 0;i < HETERODYNEPULSARTEST_LENGTH / (HETERODYNEPULSARTEST_BOXM*HETERODYNEPULSARTEST_IIRM); i++)  
00341   {
00342     fineInput.Vh.data->data[i].re = 100. + 10.0*noise->data[i];
00343     fineInput.Vh.data->data[i].im = 100. + 10.0*noise->data[HETERODYNEPULSARTEST_LENGTH-i];
00344     fineInput.varh.data->data[i].re = 100. + 10.0*noise->data[HETERODYNEPULSARTEST_LENGTH-i];
00345     fineInput.varh.data->data[i].im = 100. + 10.0*noise->data[i];
00346   }
00347   
00348   fineInput.Vh.data->length = HETERODYNEPULSARTEST_LENGTH / (HETERODYNEPULSARTEST_BOXM*HETERODYNEPULSARTEST_IIRM);
00349   fineInput.varh.data->length = HETERODYNEPULSARTEST_LENGTH / (HETERODYNEPULSARTEST_BOXM*HETERODYNEPULSARTEST_IIRM);
00350      
00351   fineInput.f0 = HETERODYNEPULSARTEST_F0;
00352   fineInput.f1 = HETERODYNEPULSARTEST_F1;
00353   fineInput.f2 = HETERODYNEPULSARTEST_F2;
00354   fineInput.source.longitude = 0.0;
00355   fineInput.source.latitude = 0.0;
00356   fineInput.fEpochGPS = 230720013.0;
00357   fineInput.pmRA = 0.0;
00358   fineInput.pmDEC = 0.0;
00359   fineInput.posEpochGPS = 230720013.0;
00360   
00361   /* isolated pulsar - note that the function LALFineHeterodyneToPulsar doesn't accept binaries yet */
00362   fineInput.model = 0;
00363 
00364   fineParams.M = HETERODYNEPULSARTEST_FINEIIRM;
00365   
00366   fineParams.iirFlag = 0;
00367   
00368   /* Create the time-domain filter. */
00369   
00370   wc = tan(LAL_PI * dt * HETERODYNEPULSARTEST_BOXM *HETERODYNEPULSARTEST_IIRM* HETERODYNEPULSARTEST_FINEFC);
00371   
00372  /* First create ZPG filter used to define IIR filter. */
00373     
00374   LALCreateCOMPLEX8ZPGFilter( &status, &zpgFilter, 0, 3 );
00375   zpgFilter->poles->data[0].re = wc*SQRT3_2;
00376   zpgFilter->poles->data[0].im = wc*0.5;
00377   zpgFilter->poles->data[1].re = 0.0;
00378   zpgFilter->poles->data[1].im = wc;
00379   zpgFilter->poles->data[2].re = -wc*SQRT3_2;
00380   zpgFilter->poles->data[2].im = wc*0.5;
00381   zpgFilter->gain.re = 0.0;
00382   zpgFilter->gain.im = wc*wc*wc;
00383   LALWToZCOMPLEX8ZPGFilter( &status, zpgFilter );
00384  
00385   LALDestroyREAL4IIRFilter( &status, &iirFilterRe );
00386   LALDestroyREAL4IIRFilter( &status, &iirFilterIm ); 
00387   iirFilterRe = NULL;
00388   iirFilterIm = NULL;
00389  
00390   LALCreateREAL4IIRFilter( &status, &iirFilterRe, zpgFilter );
00391   LALCreateREAL4IIRFilter( &status, &iirFilterIm, zpgFilter );
00392   LALDestroyCOMPLEX8ZPGFilter( &status, &zpgFilter );
00393  
00394   fineParams.iirFilterRe = iirFilterRe;
00395   fineParams.iirFilterIm = iirFilterIm;
00396   
00397   
00398  
00399   LALFineHeterodyneToPulsar(&status, &fineOutput, &fineInput, &fineParams);
00400 
00401   if(status.statusCode) 
00402   {
00403     printf("Unexpectedly got error code %d and message %s\n",
00404             status.statusCode, status.statusDescription);
00405     return HETERODYNEPULSARTESTC_EFLS;
00406   }
00407 
00408     if(fineOutput.B.data->length != HETERODYNEPULSARTEST_LENGTH / 
00409        (HETERODYNEPULSARTEST_BOXM*HETERODYNEPULSARTEST_IIRM*HETERODYNEPULSARTEST_FINEIIRM) )
00410   {
00411     printf("Got incorrect length of output vector %d when expecting %d\n",
00412             fineOutput.B.data->length, HETERODYNEPULSARTEST_LENGTH / 
00413        (HETERODYNEPULSARTEST_BOXM*HETERODYNEPULSARTEST_IIRM*HETERODYNEPULSARTEST_FINEIIRM));
00414     return  HETERODYNEPULSARTESTC_EFLS;
00415   } 
00416  
00417  /*******  TEST RESPONSE OF LALFineHeterodyneToPulsar TO INVALID DATA  ************/
00418 #ifndef LAL_NDEBUG
00419 if ( ! lalNoDebug ) {
00420 
00421  LALFineHeterodyneToPulsar(&status, NULL, &fineInput, &fineParams);
00422  
00423   if (status.statusCode != HETERODYNEPULSARH_ENULLOUTPUT
00424        || strcmp(status.statusDescription, HETERODYNEPULSARH_MSGENULLOUTPUT)) 
00425   {
00426     printf( "Got error code %d and message %s\n",
00427             status.statusCode, status.statusDescription);
00428     printf( "Expected error code %d and message %s\n",
00429             HETERODYNEPULSARH_ENULLOUTPUT, HETERODYNEPULSARH_MSGENULLOUTPUT);
00430     return HETERODYNEPULSARTESTC_ECHK;
00431   }  
00432   
00433  LALFineHeterodyneToPulsar(&status, &fineOutput, NULL, &fineParams);
00434  
00435   if (status.statusCode != HETERODYNEPULSARH_ENULLINPUT
00436        || strcmp(status.statusDescription, HETERODYNEPULSARH_MSGENULLINPUT)) 
00437   {
00438     printf( "Got error code %d and message %s\n",
00439             status.statusCode, status.statusDescription);
00440     printf( "Expected error code %d and message %s\n",
00441             HETERODYNEPULSARH_ENULLINPUT, HETERODYNEPULSARH_MSGENULLINPUT);
00442     return HETERODYNEPULSARTESTC_ECHK;
00443   }    
00444   
00445  LALFineHeterodyneToPulsar(&status, &fineOutput, &fineInput, NULL);
00446  
00447   if (status.statusCode != HETERODYNEPULSARH_ENULLPARAMS
00448        || strcmp(status.statusDescription, HETERODYNEPULSARH_MSGENULLPARAMS)) 
00449   {
00450     printf( "Got error code %d and message %s\n",
00451             status.statusCode, status.statusDescription);
00452     printf( "Expected error code %d and message %s\n",
00453             HETERODYNEPULSARH_ENULLPARAMS, HETERODYNEPULSARH_MSGENULLPARAMS);
00454     return HETERODYNEPULSARTESTC_ECHK;
00455   }      
00456     
00457  itmp = fineParams.M;
00458  fineParams.M -= 1; 
00459   
00460  LALFineHeterodyneToPulsar(&status, &fineOutput, &fineInput, &fineParams);
00461  
00462   if (status.statusCode != HETERODYNEPULSARH_ERFACTOR
00463        || strcmp(status.statusDescription, HETERODYNEPULSARH_MSGERFACTOR)) 
00464   {
00465     printf( "Got error code %d and message %s\n",
00466             status.statusCode, status.statusDescription);
00467     printf( "Expected error code %d and message %s\n",
00468             HETERODYNEPULSARH_ERFACTOR, HETERODYNEPULSARH_MSGERFACTOR);
00469     return HETERODYNEPULSARTESTC_ECHK;
00470   }        
00471  fineParams.M = itmp;  
00472 
00473  fineInput.varh.data->length -= 1;
00474 
00475  LALFineHeterodyneToPulsar(&status, &fineOutput, &fineInput, &fineParams);
00476  
00477   if (status.statusCode != HETERODYNEPULSARH_ELENGTH
00478        || strcmp(status.statusDescription, HETERODYNEPULSARH_MSGELENGTH)) 
00479   {
00480     printf( "Got error code %d and message %s\n",
00481             status.statusCode, status.statusDescription);
00482     printf( "Expected error code %d and message %s\n",
00483             HETERODYNEPULSARH_ELENGTH, HETERODYNEPULSARH_MSGELENGTH);
00484     return HETERODYNEPULSARTESTC_ECHK;
00485   }         
00486 
00487 } /* if ( ! lalNoDebug ) */
00488 #endif /* LAL_NDEBUG */
00489   
00490  /*******  CLEAN UP  ************/
00491  LALDestroyVector(&status, &coarseInput.V.data); 
00492  LALCDestroyVector(&status, &coarseOutput.Vh.data); 
00493  LALCDestroyVector(&status, &fineInput.Vh.data); 
00494  LALCDestroyVector(&status, &fineInput.varh.data);  
00495  
00496  LALZDestroyVector(&status, &fineOutput.B.data); 
00497  LALZDestroyVector(&status, &fineOutput.var.data); 
00498  LALDestroyVector(&status, &noise);  
00499  LALDestroyRandomParams(&status, &randomParams);
00500  LALDestroyREAL4IIRFilter( &status, &iirFilterRe );
00501  LALDestroyREAL4IIRFilter( &status, &iirFilterIm );
00502   
00503  LALFree(edat->ephemE);
00504  LALFree(edat->ephemS);
00505  LALFree(edat);
00506    
00507  LALCheckMemoryLeaks();
00508 
00509  return HETERODYNEPULSARTESTC_ENOM;
00510 }
00511 
00512 
00513 
00514 
00515 
00516 
00517 
00518 
00519 
00520 
00521 
00522 
00523 

Generated on Mon Sep 8 03:06:51 2008 for LAL by  doxygen 1.5.2