Code Monkey home page Code Monkey logo

Comments (4)

Moelf avatar Moelf commented on May 29, 2024

That histogram doesn't have overflow bin enabled, so you shouldn't be able to push infinity into it?

from fhist.jl.

tamasgal avatar tamasgal commented on May 29, 2024

Yes sorry I forgot to add that it also happens with overflow=true ;) Nevertheless, I think that in both cases it should not error, should it?

julia> using FHist

julia> h = Hist1D(;bins=1:10, overflow=true)
edges: 1:10
bin counts: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
total count: 0.0

julia> push!(h, -Inf)
ERROR: InexactError: trunc(Int64, -Inf)
Stacktrace:
 [1] trunc
   @ ./float.jl:893 [inlined]
 [2] floor
   @ ./float.jl:382 [inlined]
 [3] _edge_binindex
   @ ~/.julia/packages/FHist/Gj41b/src/hist1d.jl:15 [inlined]
 [4] push!
   @ ~/.julia/packages/FHist/Gj41b/src/hist1d.jl:121 [inlined]
 [5] push!(h::Hist1D{Float64, Tuple{UnitRange{Int64}}}, val::Float64)
   @ FHist ~/.julia/packages/FHist/Gj41b/src/hist1d.jl:119
 [6] top-level scope
   @ REPL[3]:1

from fhist.jl.

Moelf avatar Moelf commented on May 29, 2024

my take is that Inf is not physical, a physical quantity you put into histogram cannot actually be infinity, so users should handle it themselves to show intention.

from fhist.jl.

tamasgal avatar tamasgal commented on May 29, 2024

Hm, yeah I agree that they are not so physical but sometimes these singularities are there ;) and if I want to count them outside of the bin-range, I need to hack it.

Anyways, It's probably fine like it is, I can get around with an extra filter before I push. We can close...

from fhist.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.