Skip to content

v0.14.0: Add Base.norm, normalize and normalize! for Histogram (#243)

Compare
Choose a tag to compare
@ararslan ararslan released this 01 May 17:33
· 341 commits to master since this release
* Add Base.norm, normalize and normalize! for Histogram

* Add Base.float for Histogram and support for aux_weights on normalize

* Add tests for histogram norm and normalize

* Clarify description of histogram hormalization modes

* Add histogram normalization mode :none

* Better exceptions and small coding style improvements in hist norm code

Also removed some remnant code in hist norm tests.

* Add proper docstrings for histogram norm, normalize and normalize!

* Add tests for histogram normalize! and normalize with aux weights

* Add new field isdensity to Histogram, refactor histogram code

Enables consistent and idempotent behaviour of normalization, increases
histogram filling performance.

Changes:

* New Histogram field isdensity
* Support for isdensity in constructors, etc., includes refactoring
  of ctor code (removed duplicated code).
* Refactoring of histogram fill code:
    * Removed duplicated code
    * New functions binindex and binvolume
    * Significant performance gain for push!/append!
* Support for fit(Histogram{T}, ...)
* Better structure of histograms tests with test sets

* Remove _tuple_map from Histogram implementation

Better to add this to Base.

* Simplify implementation of _multi_getindex

* Fix float(h::Histogram)

* Handle h.isdensity
* Don't copy more than necessary (as requested by A. Noack)

* Change histogram norm to directly return integral value, not it's norm.

* Extend == and show for Histogram to handle new isdensity field

* Fix normalize! for Histogram

Don't set h.isdensity to true for mode == :none

* Improve numerical precision in implementation of Histogram norm/normalize

* Use _edge_binvolume in implementation of Histogram norm/normlalize

Also add optional result-type argument to binvolume

* Change implementation of float(::Histogram), remove _float_deepcopy

* Minor code pretty-up in push!(::Histogram)