class_docstr: Define basic tools for triangular mesh analysis and improvement.
  
  A TriAnalizer encapsulates a :class:`~matplotlib.tri.Triangulation`
  object and provides basic tools for mesh analysis and mesh improvement.
  
  Parameters
  ----------
  triangulation : :class:`~matplotlib.tri.Triangulation` object
      The encapsulated triangulation to analyze.
  
  Attributes
  ----------
  `scale_factors`
class_docstr_tok: ["Define","basic","tools","for","triangular","mesh","analysis","and","improvement",".","A","TriAnalizer","encapsulates","a",":","class",":","`","~matplotlib.tri.Triangulation","`","object","and","provides","basic","tools","for","mesh","analysis","and","mesh","improvement",".","Parameters","--","--","--","--","--","triangulation",":",":","class",":","`","~matplotlib.tri.Triangulation","`","object","The","encapsulated","triangulation","to","analyze",".","Attributes","--","--","--","--","--","`","scale_factors","`"]
docstr: 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 : boolean, optional
      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 : boolean, optional
      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
      the returned compressed triangulation triangles
  compressed_x : array-like
      the returned compressed triangulation 1st coordinate
  compressed_y : array-like
      the returned compressed triangulation 2nd coordinate
  tri_renum : array-like of integers
      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 : array-like of integers
      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.
docstr_tok: ["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",":","boolean",",","optional","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",":","boolean",",","optional","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","the","returned","compressed","triangulation","triangles","compressed_x",":","array-like","the","returned","compressed","triangulation","1st","coordinate","compressed_y",":","array-like","the","returned","compressed","triangulation","2nd","coordinate","tri_renum",":","array-like","of","integers","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",":","array-like","of","integers","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","."]
code: def _get_compressed_triangulation(
      self, return_tri_renum=False, return_node_renum=False
  ):
      """
      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 : boolean, optional
          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 : boolean, optional
          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
          the returned compressed triangulation triangles
      compressed_x : array-like
          the returned compressed triangulation 1st coordinate
      compressed_y : array-like
          the returned compressed triangulation 2nd coordinate
      tri_renum : array-like of integers
          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 : array-like of integers
          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.
  
      """
      # Valid triangles and renumbering
      tri_mask = self._triangulation.mask
      compressed_triangles = self._triangulation.get_masked_triangles()
      ntri = self._triangulation.triangles.shape[0]
      tri_renum = self._total_to_compress_renum(tri_mask, ntri)
  
      # Valid nodes and renumbering
      node_mask = (
          np.bincount(
              np.ravel(compressed_triangles),
              minlength=self._triangulation.x.size,
          )
          == 0
      )
      compressed_x = self._triangulation.x[~node_mask]
      compressed_y = self._triangulation.y[~node_mask]
      node_renum = self._total_to_compress_renum(node_mask)
  
      # 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,
              )
  
file_path: catboost/contrib/python/matplotlib/py2/matplotlib/tri/tritools.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  from matplotlib.tri import Triangulation
  import numpy
label_desc: Use image node_id 5 for calling the TriAnalyzer obj's underlying member method code with example usage: obj._get_compressed_triangulation(return_tri_renum, return_node_renum) and returns: compressed_triangles,  compressed_x,  compressed_y, compressed_triangles,  compressed_x,  compressed_y,  node_renum, compressed_triangles,  compressed_x,  compressed_y,  tri_renum, compressed_triangles,  compressed_x,  compressed_y,  tri_renum,  node_renum