@@ -162,19 +162,6 @@ function fft2oneortwosided!{T}(out::Array{Complex{T}}, s_fft::Vector{Complex{T}}
162162 out
163163end
164164
165- # Evaluate a window function at n points, returning both the window
166- # (or nothing if no window) and the squared L2 norm of the window
167- compute_window (:: Nothing , n:: Int ) = (nothing , n)
168- function compute_window (window:: Function , n:: Int )
169- win = window (n):: Vector{Float64}
170- norm2 = sumabs2 (win)
171- (win, norm2)
172- end
173- function compute_window (window:: AbstractVector , n:: Int )
174- length (window) == n || error (" length of window must match input" )
175- (window, sumabs2 (window))
176- end
177-
178165# # PERIODOGRAMS
179166abstract TFR{T}
180167immutable Periodogram{T,F<: Union(Frequencies,Range) } <: TFR{T}
@@ -207,7 +194,7 @@ function periodogram{T<:Number}(s::AbstractVector{T}; onesided::Bool=eltype(s)<:
207194 onesided && T <: Complex && error (" cannot compute one-sided FFT of a complex signal" )
208195 nfft >= length (s) || error (" nfft must be >= n" )
209196
210- win, norm2 = compute_window (window, length (s))
197+ win, norm2 = Util . compute_window (window, length (s))
211198 if nfft == length (s) && win == nothing && isa (s, StridedArray)
212199 input = s # no need to pad
213200 else
@@ -286,7 +273,7 @@ function welch_pgram{T<:Number}(s::AbstractVector{T}, n::Int=length(s)>>3, nover
286273 onesided && T <: Complex && error (" cannot compute one-sided FFT of a complex signal" )
287274 nfft >= n || error (" nfft must be >= n" )
288275
289- win, norm2 = compute_window (window, n)
276+ win, norm2 = Util . compute_window (window, n)
290277 sig_split = arraysplit (s, n, noverlap, nfft, win)
291278 out = zeros (fftabs2type (T), onesided ? (nfft >> 1 )+ 1 : nfft)
292279 r = fs* norm2* length (sig_split)
@@ -369,7 +356,7 @@ function stft{T}(s::AbstractVector{T}, n::Int=length(s)>>3, noverlap::Int=n>>1,
369356 window:: Union(Function,AbstractVector,Nothing) = nothing )
370357 onesided && T <: Complex && error (" cannot compute one-sided FFT of a complex signal" )
371358
372- win, norm2 = compute_window (window, n)
359+ win, norm2 = Util . compute_window (window, n)
373360 sig_split = arraysplit (s, n, noverlap, nfft, win)
374361 nout = onesided ? (nfft >> 1 )+ 1 : nfft
375362 out = zeros (stfttype (T, psdonly), nout, length (sig_split))
0 commit comments