Skip to content

In sparselybin switch q array to floats before applying divide and floor#21

Merged
jpivarski merged 1 commit into
histogrammar:1.0.xfrom
mbaak:1.0.x
Mar 30, 2017
Merged

In sparselybin switch q array to floats before applying divide and floor#21
jpivarski merged 1 commit into
histogrammar:1.0.xfrom
mbaak:1.0.x

Conversation

@mbaak
Copy link
Copy Markdown
Contributor

@mbaak mbaak commented Mar 22, 2017

One more request I'm afraid, I hope it's the last one.
Could you turn this into tag 1.0.8 as well? Many thanks!

In sparselybin I switched the q array to floats before applying divide and floor.
(In fact I see that the same is done for normally binned histograms.)
If not, for some reason numpy throws TypeError on trivial integer array cases such as:

q = numpy.array([1,2,3,4])
np.divide(q,1,q)
np.floor(q,q)

which can easily happen if your default binwidth is 1.

In fact, unless specified this is my default binning.
So any sparse histograms filled with integers fail for me.

The same is done in binned histograms.
If not, numpy throws TypeError on trivial integer array cases such as:
>>> q = numpy.array([1,2,3,4])
>>> np.divide(q,1,q)
>>> np.floor(q,q)
which can easily happen if default binning is 1.
@jpivarski jpivarski merged commit 77b1fc0 into histogrammar:1.0.x Mar 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants