43#include <lal/LALgetopt.h>
44#include <lal/LALFrStream.h>
45#include <lal/LALFrameIO.h>
46#include <lal/LALCache.h>
47#include <lal/TimeSeries.h>
48#include <lal/LALStdlib.h>
49#include <lal/AVFactories.h>
50#include <lal/UserInput.h>
51#include <lal/GeneratePulsarSignal.h>
52#include <lal/LALInitBarycenter.h>
53#include <lal/LALDatatypes.h>
54#include <lal/DetectorSite.h>
56#include <lal/SkyCoordinates.h>
57#include <lal/RngMedBias.h>
58#include <lal/LALRunningMedian.h>
59#include <lal/BinaryPulsarTiming.h>
60#include <lal/LogPrintf.h>
61#include <lal/LALString.h>
62#include <lal/LALPulsarVCSInfo.h>
64#define STRINGLENGTH 256
81"Usage: %s [options]\n\n"\
82" --help, -h display this message\n"\
83" --detector, -i the detector for which to create a frame (e.g. H1)\n"\
84" --channel, -c the channel name into which the signals will be added\n"\
85" --epoch, -e (int) the start epoch of the created frame\n"\
86" --geocentre, g set the detector to the geocentre\n"\
87" --duration, -d (int) the duration (in seconds) of the frame\n"\
88" --pulsar-dir, -p the directory containing pulsar (.par) files of signals\n\
89 to be added to the frame\n"\
90" --output-dir, -o the directory in which to output the frame\n"\
91" --output-str, -s a string to start the frame file name\n"\
92" --ephem-dir, -m the directory containing ephemeris files\n"\
93" --ephem-type, -y the ephemeris file type to use (e.g. DE405 [default])\n"\
94" --dbg-lvl, -l (int) the code debug level\n"\
100typedef struct tagInputParams {
122int main(
int argc,
char **argv )
144 XLALPrintError(
"%s: Failed to get site-info for detector '%s'\n", fn,
150 if ( inputs.geocentre ) {
151 site.location[0] = 0.0;
152 site.location[1] = 0.0;
153 site.location[2] = 0.0;
156 struct dirent **pulsars;
157 INT4 n = scandir( inputs.pulsarDir, &pulsars, 0, alphasort );
169 for ( h = 2; h < numpulsars; h++ ) {
170 if ( strstr( pulsars[h]->d_name,
".par" ) == NULL ) {
174 if ( (
int )
sizeof( parname ) <= snprintf( parname,
sizeof( parname ),
"%s/%s", inputs.pulsarDir, pulsars[h]->d_name ) ) {
177 fprintf( stderr,
"%s\n", parname );
180 if ( ( inject = fopen( parname,
"r" ) ) == NULL ) {
181 fprintf( stderr,
"Error opening file: %s\n", parname );
194 epoch.gpsSeconds = inputs.epoch;
195 epoch.gpsNanoSeconds = 0;
197 ndata = inputs.frDur;
202 sprintf( out_file,
"%s-%s-%d-%d.gwf", inputs.det, inputs.outStr,
203 epoch.gpsSeconds, ndata );
219 for ( counter = 0; counter < series->
data->
length; counter++ ) {
224 for ( h = 0; h < numpulsars; h++ ) {
225 if ( strstr( pulsars[h]->d_name,
".par" ) == NULL ) {
246 REAL8 ra = 0., dec = 0.;
276 params.pulsar.spindown->data[0] = 2.*fs->
data[1];
285 params.pulsar.aPlus = 0.5 *
h0 * ( 1. + cosiota * cosiota );
286 params.pulsar.aCross =
h0 * cosiota;
301 if (
status.statusCode ) {
302 fprintf( stderr,
"LAL Routine failed!\n" );
321 snprintf( OUTFILE,
sizeof( OUTFILE ),
"%s/%s", inputs.outDir, out_file );
337#define FNAME_LENGTH 1024
347 snprintf( EphemEarth,
FNAME_LENGTH,
"%s/earth00-40-%s.dat.gz", ephemDir, ephemType );
348 snprintf( EphemSun,
FNAME_LENGTH,
"%s/sun00-40-%s.dat.gz", ephemDir, ephemType );
382 CHAR args[] =
"hi:c:e:gd:p:o:s:m:y:l:";
395 INT4 option_index = 0;
405 if ( long_options[option_index].
flag ) {
408 fprintf( stderr,
"Error parsing option %s with argument %s\n",
447 fprintf( stderr,
"unknown error while parsing options\n" );
450 fprintf( stderr,
"unknown error while parsing options\n" );
455 if ( inputParams->
epoch == 0 || inputParams->
frDur == 0 ) {
#define __func__
log an I/O error, i.e.
int LALgetopt_long(int argc, char *const *argv, const char *options, const struct LALoption *long_options, int *opt_index)
#define required_argument
const REAL8Vector * PulsarGetREAL8VectorParam(const PulsarParameters *pars, const CHAR *name)
Return a REAL8Vector parameter.
REAL8 PulsarGetREAL8ParamOrZero(const PulsarParameters *pars, const CHAR *name)
Return a REAL8 parameter if it exists, otherwise return zero.
int PulsarCheckParam(const PulsarParameters *pars, const CHAR *name)
Check for the existence of the parameter name in the PulsarParameters structure.
PulsarParameters * XLALReadTEMPOParFile(const CHAR *pulsarAndPath)
Read in the parameters from a TEMPO(2) parameter file into a PulsarParameters structure.
REAL8 PulsarGetREAL8Param(const PulsarParameters *pars, const CHAR *name)
Return a REAL8 parameter.
int main(int argc, char **argv)
void ReadInput(InputParams *inputParams, int argc, char *argv[])
EphemerisData * InitEphemeris(const CHAR *ephemType, const CHAR *ephemDir)
void LALGeneratePulsarSignal(LALStatus *status, REAL4TimeSeries **signalvec, const PulsarSignalParams *params)
EphemerisData * XLALInitBarycenter(const CHAR *earthEphemerisFile, const CHAR *sunEphemerisFile)
XLAL interface to reading ephemeris files 'earth' and 'sun', and return ephemeris-data in old backwar...
#define XLAL_INIT_DECL(var,...)
LALFrameUFrameH LALFrameH
int XLALFrameWrite(LALFrameH *frame, const char *fname)
LALFrameH * XLALFrameNew(const LIGOTimeGPS *epoch, double duration, const char *project, int run, int frnum, INT8 detectorFlags)
void XLALFrameFree(LALFrameH *frame)
int XLALFrameAddREAL8TimeSeriesProcData(LALFrameH *frame, const REAL8TimeSeries *series)
char char * XLALStringDuplicate(const char *s)
void LogPrintf(LogLevel_t, const char *format,...) _LAL_GCC_PRINTF_FORMAT_(2
const LALDetector * XLALGetSiteInfo(const CHAR *name)
Find the site geometry-information 'LALDetector' for given a detector name (or prefix).
COORDINATESYSTEM_EQUATORIAL
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
void XLALDestroyREAL4TimeSeries(REAL4TimeSeries *series)
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalSecondUnit
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
#define XLAL_ERROR_VOID(...)
#define XLAL_ERROR_NULL(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
The PulsarParameters structure to contain a set of pulsar parameters.
Input parameters to GeneratePulsarSignal(), defining the source and the time-series.