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

Skip to content

TST: simplify mask in pcolor writing to mask test #26273

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 1 commit into from
Jul 7, 2023

Conversation

rcomer
Copy link
Member

@rcomer rcomer commented Jul 7, 2023

PR summary

This PR unbreaks CI by modifying the failing test.

Since the X and Y shape match the Z shape, they represent the centres of the boxes. pcolor therefore needs to work out the locations of the box corners. In this case, every other column of X and Y were masked, so pcolor can't reasonably be expected to do that.

It previously passed because our use of np.hstack stripped the mask off, so it was the same as if we'd not added the mask to begin with. For the test data, there were sensible numbers under the mask but this would obviously not be true in general. We now (since #25027) use np.ma.hstack.

hstack = np.ma.hstack if np.ma.isMA(X) else np.hstack
X = hstack((X[:, [0]] - dX[:, [0]],
X[:, :-1] + dX,
X[:, [-1]] + dX[:, [-1]]))

The point of the test is to verify that we don't attempt to write anything back to the input mask (#26230) . It doesn't matter for those purposes which elements are True or False.

PR checklist

@rcomer rcomer mentioned this pull request Jul 7, 2023
1 task
@rcomer rcomer added this to the v3.8.0 milestone Jul 7, 2023
@jklymak jklymak requested a review from greglucas July 7, 2023 13:49
@jklymak
Copy link
Member

jklymak commented Jul 7, 2023

Perhaps we should just merge to fix CI, but it would be good if @greglucas looked this over, maybe as a follow-on issue...

@QuLogic QuLogic merged commit f7bdfd3 into matplotlib:main Jul 7, 2023
@QuLogic
Copy link
Member

QuLogic commented Jul 7, 2023

I think @greglucas is away this week, but the explanation in the description makes sense to me.

@rcomer rcomer deleted the pcolor-maskwrite branch July 7, 2023 21:33
@greglucas
Copy link
Contributor

I agree with this change. One could argue whether we should take it one step further and raise if we get to the "auto" path and have masked values when we are trying to do any creation of the mesh. I think this seems reasonable for now, and we can reevaluate that later if the need arises.

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.

4 participants