Skip to content

Commit

Permalink
Remove Compat from dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 28, 2024
1 parent 48e57fc commit 052e270
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.8.0"

[deps]
Bessels = "0e736298-9ec6-45e8-9647-e4fc86a2fe38"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -16,7 +15,6 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
Bessels = "0.2"
Compat = "4.1"
DelimitedFiles = "1.6"
FFTW = "1.8"
IterTools = "1.4"
Expand Down
1 change: 0 additions & 1 deletion src/DSP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module DSP
using FFTW
using LinearAlgebra: mul!, rmul!
using IterTools: subsets
using Compat: Compat

export conv, deconv, filt, filt!, xcorr

Expand Down
1 change: 0 additions & 1 deletion src/Filters/Filters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ using Statistics: middle
using SpecialFunctions: ellipk
using ..DSP: optimalfftfiltlength, os_fft_complexity, SMALL_FILT_CUTOFF
import ..DSP: filt, filt!
using Compat: Compat
using FFTW

include("coefficients.jl")
Expand Down
10 changes: 5 additions & 5 deletions src/Filters/design.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Butterworth(::Type{T}, n::Integer) where {T<:Real}
poles = Vector{Complex{T}}(undef, n)
for i = 1:n÷2
w = convert(T, 2i - 1) / 2n
sinpi_w, cospi_w = Compat.@inline sincospi(w)
sinpi_w, cospi_w = @inline sincospi(w)
pole = complex(-sinpi_w, cospi_w)
poles[2i-1] = pole
poles[2i] = conj(pole)
Expand Down Expand Up @@ -43,7 +43,7 @@ function chebyshev_poles(::Type{T}, n::Integer, ε::Real) where {T<:Real}
c = cosh(μ)
for i = 1:n÷2
w = convert(T, 2i - 1) / 2n
sinpi_w, cospi_w = Compat.@inline sincospi(w)
sinpi_w, cospi_w = @inline sincospi(w)
pole = complex(b * sinpi_w, c * cospi_w)
p[2i-1] = pole
p[2i] = conj(pole)
Expand Down Expand Up @@ -94,7 +94,7 @@ function Chebyshev2(::Type{T}, n::Integer, ripple::Real) where {T<:Real}
k = one(T)
for i = 1:n÷2
w = convert(T, 2i - 1) / 2n
ze = Compat.@inline complex(zero(T), -inv(cospi(w)))
ze = @inline complex(zero(T), -inv(cospi(w)))
z[2i-1] = ze
z[2i] = conj(ze)
k *= abs2(p[2i]) / abs2(ze)
Expand Down Expand Up @@ -140,8 +140,8 @@ function _ellip(init::Number, landen::Vector{<:Real})
end
w = inv(winv)
end
@inline cde(u::Number, landen::Vector{<:Real}) = Compat.@inline _ellip(cospi(u / 2), landen)
@inline sne(u::Number, landen::Vector{<:Real}) = Compat.@inline _ellip(sinpi(u / 2), landen)
@inline cde(u::Number, landen::Vector{<:Real}) = @inline _ellip(cospi(u / 2), landen)
@inline sne(u::Number, landen::Vector{<:Real}) = @inline _ellip(sinpi(u / 2), landen)

# sne inverse
function asne(w::Number, k::Real)
Expand Down
2 changes: 1 addition & 1 deletion src/Filters/response.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function _freqrange(filter::FilterCoefficients{:s})
filter = convert(ZeroPoleGain, filter)
w_interesting = sort!(Float64.(abs.([filter.p; filter.z])))
include_zero = !isempty(w_interesting) && iszero(w_interesting[1])
w_interesting = collect(Compat.Iterators.dropwhile(iszero, w_interesting))
w_interesting = collect(Iterators.dropwhile(iszero, w_interesting))
if isempty(w_interesting) # no non-zero poles or zeros
if !include_zero || !isfinite(1/filter.k)
return [0; 10 .^ (0:6)] # fallback
Expand Down
6 changes: 3 additions & 3 deletions src/dspbase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ function filt!(out::AbstractArray, b::Union{AbstractVector, Number}, a::Union{Ab
end

iszero(size(x, 1)) && return out
isone(sz) && return (k = b[1] / a[1]; Compat.@noinline mul!(out, x, k)) # Simple scaling without memory
isone(sz) && return (k = b[1] / a[1]; @noinline mul!(out, x, k)) # Simple scaling without memory

# Filter coefficient normalization
if !isone(a[1])
norml = a[1]
a = Compat.@noinline broadcast(/, a, norml)
b = Compat.@noinline broadcast(/, b, norml)
a = @noinline broadcast(/, a, norml)
b = @noinline broadcast(/, b, norml)
end
# Pad the coefficients with zeros if needed
bs<sz && (b = copyto!(zeros(eltype(b), sz), b))
Expand Down

0 comments on commit 052e270

Please sign in to comment.