q-bio0309023/pfft.pro
1: ;+
2: ;
3: ; NAME:
4: ;	PFFT
5: ;
6: ; PURPOSE:
7: ;	Calculates the padded fft of an input matrix, INPUT, padded
8: ;	out to NF, where NF defauts to 2*N, the dimension of the INPUT
9: ;	matrix.
10: ;
11: ; CATEGORY:
12: ;	Spectral Analysis
13: ;
14: ; CALLING SEQUENCE;
15: ;	finput=PFFT(input,NF=nf)
16: ;
17: ; INPUTS:
18: ;	INPUT:	The input matrix.  The longest dimension is fourier
19: ;		transformed.
20: ;
21: ; OUTPUTS
22: ;	FINPUT:	The output matrix which is the fourier transform
23: ;		of INPUT
24: ;	
25: ; KEYWORDS:
26: ;	NF:	The degree of padding.  Defaults to 2*N.
27: ;
28: ; EXAMPLES:
29: ;
30: ; MODIFICATION HISTORY:
31: ;	Written by:	Bijan Pesaran, Bell Labs, August, 1997
32: ;
33: ;-
34: 
35: FUNCTION pfft, input, NF=nf
36: 
37: sz1=n_elements(input(*,0))
38: sz2=n_elements(input(0,*))
39: 
40: n=max([sz1,sz2])
41: if not keyword_set(nf) then nf =2.*n
42: if n eq sz1 then chk=1 else chk=0
43: finput=complexarr(nf,min([sz1,sz2]))
44: tmp=dblarr(nf)
45: for i=0,min([sz1,sz2])-1 do begin
46: 	if chk eq 1 then tmp(0:n-1)=input(*,i) else tmp(0:n-1)=input(i,*)
47: 	finput(*,i)=fft(tmp,-1)
48: endfor
49: 
50: return, finput
51: end
52: 
53: