Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BF: make histogram bins integer for numpy 1.10 #372

Merged
merged 2 commits into from Oct 14, 2015

Conversation

matthew-brett
Copy link
Member

Numpy 1.10 seems to need an integer input to np.histogram.

Probably fixes gh-369.

I would be happy of a quick review.

@effigies
Copy link
Member

Looking at numpy/numpy#6469, it looks like it was rounding down before. Is this an explicit decision to round up? For consistent behavior across versions, I'd probably use integer division:

bins = max(10, (self.x.max() - self.x.min()) // step)

To compare, another np.histogram call in this file coerces to int. And another one looks like it needs coercing/rounding. A little surprised that's not causing test failures.

Numpy 1.10 seems to need an integer input to np.histogram.
Small edits to smoothed_histogram_from_samples docstring.
@matthew-brett
Copy link
Member Author

Thanks for looking at this. I made the // change you suggested.

The other np.histogram instance you found, I think is passing a vector of bin positions, so these do not have to be integers.

@effigies
Copy link
Member

Makes sense. CI error seems unrelated, so LGTM.

@matthew-brett
Copy link
Member Author

Thanks again for the review - in it goes.

matthew-brett added a commit that referenced this pull request Oct 14, 2015
MRG: make histogram bins integer for numpy 1.10

Numpy 1.10 seems to need an integer input to np.histogram.

Probably fixes gh-369.
@matthew-brett matthew-brett merged commit 088321e into nipy:master Oct 14, 2015
@matthew-brett matthew-brett deleted the numpy-1.10-fix branch October 14, 2015 00:29
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.

empirical p-value error, maybe caused by numpy 1.10
2 participants