q-bio0309023/filt.pro
1: ;+ 
2: ;
3: ; NAME: 
4: ; 	FILT
5: ;
6: ; PURPOSE:
7: ;	This program bandpass filters the data at center frequency
8: ;	f0 using the tapers provided by TAPERS.
9: ;
10: ; CATEGORY:
11: ;	Spectral Analysis
12: ;
13: ; CALLING SEQUENCE:
14: ;	FILT, ts, tapers, f0, tsfilt, DN=dn
15: ;
16: ; INPUTS:
17: ;	TS:	The time series to be filtered.
18: ;
19: ; 	TAPERS:	The data tapers that will filter the data
20: ;
21: ;	F0:	The centre frequency of the filters.  Units where sampling
22: ;		frequency is 1.
23: ;
24: ; OUTPUTS:	
25: ;	TSFILT:	The time series filtered at f0.  A complexarr.
26: ;
27: ; KEYWORDS:	
28: ;	DN:	The step size between windows.  Defaults to N/10 where
29: ;		N is the window size specified by the tapers.
30: ;
31: ; EXAMPLES:
32: ;
33: ; MODIFICATION HISTORY:
34: ;	Written by:	Bijan Pesaran
35: ;
36: ;-
37: 
38: PRO filt, ts, tapers, tsfilt, f0, DN=dn
39: 
40: N=n_elements(tapers(*,0))
41: if not keyword_set(DN) then dn=fix(N/10)
42: 
43: k=n_elements(tapers(0,*))
44: nt=n_elements(ts(0,*))
45: na=n_elements(ts(*,0))
46: tsfilt=complexarr(nt)
47: ii=complex(0,1)
48: shifter=exp(ii*2.*!pi*findgen(nt)*f0)
49: 
50: 	dpfilt, ts, tapers, f0, tmp1, DN=dn
51: 	tsdiff=ts-2*tmp1	
52: print, systime()
53: 	dpfilt, tsdiff, tapers, f0, tmp2, DN=dn
54: 	tsdiff1=tsdiff-2*tmp2
55: 	dpfilt, tsdiff1, tapers, f0, tmp3, DN=dn
56: 	tsfilt=2*(tmp1+tmp2+tmp3)
57: 
58: end
59: