physt
physt copied to clipboard
h1 (resp. calculate_frequencies) is too slow
Actually, ~10 times slower than np.histogram. It has its reasons but (being more general) but in the simple case, we should not add any overhead.
Suggestion: when parameters allow, fall back to np variant.
Related: #48
For regular binning, it is possible to use this:
contents = linspace(...)
indexes = (data - low) / (high - low) # data is an array
numpy.add.at(contents, indexes, 1)
As suggested by Jim Pivarski.