parameters: (mask, edges, weights=None)
docstring: Apply a mask to edges (weighted or not)
docstring_summary: Apply a mask to edges (weighted or not)
docstring_tokens: Apply a mask to edges ( weighted or not )
function: def _mask_edges_weights(mask, edges, weights=None):
      """Apply a mask to edges (weighted or not)"""
      inds = np.arange(mask.size)
      inds = inds[mask.ravel()]
      ind_mask = np.logical_and(np.in1d(edges[0], inds),
                                np.in1d(edges[1], inds))
      edges = edges[:, ind_mask]
      if weights is not None:
          weights = weights[ind_mask]
      if len(edges.ravel()):
          maxval = edges.max()
      else:
          maxval = 0
      order = np.searchsorted(np.unique(edges.ravel()), np.arange(maxval + 1))
      edges = order[edges]
      if weights is None:
          return edges
      else:
          return edges, weights
function_tokens: def _mask_edges_weights ( mask , edges , weights = None ) : inds = np . arange ( mask . size ) inds = inds [ mask . ravel ( ) ] ind_mask = np . logical_and ( np . in1d ( edges [ 0 ] , inds ) , np . in1d ( edges [ 1 ] , inds ) ) edges = edges [ : , ind_mask ] if weights is not None : weights = weights [ ind_mask ] if len ( edges . ravel ( ) ) : maxval = edges . max ( ) else : maxval = 0 order = np . searchsorted ( np . unique ( edges . ravel ( ) ) , np . arange ( maxval + 1 ) ) edges = order [ edges ] if weights is None : return edges else : return edges , weights