BitInformation.jl icon indicating copy to clipboard operation
BitInformation.jl copied to clipboard

Check for NaNs and raise warning

Open milankl opened this issue 1 year ago • 0 comments

As just discussed with @observingClouds and @ayoubft, we should have a check that elements in an array have only finite values and raise a warning if. While the algorithm does not care about the meaning of the bitpatterns the user may not get what they expect if there are many NaNs in the dataset. Example, currently we have

julia> A = rand(100,100);
julia> A[1] = NaN
NaN

julia> bitinformation(A)
64-element Vector{Float64}:
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 ⋮

but we shoud throw something like

julia> for a in A
           if !isfinite(a)
               @warn "Non-finite value detected."
           end
       end
┌ Warning: Non-finite value detected.
└ @ Main REPL[8]:3

milankl avatar May 15 '23 15:05 milankl