physt icon indicating copy to clipboard operation
physt copied to clipboard

h1 (resp. calculate_frequencies) is too slow

Open janpipek opened this issue 8 years ago • 2 comments

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 avatar Apr 15 '17 12:04 janpipek

Related: #48

janpipek avatar Nov 01 '18 13:11 janpipek

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.

janpipek avatar Nov 01 '18 19:11 janpipek