Skip to content

Commit d5bd196

Browse files
Fix a few deprecations on Julia 0.7 (#207)
* Use `eigen` and `eigen!` on newer Julia * Use single-argument `eval` * Replace `atan2` with two-argument `atan`
1 parent 6e8901b commit d5bd196

File tree

5 files changed

+21
-7
lines changed

5 files changed

+21
-7
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
julia 0.6
2-
Compat 0.63
2+
Compat 0.69
33
Polynomials 0.1.0
44
Reexport
55
SpecialFunctions

src/Filters/response.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ or frequencies `w` in radians/sample.
5454
"""
5555
function phasez(filter::FilterCoefficients, w = Compat.range(0, stop=π, length=250))
5656
h = freqz(filter, w)
57-
unwrap(-atan2.(imag(h), real(h)); dims=ndims(h))
57+
unwrap(-atan.(imag(h), real(h)); dims=ndims(h))
5858
end
5959

6060

src/estimation.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
module Estimation
22

3-
using Compat.LinearAlgebra: eig, svd
3+
if VERSION < v"0.7.0-DEV.5211"
4+
using Compat.LinearAlgebra: eig, svd
5+
else
6+
using LinearAlgebra: eigen, svd
7+
end
48

59
export esprit
610

@@ -33,7 +37,11 @@ function esprit(x::AbstractArray, M::Integer, p::Integer, Fs::Real=1.0)
3337
N = length(x)
3438
X = x[ (1:M) .+ (0:N-M)' ]
3539
U,s,V = svd(X)
36-
D,_ = eig( U[1:end-1,1:p] \ U[2:end,1:p] )
40+
@static if VERSION < v"0.7.0-DEV.5211"
41+
D,_ = eig( U[1:end-1,1:p] \ U[2:end,1:p] )
42+
else
43+
D,_ = eigen( U[1:end-1,1:p] \ U[2:end,1:p] )
44+
end
3745
angle.(D)*Fs/2π
3846
end
3947

src/windows.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ using ..Util
44
import SpecialFunctions: besseli
55
import Compat
66
using Compat: copyto!, undef
7-
using Compat.LinearAlgebra: Diagonal, SymTridiagonal, eigfact!
7+
if VERSION < v"0.7.0-DEV.5211"
8+
using Compat.LinearAlgebra: Diagonal, SymTridiagonal, eigfact!
9+
else
10+
using LinearAlgebra: Diagonal, SymTridiagonal, eigen!
11+
end
812
@importffts
913

1014
export rect,
@@ -193,8 +197,10 @@ function dpss(n::Int, nw::Real, ntapers::Int=ceil(Int, 2*nw)-1)
193197
# Get tapers
194198
@static if VERSION < v"0.7.0-DEV.3159"
195199
eigvec = eigfact!(mat, n-ntapers+1:n)[:vectors]
196-
else
200+
elseif VERSION < v"0.7.0-DEV.5211"
197201
eigvec = eigfact!(mat, n-ntapers+1:n).vectors
202+
else
203+
eigvec = eigen!(mat, n-ntapers+1:n).vectors
198204
end
199205
v = Compat.reverse(eigvec::Matrix{Float64}, dims=2)
200206

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ testfiles = [ "dsp.jl", "util.jl", "windows.jl", "filter_conversion.jl",
55
"periodograms.jl", "resample.jl", "lpc.jl", "estimation.jl", "unwrap.jl"]
66

77
for testfile in testfiles
8-
eval(@__MODULE__, :(@testset $testfile begin include($testfile) end))
8+
eval(:(@testset $testfile begin include($testfile) end))
99
end

0 commit comments

Comments
 (0)