InspiralInjectionParams.c

Go to the documentation of this file.
00001  /*      
00002  *  Copyright (C) 2007 Bernd Machenschalk, Stephen Fairhurst, Alexander Dietz    
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 /** \file InspiralInjectionParams.c
00020  *  \ingroup InspiralInjectionParams
00021  *  \author D. Brown, J. Creighton, S. Fairhurst, G. Jones, E. Messaritaki
00022  * 
00023  *  \brief Functions for generating random distributions of inspiral parameters
00024  *  for injection purposes
00025  *
00026  * $Id: InspiralInjectionParams.c,v 1.13 2008/07/03 23:59:53 dfazi Exp $ 
00027  *
00028  */
00029 
00030 #include <math.h>
00031 #include <stdio.h>
00032 #include <stdlib.h>
00033 #include <lal/LALStdlib.h>
00034 #include <lal/LALStdio.h>
00035 #include <lal/LIGOMetadataTables.h>
00036 #include <lal/LIGOMetadataUtils.h>
00037 #include <lal/LIGOMetadataUtils.h>
00038 #include <lal/Date.h>
00039 #include <lal/SkyCoordinates.h>
00040 #include <lal/GeneratePPNInspiral.h>
00041 #include <lal/DetectorSite.h>
00042 #include <lal/DetResponse.h>
00043 #include <lal/TimeDelay.h>
00044 #include <lal/InspiralInjectionParams.h>
00045 
00046 NRCSID (INSPIRALINJECTIONPARAMSC,"$Id: InspiralInjectionParams.c,v 1.13 2008/07/03 23:59:53 dfazi Exp $");
00047 
00048 /** Generates the geocent_end_time for an inspiral injection, based on the
00049  * given startTime and timeWindow */
00050 SimInspiralTable* XLALRandomInspiralTime(
00051     SimInspiralTable *inj,   /**< injection for which time will be set */
00052     RandomParams *randParams,/**< random parameter details*/
00053     LIGOTimeGPS startTime,   /**< the first time that the injection could be */
00054     REAL4 timeWindow         /**< the time window within which inj must occur*/
00055     )
00056 {       
00057   REAL8 timeOffset;
00058   timeOffset = (REAL8) timeWindow * XLALUniformDeviate( randParams );
00059   inj->geocent_end_time = *XLALGPSAdd( &startTime, timeOffset );
00060   inj->end_time_gmst = XLALGreenwichMeanSiderealTime( 
00061       &(inj->geocent_end_time) );
00062 
00063   return ( inj );
00064 }
00065 
00066 /** Generates the distance for an inspiral injection, based on the requested
00067  * distribution and max/min distances */
00068 SimInspiralTable* XLALRandomInspiralDistance( 
00069     SimInspiralTable *inj,     /**< injection for which distance will be set */
00070     RandomParams *randParams,  /**< random parameter details*/
00071     DistanceDistribution dDist,/**< requested distance distribution */
00072     REAL4  distMin,            /**< minimum distance (Mpc) */
00073     REAL4  distMax             /**< maximum distance (Mpc) */
00074     )    
00075 {       
00076   if ( dDist == uniformDistance )
00077   {
00078     /* uniform distribution in distance */
00079     inj->distance = distMin + 
00080       (distMax - distMin) * XLALUniformDeviate( randParams );
00081   }
00082   else if ( dDist == uniformLogDistance )
00083   {
00084     /* uniform distribution in log(distance) */
00085     REAL4 lmin = log10(distMin);
00086     REAL4 lmax = log10(distMax);
00087     REAL4 deltaL = lmax - lmin;
00088     REAL4 exponent;
00089     exponent = lmin + deltaL * XLALUniformDeviate( randParams );
00090     inj->distance = pow(10.0,(REAL4) exponent);
00091   }
00092   else if (dDist == uniformVolume )
00093   {
00094     /* uniform volume distribution */
00095     REAL4 d2min = distMin * distMin ;
00096     REAL4 d2max = distMax * distMax ;
00097     REAL4 deltad2 = d2max - d2min ;
00098     REAL4 d2;
00099     d2 = d2min + deltad2 * XLALUniformDeviate( randParams );
00100     inj->distance = sqrt( d2 );
00101   }    
00102   return ( inj );
00103 } 
00104 
00105 
00106 /** Generates a random sky location (right ascension=longitude,
00107      delta=latitude) for an inspiral injection */
00108 SimInspiralTable* XLALRandomInspiralSkyLocation( 
00109     SimInspiralTable *inj,  /**< injection for which sky location will be set*/
00110     RandomParams *randParams/**< random parameter details*/
00111     )
00112 {
00113   inj->latitude = asin( 2.0 * XLALUniformDeviate( randParams ) - 1.0 ) ;
00114   inj->longitude = LAL_TWOPI * XLALUniformDeviate( randParams ) ;
00115   return ( inj );
00116 }
00117 
00118 /** Generates a location within the Milky Way
00119      for an inspiral injection */
00120 void XLALRandomInspiralMilkywayLocation( 
00121     REAL8 *rightAscension,  /**< right ascension of the milky-way source */
00122     REAL8 *declination,     /**< declination of the milky-way source */
00123     REAL8 *distance,        /**< distance to the milky-way source */
00124     RandomParams *randParams/**< random parameter details*/
00125     )
00126 {
00127   static LALStatus status;
00128   SkyPosition galacticPos, equatorialPos;
00129   const REAL8 h_scale = 1.5; /* scales in kpc */
00130   const REAL8 r_scale = 4.0;
00131   const REAL8 r_sun   = 8.5;
00132   REAL8 r, z, phi, rho2, dist;
00133   REAL4 u;
00134 
00135    /* draw the radial position in the galactic plane */ 
00136   r = r_scale * sqrt( -2 * log( XLALUniformDeviate(randParams) ) );
00137 
00138   /* draw the height */
00139   u = XLALUniformDeviate(randParams);
00140   if ( u > 0.5)
00141   {
00142     z = -h_scale * log( 2 * ( 1 - u ) );
00143   }
00144   else
00145   {
00146     z = h_scale * log( 2 * u );
00147   }
00148   phi = LAL_TWOPI * XLALUniformDeviate(randParams);
00149 
00150   /* calculate the distace from the sun */
00151   rho2 = r_sun * r_sun + r * r - 2 * r_sun * r * cos( phi );
00152   dist = sqrt( z * z + rho2 );
00153 
00154   /* convert galactic coordinates into equatorial coordinates */
00155   galacticPos.longitude = atan2( r * sin( phi ), r_sun - r * cos( phi ) );
00156   galacticPos.latitude  = asin( z /  dist );
00157   galacticPos.system    = COORDINATESYSTEM_GALACTIC;
00158 
00159   /* convert the coordinates */
00160   LALGalacticToEquatorial( &status, &equatorialPos, &galacticPos);
00161 
00162   *declination    = equatorialPos.latitude;
00163   *rightAscension = equatorialPos.longitude;
00164   *distance       = dist/1000.0; /* convert to Mpc */
00165 
00166 }
00167 
00168 /** Generates a random orientation (polarization, inclination, coa_phase)
00169  * for an inspiral injection.  If inclinationPeak is non-zero, then peak the 
00170  * inclination around o with width inclinationPeak */
00171 SimInspiralTable* XLALRandomInspiralOrientation( 
00172     SimInspiralTable *inj,   /**< injection for which orientation will be set*/
00173     RandomParams *randParams,/**< random parameter details*/
00174     InclDistribution iDist,  /**< requested inclination distribution */
00175     REAL4   inclinationPeak /**< width of the peak of the inclination */
00176     )
00177 {       
00178   if ( iDist == uniformInclDist )
00179   {
00180     inj->inclination = acos( 2.0 * XLALUniformDeviate( randParams ) 
00181         - 1.0 );
00182   }
00183   else if ( iDist == gaussianInclDist )
00184   {
00185     inj->inclination = inclinationPeak * XLALNormalDeviate( randParams );
00186   }
00187 
00188   inj->polarization = LAL_TWOPI * XLALUniformDeviate( randParams ) ;
00189   inj->coa_phase = LAL_TWOPI * XLALUniformDeviate( randParams ) ;
00190 
00191   return ( inj );
00192 }
00193 
00194 /** Generates random masses for an inspiral injection. */
00195 SimInspiralTable* XLALRandomInspiralMasses( 
00196     SimInspiralTable *inj,   /**< injection for which masses will be set*/
00197     RandomParams *randParams,/**< random parameter details*/
00198     MassDistribution mDist,  /**< the mass distribution to use */
00199     REAL4  mass1Min,         /**< minimum mass for first component */
00200     REAL4  mass1Max,         /**< maximum mass for first component */
00201     REAL4  mass2Min,         /**< minimum mass for second component */
00202     REAL4  mass2Max,         /**< maximum mass for second component */
00203     REAL4  minTotalMass,     /**< minimum total mass of binaty */
00204     REAL4  maxTotalMass      /**< maximum total mass of binary */
00205     )
00206 {       
00207   REAL4 mTotal = maxTotalMass +1;
00208 
00209   while ( mTotal < minTotalMass || mTotal > maxTotalMass )
00210   {
00211 
00212     if ( mDist == uniformComponentMass )
00213     {
00214       /* uniformly distributed mass1 and uniformly distributed mass2 */
00215       inj->mass1 = mass1Min + XLALUniformDeviate( randParams ) * 
00216         (mass1Max - mass1Min);
00217       inj->mass2 = mass2Min + XLALUniformDeviate( randParams ) * 
00218         (mass2Max - mass2Min);
00219       mTotal = inj->mass1 + inj->mass2 ;
00220     }
00221     else if ( mDist == logComponentMass )
00222     {
00223       /* distributed logarithmically in mass1 and mass2 */
00224       inj->mass1 = exp( log(mass1Min) + XLALUniformDeviate( randParams ) *
00225           (log(mass1Max) - log(mass1Min) ) );
00226       inj->mass2 = exp( log(mass2Min) + XLALUniformDeviate( randParams ) *
00227           (log(mass2Max) - log(mass2Min) ) );
00228       mTotal = inj->mass1 + inj->mass2;
00229     }
00230     else if ( mDist == uniformTotalMass )
00231     {
00232       /*uniformly distributed total mass */
00233       REAL4 minMass= mass1Min + mass2Min;
00234       REAL4 maxMass= mass1Max + mass2Max;
00235       mTotal = minMass + XLALUniformDeviate( randParams ) * (maxMass - minMass);
00236       inj->mass2 = -1.0;
00237       while( inj->mass2 > mass2Max || inj->mass2 <= mass2Min )
00238       {
00239         inj->mass1 = mass1Min + 
00240           XLALUniformDeviate( randParams ) * (mass1Max - mass1Min);
00241         inj->mass2 = mTotal - inj->mass1;
00242       }
00243     }
00244   }
00245 
00246   inj->eta = inj->mass1 * inj->mass2 / ( mTotal * mTotal );
00247   inj->mchirp = mTotal * pow(inj->eta, 0.6);
00248 
00249   return ( inj );
00250 }  
00251 
00252 /** Generates masses for an inspiral injection. Masses are Gaussian distributed
00253  * with the requested mean and standard deviation. */
00254 SimInspiralTable* XLALGaussianInspiralMasses( 
00255     SimInspiralTable *inj,   /**< injection for which masses will be set*/
00256     RandomParams *randParams,/**< random parameter details*/
00257     REAL4  mass1Min,         /**< minimum mass for first component */
00258     REAL4  mass1Max,         /**< maximum mass for first component */
00259     REAL4  mass1Mean,        /**< mean value for mass1 */
00260     REAL4  mass1Std,         /**< standard deviation of mass1 */
00261     REAL4  mass2Min,         /**< minimum mass for second component */
00262     REAL4  mass2Max,         /**< maximum mass for second component */
00263     REAL4  mass2Mean,        /**< mean value of mass2 */
00264     REAL4  mass2Std          /**< standard deviation of mass2 */
00265     )
00266 {       
00267   REAL4 m1, m2, mtotal;
00268   
00269   m1 = 0.0;
00270   while ( (m1-mass1Max)*(m1-mass1Min) > 0 )
00271   {
00272     m1 = mass1Mean + mass1Std * XLALNormalDeviate( randParams );
00273   }
00274   m2 = 0.0;
00275   while ( (m2-mass2Max)*(m2-mass2Min) > 0 )
00276   {
00277     m2 = mass2Mean + mass2Std * XLALNormalDeviate( randParams );
00278   }
00279 
00280   mtotal = m1 + m2;
00281   inj->mass1 = m1;
00282   inj->mass2 = m2;
00283   inj->eta = inj->mass1 * inj->mass2 / ( mtotal * mtotal );
00284   inj->mchirp = mtotal * pow(inj->eta, 0.6);
00285 
00286   return ( inj );
00287 }  
00288 
00289 /* generate masses for an inspiral injection. Total mass and mass ratio
00290  * are uniformly distributed */
00291 SimInspiralTable* XLALRandomInspiralTotalMassRatio(
00292     SimInspiralTable *inj,   /**< injection for which masses will be set */
00293     RandomParams *randParams,/**< random parameter details */
00294     REAL4  minTotalMass,     /**< minimum total mass of binary */
00295     REAL4  maxTotalMass,     /**< maximum total mass of binary */
00296     REAL4  minMassRatio,     /**< minimum mass ratio */
00297     REAL4  maxMassRatio      /**< maximum mass ratio */
00298     )
00299 {
00300   REAL4 mtotal, ratio;
00301 
00302   /* generate uniformly distributed total mass and mass ratio */
00303   mtotal = minTotalMass + (XLALUniformDeviate(randParams) * (maxTotalMass - minTotalMass));
00304   ratio = minMassRatio + (XLALUniformDeviate(randParams) * (maxMassRatio - minMassRatio));
00305 
00306   inj->mass1 = (ratio * mtotal) / (ratio + 1);
00307   inj->mass2 = mtotal / (ratio + 1);
00308   inj->eta = inj->mass1 * inj->mass2 / ( mtotal * mtotal );
00309   inj->mchirp = mtotal * pow(inj->eta, 0.6);
00310 
00311   return ( inj );
00312 }
00313 
00314 /** Generates spins for an inspiral injection.  Spin magnitudes lie between the
00315  * specified max and min values.  Orientation for spin1 can be constrained by
00316  * the specified values of kappa1, otherwise are random. Orientation for spin2
00317  * are random 
00318  */
00319 SimInspiralTable* XLALRandomInspiralSpins( 
00320     SimInspiralTable *inj,   /**< injection for which spins will be set*/
00321     RandomParams *randParams,/**< random parameter details*/
00322     REAL4  spin1Min,         /**< minimum magnitude of spin1 */
00323     REAL4  spin1Max,         /**< maximum magnitude of spin1 */
00324     REAL4  spin2Min,         /**< minimum magnitude of spin2 */
00325     REAL4  spin2Max,          /**< maximum magnitude of spin2 */
00326     REAL4  kappa1Min,
00327     REAL4  kappa1Max,
00328     REAL4  abskappa1Min,
00329     REAL4  abskappa1Max
00330     )
00331 {       
00332   REAL4 spin1Mag;
00333   REAL4 spin2Mag;
00334   REAL4 r1;
00335   REAL4 r2;
00336   REAL4 phi1;
00337   REAL4 phi2;
00338   REAL4 kappa;
00339   REAL4 sintheta;
00340   REAL4 zmin;
00341   REAL4 zmax;
00342   REAL4 inc;
00343   REAL4 cosinc;
00344   REAL4 sininc;
00345   REAL4 sgn;
00346   
00347   inc      = inj->inclination;
00348   cosinc   = cos( inc );
00349   sininc   = sin( inc );
00350   kappa    = -2.0;
00351   
00352   /* spin1Mag */
00353   spin1Mag =  spin1Min + XLALUniformDeviate( randParams ) * 
00354     (spin1Max - spin1Min);
00355   
00356   /* Check if initial spin orientation is specified by user */
00357   if ( (kappa1Min > -1.0) || (kappa1Max < 1.0) )
00358   {
00359     kappa = kappa1Min + XLALUniformDeviate( randParams ) * 
00360         ( kappa1Max - kappa1Min );
00361   }
00362   else if ( (abskappa1Min > 0.0) || (abskappa1Max < 1.0) )
00363   {
00364     kappa = abskappa1Min + XLALUniformDeviate( randParams ) * 
00365         ( abskappa1Max - abskappa1Min );
00366     sgn = XLALUniformDeviate( randParams ) - 0.5;
00367     sgn = (sgn > 0.0) ? 1.0 : -1.0;
00368     kappa = kappa * sgn;    
00369   }
00370   if (kappa > -2.0)
00371   {
00372     sintheta = sqrt( 1 - kappa * kappa );
00373     zmin = spin1Mag * ( cosinc * kappa - sininc * sintheta );
00374     zmax = spin1Mag * ( cosinc * kappa + sininc * sintheta );
00375     
00376     /* spin1z */
00377     inj->spin1z = zmin + XLALUniformDeviate( randParams ) * (zmax - zmin);
00378 
00379     /* spin1x and spin1y */
00380     inj->spin1x = (kappa * spin1Mag - inj->spin1z * cosinc) / sininc ;
00381     inj->spin1y = pow( ((spin1Mag * spin1Mag) - (inj->spin1z * inj->spin1z) - 
00382           (inj->spin1x * inj->spin1x)) , 0.5);
00383   }
00384   else
00385   {
00386     /* spin1z */
00387     inj->spin1z = (XLALUniformDeviate( randParams ) - 0.5) * 2 * (spin1Mag);
00388     /* phi1 */
00389     r1 = pow( ((spin1Mag * spin1Mag) - (inj->spin1z * inj->spin1z)) , 0.5);
00390     phi1 = XLALUniformDeviate( randParams ) * LAL_TWOPI;
00391     inj->spin1x = r1 * cos(phi1);
00392     inj->spin1y = r1 * sin(phi1);
00393   }
00394 
00395   /* spin2Mag */
00396   spin2Mag =  spin2Min + XLALUniformDeviate( randParams ) * 
00397     (spin2Max - spin2Min);
00398 
00399   /* spin2z */
00400   inj->spin2z = (XLALUniformDeviate( randParams ) - 0.5) * 2 * (spin2Mag);
00401   r2 = pow( ((spin2Mag * spin2Mag) - (inj->spin2z * inj->spin2z)) , 
00402       0.5); 
00403 
00404   /* phi2 */
00405   phi2 = XLALUniformDeviate( randParams ) * LAL_TWOPI;
00406 
00407   /* spin2x and spin2y */  
00408   inj->spin2x = r2 * cos(phi2);
00409   inj->spin2y = r2 * sin(phi2);
00410 
00411   return ( inj );
00412 }
00413 
00414 /** Generates random masses for an inspiral injection. */
00415 SimInspiralTable* XLALRandomNRInjectTotalMass( 
00416     SimInspiralTable *inj,   /**< injection for which masses will be set*/
00417     RandomParams *randParams,/**< random parameter details*/
00418     REAL4  minTotalMass,     /**< minimum total mass of binaty */
00419     REAL4  maxTotalMass,     /**< maximum total mass of binary */
00420     SimInspiralTable *nrInjParams   /**< parameters of NR injection*/
00421     )
00422 {       
00423   REAL4 mtotal;
00424   
00425   mtotal = minTotalMass + XLALUniformDeviate( randParams ) * 00426                (maxTotalMass - minTotalMass);
00427   inj->eta = nrInjParams->eta;
00428   inj->mchirp = mtotal * pow(inj->eta, 3.0/5.0);
00429 
00430   /* set mass1 and mass2 */
00431   inj->mass1 = (mtotal / 2.0) * (1 + pow( (1 - 4 * inj->eta), 0.5) );
00432   inj->mass2 = (mtotal / 2.0) * (1 - pow( (1 - 4 * inj->eta), 0.5) );
00433 
00434   /* copy over the spin parameters */
00435   inj->spin1x = nrInjParams->spin1x;
00436   inj->spin1y = nrInjParams->spin1y;
00437   inj->spin1z = nrInjParams->spin1z;
00438   inj->spin2x = nrInjParams->spin2x;
00439   inj->spin2y = nrInjParams->spin2y;
00440   inj->spin2z = nrInjParams->spin2z;
00441 
00442   /* copy over the numrel information */
00443   inj->numrel_mode_min = nrInjParams->numrel_mode_min;
00444   inj->numrel_mode_max = nrInjParams->numrel_mode_max;
00445   LALSnprintf( inj->numrel_data, LIGOMETA_STRING_MAX, 
00446       nrInjParams->numrel_data);
00447 
00448   return ( inj );
00449 }  
00450 
00451 
00452 /** Set end time and effective distance of an injection for a detector */
00453 SimInspiralTable *XLALInspiralSiteTimeAndDist( 
00454     SimInspiralTable  *inj, /**< the injection details */
00455     LALDetector       *detector, /**< the detector of interest */
00456     LIGOTimeGPS       *endTime,  /**< the end time to populate */
00457     REAL4             *effDist   /**< the effective distance to populate */
00458     )
00459 {
00460 
00461   REAL8                 tDelay, fplus, fcross;
00462   REAL4                 splus, scross, cosiota;
00463 
00464   /* calculate the detector end time */
00465   tDelay = XLALTimeDelayFromEarthCenter( detector->location, inj->longitude,
00466       inj->latitude, &(inj->geocent_end_time) );
00467   *endTime = inj->geocent_end_time;
00468   *endTime = *XLALGPSAdd( endTime, tDelay );
00469 
00470   /* initialize distance with real distance and compute splus and scross */
00471   *effDist = 2.0 * inj->distance;
00472   cosiota = cos( inj->inclination );
00473   splus = -( 1.0 + cosiota * cosiota );
00474   scross = -2.0 * cosiota;
00475 
00476 
00477   /* calculate the detector response */
00478   XLALComputeDetAMResponse(&fplus, &fcross, detector->response, inj->longitude, 
00479       inj->latitude, inj->polarization, inj->end_time_gmst);
00480 
00481   /* compute the effective distance */
00482   *effDist /= sqrt( 
00483       splus*splus*fplus*fplus + scross*scross*fcross*fcross );
00484 
00485   return ( inj );
00486 }
00487 
00488 /** Set the end time and effective distance for all detectors for this 
00489  * injection */
00490 SimInspiralTable *XLALPopulateSimInspiralSiteInfo(
00491     SimInspiralTable           *inj /**< the injection */ 
00492     )
00493 {
00494   LALDetector           detector; 
00495   REAL4                *eff_dist;
00496   LIGOTimeGPS          *end_time;
00497 
00498   /* LIGO Hanford observatory*/
00499   detector = lalCachedDetectors[LALDetectorIndexLHODIFF];
00500   end_time = &(inj->h_end_time);
00501   eff_dist = &(inj->eff_dist_h);
00502   inj = XLALInspiralSiteTimeAndDist(inj, &detector, end_time, eff_dist);
00503 
00504   /* LIGO Livingston observatory*/
00505   detector = lalCachedDetectors[LALDetectorIndexLLODIFF];
00506   end_time = &(inj->l_end_time);
00507   eff_dist = &(inj->eff_dist_l);
00508   inj = XLALInspiralSiteTimeAndDist(inj, &detector, end_time, eff_dist);
00509 
00510   /* GEO observatory*/
00511   detector = lalCachedDetectors[LALDetectorIndexGEO600DIFF];
00512   end_time = &(inj->g_end_time);
00513   eff_dist = &(inj->eff_dist_g);
00514   inj = XLALInspiralSiteTimeAndDist(inj, &detector, end_time, eff_dist);
00515 
00516   /* TAMA observatory*/
00517   detector = lalCachedDetectors[LALDetectorIndexTAMA300DIFF];
00518   end_time = &(inj->t_end_time);
00519   eff_dist = &(inj->eff_dist_t);
00520   inj = XLALInspiralSiteTimeAndDist(inj, &detector, end_time, eff_dist);
00521 
00522   /* Virgo observatory*/
00523   detector = lalCachedDetectors[LALDetectorIndexVIRGODIFF];
00524   end_time = &(inj->v_end_time);
00525   eff_dist = &(inj->eff_dist_v);
00526   inj = XLALInspiralSiteTimeAndDist(inj, &detector, end_time, eff_dist);
00527 
00528   return ( inj );
00529 
00530 }
00531 
00532 /** Populate a frequency series with the actuation response.  Here, we just use
00533  * the pendulum part of the actuation function */
00534 COMPLEX8FrequencySeries *generateActuation( 
00535     COMPLEX8FrequencySeries *resp, /* the frequency series to be populated */
00536     REAL4                    ETMcal,/* the ETM calibration */
00537     REAL4                    pendF, /* the pendulum frequency */
00538     REAL4                    pendQ  /* the pendulum Q */ 
00539     )
00540 {
00541   INT4   k;
00542   REAL4  fNorm = 0;
00543   COMPLEX8Vector *num = NULL;  
00544   COMPLEX8Vector *denom = NULL;  
00545 
00546   num = XLALCreateCOMPLEX8Vector( resp->data->length );
00547   denom = XLALCreateCOMPLEX8Vector( resp->data->length );
00548 
00549   /* the response function is
00550    *
00551    *                  ETMcal * pendF^2
00552    * R(f) =  ---------------------------------------
00553    *         pendF^2 - freq^2 - i freq (pendF/pendQ)
00554    */
00555 
00556   for ( k = 0; k < resp->data->length; k++ )
00557   {
00558     fNorm = k * resp->deltaF / pendF;
00559     denom->data[k].re = ( 1 - fNorm * fNorm );
00560     denom->data[k].im = - fNorm / pendQ;
00561     num->data[k].re = 1.0 * ETMcal;
00562     num->data[k].im = 0.0;
00563   }
00564 
00565   XLALCCVectorDivide( resp->data, num, denom);
00566   XLALDestroyCOMPLEX8Vector( num );
00567   XLALDestroyCOMPLEX8Vector( denom );
00568   return( resp );
00569 
00570 }
00571 

Generated on Tue Oct 7 02:39:55 2008 for LAL by  doxygen 1.5.2