Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
BUG : fixes broadcast errors with np 1.9
 fixes some of the issues raised in #3186
  • Loading branch information
tacaswell committed Jul 5, 2014
commit 8d2f28b02274319f83a3f21c1bbe332e80c0b82d
9 changes: 6 additions & 3 deletions lib/matplotlib/tri/trirefine.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def refine_triangulation(self, return_tri_index=False, subdiv=3):
found_index = - np.ones(refi_npts, dtype=np.int32)
tri_mask = self._triangulation.mask
if tri_mask is None:
found_index[refi_triangles] = np.repeat(ancestors, 3)
found_index[refi_triangles] = np.repeat(ancestors,
3).reshape(-1, 3)
else:
# There is a subtlety here: we want to avoid whenever possible
# that refined points container is a masked triangle (which
Expand All @@ -126,9 +127,11 @@ def refine_triangulation(self, return_tri_index=False, subdiv=3):
# then overwrite it with unmasked ancestor numbers.
ancestor_mask = tri_mask[ancestors]
found_index[refi_triangles[ancestor_mask, :]
] = np.repeat(ancestors[ancestor_mask], 3)
] = np.repeat(ancestors[ancestor_mask],
3).reshape(-1, 3)
found_index[refi_triangles[~ancestor_mask, :]
] = np.repeat(ancestors[~ancestor_mask], 3)
] = np.repeat(ancestors[~ancestor_mask],
3).reshape(-1, 3)
return refi_triangulation, found_index
else:
return refi_triangulation
Expand Down