Comments (3)
I just add to this that I could imagine that BitInformation.jl would raise a user defined error, which could be as simple as
type DimensionalityError <: Exception
end
type DimensionalityErrorTree <: Exception
var::String
end
Base.showerror(io::IO, e:: DimensionalityErrorTree) = print(io, "You try to calculate bitinformation along a (too) short dimension of",e.var, "elements.")
julia> throw(DimensionalityError(Len(data[dim])))
Not sure if this is the correct syntax. I just adapted it from here.
This would be easier to catch from calling scripts.
from bitinformation.jl.
At the moment we are doing
BitInformation.jl/src/mutual_information.jl
Lines 103 to 105 in 5f3ebbd
So we count the bits but if the counter is still zero afterwards an
AssertionError
is triggered.
julia> using BitInformation
julia> A = rand(100);
julia> mask = A .== A;
julia> bitinformation(A,mask)
ERROR: AssertionError: Mask has 0 unmasked values, 0 entries are adjacent.
Stacktrace:
[1] bitinformation(A::Vector{Float64}, mask::BitVector; dim::Int64, set_zero_insignificant::Bool, confidence::Float64)
@ BitInformation ~/.julia/packages/BitInformation/VpaaY/src/mutual_information.jl:105
...
Julia has a bunch of error types. I agree that an AssertionError
is maybe not the most telling and that we may want to reconsider what kind of error is thrown. However, it seems that this AssertionError is only propagated as a string in the error message (why are python error messages always sooo long 😄) probably because the python errors are not matched to julia errors. Meaning that whether we decide for another error type or define our own, this would only be of use if you could actually catch that error somehow. And what do you want to do with it if you catch it?
from bitinformation.jl.
You try to calculate bitinformation along a (too) short dimension of {length(data[dim])} elements. Maybe even continuing ... bitinformation assumes that adjacents analysis elements are also physically adjacent...
Feel free to suggest error messages. I'd rather have it short and on the point though. I don't think it's the job of an error message to explain how a function is used though, this should be part of the docstring / documentation. On that note I don't think the masked array support ever made it into the documentation ... 😞
from bitinformation.jl.
Related Issues (16)
- TagBot trigger issue HOT 8
- @inbounds for array rounding HOT 1
- Where is the best place to discuss usage/interpretation/best practices? HOT 30
- Applying BitInformation to compress WRF model results HOT 4
- Discuss best practices for `xr.Dataset.to_netcdf()` HOT 3
- Bitinformation of masked data HOT 14
- use of bitinformation(dim) HOT 5
- Incorrect round away from zero for keepbits=significand_bits HOT 1
- Understanding latitudinal bounds of bitrounding absolute error HOT 11
- How to implement boundary conditions with `masked_value` HOT 3
- Method definition triggers warning in precompilation HOT 1
- Compressing zarr data store for simulation data HOT 6
- Smallest chunk based on statistics of random information HOT 1
- BitInformation for data previously reduced in precision HOT 5
- Check for NaNs and raise warning
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitinformation.jl.