Merge pull request #1891 from mkborregaard/master

filter infinite values in histograms too
This commit is contained in:
Michael Krabbe Borregaard 2019-01-14 23:09:59 +01:00 committed by GitHub
commit 51d4416b00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -635,10 +635,10 @@ _hist_edges(vs::NTuple{N,AbstractVector}, binning::Union{Integer, Symbol, Abstra
_hist_norm_mode(mode::Symbol) = mode _hist_norm_mode(mode::Symbol) = mode
_hist_norm_mode(mode::Bool) = mode ? :pdf : :none _hist_norm_mode(mode::Bool) = mode ? :pdf : :none
_filternans(vs::NTuple{1,AbstractVector}) = filter!.(!isnan, vs) _filternans(vs::NTuple{1,AbstractVector}) = filter!.(isfinite, vs)
function _filternans(vs::NTuple{N,AbstractVector}) where N function _filternans(vs::NTuple{N,AbstractVector}) where N
_invertedindex(v, not) = [j for (i,j) in enumerate(v) if !(i not)] _invertedindex(v, not) = [j for (i,j) in enumerate(v) if !(i not)]
nots = union(Set.(findall.(isnan, vs))...) nots = union(Set.(findall.(!isfinite, vs))...)
_invertedindex.(vs, Ref(nots)) _invertedindex.(vs, Ref(nots))
end end