BUG: Fix non-square wireframe 3D plotting#31750
Conversation
| segment_lengths = [len(segment) for segment in segments] | ||
| ragged = len(set(segment_lengths)) > 1 | ||
| if ragged: | ||
| # Branch masked / non-masked for speed |
There was a problem hiding this comment.
Yeah, for large wireframes the overall function call is 20-30% faster when you skip creating a masked array (mostly due to split set_segments and min below, not in the concat here). The any check is cheap. Part of the reason I want to rip out masked arrays altogether, but that's for later #31008
There was a problem hiding this comment.
If self._segments3d is already and array, you could skip the segment_length calculation.
There was a problem hiding this comment.
I'm inclined to merge this as-is and optimize in follow on PRs to get 3.11 unblocked.
| segment_lengths = [len(segment) for segment in segments] | ||
| ragged = len(set(segment_lengths)) > 1 | ||
| if ragged: | ||
| # Branch masked / non-masked for speed |
There was a problem hiding this comment.
If self._segments3d is already and array, you could skip the segment_length calculation.
| segment_lengths = [len(segment) for segment in segments] | ||
| ragged = len(set(segment_lengths)) > 1 | ||
| if ragged: | ||
| # Branch masked / non-masked for speed |
There was a problem hiding this comment.
I'm inclined to merge this as-is and optimize in follow on PRs to get 3.11 unblocked.
…750-on-v3.11.x Backport PR #31750 on branch v3.11.x (BUG: Fix non-square wireframe 3D plotting)
PR summary
Closes #31742
The optimization in #29397 caused issues when the underlying data for 3D wireframe plotting was not square. The test
test_wireframe3dasymmetriconly made the strides asymmetric and still used square underlying data, so did not catch this. Updated both.AI Disclosure
Diagnosed with claude's help, manually edited.
PR checklist