38#include <lal/LALError.h>
39#include <lal/LALgetopt.h>
40#include <lal/LALStdio.h>
41#include <lal/LALStdlib.h>
42#include <lal/LALStatusMacros.h>
43#include <lal/LALConstants.h>
44#include <lal/ReadNoiseSpectrum.h>
45#include <lal/SeqFactories.h>
48#include <lal/SimulateCoherentGW.h>
49#include <lal/GeneratePPNInspiral.h>
50#include <lal/TimeFreqFFT.h>
51#include <lal/LIGOLwXML.h>
52#include <lal/LIGOLwXMLRead.h>
53#include <lal/LIGOMetadataUtils.h>
56#define CVS_ID_STRING "$Id$"
57#define CVS_NAME_STRING "$Name$"
58#define CVS_REVISION "$Revision$"
59#define CVS_SOURCE "$Source$"
60#define CVS_DATE "$Date$"
61#define PROGRAM_NAME "chirplen"
65"Usage: %s [options] [LIGOLW XML input files]\n\n"\
66" --help display this message\n"\
67" --version print version information and exit\n"\
68" --machine prints space delimeted output\n"\
69" --m1 m1 mass of 1st binary element in Msun\n"\
70" --m2 m2 mass of 2nd binary element in Msun\n"\
71" --flow fstart low frequency cutoff\n"\
75#define DELTAT (1.0/4096.0)
82int main (
int argc,
char *argv[] )
88 float mtot,
eta,mchirp,
c0,
c2,c3,c4,
x,x2,x3,x4,x8,chirpTime,
f_max;
104 REAL4 numChisqBins=0.0;
131 setvbuf( stdout, NULL, _IONBF, 0 );
137 int option_index = 0;
138 int LALoptarg_len = 0;
141 "f:m:n:o:p:hV", long_options,
154 if ( long_options[option_index].
flag != 0 )
160 fprintf( stderr,
"Error parsing option %s with argument %s\n",
183 specFile = (
CHAR *) calloc( LALoptarg_len,
sizeof(
CHAR));
184 memcpy( specFile,
LALoptarg, LALoptarg_len );
195 waveFile = (
CHAR *) calloc( LALoptarg_len,
sizeof(
CHAR));
196 memcpy( waveFile,
LALoptarg, LALoptarg_len );
208 fprintf( stdout,
"Compute some basic properties of inspiral signals\n"
209 "Patrick R Brady and Duncan Brown\n"
221 fprintf( stderr,
"Error: Unknown error while parsing options\n" );
229 if ( numChisqBins <= 0.0 || !(specFile) ){
230 fprintf(stderr,
"Computing chisq bin boundaries:\n");
231 fprintf(stderr,
"Need both numChisqBins and specFile\n");
237 if (
m1 <= 0.0 ||
m2 <= 0.0 ){
238 fprintf(stderr,
"Mass parameters m1 and m2 must be positive\n");
243 eta = (
m1 *
m2 ) / ( mtot * mtot );
244 mchirp = pow(
eta, 0.6) * (mtot);
248 fprintf( stdout,
"m1 = %e\tm2 = %e\tfLow = %e\n",
m1,
m2, fstart );
249 fprintf( stdout,
"eta = %0.2f\tm = %0.2f\tmchirp = %0.2f\n",
259 c2 = 743.0/252.0 +
eta*11.0/3.0;
261 c4 = 3058673.0/508032.0 +
eta*(5429.0/504.0 +
eta*617.0/72.0);
267 chirpTime =
c0*(1 +
c2*x2 + c3*x3 + c4*x4)/x8;
270 fprintf( stdout,
"length = %e seconds\n", chirpTime );
277 ppnParams.
mTot = mtot;
292 ppnParams.
ppn = NULL;
300 ppnParams.
ppn = phiPPN;
304 if ( ppnParams.
dfdt > 2.0 ) {
306 "\tmaximum df*dt = %f", ppnParams.
dfdt );
321 fprintf( stdout,
"fStart according to Tev = %e Hz\n", ppnParams.
fStart );
322 fprintf( stdout,
"fStop according to Tev = %e Hz\n", ppnParams.
fStop );
323 fprintf( stdout,
"length according to Tev = %e seconds\n", ppnParams.
tc );
324 fprintf( stdout,
"Ncycle according to Tev = %f \n",
338 REAL4 chisqSum = 0.0;
344 spectrum.
data = NULL;
363 chisqSum +=
norm * pow(
freq, -7.0/3.0)
365 if ( chisqSum/sum >= 1.0/numChisqBins ){
370 if ( chisqSum > 0.0 ){
381 fpout = fopen(waveFile,
"w");
lal_errhandler_t lal_errhandler
int LAL_ERR_EXIT(LALStatus *stat, const char *func, const char *file, const int line, volatile const char *id)
#define LAL_CALL(function, statusptr)
int LALgetopt_long_only(int argc, char *const *argv, const char *options, const struct LALoption *long_options, int *opt_index)
#define required_argument
int main(int argc, char *argv[])
void LALGeneratePPNInspiral(LALStatus *, CoherentGW *output, PPNParamStruc *params)
int LALPrintError(const char *fmt,...)
void LALReadNoiseSpectrum(LALStatus *stat, REAL4FrequencySeries *spectrum, CHAR *fname)
COORDINATESYSTEM_EQUATORIAL
void LALCreateVector(LALStatus *, REAL4Vector **, UINT4)
char name[LIGOMETA_SOURCE_MAX]
const CHAR * termDescription