Skip to content

Commit

Permalink
🐛 Fix broken depwarn & whitespace for ColorizedArray
Browse files Browse the repository at this point in the history
From #927
  • Loading branch information
timholy authored and johnnychen94 committed Nov 3, 2021
1 parent fcdca59 commit 65931ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/labeledarrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ associated with that point's label.
This computation is performed lazily, as to be suitable even for large arrays.
"""
function ColorizedArray(intensity, label::IndirectArray{C,N}) where {C<:Colorant,N}
depwarn("`ColorizedArray(intensity, label)` is deprecated, use `mappedarray(*, intensity, label)` from `MappedArrays` instead", :ColorizedArray)
Base.depwarn("`ColorizedArray(intensity, label)` is deprecated, use `mappedarray(*, intensity, label)` from `MappedArrays` instead", :ColorizedArray)

axes(intensity) == axes(label) || throw(DimensionMismatch("intensity and label must have the same axes, got $(axes(intensity)) and $(axes(label))"))
CI = typeof(zero(C)*zero(eltype(intensity)))
Expand Down
6 changes: 3 additions & 3 deletions test/arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ using Images.MappedArrays: mappedarray
labels = IndirectArray([1 2; 2 1], [RGB(1,0,0), RGB(0,0,1)])
colorized_A = @suppress_err ColorizedArray(intensity, labels)
mapped_A = mappedarray(*, intensity, labels)

target = intensity .* labels

for A in (colorized_A, mapped_A)
for A in (colorized_A, mapped_A)
@test eltype(A) == RGB{Float64}
@test size(A) == (2,2)
@test axes(A) == (Base.OneTo(2), Base.OneTo(2))
Expand All @@ -26,7 +26,7 @@ using Images.MappedArrays: mappedarray

intensity1 = [0.1 0.3 0.6; 0.2 0.4 0.1]
labels1 = IndirectArray([1 2 3; 2 1 3], [RGB(1,0,0), RGB(0,0,1),RGB(0,1,0)])
A1 = ColorizedArray(intensity1, labels1)
A1 = @suppress_err ColorizedArray(intensity1, labels1)
target1 = intensity1 .* labels1
@test eltype(A1) == RGB{Float64}
@test size(A1) == (2,3)
Expand Down

0 comments on commit 65931ce

Please sign in to comment.