Skip to content

Remove optional returns from TriAnalyzer._get_compressed_triangulation. #16899

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
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/matplotlib/tri/triinterpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def __init__(self, triangulation, z, kind='min_E', trifinder=None,
# (used) node numbering.
tri_analyzer = TriAnalyzer(self._triangulation)
(compressed_triangles, compressed_x, compressed_y, tri_renum,
node_renum) = tri_analyzer._get_compressed_triangulation(True, True)
node_renum) = tri_analyzer._get_compressed_triangulation()
self._triangles = compressed_triangles
self._tri_renum = tri_renum
# Taking into account the node renumbering in self._z:
Expand Down
33 changes: 4 additions & 29 deletions lib/matplotlib/tri/tritools.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,26 +190,14 @@ def get_flat_tri_mask(self, min_circle_ratio=0.01, rescale=True):

return np.ma.filled(current_mask, True)

def _get_compressed_triangulation(self, return_tri_renum=False,
return_node_renum=False):
def _get_compressed_triangulation(self):
"""
Compress (if masked) the encapsulated triangulation.

Returns minimal-length triangles array (*compressed_triangles*) and
coordinates arrays (*compressed_x*, *compressed_y*) that can still
describe the unmasked triangles of the encapsulated triangulation.

Parameters
----------
return_tri_renum : bool, default: False
Indicates whether a renumbering table to translate the triangle
numbers from the encapsulated triangulation numbering into the
new (compressed) renumbering will be returned.
return_node_renum : bool, default: False
Indicates whether a renumbering table to translate the nodes
numbers from the encapsulated triangulation numbering into the
new (compressed) renumbering will be returned.

Returns
-------
compressed_triangles : array-like
Expand All @@ -222,12 +210,11 @@ def _get_compressed_triangulation(self, return_tri_renum=False,
renumbering table to translate the triangle numbers from the
encapsulated triangulation into the new (compressed) renumbering.
-1 for masked triangles (deleted from *compressed_triangles*).
Returned only if *return_tri_renum* is True.
node_renum : int array
renumbering table to translate the point numbers from the
encapsulated triangulation into the new (compressed) renumbering.
-1 for unused points (i.e. those deleted from *compressed_x* and
*compressed_y*). Returned only if *return_node_renum* is True.
*compressed_y*).

"""
# Valid triangles and renumbering
Expand All @@ -246,20 +233,8 @@ def _get_compressed_triangulation(self, return_tri_renum=False,
# Now renumbering the valid triangles nodes
compressed_triangles = node_renum[compressed_triangles]

# 4 cases possible for return
if not return_tri_renum:
if not return_node_renum:
return compressed_triangles, compressed_x, compressed_y
else:
return (compressed_triangles, compressed_x, compressed_y,
node_renum)
else:
if not return_node_renum:
return (compressed_triangles, compressed_x, compressed_y,
tri_renum)
else:
return (compressed_triangles, compressed_x, compressed_y,
tri_renum, node_renum)
return (compressed_triangles, compressed_x, compressed_y, tri_renum,
node_renum)

@staticmethod
def _total_to_compress_renum(mask, n=None):
Expand Down