Skip to content

Deprecate StatsBase #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/ColorVectorSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,6 @@ varm(v::AbstractArray{C}, s::AbstractGray; corrected::Bool=true) where {C<:Abstr
varm(map(gray,v),gray(s); corrected=corrected)
real(::Type{C}) where {C<:AbstractGray} = real(eltype(C))

#histrange for Gray type
histrange(v::AbstractArray{Gray{T}}, n::Integer) where {T} = histrange(convert(Array{Float32}, map(gray, v)), n, :right)

# To help type inference
promote_rule(::Type{T}, ::Type{C}) where {T<:Real,C<:AbstractGray} = promote_type(T, eltype(C))

Expand Down Expand Up @@ -345,4 +342,12 @@ _precompile_()
@deprecate (*)(A::AbstractArray{T}, b::TransparentGray) where {T<:Number} A.*b
@deprecate (*)(b::TransparentGray, A::AbstractArray{T}) where {T<:Number} A.*b

## Deprecations

## From 2020-Sept-9
# Since ImageContrastAdjustment is now doing its own binning, I think this can be safely deprecated and we can eliminate
# the dependency on StatsBase.
import StatsBase: histrange
@deprecate histrange(v::AbstractArray{Gray{T}}, n::Integer) where {T} histrange(convert(Array{Float32}, map(gray, v)), n, :right)

end
6 changes: 5 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,11 @@ end

@testset "Colors issue #326" begin
A = rand(RGB{N0f8}, 2, 2)
@test @inferred mean(A) == mean(map(c->mapc(FixedPointNumbers.Treduce, c), A))
if VERSION >= v"1.5"
@test_broken @inferred mean(A) == mean(map(c->mapc(FixedPointNumbers.Treduce, c), A))
else
@test @inferred mean(A) == mean(map(c->mapc(FixedPointNumbers.Treduce, c), A))
end
end
end

Expand Down