Skip to content

Commit

Permalink
Merge pull request #221 from wherrera10/master
Browse files Browse the repository at this point in the history
Fixes for 0.7 and 1.0. Thanks @mokus0 and @wherrera10!
  • Loading branch information
ssfrr authored Aug 15, 2018
2 parents b5510df + 7538609 commit f3c9382
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 19 deletions.
19 changes: 14 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@ os:
julia:
- 0.6
- 0.7
- 1.0
- nightly
matrix:
allow_failures:
- julia: nightly
fast_finish: true
notifications:
email: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia --check-bounds=yes -e 'Pkg.clone(pwd()); Pkg.build("DSP"); Pkg.test("DSP"; coverage=true)'
after_success:
- julia -e 'cd(Pkg.dir("DSP")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
- julia -e 'Pkg.add("Documenter"); cd(Pkg.dir("DSP")); include(joinpath("docs", "make.jl"))'
- julia -e 'VERSION >= v"0.7.0-DEV.5183" && using Pkg;
VERSION >= v"0.7.0-DEV.5183" || cd(Pkg.dir("DSP"));
Pkg.add("Coverage");
using Coverage;
Coveralls.submit(Coveralls.process_folder())'
- julia -e 'VERSION >= v"0.7.0-DEV.5183" && using Pkg;
VERSION >= v"0.7.0-DEV.5183" || cd(Pkg.dir("DSP"));
Pkg.add("Documenter");
include(joinpath("docs", "make.jl"))'
6 changes: 3 additions & 3 deletions src/Filters/filt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ function _fftfilt!(out::AbstractArray{T}, b::AbstractVector{T}, x::AbstractArray
# FFT of filter
filterft = similar(tmp2)
copyto!(tmp1, b)
tmp1[nb+1:end] = zero(T)
tmp1[nb+1:end] .= zero(T)
mul!(filterft, p1, tmp1)

# FFT of chunks
Expand All @@ -571,8 +571,8 @@ function _fftfilt!(out::AbstractArray{T}, b::AbstractVector{T}, x::AbstractArray
xstart = off - nb + npadbefore + 1
n = min(nfft - npadbefore, nx - xstart + 1)

tmp1[1:npadbefore] = zero(T)
tmp1[npadbefore+n+1:end] = zero(T)
tmp1[1:npadbefore] .= zero(T)
tmp1[npadbefore+n+1:end] .= zero(T)

copyto!(tmp1, npadbefore+1, x, colstart+xstart, n)
mul!(tmp2, p1, tmp1)
Expand Down
2 changes: 1 addition & 1 deletion src/dspbase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function conv(u::StridedVector{T}, v::StridedVector{T}) where T<:BLAS.BlasFloat
nu = length(u)
nv = length(v)
n = nu + nv - 1
np2 = n > 1024 ? nextprod([2,3,5], n) : nextpow2(n)
np2 = n > 1024 ? nextprod([2,3,5], n) : nextpow(2, n)
upad = [u; zeros(T, np2 - nu)]
vpad = [v; zeros(T, np2 - nv)]
if T <: Real
Expand Down
12 changes: 9 additions & 3 deletions src/periodograms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@ function Base.getindex(x::ArraySplit{T,S,W}, i::Int) where {T,S,W}
end
x.buf
end
Base.start(x::ArraySplit) = 1
Base.next(x::ArraySplit, i::Int) = (x[i], i+1)
Base.done(x::ArraySplit, i::Int) = i > x.k
if isdefined(Base, :iterate)
function Base.iterate(x::ArraySplit, i::Int = 1)
i > x.k ? nothing : (x[i], i+1)
end
else
Base.start(x::ArraySplit) = 1
Base.next(x::ArraySplit, i::Int) = (x[i], i+1)
Base.done(x::ArraySplit, i::Int) = i > x.k
end
Base.size(x::ArraySplit) = (x.k,)

"""
Expand Down
12 changes: 9 additions & 3 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,15 @@ function Base.getindex(x::Frequencies, i::Int)
(i >= 1 && i <= x.n) || throw(BoundsError())
unsafe_getindex(x, i)
end
Base.start(x::Frequencies) = 1
Base.next(x::Frequencies, i::Int) = (unsafe_getindex(x, i), i+1)
Base.done(x::Frequencies, i::Int) = i > x.n
if isdefined(Base, :iterate)
function Base.iterate(x::Frequencies, i::Int=1)
i > x.n ? nothing : (unsafe_getindex(x,i), i + 1)
end
else
Base.start(x::Frequencies) = 1
Base.next(x::Frequencies, i::Int) = (unsafe_getindex(x, i), i+1)
Base.done(x::Frequencies, i::Int) = i > x.n
end
Base.size(x::Frequencies) = (x.n,)
Base.step(x::Frequencies) = x.multiplier

Expand Down
2 changes: 1 addition & 1 deletion test/filt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using DSP, Compat, Compat.Test, Compat.Random, FilterTestHelpers
# filt with different filter forms
#
@testset "filt" begin
srand(1776)
seed!(1776)
x = randn(100)

for n = 1:6
Expand Down
6 changes: 5 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
using Compat, DSP, AbstractFFTs, FFTW, Compat.Test
if VERSION >= v"0.7.0-beta.171"
using Random: seed!
else
seed!(x) = srand(x)
end

testfiles = [ "dsp.jl", "util.jl", "windows.jl", "filter_conversion.jl",
"filter_design.jl", "filter_response.jl", "filt.jl", "filt_stream.jl",
Expand All @@ -8,4 +13,3 @@ testfiles = [ "dsp.jl", "util.jl", "windows.jl", "filter_conversion.jl",
for testfile in testfiles
eval(:(@testset $testfile begin include($testfile) end))
end

4 changes: 2 additions & 2 deletions test/unwrap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using DSP, Compat, Compat.Test
# test generically typed unwrapping
types = (Float32, Float64, BigFloat)
for T in types
srand(1234)
seed!(1234)
A_unwrapped = collect(Compat.range(0, stop=4convert(T, π), length=10))
A_wrapped = A_unwrapped .% (2convert(T, π))

Expand All @@ -58,7 +58,7 @@ end
@testset "Unwrap 2D" begin
types = (Float32, Float64, BigFloat)
for T in types
srand(1234)
seed!(1234)
v_unwrapped = collect(Compat.range(0, stop=4convert(T, π), length=7))
A_unwrapped = v_unwrapped .+ v_unwrapped'
A_wrapped = A_unwrapped .% (2convert(T, π))
Expand Down

0 comments on commit f3c9382

Please sign in to comment.