20 #include <lal/LALStdio.h>
21 #include <lal/LALStdlib.h>
25 #include <lal/AVFactories.h>
26 #include <lal/BandPassTimeSeries.h>
27 #include <lal/StreamInput.h>
28 #include <lal/StreamOutput.h>
75 #define BANDPASSTESTC_ENORM 0
76 #define BANDPASSTESTC_ESUB 1
77 #define BANDPASSTESTC_EARG 2
78 #define BANDPASSTESTC_EBAD 3
79 #define BANDPASSTESTC_EFILE 4
83 #define BANDPASSTESTC_MSGENORM "Normal exit"
84 #define BANDPASSTESTC_MSGESUB "Subroutine failed"
85 #define BANDPASSTESTC_MSGEARG "Error parsing arguments"
86 #define BANDPASSTESTC_MSGEBAD "Bad argument values"
87 #define BANDPASSTESTC_MSGEFILE "Could not open file"
100 #define USAGE "Usage: %s [-d debuglevel] [-i infile | -n npts dt offset]\n" \
101 "\t[-o outfile] [-f f1 f2 a1 a2 order]\n"
104 #define ERROR( code, msg, statement ) \
106 if ( lalDebugLevel & LALERROR ) \
107 LALPrintError( "Error[0] %d: program %s, file %s, line %d, %s\n" \
108 " %s %s\n", (code), *argv, __FILE__, \
109 __LINE__, "$Id$", statement ? statement : \
113 #define INFO( statement ) \
115 if ( lalDebugLevel & LALINFO ) \
116 LALPrintError( "Info[0]: program %s, file %s, line %d, %s\n" \
117 " %s\n", *argv, __FILE__, __LINE__, \
118 "$Id$", (statement) ); \
121 #define SUB( func, statusptr ) \
123 if ( (func), (statusptr)->statusCode ) { \
124 ERROR( BANDPASSTESTC_ESUB, BANDPASSTESTC_MSGESUB, \
125 "Function call \"" #func "\" failed:" ); \
126 return BANDPASSTESTC_ESUB; \
131 main(
int argc,
char **argv)
135 CHAR *outfile = NULL;
138 UINT4 offset = OFFSET;
154 while ( arg < argc ) {
156 if ( !strcmp( argv[arg],
"-d" ) ) {
157 if ( argc > arg + 1 ) {
166 else if ( !strcmp( argv[arg],
"-i" ) ) {
167 if ( argc > arg + 1 ) {
169 infile = argv[arg++];
177 else if ( !strcmp( argv[arg],
"-o" ) ) {
178 if ( argc > arg + 1 ) {
180 outfile = argv[arg++];
188 else if ( !strcmp( argv[arg],
"-f" ) ) {
189 if ( argc > arg + 5 ) {
191 params.
f1=atof(argv[arg++]);
192 params.
f2=atof(argv[arg++]);
193 params.
a1=atof(argv[arg++]);
194 params.
a2=atof(argv[arg++]);
195 params.
nMax=atoi(argv[arg++]);
203 else if ( !strcmp( argv[arg],
"-n" ) ) {
204 if ( argc > arg + 3 ) {
206 npts=atoi(argv[arg++]);
207 dt=atof(argv[arg++]);
208 offset=atoi(argv[arg++]);
225 if ( offset >= npts ) {
227 LALPrintError(
"\toffset=%i must be less than npts=%i\n", offset,
235 FILE *
fp = fopen( infile,
"r" );
256 FILE *
fp = fopen( outfile,
"w" );
268 INFO( BANDPASSTESTC_MSGENORM );
#define BANDPASSTESTC_EARG
Error parsing arguments.
#define BANDPASSTESTC_EBAD
Bad argument values.
#define BANDPASSTESTC_ENORM
Normal exit.
#define BANDPASSTESTC_EFILE
Could not open file.
void LALCheckMemoryLeaks(void)
#define SUB(func, statusptr)
#define ERROR(code, msg, statement)
void LALSWriteTSeries(LALStatus *status, FILE *stream, REAL4TimeSeries *series)
int main(int argc, char *argv[])
void LALDButterworthREAL4TimeSeries(LALStatus *status, REAL4TimeSeries *series, PassBandParamStruc *params)
Deprecated.
double REAL8
Double precision real floating-point number (8 bytes).
char CHAR
One-byte signed integer, see Headers LAL(Atomic)Datatypes.h for more details.
uint32_t UINT4
Four-byte unsigned integer.
int32_t INT4
Four-byte signed integer.
float REAL4
Single precision real floating-point number (4 bytes).
int LALPrintError(const char *fmt,...)
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALSCreateVector(LALStatus *, REAL4Vector **, UINT4)
void XLALAbortErrorHandler(const char *func, const char *file, int line, int errnum)
The XLAL error handler that raises SIGABRT.
XLALErrorHandlerType * XLALSetErrorHandler(XLALErrorHandlerType *newHandler)
Sets the error handler to a new handler and returns the old handler.
LAL status structure, see The LALStatus structure for more details.
This structure stores data used for constructing a low- or high-pass filter: either the order and cha...
REAL8 a1
The minimal desired attenuation factors at the reference frequencies.
REAL8 a2
The minimal desired attenuation factors at the reference frequencies.
REAL8 f1
The reference frequencies of the transition band.
INT4 nMax
The maximum desired filter order (actual order may be less if specified attenuations do not require a...
REAL8 f2
The reference frequencies of the transition band.
Time series of REAL4 data, see DATATYPE-TimeSeries types for more details.
CHAR name[LALNameLength]
The name of the time series.
REAL4Sequence * data
The sequence of sampled data.
REAL8 deltaT
The time step between samples of the time series in seconds.
REAL4 * data
Pointer to the data array.