Skip to content

BUG/DOC/MAINT: Tidy up histogramdd #10802

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

Merged
merged 7 commits into from
Apr 7, 2018
Merged

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Mar 26, 2018

Split into small commits, one piece at a time.

Fixes gh-8531.

Happy to split these commits into multiple PRs, if needed.

This also switches to doing comparisons rather than subtractions, for consistency with np.histogram.
That change is not strictly necessary here as the arguments are not unsigned integer types (unlike in np.histogram), but it would nice to support integer bins in future.
…ension

Previously gave `ValueError: object too deep for desired array` from an internal call

This also adds support for 0d array bincounts
@eric-wieser eric-wieser changed the title BUG/DOC/MAINT: Histogramdd fixes BUG/DOC/MAINT: Tidy up histogramdd Mar 26, 2018
The data to be histogrammed. It must be an (N,D) array or data
that can be converted to such. The rows of the resulting array
are the coordinates of points in a D dimensional polytope.
sample : (N, D) array, or (D, N) array_like
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the different shapes?

sample : (N, D) array, or (D, N) array_like
The data to be histogrammed.

If an array, each row is a coordinate in a D-dimensional space.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might look better as a list rather than separate paragraphs. Why the transpose for array_like?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transpose was always there, not my choice - just documented it.

It's so the caller can pass (X, Y, Z) instead of np.stack((X, Y, Z), axis=-1), I think, which is similar to some matplotlib APIs.

I don't like it, but I think we're stuck with it.

@@ -792,8 +795,10 @@ def histogramdd(sample, bins=10, range=None, normed=False, weights=None):

range : sequence, optional
A sequence of lower and upper bin edges to be used if the edges are
not given explicitly in `bins`. Defaults to the minimum and maximum
values along each dimension.
not given explicitly in `bins`. An entry of None in the sequence
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So they must match the dimensions in some way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, should be a tuple of length D. Will update.

@charris
Copy link
Member

charris commented Apr 5, 2018

Seems like a somewhat weird function. The documentation still isn't very clear.

@eric-wieser
Copy link
Member Author

Do you want me to leave the DOC commit to a later PR?

@charris
Copy link
Member

charris commented Apr 5, 2018

If you still want to work on the documentation, it would be good to at least get the fix in.

…gramdd

This also adds support for inferring the range along a subset of the axes, rather than an all or nothing approach.
@eric-wieser
Copy link
Member Author

@charris: docstring updated, and a release note added for the new feature

@charris
Copy link
Member

charris commented Apr 7, 2018

Much nicer. Thanks Eric.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants