Skip to content

Commit

Permalink
Move the deprecation of midpoints to 0.6 section, (#20058)
Browse files Browse the repository at this point in the history
and actually deprecate it - this was moved to deprecated.jl
in #16450, but not actually deprecated
  • Loading branch information
tkelman authored Jan 17, 2017
1 parent a1f232e commit 7e11e9d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 19 deletions.
7 changes: 3 additions & 4 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,6 @@ function histrange{T<:Integer,N}(v::AbstractArray{T,N}, n::Integer)
start:step:(start + nm1*step)
end

## midpoints of intervals
midpoints(r::Range) = r[1:length(r)-1] + 0.5*step(r)
midpoints(v::AbstractVector) = [0.5*(v[i] + v[i+1]) for i in 1:length(v)-1]

## hist ##
function sturges(n) # Sturges' formula
depwarn("sturges(n) is deprecated, use StatsBase.sturges(n) instead.",:sturges)
Expand Down Expand Up @@ -1028,6 +1024,9 @@ export $

@deprecate is (===)

# midpoints of intervals
@deprecate midpoints(r::Range) r[1:length(r)-1] + 0.5*step(r)
@deprecate midpoints(v::AbstractVector) [0.5*(v[i] + v[i+1]) for i in 1:length(v)-1]

@deprecate_binding Filter Iterators.Filter
@deprecate_binding Zip Iterators.Zip
Expand Down
8 changes: 0 additions & 8 deletions base/docs/helpdb/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2219,14 +2219,6 @@ unsigned without checking for negative values.
"""
unsigned

"""
midpoints(e)
Compute the midpoints of the bins with edges `e`. The result is a vector/range of length
`length(e) - 1`. Note: Julia does not ignore `NaN` values in the computation.
"""
midpoints

"""
reverseind(v, i)
Expand Down
1 change: 0 additions & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,6 @@ export
median!,
median,
middle,
midpoints,
quantile!,
quantile,
std,
Expand Down
1 change: 0 additions & 1 deletion doc/src/stdlib/math.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ Base.varm
Base.middle
Base.median
Base.median!
Base.midpoints
Base.quantile
Base.quantile!
Base.cov
Expand Down
5 changes: 0 additions & 5 deletions test/statistics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,6 @@ let tmp = linspace(1, 85, 100)
@test cor(tmp, tmp2) <= 1.0
end


@test midpoints(1.0:1.0:10.0) == 1.5:1.0:9.5
@test midpoints(1:10) == 1.5:9.5
@test midpoints(Float64[1.0:1.0:10.0;]) == Float64[1.5:1.0:9.5;]

@test quantile([1,2,3,4],0.5) == 2.5
@test quantile([1,2,3,4],[0.5]) == [2.5]
@test quantile([1., 3],[.25,.5,.75])[2] == median([1., 3])
Expand Down

0 comments on commit 7e11e9d

Please sign in to comment.