Skip to content

Constrain usage of int histograms

This is coming from !1688 (merged) where int histograms were fixed. I copy here the nice summary of @jonrob :

@sponce Just going back to your question as to if there is a use case for int like histograms, I definitely think there is one. I have quite a number of examples myself where I am filling int quantities into a histogram, and to do this 'correctly' you have to ensure by hand the min/max range and number of bins is 'appropriate' for the int quantities you are filling. If we could instead have a bespoke int like histogram implementation that enforced these constraints so users could not get it wrong, that would I think be very useful.

The constraints I can think of are :

  • Axis min and max values should be integer values (currently not the case I believe, can be any floating point value).
  • Bin sizes should be constrained to be multiples of a int.
  • Allowed bin sizes for any min max range should be an exact factor of that range, so for @graven's example above a hist with 21 bins should only allow 1, 3 or 7 unit width bins.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information