Skip to content

Graceful handling of a numpy matrix #1558

Closed
@gustavla

Description

@gustavla

If you give quiver numpy matrices, it will crash. It raises a ValueError for a reshape, which can be hard to realize was caused by the matrices (potentially to great frustration for the user).

The source of the problem boils down to ravel() for np.matrix creating a row matrix of shape (1, N), instead of an ndarray with shape (N,).

I naively tried fixing it (pull request: #1546) by throwing in a call to np.asarray, but it was rightly closed because it would break support for masked arrays. It was also pointed out that it was likely to be a problem beyond just quiver.

As I see it, the issue is either resolved by adding support for numpy.matrix, or better information to the users of the source of the error.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions