00001 /* 00002 * Copyright (C) 2007 Jolien Creighton, Teviet Creighton 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with with program; see the file COPYING. If not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00017 * MA 02111-1307 USA 00018 */ 00019 00020 /*************************** <lalVerbatim file="BandPassTimeSeriesHV"> 00021 Author: Creighton, T. D. 00022 $Id: BandPassTimeSeries.h,v 1.12 2007/06/08 14:41:56 bema Exp $ 00023 **************************************************** </lalVerbatim> */ 00024 00025 /********************************************************** <lalLaTeX> 00026 00027 \section{Header \texttt{BandPassTimeSeries.h}} 00028 \label{s:BandPassTimeSeries.h} 00029 00030 Provides routines to low- or high-pass filter a time series. 00031 00032 \subsection*{Synopsis} 00033 \begin{verbatim} 00034 #include <lal/BandPassTimeSeries.h> 00035 \end{verbatim} 00036 00037 \noindent This header covers routines that apply a time-domain low- or 00038 high-pass filter to a data series of type \verb@<datatype>TimeSeries@. 00039 Further documentation is given in the individual routines' modules. 00040 00041 ******************************************************* </lalLaTeX> */ 00042 00043 #ifndef _BANDPASSTIMESERIES_H 00044 #define _BANDPASSTIMESERIES_H 00045 00046 #include <lal/LALStdlib.h> 00047 #include <lal/IIRFilter.h> 00048 #include <lal/ZPGFilter.h> 00049 00050 #ifdef __cplusplus 00051 extern "C" { 00052 #pragma } 00053 #endif 00054 00055 NRCSID(BANDPASSTIMESERIESH,"$Id: BandPassTimeSeries.h,v 1.12 2007/06/08 14:41:56 bema Exp $"); 00056 00057 /********************************************************** <lalLaTeX> 00058 \subsection*{Error conditions} 00059 ****************************************** </lalLaTeX><lalErrTable> */ 00060 #define BANDPASSTIMESERIESH_ENUL 1 00061 #define BANDPASSTIMESERIESH_EBAD 2 00062 00063 #define BANDPASSTIMESERIESH_MSGENUL "Unexpected null pointer in arguments" 00064 #define BANDPASSTIMESERIESH_MSGEBAD "Bad filter parameters" 00065 /******************************************** </lalErrTable><lalLaTeX> 00066 00067 \subsection*{Types} 00068 00069 \subsubsection*{Structure \texttt{PassBandParamStruc}} 00070 \idx[Type]{PassBandParamStruc} 00071 00072 This structure stores data used for constructing a low- or high-pass 00073 filter: either the order and characteristic frequency of the filter, 00074 or the frequencies and desired attenuations at the ends of some 00075 transition band. In the latter case, a nonzero filter order parameter 00076 \verb@n@ indicates a maximum allowed order. The fields are: 00077 00078 \begin{description} 00079 \item[\texttt{CHAR *name}] A user-assigned name. 00080 00081 \item[\texttt{INT4 n}] The maximum desired filter order (actual order 00082 may be less if specified attenuations do not require a high order). 00083 00084 \item[\texttt{REAL8 f1}, \texttt{f2}] The reference frequencies of the 00085 transition band. 00086 00087 \item[\texttt{REAL8 a1}, \texttt{a2}] The minimal desired attenuation 00088 factors at the reference frequencies. 00089 \end{description} 00090 00091 ******************************************************* </lalLaTeX> */ 00092 00093 typedef struct tagPassBandParamStruc{ 00094 CHAR *name; 00095 INT4 nMax; 00096 REAL8 f1; 00097 REAL8 f2; 00098 REAL8 a1; 00099 REAL8 a2; 00100 } PassBandParamStruc; 00101 00102 /* <lalLaTeX> 00103 \vfill{\footnotesize\input{BandPassTimeSeriesHV}} 00104 </lalLaTeX> */ 00105 00106 /* Function prototypes. */ 00107 00108 /* <lalLaTeX> 00109 \newpage\input{ButterworthTimeSeriesC} 00110 </lalLaTeX> */ 00111 00112 int XLALButterworthREAL4TimeSeries( REAL4TimeSeries *series, PassBandParamStruc *params ); 00113 int XLALButterworthREAL8TimeSeries( REAL8TimeSeries *series, PassBandParamStruc *params ); 00114 int XLALLowPassREAL4TimeSeries( REAL4TimeSeries *series, 00115 REAL8 frequency, REAL8 amplitude, INT4 filtorder ); 00116 int XLALLowPassREAL8TimeSeries( REAL8TimeSeries *series, 00117 REAL8 frequency, REAL8 amplitude, INT4 filtorder ); 00118 int XLALHighPassREAL4TimeSeries( REAL4TimeSeries *series, 00119 REAL8 frequency, REAL8 amplitude, INT4 filtorder ); 00120 int XLALHighPassREAL8TimeSeries( REAL8TimeSeries *series, 00121 REAL8 frequency, REAL8 amplitude, INT4 filtorder ); 00122 00123 00124 00125 void 00126 LALButterworthREAL4TimeSeries( LALStatus *status, 00127 REAL4TimeSeries *series, 00128 PassBandParamStruc *params ); 00129 00130 void 00131 LALButterworthREAL8TimeSeries( LALStatus *status, 00132 REAL8TimeSeries *series, 00133 PassBandParamStruc *params ); 00134 00135 void 00136 LALDButterworthREAL4TimeSeries( LALStatus *status, 00137 REAL4TimeSeries *series, 00138 PassBandParamStruc *params ); 00139 00140 /* Chebyshev filters should also be added, but I'm too busy to write 00141 the routines now. */ 00142 00143 /* Test program. */ 00144 00145 /* <lalLaTeX> 00146 \newpage\input{BandPassTestC} 00147 </lalLaTeX> */ 00148 00149 #ifdef __cplusplus 00150 #pragma { 00151 } 00152 #endif 00153 00154 #endif /* _BANDPASSTIMESERIES_H */
1.5.2