29#include <lal/LALStdlib.h>
30#include <lal/LALConstants.h>
31#include <lal/AVFactories.h>
32#include <lal/PrintFTSeries.h>
33#include <lal/LALFrStream.h>
35#include <lal/BandPassTimeSeries.h>
40#define FRAMEHEARSEEC_ENORM 0
41#define FRAMEHEARSEEC_EARG 2
43#define FRAMEHEARSEEC_MSGENORM "Normal exit"
44#define FRAMEHEARSEEC_MSGEARG "Error parsing arguments"
47#define USAGE "Usage: %s [options] | xmgr -pipe\n"\
48 " --help Print this help message\n" \
49 " --channel name Name of frame channel\n" \
50 " [--duration secs] How many seconds to look at\n"\
51 " [--epoch sec nsec] The starting epoch\n"\
52 " [--framedir dirname] Directory containing frame files\n"\
53 " [--freq frequency] Frequency of line\n"\
54 " [--numpts npoints] Points to use\n"
58#ifndef HAVE_LIBLALFRAME
61 fputs(
"Disabled: LALApps compiled with non-frame-enabled LAL\n", stderr );
68void graphout(
float x1,
float x2,
int thistime,
int last) {
73 printf(
"@doublebuffer true\n");
74 printf(
"@s0 color 3\n");
75 printf(
"@view 0.1, 0.1, 0.9, 0.45\n");
77 printf(
"@view 0.1, 0.6, 0.9, 0.95\n");
79 printf(
"@world xmin %f\n",x1);
80 printf(
"@world xmax %f\n",x2);
81 printf(
"@autoscale\n");
82 printf(
"@focus off\n");
83 printf(
"@xaxis label \"t (sec)\"\n");
84 printf(
"@fft(s0, 1)\n");
85 printf(
"@s1 color 2\n");
86 printf(
"@move g0.s1 to g1.s0\n");
88 printf(
"@g1 type logy\n");
89 printf(
"@autoscale\n");
90 printf(
"@subtitle \"Spectrum\"\n");
91 printf(
"@xaxis label \"f (Hz)\"\n");
93 printf(
"@subtitle \"IFO output %d\"\n",thistime);
95 if (!last) printf(
"@kill s0\n");
99 printf(
"@s0 color 3\n");
100 printf(
"@fft(s0, 1)\n");
101 printf(
"@s1 color 2\n");
102 printf(
"@move g0.s1 to g1.s0\n");
103 printf(
"@subtitle \"IFO output %d\"\n",thistime);
105 printf(
"@world xmin %f\n",x1);
106 printf(
"@world xmax %f\n",x2);
107 printf(
"@autoscale yaxes\n");
108 printf(
"@clear stack\n");
109 if (!last) printf(
"@kill s0\n");
110 printf(
"@with g1\n");
111 printf(
"@g1 type logy\n");
112 printf(
"@clear stack\n");
113 if (!last) printf(
"@kill s0\n");
114 printf(
"@with g0\n");
120int main(
int argc,
char *argv[] )
125 REAL4 numSeconds = 2.0, oreal, oimag,
dt, omega = 0.0;
135 dirname = getenv(
"LAL_FRAME_PATH" );
138 highpassParam.
nMax = 4;
139 highpassParam.
f1 = -1.0;
140 highpassParam.
a1 = -1.0;
151 while ( inarg < argc ) {
153 if ( !strcmp( argv[inarg],
"--help" ) ) {
154 if ( argc > inarg + 1 ) {
156 fprintf(stderr,
"Should be a usage message\n");
163 else if ( !strcmp( argv[inarg],
"--epoch" ) ) {
164 if ( argc > inarg + 1 ) {
166 epoch.gpsSeconds = atoi( argv[inarg++] );
167 epoch.gpsNanoSeconds = atoi( argv[inarg++] );
174 else if ( !strcmp( argv[inarg],
"--numpts" ) ) {
175 if ( argc > inarg + 1 ) {
183 else if ( !strcmp( argv[inarg],
"--freq" ) ) {
184 if ( argc > inarg + 1 ) {
186 omega = 2.0*
LAL_PI * atof( argv[inarg++] );
192 else if ( !strcmp( argv[inarg],
"--highpass" ) ) {
193 if ( argc > inarg + 1 ) {
196 highpassParam.
f2 = atof( argv[inarg++] );
197 highpassParam.
a2 = atof( argv[inarg++] );
203 else if ( !strcmp( argv[inarg],
"--duration" ) ) {
204 if ( argc > inarg + 1 ) {
206 numSeconds = atof( argv[inarg++] );
212 else if ( !strcmp( argv[inarg],
"--channel" ) ) {
213 if ( argc > inarg + 1 ) {
215 channelIn.
name = argv[inarg++];
222 else if ( !strcmp( argv[inarg],
"--framedir" ) ) {
223 if ( argc > inarg + 1 ) {
225 dirname = argv[inarg++];
232 else if ( argv[inarg][0] ==
'-' ) {
246 series.epoch.gpsNanoSeconds =
epoch.gpsNanoSeconds;
272 oreal, oimag, sqrt(oreal*oreal + oimag*oimag));
void LALFrSeek(LALStatus *status, const LIGOTimeGPS *epoch, LALFrStream *stream)
void LALFrOpen(LALStatus *status, LALFrStream **stream, const CHAR *dirname, const CHAR *pattern)
void LALFrGetREAL4TimeSeries(LALStatus *status, REAL4TimeSeries *series, FrChanIn *chanin, LALFrStream *stream)
void LALFrClose(LALStatus *status, LALFrStream **stream)
void LALCheckMemoryLeaks(void)
#define FRAMEHEARSEEC_EARG
void LALButterworthREAL4TimeSeries(LALStatus *stat, REAL4TimeSeries *series, PassBandParamStruc *params)
int LALPrintError(const char *fmt,...)
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALCreateVector(LALStatus *, REAL4Vector **, UINT4)