77#define GENERATEPPNINSPIRALTESTC_ENORM 0
78#define GENERATEPPNINSPIRALTESTC_ESUB 1
79#define GENERATEPPNINSPIRALTESTC_EARG 2
80#define GENERATEPPNINSPIRALTESTC_EVAL 3
81#define GENERATEPPNINSPIRALTESTC_EFILE 4
82#define GENERATEPPNINSPIRALTESTC_EPRINT 5
86#define GENERATEPPNINSPIRALTESTC_MSGENORM "Normal exit"
87#define GENERATEPPNINSPIRALTESTC_MSGESUB "Subroutine failed"
88#define GENERATEPPNINSPIRALTESTC_MSGEARG "Error parsing arguments"
89#define GENERATEPPNINSPIRALTESTC_MSGEVAL "Input argument out of valid range"
90#define GENERATEPPNINSPIRALTESTC_MSGEFILE "Could not open file"
91#define GENERATEPPNINSPIRALTESTC_MSGEPRINT "Wrote past end of message string"
96#include <lal/LALStdio.h>
97#include <lal/LALStdlib.h>
98#include <lal/LALConstants.h>
99#include <lal/AVFactories.h>
100#include <lal/SeqFactories.h>
101#include <lal/SimulateCoherentGW.h>
102#include <lal/GeneratePPNInspiral.h>
105#define EPOCH (315187200000000000LL)
117#define USAGE "Usage: %s [-m m1 m2] [-r dist] [-i inc phii]\n\t[-f f_min f_max] [-t dt] [-w deltat] [-p order] [-d debuglevel] [-o outfile]\n"
120#define MSGLENGTH (1024)
124#define ERROR( code, msg, statement ) \
126if ( lalDebugLevel & LALERROR ) \
128 LALPrintError( "Error[0] %d: program %s, file %s, line %d, %s\n" \
129 " %s %s\n", (code), *argv, __FILE__, \
131 statement ? statement : "", (msg) ); \
135#define INFO( statement ) \
137if ( lalDebugLevel & LALINFO ) \
139 LALPrintError( "Info[0]: program %s, file %s, line %d, %s\n" \
140 " %s\n", *argv, __FILE__, __LINE__, \
141 "$Id$", (statement) ); \
145#define WARNING( statement ) \
147if ( lalDebugLevel & LALWARNING ) \
149 LALPrintError( "Warning[0]: program %s, file %s, line %d, %s\n" \
150 " %s\n", *argv, __FILE__, __LINE__, \
151 "$Id$", (statement) ); \
155#define SUB( func, statusptr ) \
157if ( (func), (statusptr)->statusCode ) \
159 ERROR( GENERATEPPNINSPIRALTESTC_ESUB, \
160 GENERATEPPNINSPIRALTESTC_MSGESUB, \
161 "Function call \"" #func "\" failed:" ); \
162 return GENERATEPPNINSPIRALTESTC_ESUB; \
166#define CHECKVAL( val, lower, upper ) \
168if ( ( (val) < (lower) ) || ( (val) > (upper) ) ) \
170 ERROR( GENERATEPPNINSPIRALTESTC_EVAL, \
171 GENERATEPPNINSPIRALTESTC_MSGEVAL, \
172 "Value of " #val " out of range:" ); \
173 LALPrintError( #val " = %f, range = [%f,%f]\n", (REAL8)(val), \
174 (REAL8)(lower), (REAL8)(upper) ); \
175 return GENERATEPPNINSPIRALTESTC_EVAL; \
181main(
int argc,
char **argv)
187 REAL4 m1 = M1, m2 = M2;
189 REAL4 inc = 0.0, phii = 0.0;
197 CHAR message[MSGLENGTH];
208 while ( arg < argc ) {
210 if ( !strcmp( argv[arg],
"-m" ) ) {
211 if ( argc > arg + 2 ) {
213 m1 = atof( argv[arg++] );
214 m2 = atof( argv[arg++] );
217 GENERATEPPNINSPIRALTESTC_MSGEARG, 0 );
223 else if ( !strcmp( argv[arg],
"-r" ) ) {
224 if ( argc > arg + 1 ) {
226 dist = atof( argv[arg++] );
229 GENERATEPPNINSPIRALTESTC_MSGEARG, 0 );
235 else if ( !strcmp( argv[arg],
"-i" ) ) {
236 if ( argc > arg + 2 ) {
238 inc = atof( argv[arg++] )*
LAL_PI/180.0;
239 phii = atof( argv[arg++] )*
LAL_PI/180.0;
242 GENERATEPPNINSPIRALTESTC_MSGEARG, 0 );
248 else if ( !strcmp( argv[arg],
"-f" ) ) {
249 if ( argc > arg + 2 ) {
251 f_min = atof( argv[arg++] );
252 f_max = atof( argv[arg++] );
255 GENERATEPPNINSPIRALTESTC_MSGEARG, 0 );
261 else if ( !strcmp( argv[arg],
"-t" ) ) {
262 if ( argc > arg + 1 ) {
264 dt = atof( argv[arg++] );
267 GENERATEPPNINSPIRALTESTC_MSGEARG, 0 );
273 else if ( !strcmp( argv[arg],
"-w" ) ) {
274 if ( argc > arg + 1 ) {
276 deltat = atof( argv[arg++] );
279 GENERATEPPNINSPIRALTESTC_MSGEARG, 0 );
285 else if ( !strcmp( argv[arg],
"-p" ) ) {
286 if ( argc > arg + 1 ) {
288 order = atoi( argv[arg++] );
291 GENERATEPPNINSPIRALTESTC_MSGEARG, 0 );
297 else if ( !strcmp( argv[arg],
"-o" ) ) {
298 if ( argc > arg + 1 ) {
303 GENERATEPPNINSPIRALTESTC_MSGEARG, 0 );
309 else if ( !strcmp( argv[arg],
"-d" ) ) {
310 if ( argc > arg + 1 ) {
314 GENERATEPPNINSPIRALTESTC_MSGEARG, 0 );
320 else if ( argv[arg][0] ==
'-' ) {
322 GENERATEPPNINSPIRALTESTC_MSGEARG, 0 );
329 CHECKVAL( order, -1, 5 );
339 params.position.latitude =
params.position.longitude = 0.0;
358 params.ppn->data[0] = 1.0;
360 params.ppn->data[1] = 0.0;
361 for (
i = 2;
i <= (
UINT4)( order );
i++ )
376 snprintf( message, MSGLENGTH,
"%d: %s",
params.termCode,
387 "Waveform ends %.3f cycles before coalescence",
391 if (
code >= MSGLENGTH ||
code < 0 ) {
393 GENERATEPPNINSPIRALTESTC_MSGEPRINT, 0 );
400 if (
params.dfdt > 2.0 ) {
401 snprintf( message, MSGLENGTH,
402 "Waveform sampling interval is too large:\n"
403 "\tmaximum df*dt = %f",
params.dfdt );
414 if ( (
fp = fopen(
outfile,
"w" ) ) == NULL ) {
416 GENERATEPPNINSPIRALTESTC_MSGEFILE,
outfile );
421 if ( deltat == 0.0 ) {
424 fprintf(
fp,
"%f %.3f %10.3e %10.3e %10.3e\n", t,
440 for ( ;
x < xMax;
x += dx, t += deltat ) {
443 REAL8 p = frac*phiData[j+1] + ( 1.0 - frac )*phiData[j];
444 REAL8 f = frac*fData[j+1] + ( 1.0 - frac )*fData[j];
445 REAL8 ap = frac*aData[2*j+2] + ( 1.0 - frac )*aData[2*j];
446 REAL8 ac = frac*aData[2*j+3] + ( 1.0 - frac )*aData[2*j+1];
448 fprintf(
fp,
"%f %.3f %10.3e %10.3e %10.3e\n", t,
p, f,
449 ap*cos(
p ), ac*sin(
p ) );
472 INFO( GENERATEPPNINSPIRALTESTC_MSGENORM );
#define GENERATEPPNINSPIRALTESTC_EFILE
Could not open file.
#define GENERATEPPNINSPIRALTESTC_EARG
Error parsing arguments.
#define GENERATEPPNINSPIRALTESTC_EPRINT
Wrote past end of message string.
#define GENERATEPPNINSPIRALTESTC_ENORM
Normal exit.
void LALCheckMemoryLeaks(void)
void LALSDestroyVectorSequence(LALStatus *status, REAL4VectorSequence **vectorSequence)
void LALGeneratePPNInspiral(LALStatus *stat, CoherentGW *output, PPNParamStruc *params)
Computes a parametrized post-Newtonian inspiral waveform.
int LALPrintError(const char *fmt,...)
COORDINATESYSTEM_EQUATORIAL
void LALDDestroyVector(LALStatus *, REAL8Vector **)
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALSCreateVector(LALStatus *, REAL4Vector **, UINT4)
LIGOTimeGPS * XLALINT8NSToGPS(LIGOTimeGPS *epoch, INT8 ns)
REAL4TimeVectorSeries * a
This structure stores the parameters for constructing a restricted post-Newtonian waveform.
REAL4VectorSequence * data
int main(int argc, char **argv)