Skip to content

Commit 69abc40

Browse files
martinholtersararslan
authored andcommitted
Fix FFTW related warning on Julia 0.6 (#179)
Avoid `using FFTW` on Julia 0.6, as the FFTW package does not define a module there, leading a warning about failed precompilation.
1 parent 3b44986 commit 69abc40

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/DSP.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ module DSP
66
# This macro will be called in each submodule herein to do the appropriate imports
77
macro importffts()
88
quote
9-
using AbstractFFTs, FFTW
10-
importall AbstractFFTs, FFTW
9+
using AbstractFFTs
10+
importall AbstractFFTs
1111
if VERSION >= v"0.7.0-DEV.602"
12+
using FFTW
13+
importall FFTW
1214
import AbstractFFTs: fftshift, ifftshift
1315
import FFTW: plan_fft, plan_fft!, plan_rfft, plan_brfft, plan_irfft, plan_bfft, plan_bfft!,
1416
fft, fft!, ifft, ifft!, irfft, bfft, bfft!

src/util.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module Util
22
using ..DSP: @importffts
3-
import FFTW: fftwReal, fftwComplex, fftwNumber
43
import Base: *
54
@importffts
65

@@ -49,7 +48,7 @@ function unwrap(m::Array{T}, args...; kwargs...) where T<:AbstractFloat
4948
unwrap!(copy(m), args...; kwargs...)
5049
end
5150

52-
function hilbert(x::StridedVector{T}) where T<:fftwReal
51+
function hilbert(x::StridedVector{T}) where T<:FFTW.fftwReal
5352
# Return the Hilbert transform of x (a real signal).
5453
# Code inspired by Scipy's implementation, which is under BSD license.
5554
N = length(x)
@@ -104,18 +103,18 @@ end
104103
## FFT TYPES
105104

106105
# Get the input element type of FFT for a given type
107-
fftintype(::Type{T}) where {T<:fftwNumber} = T
106+
fftintype(::Type{T}) where {T<:FFTW.fftwNumber} = T
108107
fftintype(::Type{T}) where {T<:Real} = Float64
109108
fftintype(::Type{T}) where {T<:Complex} = Complex128
110109

111110
# Get the return element type of FFT for a given type
112-
fftouttype(::Type{T}) where {T<:fftwComplex} = T
113-
fftouttype(::Type{T}) where {T<:fftwReal} = Complex{T}
111+
fftouttype(::Type{T}) where {T<:FFTW.fftwComplex} = T
112+
fftouttype(::Type{T}) where {T<:FFTW.fftwReal} = Complex{T}
114113
fftouttype(::Type{T}) where {T<:Union{Real,Complex}} = Complex128
115114

116115
# Get the real part of the return element type of FFT for a given type
117-
fftabs2type(::Type{Complex{T}}) where {T<:fftwReal} = T
118-
fftabs2type(::Type{T}) where {T<:fftwReal} = T
116+
fftabs2type(::Type{Complex{T}}) where {T<:FFTW.fftwReal} = T
117+
fftabs2type(::Type{T}) where {T<:FFTW.fftwReal} = T
119118
fftabs2type(::Type{T}) where {T<:Union{Real,Complex}} = Float64
120119

121120
## FREQUENCY VECTOR

0 commit comments

Comments
 (0)