Closed
Description
In Matplotlib 1.5.1, contains_points return a boolean, consistent with the docstring:
In [1]: from matplotlib.path import Path
In [2]: Path([[1,2],[3,4],[5,6]]).contains_points([[1,2]])
Out[2]: array([False], dtype=bool)
However, in the latest developer version, an uint8
is returned:
In [15]: from matplotlib.path import Path
In [16]: Path([[1,2],[3,4],[5,6]]).contains_points([[1,2]])
Out[16]: array([0], dtype=uint8)
This causes issues with packages that are assuming bool, since masking arrays using an array of ints has a different results (it will either select the first or second element or both from an array), so I believe this is a regression.
Metadata
Metadata
Assignees
Labels
No labels
Activity
tacaswell commentedon Jun 10, 2016
In < 1.4 it returned uints, 1.5 return bool (as part of removing CXX usage), and we reverted to uint in #6450 as part of fixing a major path related speed regression.
We should probably cast to bool on the way out?
attn @mdboom
WeatherGod commentedon Jun 10, 2016
I thought we were casting to bool on the way out? Is that only on master
then?
On Fri, Jun 10, 2016 at 8:58 AM, Thomas A Caswell notifications@github.com
wrote:
astrofrog commentedon Jun 10, 2016
@WeatherGod - the failure is on master, I haven't tested elsewhere
tacaswell commentedon Jun 28, 2016
attn @mdboom
tacaswell commentedon Jun 28, 2016
I think we should revert the change to return uint -> bool. We broke that api 1.4->1.5 without realizing it, but it is better to stick with it (rather than swing back and forth).
Also as @astrofrog the bool is more natural to use for masking.
FIX: cast return of `contains_points` to bool
contains_points
to bool #6654jenshnielsen commentedon Jun 28, 2016
Closed by #6654