BCVTemplates.c

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Jolien Creighton, B.S. Sathyaprakash, Thomas Cokelaer
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="BCVTemplatesCV">
00021 Author: B.S. Sathyaprakash
00022 $Id: BCVTemplates.c,v 1.17 2007/06/08 14:41:42 bema Exp $
00023 **************************************************** </lalVerbatim> */
00024 
00025 /********************************************************** <lalLaTeX>
00026 
00027 \subsection{Program \texttt{BCVTemplates.c}}
00028 \label{ss:BCVTemplates.c}
00029 
00030 Creates a template mesh for BCV (or, alternatively, for SPA but
00031 assuing a constant metric) using the mismatch metric.
00032 
00033 \subsubsection*{Usage}
00034 
00035 \subsubsection*{Description}
00036 
00037 \subsubsection*{Exit codes}
00038 ****************************************** </lalLaTeX><lalErrTable> */
00039 /******************************************** </lalErrTable><lalLaTeX>
00040 
00041 \subsubsection*{Algorithm}
00042 
00043 \subsubsection*{Uses}
00044 \begin{verbatim}
00045 lalDebugLevel
00046 \end{verbatim}
00047 
00048 \subsubsection*{Notes}
00049 
00050 \vfill{\footnotesize\input{BCVTemplatesCV}}
00051 
00052 ******************************************************* </lalLaTeX> */
00053 
00054 #include <math.h>
00055 #include <stdlib.h>
00056 #include <lal/LALInspiralBank.h>
00057 #include <lal/AVFactories.h>
00058 #include <lal/SeqFactories.h>
00059 
00060 NRCSID(FLATMESHTESTC,"$Id: BCVTemplates.c,v 1.17 2007/06/08 14:41:42 bema Exp $");
00061 
00062 /* Default parameter settings. */
00063 INT4 lalDebugLevel = 0;
00064 
00065 int
00066 main(int argc, char **argv)
00067 {
00068   /* top-level status structure */
00069   static LALStatus status;     
00070   static InspiralCoarseBankIn coarseIn;
00071   static InspiralTemplateList *list1, *list2;
00072 
00073   static RectangleIn RectIn;
00074   static RectangleOut RectOut;
00075   void (*noisemodel)(LALStatus*,REAL8*,REAL8) = LALLIGOIPsd;
00076 
00077   UINT4   j, valid, numPSDpts=262144;
00078   FILE *fpr;
00079   INT4 nlist1, nlist2;
00080 /* Number of templates is nlist */
00081 
00082 
00083   fpr = fopen("BCVTemplates.out", "w");
00084   nlist1 = 0;
00085   nlist2 = 0;
00086   coarseIn.HighGM =6.; 
00087   coarseIn.LowGM = 3.;
00088   coarseIn.fLower = 40.L;
00089   coarseIn.fUpper = 2000.L;
00090   coarseIn.tSampling = 4096.L;
00091   coarseIn.order = twoPN;
00092   coarseIn.space = Tau0Tau3;
00093   coarseIn.mmCoarse = 0.95;
00094   coarseIn.mmFine = 0.97;
00095   coarseIn.iflso = 0.0L;
00096   coarseIn.mMin = 3.0;
00097   coarseIn.mMax = 20.0;
00098   coarseIn.MMax = coarseIn.mMax * 2.;
00099   coarseIn.massRange = MinMaxComponentMass; 
00100   /* coarseIn.massRange = MinComponentMassMaxTotalMass;*/
00101   /* minimum value of eta */
00102   coarseIn.etamin = coarseIn.mMin * ( coarseIn.MMax - coarseIn.mMin) / pow(coarseIn.MMax,2.);
00103   coarseIn.psi0Min = 1.e0;
00104   coarseIn.psi0Max = 2.5e4;
00105   coarseIn.psi3Min = -2.2e3;
00106   coarseIn.psi3Max = 8.e2;
00107   coarseIn.alpha = 0.L;
00108   coarseIn.numFcutTemplates = 4;
00109 
00110   memset( &(coarseIn.shf), 0, sizeof(REAL8FrequencySeries) );
00111   coarseIn.shf.f0 = 0;
00112   LALDCreateVector( &status, &(coarseIn.shf.data), numPSDpts );
00113   coarseIn.shf.deltaF = coarseIn.tSampling / (2.*(REAL8) coarseIn.shf.data->length + 1.L);
00114   LALNoiseSpectralDensity (&status, coarseIn.shf.data, noisemodel, coarseIn.shf.deltaF );
00115 
00116   coarseIn.approximant = BCV;
00117   coarseIn.space       = Psi0Psi3;
00118   
00119   LALInspiralCreateCoarseBank(&status, &list1, &nlist1, coarseIn);
00120   for (j=0; j<nlist1; j++)
00121   {
00122           fprintf(fpr, "%e %e %e %e\n", 
00123                           list1[j].params.psi0, 
00124                           list1[j].params.psi3, 
00125                           list1[j].params.totalMass, 
00126                           list1[j].params.fFinal);
00127   }
00128   fprintf(fpr, "&\n");
00129   coarseIn.approximant  = TaylorT1;
00130   coarseIn.space        = Tau0Tau3;
00131 
00132   LALInspiralCreateCoarseBank(&status, &list2, &nlist2, coarseIn);
00133     
00134   for (j=0; j<nlist2; j++)
00135   {
00136           fprintf(fpr, "%e %e %e %e\n", 
00137                           list2[j].params.t0, 
00138                           list2[j].params.t3,
00139                           list2[j].params.mass1, 
00140                           list2[j].params.mass2 
00141                           );
00142   }
00143                 
00144   fprintf(fpr, "&\n");
00145 
00146   /* Print rectagles*/
00147   
00148     RectIn.dx = sqrt(2.0 * (1. - coarseIn.mmCoarse)/list1[0].metric.g00 );
00149     RectIn.dy = sqrt(2.0 * (1. - coarseIn.mmCoarse)/list1[0].metric.g11 );
00150     RectIn.theta = list1[0].metric.theta;
00151     
00152     /* Print out the template parameters */
00153     for (j=0; j<nlist1; j++)
00154     {
00155         /*
00156         Retain only those templates that have meaningful masses:
00157         */
00158         RectIn.x0 = (REAL8) list1[j].params.psi0;
00159         RectIn.y0 = (REAL8) list1[j].params.psi3;
00160         /*
00161         LALInspiralValidParams(&status, &valid, bankParams, coarseIn);
00162         */
00163         valid = 1;
00164         if (valid) 
00165         {
00166                 LALRectangleVertices(&status, &RectOut, &RectIn);
00167                 fprintf(fpr, "%e %e\n%e %e\n%e %e\n%e %e\n%e %e\n", 
00168                                 RectOut.x1, RectOut.y1, 
00169                                 RectOut.x2, RectOut.y2, 
00170                                 RectOut.x3, RectOut.y3, 
00171                                 RectOut.x4, RectOut.y4, 
00172                                 RectOut.x5, RectOut.y5);
00173                 fprintf(fpr, "&\n");
00174         }
00175     }
00176   
00177   /* Free the list, and exit. */
00178   if (list1 != NULL) LALFree (list1);
00179   if (list2 != NULL) LALFree (list2);
00180   LALDDestroyVector( &status, &(coarseIn.shf.data) );
00181   LALCheckMemoryLeaks();
00182   fclose(fpr);
00183   return 0;
00184 }

Generated on Sat Sep 6 03:06:37 2008 for LAL by  doxygen 1.5.2