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

Skip to content

Commit 956db9f

Browse files
committed
Merge pull request matplotlib#3188 from tacaswell/np_error_patch
Np error patch
2 parents 5293b22 + 2733217 commit 956db9f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/matplotlib/tri/triinterpolate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,9 @@ def _interpolate_single_key(self, return_key, tri_index, x, y):
462462
dzdx = self._ReferenceElement.get_function_derivatives(
463463
alpha, J, ecc, dof)
464464
if return_key == 'dzdx':
465-
return dzdx[:, 0]
465+
return dzdx[:, 0, 0]
466466
else:
467-
return dzdx[:, 1]
467+
return dzdx[:, 1, 0]
468468
else:
469469
raise ValueError("Invalid return_key: " + return_key)
470470

lib/matplotlib/tri/trirefine.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ def refine_triangulation(self, return_tri_index=False, subdiv=3):
117117
found_index = - np.ones(refi_npts, dtype=np.int32)
118118
tri_mask = self._triangulation.mask
119119
if tri_mask is None:
120-
found_index[refi_triangles] = np.repeat(ancestors, 3)
120+
found_index[refi_triangles] = np.repeat(ancestors,
121+
3).reshape(-1, 3)
121122
else:
122123
# There is a subtlety here: we want to avoid whenever possible
123124
# that refined points container is a masked triangle (which
@@ -126,9 +127,11 @@ def refine_triangulation(self, return_tri_index=False, subdiv=3):
126127
# then overwrite it with unmasked ancestor numbers.
127128
ancestor_mask = tri_mask[ancestors]
128129
found_index[refi_triangles[ancestor_mask, :]
129-
] = np.repeat(ancestors[ancestor_mask], 3)
130+
] = np.repeat(ancestors[ancestor_mask],
131+
3).reshape(-1, 3)
130132
found_index[refi_triangles[~ancestor_mask, :]
131-
] = np.repeat(ancestors[~ancestor_mask], 3)
133+
] = np.repeat(ancestors[~ancestor_mask],
134+
3).reshape(-1, 3)
132135
return refi_triangulation, found_index
133136
else:
134137
return refi_triangulation

0 commit comments

Comments
 (0)