21 #include <lal/LALStdlib.h>
22 #include <lal/LALConstants.h>
23 #include <lal/AVFactories.h>
25 #include <lal/IIRFilter.h>
26 #include <lal/BandPassTimeSeries.h>
222 #undef SINGLE_PRECISION
225 #define SINGLE_PRECISION
227 #undef SINGLE_PRECISION
230 #define SINGLE_PRECISION
232 #undef SINGLE_PRECISION
255 BANDPASSTIMESERIESH_MSGENUL);
257 BANDPASSTIMESERIESH_MSGENUL);
259 BANDPASSTIMESERIESH_MSGENUL);
261 BANDPASSTIMESERIESH_MSGENUL);
278 for(i=0,j=n-1;i<j;i++,j--){
280 REAL4 ar=wc*cos(theta);
281 REAL4 ai=wc*sin(theta);
295 zpgFilter->
gain=-wc*wc;
348 zpgFilter->
gain=-wc*I;
464 BOOLEAN w1Given = (w1>0.0)&&(w1<0.5);
465 BOOLEAN w2Given = (w2>0.0)&&(w2<0.5);
466 BOOLEAN both1Given = w1Given && (a1>0.0)&&(a1<1.0);
467 BOOLEAN both2Given = w2Given && (a2>0.0)&&(a2<1.0);
472 if(both1Given && both2Given){
473 REAL8 aLow = w1<w2 ? sqrt(a1) : sqrt(a2);
474 REAL8 aHigh = w1>w2 ? sqrt(a1) : sqrt(a2);
482 XLALPrintInfo(
"The two frequencies defining the transition band"
488 XLALPrintInfo(
"The two attenuations across the transition band"
495 *n=(
INT4)(0.5*log((1.0/aHigh-1.0)/(1.0/aLow-1.0))
498 *n=(
INT4)(0.5*log((1.0/aHigh-1.0)/(1.0/aLow-1.0))
503 if((params->
nMax>0)&&(params->
nMax<*n)){
506 " performance exceeds\n"
507 "\tspecified limit.\n");
515 *wc=wHigh*pow(1.0/aHigh - 1.0,-0.5/((
REAL8)(*n)));
518 *wc=wLow*pow(1.0/aLow - 1.0,0.5/((
REAL8)(*n)));
530 XLALPrintInfo(
"The filter order must be given if one or more"
532 "\tattenuations of the transition band have not been"
533 " (validly) specified.");
540 *wc=wLow*pow(1.0/aLow - 1.0, -0.5/((
REAL8)(*n)));
542 }
else if(both2Given){
544 REAL8 aHigh=sqrt(a2);
546 *wc=wHigh*pow(1.0/aHigh - 1.0, 0.5/((
REAL8)(*n)));
553 else if(w1Given && w2Given){
555 XLALPrintInfo(
"Neither attenuation has been specified, so only"
556 " one frequency should be.");
int XLALButterworthREAL8TimeSeries(REAL8TimeSeries *series, PassBandParamStruc *params)
int XLALButterworthREAL4TimeSeries(REAL4TimeSeries *series, PassBandParamStruc *params)
#define ABORT(statusptr, code, mesg)
#define ENDFAIL(statusptr)
#define TRY(func, statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
#define BEGINFAIL(statusptr)
int XLALPrintWarning(const char *fmt,...)
int XLALPrintInfo(const char *fmt,...)
#define BANDPASSTIMESERIESH_ENUL
Unexpected null pointer in arguments.
#define BANDPASSTIMESERIESH_EBAD
Bad filter parameters.
void LALButterworthREAL8TimeSeries(LALStatus *stat, REAL8TimeSeries *series, PassBandParamStruc *params)
Deprecated.
void LALDButterworthREAL4TimeSeries(LALStatus *stat, REAL4TimeSeries *series, PassBandParamStruc *params)
Deprecated.
void LALButterworthREAL4TimeSeries(LALStatus *stat, REAL4TimeSeries *series, PassBandParamStruc *params)
Deprecated.
static int XLALParsePassBandParamStruc(PassBandParamStruc *params, INT4 *n, REAL8 *wc, REAL8 deltaT)
void LALCreateREAL4IIRFilter(LALStatus *stat, REAL4IIRFilter **output, COMPLEX8ZPGFilter *input)
Deprecated.
void LALCreateCOMPLEX8ZPGFilter(LALStatus *stat, COMPLEX8ZPGFilter **output, INT4 numZeros, INT4 numPoles)
void LALDestroyREAL4IIRFilter(LALStatus *stat, REAL4IIRFilter **input)
Deprecated.
void LALDestroyCOMPLEX8ZPGFilter(LALStatus *stat, COMPLEX8ZPGFilter **input)
void LALIIRFilterREAL4Vector(LALStatus *status, REAL4Vector *vector, REAL4IIRFilter *filter)
WARNING: THIS FUNCTION IS OBSOLETE.
void LALIIRFilterREAL4VectorR(LALStatus *status, REAL4Vector *vector, REAL4IIRFilter *filter)
WARNING: THIS FUNCTION IS OBSOLETE.
#define LAL_PI
Archimedes's constant, pi.
unsigned char BOOLEAN
Boolean logical type, see Headers LAL(Atomic)Datatypes.h for more details.
double REAL8
Double precision real floating-point number (8 bytes).
int32_t INT4
Four-byte signed integer.
float REAL4
Single precision real floating-point number (4 bytes).
#define xlalErrno
Modifiable lvalue containing the XLAL error number.
#define XLAL_ERROR(...)
Macro to invoke a failure from a XLAL routine returning an integer.
int XLALClearErrno(void)
Clears the XLAL error number, returns the old value.
@ XLAL_EFAULT
Invalid pointer.
@ XLAL_EINVAL
Invalid argument.
COMPLEX8 * data
Pointer to the data array.
See DATATYPE-ZPGFilter types for details.
LAL status structure, see The LALStatus structure for more details.
struct tagLALStatus * statusPtr
Pointer to the next node in the list; NULL if this function is not reporting a subroutine error.
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.
This structure stores the direct and recursive REAL4 filter coefficients, as well as the history of t...
Time series of REAL4 data, see DATATYPE-TimeSeries types for more details.
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.
Time series of REAL8 data, see DATATYPE-TimeSeries types for more details.