astrofrog / fast-histogram

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to pass various types of arguments (like numpy)

vkhodygo opened this issue · comments

Hi, I would like to try your package, but my code keeps throwing errors.
First, I do not use range parameter at all (I have no need). That is OK, I can add a few numbers.
However, when I try to run it again, I get The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() since I use bins=[bin_x,bin_y].

I can in general rewrite my code but my sets of bins are quite sophisticated and it would be a bit painful.
Is it possible to update your code somehow?

Sincerely,
V.

@v-kh - could you give more details about the example you ran that returned The truth value of an array with more than one element ? Could you show the full code to get this error?

@v-kh - I think I understand - you tried to pass arrays of bin edges to the bins argument, but this is not supported in this package. The aim of this package is to provide faster functions when the bins are equally spaced, and therefore bins can be an integer (or a tuple of integers for the 2D case). I'm adding a more explicit error for this in #24