janpipek / physt

Python histogram library - histograms as updateable, fully semantic objects with visualization tools. [P]ython [HYST]ograms.
MIT License
129 stars 15 forks source link

h1 (resp. calculate_frequencies) is too slow #35

Open janpipek opened 7 years ago

janpipek commented 7 years ago

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.

janpipek commented 5 years ago

Related: #48

janpipek commented 5 years ago

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.