131#define BASICINJECTTESTC_ENORM 0
132#define BASICINJECTTESTC_ESUB 1
133#define BASICINJECTTESTC_EARG 2
134#define BASICINJECTTESTC_EVAL 3
135#define BASICINJECTTESTC_EFILE 4
136#define BASICINJECTTESTC_EINPUT 5
137#define BASICINJECTTESTC_EMEM 6
141#define BASICINJECTTESTC_MSGENORM "Normal exit"
142#define BASICINJECTTESTC_MSGESUB "Subroutine failed"
143#define BASICINJECTTESTC_MSGEARG "Error parsing arguments"
144#define BASICINJECTTESTC_MSGEVAL "Input argument out of valid range"
145#define BASICINJECTTESTC_MSGEFILE "Could not open file"
146#define BASICINJECTTESTC_MSGEINPUT "Error reading file"
147#define BASICINJECTTESTC_MSGEMEM "Out of memory"
154#include <lal/LALStdio.h>
155#include <lal/LALStdlib.h>
156#include <lal/LALConstants.h>
157#include <lal/SeqFactories.h>
158#include <lal/Units.h>
159#include <lal/Random.h>
160#include <lal/VectorOps.h>
161#include <lal/SimulateCoherentGW.h>
162#include <lal/GeneratePPNInspiral.h>
163#include <lal/StreamInput.h>
167#define DIST (0.00002*LAL_MRSUN_SI )
175#define DT (1.0/1024.0)
185#define USAGE "Usage: %s [-s sourcefile] [-r respfile] [-o outfile] [-e seed]\n [-i infile | -n sec nsec npt dt sigma] [-d debuglevel]\n"
188#define ERROR( code, msg, statement ) \
190if ( lalDebugLevel & LALERROR ) \
192 LALPrintError( "Error[0] %d: program %s, file %s, line %d, %s\n" \
193 " %s %s\n", (code), *argv, __FILE__, \
194 __LINE__, "$Id$", statement ? statement : \
199#define INFO( statement ) \
201if ( lalDebugLevel & LALINFO ) \
203 LALPrintError( "Info[0]: program %s, file %s, line %d, %s\n" \
204 " %s\n", *argv, __FILE__, __LINE__, \
205 "$Id$", (statement) ); \
209#define WARNING( statement ) \
211if ( lalDebugLevel & LALWARNING ) \
213 LALPrintError( "Warning[0]: program %s, file %s, line %d, %s\n" \
214 " %s\n", *argv, __FILE__, __LINE__, \
215 "$Id$", (statement) ); \
219#define SUB( func, statusptr ) \
221if ( (func), (statusptr)->statusCode ) \
223 ERROR( BASICINJECTTESTC_ESUB, BASICINJECTTESTC_MSGESUB, \
224 "Function call \"" #func "\" failed:" ); \
225 return BASICINJECTTESTC_ESUB; \
229#define CHECKVAL( val, lower, upper ) \
231if ( ( (val) <= (lower) ) || ( (val) > (upper) ) ) \
233 ERROR( BASICINJECTTESTC_EVAL, BASICINJECTTESTC_MSGEVAL, \
234 "Value of " #val " out of range:" ); \
235 LALPrintError( #val " = %f, range = (%f,%f]\n", (REAL8)(val), \
236 (REAL8)(lower), (REAL8)(upper) ); \
237 return BASICINJECTTESTC_EVAL; \
243main(
int argc,
char **argv)
248 CHAR *sourcefile = NULL;
249 CHAR *respfile = NULL;
282 while ( arg < argc ) {
284 if ( !strcmp( argv[arg],
"-s" ) ) {
285 if ( argc > arg + 1 ) {
287 sourcefile = argv[arg++];
295 else if ( !strcmp( argv[arg],
"-r" ) ) {
296 if ( argc > arg + 1 ) {
298 respfile = argv[arg++];
306 else if ( !strcmp( argv[arg],
"-i" ) ) {
307 if ( argc > arg + 1 ) {
309 infile = argv[arg++];
317 else if ( !strcmp( argv[arg],
"-n" ) ) {
318 if ( argc > arg + 5 ) {
320 sec = atoi( argv[arg++] );
321 nsec = atoi( argv[arg++] );
322 npt = atoi( argv[arg++] );
323 dt = atof( argv[arg++] );
324 sigma = atof( argv[arg++] );
332 else if ( !strcmp( argv[arg],
"-o" ) ) {
333 if ( argc > arg + 1 ) {
343 else if ( !strcmp( argv[arg],
"-d" ) ) {
344 if ( argc > arg + 1 ) {
353 else if ( !strcmp( argv[arg],
"-e" ) ) {
354 if ( argc > arg + 1 ) {
356 seed = atoi( argv[arg++] );
364 else if ( argv[arg][0] ==
'-' ) {
372 CHECKVAL( npt, 0, 2147483647 );
405 if ( (
fp = fopen( respfile,
"r" ) ) == NULL ) {
416 ok &= (
fscanf(
fp,
"# deltaF = %lf\n",
417 &(
detector.transfer->deltaF ) ) == 1 );
438 for (
i = 0;
i < response->
length;
i++ ) {
439 unity->
data[
i] = 1.0;
442 response->
length ), &stat );
453 detector.transfer->deltaF = 1.5*FSTOP;
456 detector.transfer->data->data[0] = 1.0;
457 detector.transfer->data->data[1] = 1.0;
464 if ( (
fp = fopen( infile,
"r" ) ) == NULL ) {
498 output.epoch.gpsSeconds = sec;
499 output.epoch.gpsNanoSeconds = nsec;
503 memset(
output.data->data, 0, npt*
sizeof(
INT2) );
508 for (
i = 0;
i < (
UINT4)( npt );
i++ )
510 floor( sigma*deviates->
data[
i] + 0.5 );
522 if ( (
fp = fopen( sourcefile,
"r" ) ) == NULL ) {
532 REAL4 m1, m2, dist, inc, phic;
537 CHAR message[MSGLEN];
542 &
epoch, &m1, &m2, &dist, &inc, &phic ) == 7 );
543 ppnParams.
mTot = m1 + m2;
544 ppnParams.
eta = m1*m2/( ppnParams.
mTot*ppnParams.
mTot );
550 ppnParams.
mTot = M1 + M2;
551 ppnParams.
eta = M1*M2/( ppnParams.
mTot*ppnParams.
mTot );
554 ppnParams.
phi = PHIC;
567 ppnParams.
ppn = NULL;
568 ppnParams.
deltaT = DELTAT;
574 snprintf( message, MSGLEN,
"%d: %s", ppnParams.
termCode,
577 if ( ppnParams.
dfdt > 2.0 ) {
578 snprintf( message, MSGLEN,
579 "Waveform sampling interval is too large:\n"
580 "\tmaximum df*dt = %f", ppnParams.
dfdt );
586 if ( timeCode ==
'f' )
588 else if ( timeCode ==
'c' )
598 signalvec.
data = NULL;
599 time = ( time + 2.0 )/signalvec.
deltaT;
630 if ( (
fp = fopen(
outfile,
"w" ) ) == NULL ) {
639 for (
i = 0;
i <
output.data->length;
i++ )
653 INFO( BASICINJECTTESTC_MSGENORM );
#define BASICINJECTTESTC_EFILE
Could not open file.
#define BASICINJECTTESTC_ENORM
Normal exit.
#define BASICINJECTTESTC_EARG
Error parsing arguments.
#define BASICINJECTTESTC_EINPUT
Error reading file.
#define BASICINJECTTESTC_EMEM
Out of memory.
void LALCheckMemoryLeaks(void)
void LALSimulateCoherentGW(LALStatus *status, REAL4TimeSeries *output, CoherentGW *input, DetectorResponse *detector)
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,...)
void LALCreateRandomParams(LALStatus *status, RandomParams **params, INT4 seed)
void LALNormalDeviates(LALStatus *status, REAL4Vector *deviates, RandomParams *params)
void LALDestroyRandomParams(LALStatus *status, RandomParams **params)
COORDINATESYSTEM_EQUATORIAL
const LALUnit lalStrainUnit
const LALUnit lalADCCountUnit
LALUnit * XLALUnitDivide(LALUnit *output, const LALUnit *unit1, const LALUnit *unit2)
void LALCCreateVector(LALStatus *, COMPLEX8Vector **, UINT4)
void LALCDestroyVector(LALStatus *, COMPLEX8Vector **)
void LALDDestroyVector(LALStatus *, REAL8Vector **)
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALI2CreateVector(LALStatus *, INT2Vector **, UINT4)
void LALI2DestroyVector(LALStatus *, INT2Vector **)
void LALSCreateVector(LALStatus *, REAL4Vector **, UINT4)
void LALCCVectorDivide(LALStatus *status, COMPLEX8Vector *out, const COMPLEX8Vector *in1, const COMPLEX8Vector *in2)
LIGOTimeGPS * XLALINT8NSToGPS(LIGOTimeGPS *epoch, INT8 ns)
REAL4TimeVectorSeries * a
This structure stores the parameters for constructing a restricted post-Newtonian waveform.
REAL4 fStopIn
The requested termination frequency of the waveform, in Hz; If set to 0, the waveform will be generat...
REAL4Vector * ppn
The parameters selecting the type of post-Newtonian expansion; If ppn=NULL, a "normal" (physical) ex...
const CHAR * termDescription
The termination code description (above)
INT4 termCode
The termination condition (above) that stopped computation of the waveform.
REAL4 dfdt
The maximum value of encountered over any timestep used in generating the waveform.
LIGOTimeGPS epoch
start time of output time series
REAL4 phi
The phase at coalescence (or arbitrary reference phase for a post -Newtonian approximation),...
REAL4 psi
polarization angle (radians)
SkyPosition position
location of source on sky
REAL4 eta
The mass ratio of the binary system; Physically this parameter must lie in the range ; values outsid...
REAL8 tc
The time from the start of the waveform to coalescence (in the point-mass approximation),...
REAL4 mTot
The total mass of the binary system, in solar masses.
REAL4 fStartIn
The requested starting frequency of the waveform, in Hz.
REAL8 deltaT
The requested sampling interval of the waveform, in s.
REAL4 d
The distance to the system, in metres.
UINT4 lengthIn
The maximum number of samples in the generated waveform; If zero, the waveforms can be arbitrarily lo...
REAL4 inc
The inclination of the system to the line of sight, in radians.
REAL4VectorSequence * data
char output[FILENAME_MAX]
int main(int argc, char **argv)