-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Base.norm, normalize and normalize! for Histogram (#243)
* 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)
- Loading branch information
1 parent
5a7fa11
commit 38c62a1
Showing
2 changed files
with
431 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.