Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Path fast verts bug fix #4008

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

Closed
wants to merge 7 commits into from
Closed

Conversation

tacaswell
Copy link
Member

Re-introduces changes from #3681 and fixes bug.

merge this after #4007

Expect this to be currently failing tests

semi_log_with_zero

Fixes matplotlib#3998.

The issue is that some transfroms sometimes returned masked arrays from
`transform_non_affine` (ex Log10transform).  The `Path` constructor
fills masked arrays to full arrays with `np.nan`, but the
`_fast_from_codes_and_verts` does not (as it assumes the verts have been
fully validated on the way in).

This adds the maskedarray -> np.nan filled array normalization into
`transform_path_non_affine`.
@tacaswell
Copy link
Member Author

If this passes, I will do some history re-writing to get rid of both the reversion and re-introduction of @jbmohler 's commit.

Ensure that transforms that return masked arrays have the arrays
filled with nan

Improved the code readability.
The docs on Path._fast_from_codes_and_verts said that `codes`
can not be None, however the code does not check this and everyplace
that `Path` uses `self._codes` it first verifies that the value is
not `None` and `None` is a valid value to be passed to the Path `__init__`
which falls through with the `_codes` attribute being `None`.
@tacaswell
Copy link
Member Author

attn @pelson I changed some docs in Path that you were the last person to touch.

@pelson
Copy link
Member

pelson commented Jan 19, 2015

Seems reasonable. 👍

@mdboom
Copy link
Member

mdboom commented Jan 29, 2015

Sorry I missed this the first time around. In seeing #4049, I had a slightly different solution: to do the check for masked arrays in _fast_from_vertices_and_codes itself. Doing this revealed another code path where masked arrays were not getting properly converted to NaNs that caused a test to fail because cf43d57 didn't get merged onto master properly... But that does suggest to me it's safer to fix this at a lower level. I also think we should fix the log scaling to just set invalid to NaNs rather than create a masked array (along will all of the overhead involved). I think that code dates from before NaNs were handled correctly in all of the backends and all the cool kids were using masked arrays. I should have a PR shortly.

@tacaswell
Copy link
Member Author

The reason I didn't do the mask checking in the _fast_from_verticies_and_codes was to try and keep it fast ;)

@mdboom
Copy link
Member

mdboom commented Jan 29, 2015

The reason I didn't do the mask checking in the _fast_from_verticies_and_codes was to try and keep it fast ;)

Yeah -- I get that. But there's only 3 call sites of that function anyway, and this PR fixed two of them, and the third one it turns out also needs updating. So it's a net wash -- might as well just do it in the function in one place.

@mdboom
Copy link
Member

mdboom commented Jan 29, 2015

Maybe we should rename the method to "sorta_fast"?

@tacaswell
Copy link
Member Author

@mdboom Can you also cherry-pick 8d5fb93 ?

@mdboom
Copy link
Member

mdboom commented Jan 29, 2015

Sure thing.

@tacaswell tacaswell deleted the path_fast_verts branch January 31, 2015 18:24
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.

4 participants