SPINspiral
SPINspiral is a parameter-estimation code for gravitational-wave signals detected by LIGO/Virgo
|
00001 /* 00002 00003 SPINspiral: parameter estimation on binary inspirals detected by LIGO, including spins of the binary members 00004 include/SPINspiral.h: main header file 00005 00006 00007 Copyright 2007, 2008, 2009 Christian Roever, Marc van der Sluys, Vivien Raymond, Ilya Mandel 00008 00009 00010 This file is part of SPINspiral. 00011 00012 SPINspiral is free software: you can redistribute it and/or modify 00013 it under the terms of the GNU General Public License as published by 00014 the Free Software Foundation, either version 3 of the License, or 00015 (at your option) any later version. 00016 00017 SPINspiral is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 GNU General Public License for more details. 00021 00022 You should have received a copy of the GNU General Public License 00023 along with SPINspiral. If not, see <http://www.gnu.org/licenses/>. 00024 00025 */ 00026 00027 00028 00036 #ifndef SPINspiral_h 00037 #define SPINspiral_h 00038 00039 00040 #include <stdio.h> 00041 #include <math.h> 00042 #include <complex.h> 00043 #include <fftw3.h> // www.fftw.org 00044 #include <time.h> 00045 #include <remez.h> // FIR-filter design routine: www.janovetz.com/jake 00046 #include <gsl/gsl_rng.h> 00047 #include <gsl/gsl_randist.h> 00048 #include <sys/time.h> 00049 #include <stdlib.h> 00050 00051 #include <lal/LALStdlib.h> 00052 #include <lal/LALInspiral.h> 00053 #include <lal/GeneratePPNInspiral.h> 00054 #include <lal/GenerateInspiral.h> 00055 #include <lal/LALFrameL.h> 00056 #include <lal/LALConstants.h> 00057 00058 00059 #define TRUE (1==1) 00060 #define FALSE (!TRUE) 00061 00062 #define h2r 0.2617993877991494263 //hr -> rad 00063 #define r2h 3.819718634205488207 //rad -> hr 00064 #define d2r 0.01745329251994329509 //deg -> rad 00065 #define r2d 57.29577951308232311 //rad -> deg 00066 #define c3rd 0.3333333333333333333 // 1/3 00067 #define M0 4.926e-6 //Solar mass in seconds 00068 00069 #define max(A,B) ((A)>(B)?(A):(B)) 00070 #define min(A,B) ((A)<(B)?(A):(B)) 00071 00072 00073 00074 #define USAGE "\n\n\ 00075 Usage: lalapps_spinspiral \n\ 00076 -i <main input file> \n\ 00077 --injXMLfile <injection XML file name> --injXMLnr <injection number in XML file (0-...)> \n\ 00078 --mChirp <chirp mass in solar mass> \n\ 00079 --eta <eta between 0.03 and 0.25> \n\ 00080 --tc <t_c in GPS time, e.g. : 873731234.00000> \n\ 00081 --dist <distance in Mpc> \n\ 00082 --nIter <number of iterations> \n\ 00083 --nSkip <number of skipped steps between stored steps> \n\ 00084 --rseed <6 number random seed, e.g. 12345. Use 0 for random random seed ...> \n\ 00085 --network <network configuration, e.g. H1=[1], H1L1=[1,2], H1L1V1=[1,2,3], V1H1=[3,1]> \n\ 00086 --downsample <downsample factor> \n\ 00087 --beforetc <data before t_c being analysed in seconds> \n\ 00088 --aftertc <data after t_c being analysed in seconds> \n\ 00089 --Flow <low frequency cut off in Hz> \n\ 00090 --Fhigh <high frequency cut off in Hz> \n\ 00091 --tukey1 <alpha1, the 1st parameter of the template tukey window. default 0.0> \n\ 00092 --tukey1 <alpha2, the 2nd parameter of the template tukey window. default 0.0> \n\ 00093 --nPSDsegment <number of segments to estimate the PSD> \n\ 00094 --lPSDsegment <length of each segment to estimate the PSD> \n\ 00095 --outputPath <output path> \n\ 00096 --cache <list of cache files, e.g. [cache1,cache2]> \n\ 00097 --channel <list of channels, e.g. [H1:LSC-STRAIN,L1:LSC-STRAIN]> \n\ 00098 --PSDstart <GPS time for the start of the PSD. default begining of cache file> \n\ 00099 --template <waveform template, 3 for spin, 4 for no spin> \n\ 00100 example: ./lalapps_spinspiral -i ./pipeline/SPINspiral.input --mChirp 1.7 --eta 0.12 --tc 873739311.00000 --dist 15 --nIter 5 --nSkip 1 --downsample 1 --beforetc 5 --aftertc 2 --Flow 45 --Fhigh 1600.0 --nPSDsegment 32 --lPSDsegment 4 --network [1,2] --outputPath ./pipeline/ --cache [./pipeline/H-H1_RDS_C03_L2-873739103-873740831.cache,./pipeline/L-L1_RDS_C03_L2-873739055-873740847.cache] --channel [H1:LSC-STRAIN,L1:LSC-STRAIN] --PSDstart 873740000\n\\n\n" 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 // Global constants, assigned in setConstants() 00116 extern double Ms,Mpc,G,c,Mpcs,pi,tpi,mtpi; 00117 // *** PLEASE DON'T ADD ANY NEW ONES, BUT USE THE STRUCTS BELOW INSTEAD (e.g. runPar or MCMCvariables) *** 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 // Structure with run parameters. 00135 // This should eventually include all variables in the input files and replace many of the global variables. 00136 // That also means that this struct must be passed throughout much of the code. 00137 struct runPar{ 00138 char executable[99]; // Name of the executable 00139 int maxnPar; // Maximum allowed number of MCMC/injection parameters 00140 int nMCMCpar; // Number of parameters in the MCMC template 00141 int nInjectPar; // Number of parameters in the injection template 00142 int mcmcWaveform; // Waveform used as the MCMC template 00143 double mcmcPNorder; // pN order of the MCMC waveform 00144 int nTemps; // Size of temperature ladder 00145 int MCMCseed; // Seed for MCMC 00146 int selectdata; // Select which data set to run on 00147 int networkSize; // Number of IFOs in the detector network 00148 int maxIFOdbaseSize; // Maximum number of IFOs for which the properties are read in (e.g. from mcmc.data) 00149 int selectifos[9]; // Select IFOs to use for the analysis 00150 00151 int nIter; // Number of MCMC iterations to compute 00152 int thinOutput; // Save every thiOutput-th MCMC iteration to file 00153 int thinScreenOutput; // Save every thiOutput-th MCMC iteration to screen 00154 int adaptiveMCMC; // Use adaptive MCMC 00155 double acceptRateTarget; // Target acceptance rate for MCMC 00156 double minlogL; // Minimum value for the log Likelihood to accept a jump. We used 0 for a long time, this number shouldn't be positive! 00157 00158 int correlatedUpdates; // Switch to do correlated update proposals 00159 int nCorr; // Number of iterations for which the covariance matrix is calculated 00160 int prMatrixInfo; // Print information to screen on proposed matrix updates 00161 00162 double annealTemp0; // Starting temperature of the annealed chain 00163 int annealNburn; // Number of iterations for the annealing burn-in phase 00164 int annealNburn0; // Number of iterations during which temp=annealTemp0 00165 00166 int parallelTempering; // Switch to use parallel tempering 00167 double maxTemp; // Maximum temperature in automatic parallel-tempering ladder 00168 int saveHotChains; // Save hot (T>1) parallel-tempering chains 00169 int prParTempInfo; // Print information on the temperature chains 00170 00171 double blockFrac; // Fraction of non-correlated updates that is a block update 00172 double corrFrac; // Fraction of MCMC updates that used the correlation matrix 00173 double matAccFr; // The fraction of diagonal elements that must improve in order to accept a new covariance matrix 00174 00175 double netsnr; // Total SNR of the network 00176 double tempLadder[99]; // Temperature ladder for manual parallel tempering 00177 00178 //Data: 00179 char datasetName[80]; // Name of the data set used (for printing purposes) 00180 double geocentricTc; // Geocentric time of coalescence 00181 double dataBeforeTc; // Data stretch in the time domain before t_c to use in the analysis 00182 double dataAfterTc; // Data stretch in the time domain after t_c to use in the analysis 00183 double lowFrequencyCut; // Lower frequency cutoff to compute the overlap for 00184 double lowFrequencyCutInj; // Lower frequency cutoff for the software injection 00185 double highFrequencyCut; // Upper frequency cutoff to compute the overlap for 00186 double tukeyWin; // Parameter for Tukey-window used in dataFT 00187 int downsampleFactor; // Factor by which the data should be downsampled before the analysis 00188 double tukey1; 00189 double tukey2; 00190 00191 int PSDsegmentNumber; // Number of data segments used for PSD estimation 00192 double PSDsegmentLength; // Length of each segment of data used for PSD estimation 00193 00194 00195 //Software injection: 00196 int injectSignal; // Inject a signal in the data or not 00197 int injectionWaveform; // Waveform used to do software injections 00198 double injectionPNorder; // pN order of the injection waveform 00199 int injRanSeed; // Seed to randomise injection parameters 00200 double injectionSNR; // Network SNR of the software injection, scale the distance to obtain this value 00201 00202 int injNumber[20]; // Number of the current parameter 00203 int injID[20]; // Unique parameter identifier 00204 int injRevID[200]; // Reverse parameter identifier 00205 double injParVal[20]; // Injection value for each parameter 00206 double injParValOrig[20]; // Injection value for each parameter as suggested in the input file 00207 int injRanPar[20]; // Randomise injection parameters 00208 double injSigma[20]; // Width of Gaussian distribution to draw injection parameters from 00209 int injBoundType[20]; // Type of boundary to use 00210 double injBoundLow[20]; // Info to determine lower boundary for prior 00211 double injBoundUp[20]; // Info to determine upper boundary for prior 00212 00213 00214 //MCMC parameters: 00215 int priorSet; // Set of priors to use for the MCMC parameters 00216 int offsetMCMC; // Start MCMC offset (i.e., not from injection values) or not 00217 double offsetX; // Start offset chains from a Gaussian distribution offsetX times wider than parSigma 00218 00219 int parNumber[20]; // Number of the current parameter 00220 int parID[20]; // Unique parameter identifier 00221 double parBestVal[20]; // Best known value for each parameter 00222 int parFix[20]; // Fix an MCMC parameter or not 00223 int parStartMCMC[20]; // Method of choosing starting value for Markov chains 00224 double parSigma[20]; // Width of Gaussian distribution for offset start and first correlation matrix 00225 00226 int priorType[20]; // Type of prior to use 00227 double priorBoundLow[20]; // Info to determine lower boundary for prior 00228 double priorBoundUp[20]; // Info to determine upper boundary for prior 00229 00230 //Hardcoded MCMC parameter database: 00231 int parDBn; // Size of the hardcoded database (set to 200 in the beginning of main()) 00232 char parName[200][99]; // Names of the parameters in the database 00233 char parAbrev[200][99]; // Abbreviations of the parameter names 00234 char parAbrv[200][99]; // Really short abbreviations of the parameter names 00235 int parDef[200]; // Indicates whether a parameter is defined (1) or not (0) 00236 int mcmcParUse[200]; // Indicates whether a parameter is being used (1) or not (0) for MCMC 00237 int injParUse[200]; // Indicates whether a parameter is being used (1) or not (0) for the injection 00238 int parRevID[200]; // Reverse parameter identifier 00239 00240 int doSNR; // Calculate the injection SNR 00241 int doMCMC; // Do MCMC 00242 int doMatch; // Compute matches 00243 int writeSignal; // Write signal, noise, PSDs to file 00244 int beVerbose; // Be verbose: 0-print progress only; 1-add basic details (default), 2-add a lot of details 00245 00246 char mainFilename[99]; // Run input file name 00247 char outfilename[99]; // Copy of input file name 00248 char mcmcFilename[99]; // Run MCMC input file name 00249 char dataFilename[99]; // Run data input file name 00250 char injectionFilename[99]; // Run injection input file name 00251 char parameterFilename[99]; // Run parameter input file name 00252 char systemFilename[99]; // System-dependent input file name 00253 char dataDir[99]; // Absolute path of the directory where the detector data sits 00254 00255 char* injXMLfilename; // Name of XML injection file 00256 int injXMLnr; // Number of injection in XML injection file to use 00257 double triggerMc; // Chirp mass from the command line 00258 double triggerEta; // Eta from the command line 00259 double triggerTc; // Time of coalescence from the command line 00260 double triggerDist; // Distance from the command line 00261 int commandSettingsFlag[99]; // Command line mcmc settings flags 00262 00263 char* outputPath; // where the output is stored 00264 char** cacheFilename; // Name of the cache files 00265 char** FrameDetector[3]; // table of letter code of the detectors in the cache file 00266 char** FramePrefix[3]; // table of prefix of the frame files in the cache file 00267 int* FrameGPSstart[3]; // table of GPS time of the frame files in the cache file 00268 int* FrameLength[3]; // table of lenght of the frame files in the cache file 00269 char** FrameName[3]; // table of frame file names in the cache file 00270 int nFrame[3]; // number of frame files in the cache file 00271 double PSDstart; // GPS start of the PSD 00272 00273 char channelname[3][99]; // Name of the channels from command line 00274 00275 }; // End struct runpar 00276 00277 00278 00279 //Structure for MCMC variables 00280 struct MCMCvariables{ 00281 int maxnPar; // Maximum allowed number of MCMC/injection parameters 00282 int nMCMCpar; // Number of parameters in the MCMC template 00283 int nInjectPar; // Number of parameters in the injection template 00284 int iIter; // State/iteration number 00285 int nParFit; // Number of parameters in the MCMC that is fitted for 00286 int nTemps; // Number of chains in the temperature ladder 00287 int iTemp; // The current temperature index 00288 int networkSize; // Number of IFOs in the detector network 00289 int mcmcWaveform; // Waveform used as the MCMC template 00290 double mcmcPNorder; // pN order of the MCMC waveform 00291 int injectSignal; // Inject a signal in the data or not 00292 int injectionWaveform; // Waveform used to do software injections 00293 double injectionPNorder; // pN order of the injection waveform 00294 00295 int nIter; // Number of MCMC iterations to compute 00296 int thinOutput; // Save every thiOutput-th MCMC iteration to file 00297 int thinScreenOutput; // Save every thiOutput-th MCMC iteration to screen 00298 int adaptiveMCMC; // Use adaptive MCMC 00299 double acceptRateTarget; // Target acceptance rate for MCMC 00300 double minlogL; // Minimum value for the log Likelihood to accept a jump. We used 0 for a long time, this number shouldn't be positive! 00301 00302 double decreaseSigma; // Factor with which to decrease the jump-size sigma when a proposal is rejected 00303 double increaseSigma; // Factor with which to increase the jump-size sigma when a proposal is rejected 00304 00305 int correlatedUpdates; // Switch to do correlated update proposals 00306 int nCorr; // Number of iterations for which the covariance matrix is calculated 00307 int prMatrixInfo; // Print information to screen on proposed matrix updates 00308 00309 double annealTemp0; // Starting temperature of the annealed chain 00310 int annealNburn; // Number of iterations for the annealing burn-in phase 00311 int annealNburn0; // Number of iterations during which temp=annealTemp0 00312 00313 int parallelTempering; // Switch to use parallel tempering 00314 double maxTemp; // Maximum temperature in automatic parallel-tempering ladder 00315 int saveHotChains; // Save hot (T>1) parallel-tempering chains 00316 int prParTempInfo; // Print information on the temperature chains 00317 00318 00319 00320 double chTemp; // The current chain temperature 00321 double tempOverlap; // Overlap between sinusoidal chain temperatures 00322 double blockFrac; // Fraction of non-correlated updates that is a block update 00323 double corrFrac; // Fraction of MCMC updates that used the correlation matrix 00324 double matAccFr; // The fraction of diagonal elements that must improve in order to accept a new covariance matrix 00325 double baseTime; // Base of time measurement, get rid of long GPS time format 00326 00327 00328 //MCMC parameters: 00329 int priorSet; // Set of priors to use for the MCMC parameters 00330 int offsetMCMC; // Start MCMC offset (i.e., not from injection values) or not 00331 double offsetX; // Start offset chains from a Gaussian distribution offsetX times wider than parSigma 00332 double geocentricTc; // Geocentric time of coalescence 00333 00334 int parNumber[20]; // Number of the current parameter 00335 int parID[20]; // Unique parameter identifier 00336 int injID[20]; // Unique parameter identifier 00337 double parBestVal[20]; // Best known value for each parameter 00338 int parFix[20]; // Fix an MCMC parameter or not 00339 int parStartMCMC[20]; // Method of choosing starting value for Markov chains 00340 double injParVal[20]; // Injection value for each parameter 00341 double parSigma[20]; // Width of Gaussian distribution for offset start and first correlation matrix 00342 int priorType[20]; // Type of prior to use 00343 double priorBoundLow[20]; // Info to determine lower boundary for prior 00344 double priorBoundUp[20]; // Info to determine upper boundary for prior 00345 00346 //Hardcoded MCMC parameter database: 00347 int parDBn; // Size of the hardcoded database (set to 200 in the beginning of main()) 00348 char parName[200][99]; // Names of the parameters in the database 00349 char parAbrev[200][99]; // Abbreviations of the parameter names 00350 char parAbrv[200][99]; // Really short abbreviations of the parameter names 00351 int parDef[200]; // Indicates whether a parameter is defined (1) or not (0) 00352 int mcmcParUse[200]; // Indicates whether a parameter is being used (1) or not (0) for MCMC 00353 int injParUse[200]; // Indicates whether a parameter is being used (1) or not (0) for the injection 00354 int parRevID[200]; // Reverse MCMC parameter identifier 00355 int injRevID[200]; // Reverse injection parameter identifier 00356 00357 int beVerbose; // Be verbose: 0-print progress only; 1-add basic details (default), 2-add a lot of details 00358 00359 00360 double *histMean; // Mean of hist block of iterations, used to get the covariance matrix 00361 double *histDev; // Standard deviation of hist block of iterations, used to get the covariance matrix 00362 00363 int *corrUpdate; // Switch (per chain) to do correlated (1) or uncorrelated (0) updates 00364 int *acceptElems; // Count 'improved' elements of diagonal of new corr matrix, to determine whether to accept it 00365 00366 double tempLadder[99]; // Array of temperatures in the temperature ladder 00367 double *tempAmpl; // Temperature amplitudes for sinusoid T in parallel tempering 00368 double *logL; // Current log(L) 00369 double *nlogL; // New log(L) 00370 double *dlogL; // log(L)-log(Lo) 00371 double *maxdlogL; // Remember the maximum dlog(L) 00372 00373 00374 double *corrSig; // Sigma for correlated update proposals 00375 int *swapTs1; // Totals for the columns in the chain-swap matrix 00376 int *swapTs2; // Totals for the rows in the chain-swap matrix 00377 int *acceptPrior; // Check boundary conditions and choose to accept (1) or not(0) 00378 int *iHist; // Count the iteration number in the current history block to calculate the covar matrix from 00379 00380 int **accepted; // Count accepted proposals 00381 int **swapTss; // Count swaps between chains 00382 double **param; // The current parameters for all chains 00383 double **nParam; // The new parameters for all chains 00384 double **maxLparam; // The best parameters for all chains (max logL) 00385 double **adaptSigma; // The standard deviation of the gaussian to draw the jump size from 00386 double **adaptSigmaOut; // The sigma that gets written to output 00387 double **adaptScale; // The rate of adaptation 00388 00389 double ***hist; // Store a block of iterations, to calculate the covariance matrix 00390 double ***covar; // The Cholesky-decomposed covariance matrix 00391 00392 int seed; // MCMC seed 00393 gsl_rng *ran; // GSL random-number seed 00394 00395 FILE *fout; // Output-file pointer 00396 FILE **fouts; // Output-file pointer array 00397 }; // End struct MCMCvariables 00398 00399 00400 00401 00402 00403 // Structure for waveform parameter set with up to 20 parameters 00404 struct parSet{ 00405 00406 double par[20]; // Array with all parameters 00407 int nPar; // Number of parameters used 00408 00409 double NdJ; // N^.J_o^; inclination of J_o 00410 00411 // Derived quantities (computed in localPar()): 00412 double *loctc; // vector of local coalescence times (w.r.t. FT'd data!) 00413 double *localti; // vector of local altitudes 00414 double *locazi; // vector of local azimuths 00415 }; 00416 00417 00418 struct interferometer{ 00419 char name[16]; 00420 int index; 00421 double lati, longi; // position coordinates 00422 double rightArm, leftArm; // arm directions (counter-clockwise (!) from true north) 00423 double radius_pole, radius_eqt; // earth radii at poles & equator (in metres) 00424 double lowCut, highCut; // frequency cutoffs (Hz) (`seismic' & `high-frequency' c.) 00425 double before_tc; // seconds of flat (!) window before `prior_tc_mean' 00426 double after_tc; // seconds of flat window after `prior_tc_mean' 00427 00428 char ch1name[128]; // specifications for channel 1 00429 char ch1filepath[128]; 00430 char ch1fileprefix[128]; 00431 char ch1filesuffix[128]; 00432 int ch1filesize; 00433 int ch1fileoffset; 00434 int ch1doubleprecision; 00435 00436 int add2channels; // flag: add 2nd channel to 1st ? 00437 00438 char ch2name[128]; // specifications for channel 2 00439 char ch2filepath[128]; 00440 char ch2fileprefix[128]; 00441 char ch2filesuffix[128]; 00442 int ch2filesize; 00443 int ch2fileoffset; 00444 int ch2doubleprecision; 00445 00446 long noiseGPSstart; // starting time for noise PSD estimation 00447 char noisechannel[128]; // specifications for noise channel 00448 char noisefilepath[128]; 00449 char noisefileprefix[128]; 00450 char noisefilesuffix[128]; 00451 int noisefilesize; 00452 int noisefileoffset; 00453 int noisedoubleprecision; 00454 double snr; // Save the calculated SNR for each detector 00455 00456 // Elements below this point are determined in `ifoinit()': 00457 double rightvec[3], leftvec[3], // arm (unit-) vectors 00458 normalvec[3], // normal vector of ifo arm plane 00459 orthoArm[3]; // vector orthogonal to right arm and normal vector 00460 // (usually, but not necessarily identical to 2nd arm) 00461 double positionvec[3]; // vector pointing to detector position on earth surface 00462 double *raw_noisePSD; 00463 int PSDsize; 00464 fftw_complex *raw_dataTrafo; 00465 int FTsize; 00466 int samplerate; 00467 double FTstart, deltaFT; 00468 00469 double *noisePSD; // noise PSD interpolated for the above set of frequencies 00470 fftw_complex *dataTrafo; // copy of the dataFT stretch corresponding to above frequencies 00471 int lowIndex, highIndex, indexRange; 00472 00473 // Frequency-domain template stuff: 00474 double *FTin; // Fourier transform input 00475 fftw_complex *FTout; // FT output (type here identical to `(double) complex') 00476 double *rawDownsampledWindowedData; // Copy of raw data, downsampled and windowed 00477 double *FTwindow; // Fourier transform input window 00478 fftw_plan FTplan; // Fourier transform plan 00479 int samplesize; // number of samples (original data) 00480 00481 }; 00482 00483 00484 00485 00486 00487 // Declare functions (prototypes): 00488 void readCommandLineOptions(int argc, char* argv[], struct runPar *run); 00489 void readMainInputfile(struct runPar *run); 00490 void readMCMCinputfile(struct runPar *run); 00491 void readDataInputfile(struct runPar *run, struct interferometer ifo[]); 00492 void readInjectionInputfile(struct runPar *run); 00493 void readParameterInputfile(struct runPar *run); 00494 void readSystemInputfile(struct runPar *run); 00495 void readInjectionXML(struct runPar *run); 00496 void setParameterNames(struct runPar *run); 00497 00498 void setConstants(void); 00499 void setIFOdata(struct runPar *run, struct interferometer ifo[]); 00500 00501 void setRandomInjectionParameters(struct runPar *run); 00502 void getInjectionParameters(struct parSet *par, int nInjectionPar, double *parInjectVal); 00503 void getStartParameters(struct parSet *par, struct runPar run); 00504 void startMCMCOffset(struct parSet *par, struct MCMCvariables *mcmc, struct interferometer *ifo[], struct runPar run); 00505 void setTemperatureLadder(struct MCMCvariables *mcmc); 00506 void setTemperatureLadderOld(struct MCMCvariables *mcmc); 00507 void allocParset(struct parSet *par, int networkSize); 00508 void freeParset(struct parSet *par); 00509 00510 void copyRun2MCMC(struct runPar run, struct MCMCvariables *mcmc); 00511 void setMCMCseed(struct runPar *run); 00512 void setSeed(int *seed); 00513 00514 void MCMC(struct runPar run, struct interferometer *ifo[]); 00515 void CholeskyDecompose(double **A, struct MCMCvariables *mcmc); 00516 void par2arr(struct parSet par, double **param, struct MCMCvariables mcmc); 00517 void arr2par(double **param, struct parSet *par, struct MCMCvariables mcmc); 00518 double prior(double *par, int p, struct MCMCvariables mcmc); 00519 double sigmaPeriodicBoundaries(double sigma, int p, struct MCMCvariables mcmc); 00520 00521 void correlatedMCMCupdate(struct interferometer *ifo[], struct parSet *state, struct MCMCvariables *mcmc, struct runPar run); 00522 void uncorrelatedMCMCsingleUpdate(struct interferometer *ifo[], struct parSet *state, struct MCMCvariables *mcmc, struct runPar run); 00523 void uncorrelatedMCMCblockUpdate(struct interferometer *ifo[], struct parSet *state, struct MCMCvariables *mcmc, struct runPar run); 00524 00525 void writeMCMCheader(struct interferometer *ifo[], struct MCMCvariables mcmc, struct runPar run); 00526 void writeMCMCoutput(struct MCMCvariables mcmc, struct interferometer *ifo[]); 00527 void allocateMCMCvariables(struct MCMCvariables *mcmc); 00528 void freeMCMCvariables(struct MCMCvariables *mcmc); 00529 00530 void updateCovarianceMatrix(struct MCMCvariables *mcmc); 00531 double annealTemperature(double temp0, int nburn, int nburn0, int iIter); 00532 void swapChains(struct MCMCvariables *mcmc); 00533 void writeChainInfo(struct MCMCvariables mcmc); 00534 00535 00536 00537 00538 double chirpMass(double m1, double m2); 00539 double massRatio(double m1, double m2); 00540 void McEta2masses(double mc, double eta, double *m1, double *m2); 00541 void masses2McEta(double m1, double m2, double *Mc, double *eta); 00542 00543 double GMST(double GPSsec); 00544 double rightAscension(double longi, double GMST); 00545 double longitude(double rightAscension, double GMST); 00546 00547 double dotProduct(double vec1[3], double vec2[3]); 00548 void facVec(double vec1[3], double fac, double vec2[3]); 00549 void addVec(double vec1[3], double vec2[3], double result[3]); 00550 void normalise(double vec[3]); 00551 void crossProduct(double vec1[3], double vec2[3], double result[3]); 00552 void rotate(double x[3], double angle, double axis[3]); 00553 int rightHanded(double x[3], double y[3], double z[3]); 00554 void orthoProject(double x[3], double vec1[3], double vec2[3]); 00555 double angle(double x[3], double y[3]); 00556 void coord2vec(double sinlati, double longi, double x[3]); 00557 void vec2coord(double x[3], double *sinlati, double *longi); 00558 00559 00560 //************************************************************************************************************************************************ 00561 00562 void IFOinit(struct interferometer **ifo, int networkSize, struct runPar run); 00563 void IFOdispose(struct interferometer *ifo, struct runPar run); 00564 double *filter(int *order, int samplerate, double upperlimit, struct runPar run); 00565 double *downsample(double data[], int *datalength, double coef[], int ncoef, struct runPar run); 00566 void dataFT(struct interferometer *ifo[], int i, int networkSize, struct runPar run); 00567 double hannWindow(int j, int N); 00568 double tukeyWindow(int j, int N, double r); 00569 double modifiedTukeyWindow(int j, int N, double r1, double r2); 00570 void noisePSDestimate(struct interferometer *ifo[], int ifonr, struct runPar run); 00571 double logNoisePSD(double f, struct interferometer *ifo); 00572 double interpolLogNoisePSD(double f, struct interferometer *ifo); 00573 void writeDataToFiles(struct interferometer *ifo[], int networkSize, struct runPar run); 00574 void writeNoiseToFiles(struct interferometer *ifo[], int networkSize, struct runPar run); 00575 void writeSignalsToFiles(struct interferometer *ifo[], int networkSize, struct runPar run); 00576 void printParameterHeaderToFile(FILE * dump, struct interferometer *ifo, struct runPar run); 00577 00578 00579 //************************************************************************************************************************************************ 00580 void waveformTemplate(struct parSet *par, struct interferometer *ifo[], int ifonr, int waveformVersion, int injectionWF, struct runPar run); 00581 void templateApostolatos(struct parSet *par, struct interferometer *ifo[], int ifonr, int injectionWF, struct runPar run); 00582 void localPar(struct parSet *par, struct interferometer *ifo[], int networkSize, int injectionWF, struct runPar run); 00583 00584 00585 00586 //************************************************************************************************************************************************ 00587 00588 void templateLAL12(struct parSet *par, struct interferometer *ifo[], int ifonr, int injectionWF, struct runPar run); 00589 void templateLAL15old(struct parSet *par, struct interferometer *ifo[], int ifonr, int injectionWF, struct runPar run); 00590 void templateLAL15(struct parSet *par, struct interferometer *ifo[], int ifonr, int injectionWF, struct runPar run); 00591 void templateLALPhenSpinTaylorRD(struct parSet *par, struct interferometer *ifo[], int ifonr, int injectionWF, struct runPar run); 00592 void templateLALnonSpinning(struct parSet *par, struct interferometer *ifo[], int ifonr, int injectionWF, struct runPar run); 00593 00594 //void LALHpHc(CoherentGW *waveform, double *hplus, double *hcross, int *l, int length, struct parSet *par, struct interferometer *ifo, int ifonr); 00595 void LALHpHc12(LALStatus *status, CoherentGW *waveform, SimInspiralTable *injParams, PPNParamStruc *ppnParams, int *l, struct parSet *par, struct interferometer *ifo, int injectionWF, struct runPar run); 00596 void LALHpHc15(LALStatus *status, CoherentGW *waveform, SimInspiralTable *injParams, PPNParamStruc *ppnParams, int *l, struct parSet *par, struct interferometer *ifo, int injectionWF, struct runPar run); 00597 void LALHpHcNonSpinning(LALStatus *status, CoherentGW *waveform, SimInspiralTable *injParams, PPNParamStruc *ppnParams, int *l, struct parSet *par, struct interferometer *ifo, int injectionWF, struct runPar run); 00598 //double LALFpFc(CoherentGW *waveform, double *wave, int *l, int length, struct parSet *par, int ifonr); 00599 double LALFpFc(LALStatus *status, CoherentGW *waveform, SimInspiralTable *injParams, PPNParamStruc *ppnParams, double *wave, int length, struct parSet *par, struct interferometer *ifo, int ifonr); 00600 00601 void getWaveformApproximant(const char* familyName, int length, double PNorder, char* waveformApproximant); 00602 void LALfreedomSpin(CoherentGW *waveform); 00603 void LALfreedomNoSpin(CoherentGW *waveform); 00604 void LALfreedomPhenSpinTaylorRD(CoherentGW *waveform); 00605 00606 //************************************************************************************************************************************************ 00607 00608 double netLogLikelihood(struct parSet *par, int networkSize, struct interferometer *ifo[], int waveformVersion, int injectionWF, struct runPar run); 00609 double IFOlogLikelihood(struct parSet *par, struct interferometer *ifo[], int i, int waveformVersion, int injectionWF, struct runPar run); 00610 double logLikelihood_nine(struct parSet *par, int waveformVersion, int injectionWF, struct runPar run); 00611 double signalToNoiseRatio(struct parSet *par, struct interferometer *ifo[], int i, int waveformVersion, int injectionWF, struct runPar run); 00612 double parMatch(struct parSet* par1, int waveformVersion1, int injectionWF1, struct parSet* par2, int waveformVersion2, int injectionWF2, struct interferometer *ifo[], int networkSize, struct runPar run); 00613 double overlapWithData(struct parSet *par, struct interferometer *ifo[], int ifonr, int waveformVersion, int injectionWF, struct runPar run); 00614 double parOverlap(struct parSet* par1, int waveformVersion1, int injectionWF1, struct parSet* par2, int waveformVersion2, int injectionWF2, struct interferometer* ifo[], int ifonr, struct runPar run); 00615 double vecOverlap(fftw_complex *vec1, fftw_complex *vec2, double * noise, int j_1, int j_2, double deltaFT); 00616 void signalFFT(fftw_complex * FFTout, struct parSet *par, struct interferometer *ifo[], int ifonr, int waveformVersion, int injectionWF, struct runPar run); 00617 double matchBetweenParameterArrayAndTrueParameters(double * pararray, struct interferometer *ifo[], struct MCMCvariables mcmc, struct runPar run); 00618 //void computeFisherMatrixIFO(struct parSet *par, int npar, struct interferometer *ifo[], int networkSize, int ifonr, double **matrix); 00619 //void computeFisherMatrix(struct parSet *par, int npar, struct interferometer *ifo[], int networkSize, double **matrix); 00620 //double match(struct parSet *par, struct interferometer *ifo[], int i, int networkSize); 00621 00622 void parseCharacterOptionString(char *input, char **strings[], int *n); 00623 void readCachefile(struct runPar *run, int ifonr); 00624 00625 #endif