astrofrog / fast-histogram

:zap: Fast 1D and 2D histogram functions in Python :zap:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

return two results

bastibe opened this issue · comments

numpy.histogram returns both counts and edges, while histogram1d only returns counts.

@bastibe - in the interest of performance, would you be ok with having a keyword argument return_edges that would be False by default?

Honestly, I would think that numpy compatibility was critical. Also, I would assume that a single numpy.linspace will not add any significant performance overhead, especially since the number of edges should at all times be negligible in comparison to the number of data points.

Regardless, it is up to you. I can see that you might not want to introduce backwards-incompatible changes.

@bastibe - maybe it's fine to break backward-compatibily, after all the package was only released yesterday ;) Would you like to open a pull request?

Sure, will do. It might take a few days, though.

Ok, I think I'll do it now since I'd rather break API as soon as possible. Will open a PR shortly.

It turns out this does affect performance signficantly for smaller arrays (< 10^5-6). I'll add a note to the FAQ to explain why we don't return the edges 😄

fair enough.