81#include <lal/LALDatatypes.h>
84#include <lal/TimeSeries.h>
85#include <lal/LALSimulation.h>
89int isoption(
char *arg,
const char *opt);
92int main(
int argc,
char *argv[])
105 for (
c = 1;
c < argc; ++
c) {
107 if (*arg !=
'-' || strcmp(arg,
"-") == 0)
109 if (strcmp(arg,
"--") == 0) {
124 fprintf(stderr,
"%s: must provide one target file and at least one injection file\n",
program);
129 h = calloc(argc -
c,
sizeof(*h));
130 for (n = 0;
c < argc; ++
c, ++n) {
131 char *fname = argv[
c];
134 fprintf(stderr,
"%s: reading %s data ",
program, n ?
"injection" :
"target");
135 if (strcmp(fname,
"-") != 0) {
137 fprintf(stderr,
"from file %s\n", fname);
138 if (!(
fp = fopen(fname,
"r"))) {
143 fprintf(stderr,
"from <stdin>\n");
146 if (first_stdin < 0) {
155 fprintf(stderr,
"%s: failed to read data from file %s\n",
program, fname);
158 fprintf(stderr,
"%s: %d points of strain data read\n",
program, (
int)h[n]->
data->length);
162 for (
c = 1;
c < n; ++
c) {
169 fprintf(stderr,
"%s: incorrect sample rate for injection %d -- must match target\n",
program,
c);
177 fprintf(stderr,
"%s: failed to add injection %d to target\n",
program,
c);
183 fprintf(stdout,
"# time (s)\tSTRAIN (strain)\n");
200 return strstr(opt, arg) == opt;
207 const size_t block = 1024;
218 for (
l = 0, n = 0; fgets(line,
sizeof(line),
fp); ++
l) {
226 c = sscanf(line,
"%s %le", n ? t1 : t0,
data + n);
228 fprintf(stderr,
"%s: format error on line %zd: %s\n",
program,
l, line);
249usage: %s [options] targetfile injectfile1 [injectfile2 ...]\n\
251 -h, --help print this message and exit\n\
252 -v, --verbose verbose output\n\
int XLALStrToGPS(LIGOTimeGPS *t, const char *nptr, char **endptr)
void LALCheckMemoryLeaks(void)
char * XLALGPSToStr(char *s, const LIGOTimeGPS *t)
int XLALSimAddInjectionREAL8TimeSeries(REAL8TimeSeries *target, REAL8TimeSeries *h, const COMPLEX16FrequencySeries *response)
Adds a detector strain time series to detector data.
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
REAL8TimeSeries * XLALCutREAL8TimeSeries(const REAL8TimeSeries *series, size_t first, size_t length)
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalStrainUnit
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
int main(int argc, char *argv[])
REAL8TimeSeries * readdata(FILE *fp)
int isoption(char *arg, const char *opt)