Calibrate1800SFTs.h

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Xavier Siemens
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 #include <unistd.h>
00021 #include <stdio.h>
00022 #include <string.h>
00023 #include <stdlib.h>
00024 #include <math.h>
00025 #include <glob.h>
00026 #include <lal/LALDatatypes.h>
00027 #include <lal/LALBarycenter.h>
00028 #include <lal/LALInitBarycenter.h>
00029 #include <lal/LALDemod.h>
00030 
00031 #define MAXFILES 70000          /* Maximum # of files in a directory */
00032 #define MAXFILENAMELENGTH 256   /* Maximum # of characters of a SFT filename */
00033 
00034 #define MAXLINESRS   4000000     /* Maximum # of lines in a Response or Sensing file */
00035 #define MAXLINESF    100000     /* Maximum # of lines in a Factors file */
00036 
00037 struct CommandLineArgsTag 
00038 {
00039   char *directory;
00040   char *caldirectory;
00041   char *run;
00042   char *IFO; 
00043   char *outputdirectory;
00044 } CommandLineArgs;
00045 
00046 struct headertag 
00047 {
00048   REAL8 endian;
00049   INT4  gps_sec;
00050   INT4  gps_nsec;
00051   REAL8 tbase;
00052   INT4  firstfreqindex;
00053   INT4  nsamples;
00054 } header;
00055 
00056 typedef struct ResponseFunctionTag
00057 {
00058   REAL4 Frequency[MAXLINESRS];
00059   REAL4 Magnitude[MAXLINESRS];
00060   REAL4 Phase[MAXLINESRS];
00061   REAL4 re[MAXLINESRS];
00062   REAL4 im[MAXLINESRS];
00063 } Response;
00064 
00065 typedef struct SensingFunctionTag
00066 {
00067   REAL4 Frequency[MAXLINESRS];
00068   REAL4 Magnitude[MAXLINESRS];
00069   REAL4 Phase[MAXLINESRS];
00070   REAL4 re[MAXLINESRS];
00071   REAL4 im[MAXLINESRS];
00072 } Sensing;
00073 
00074 struct FactorsTag
00075 {
00076   INT4  t[MAXLINESF];      /* in GPS seconds */
00077   REAL4 alpha[MAXLINESF];
00078   REAL4 alpha_beta[MAXLINESF];
00079 } Factors;
00080 
00081 int ReadCommandLine(int argc,char *argv[],struct CommandLineArgsTag *CLA);
00082 int ReadSFTDirectory(struct CommandLineArgsTag CLA);
00083 int ReadCalibrationFiles(struct CommandLineArgsTag CLA);
00084 int ComputeInitialRSFunctions(struct CommandLineArgsTag CLA);
00085 int CalibrateSfts(struct CommandLineArgsTag CLA);
00086 int Freemem();
00087 
00088 
00089 COMPLEX8 tmpa, tmpb, tmpc; 
00090 REAL4 tmpx, tmpy;
00091 
00092 #define cmul( a, b ) \
00093 ( tmpa = (a), tmpb = (b), \
00094   tmpc.re = tmpa.re * tmpb.re - tmpa.im * tmpb.im, \
00095   tmpc.im = tmpa.re * tmpb.im + tmpa.im * tmpb.re, \
00096   tmpc )
00097 
00098 #define cdiv( a, b ) \
00099 ( tmpa = (a), tmpb = (b), \
00100   fabs( tmpb.re ) >= fabs( tmpb.im ) ? \
00101     ( tmpx = tmpb.im / tmpb.re, \
00102       tmpy = tmpb.re + tmpx * tmpb.im, \
00103       tmpc.re = ( tmpa.re + tmpx * tmpa.im ) / tmpy, \
00104       tmpc.im = ( tmpa.im - tmpx * tmpa.re ) / tmpy, \
00105       tmpc ) : \
00106     ( tmpx = tmpb.re / tmpb.im, \
00107       tmpy = tmpb.im + tmpx * tmpb.re, \
00108       tmpc.re = ( tmpa.re * tmpx + tmpa.im ) / tmpy, \
00109       tmpc.im = ( tmpa.im * tmpx - tmpa.re ) / tmpy, \
00110       tmpc ) )
00111 

Generated on Sun Oct 12 02:31:33 2008 for LAL by  doxygen 1.5.2