Skip to content

Commit

Permalink
don't import/export midpoints (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre authored and nalimilan committed Feb 21, 2018
1 parent ba34438 commit 9f1d7aa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/src/misc.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ inverse_rle
levelsmap
indexmap
indicatormat
midpoints
StatsBase.midpoints
```
9 changes: 4 additions & 5 deletions src/StatsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ module StatsBase
using Printf
end

if VERSION < v"0.7.0-DEV.3335"
import Base: midpoints
end

## tackle compatibility issues

export
Expand Down Expand Up @@ -134,7 +130,6 @@ module StatsBase
Histogram,
hist,
# histrange,
midpoints,

## robust
trim, # trimmed set
Expand Down Expand Up @@ -187,6 +182,10 @@ module StatsBase

ConvergenceException

@static if !isdefined(Base, :midpoints)
export midpoints
end

# source files

include("common.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/hist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ weights of the resulting histogram will have the same type as those of `h`.
Base.merge(h::Histogram, others::Histogram...) = merge!(zero(h), h, others...)

"""
midpoints(v)
StatsBase.midpoints(v)
Calculate the midpoints (pairwise mean of consecutive elements).
"""
Expand Down
4 changes: 2 additions & 2 deletions test/hist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ end
end

@testset "midpoints" begin
@test midpoints([1, 2, 4]) == [1.5, 3.0]
@test midpoints(linspace(0, 1, 5)) == 0.125:0.25:0.875
@test StatsBase.midpoints([1, 2, 4]) == [1.5, 3.0]
@test StatsBase.midpoints(linspace(0, 1, 5)) == 0.125:0.25:0.875
end

end # @testset "StatsBase.Histogram"

0 comments on commit 9f1d7aa

Please sign in to comment.