class_docstr: This is the basic field structure,
       which contains the weighted graph structure
       plus an array of data (the 'field')
  field is an array of size(n, p)
        where n is the number of vertices of the graph
        and p is the field dimension
class_docstr_tok: ["This","is","the","basic","field","structure",",","which","contains","the","weighted","graph","structure","plus","an","array","of","data","(","the","'field","'",")","field","is","an","array","of","size","(","n",",","p",")","where","n","is","the","number","of","vertices","of","the","graph","and","p","is","the","field","dimension"]
docstr: Analysis of the level sets of the field:
  Bifurcations are defined as changes in the topology in the level sets
  when the level (threshold) is varied
  This can been thought of as a kind of Morse analysis
  
  Parameters
  ----------
  th: float, optional,
      threshold so that only values above th are considered
  
  Returns
  -------
  idx: array of shape (nlsets)
       indices of the vertices that are local maxima
  height: array of shape (nlsets)
          the depth of the local maxima
          depth[idx[i]] = q means that idx[i] is a q-order maximum
          Note that this is also the diameter of the basins
          associated with local maxima
  parents: array of shape (nlsets)
           the label of the maximum which dominates each local maximum
           i.e. it describes the hierarchy of the local maxima
  label: array of shape (self.V)
         a labelling of thevertices according to their bassin
docstr_tok: ["Analysis","of","the","level","sets","of","the","field",":","Bifurcations","are","defined","as","changes","in","the","topology","in","the","level","sets","when","the","level","(","threshold",")","is","varied","This","can","been","thought","of","as","a","kind","of","Morse","analysis","Parameters","--","--","--","--","--","th",":","float",",","optional",",","threshold","so","that","only","values","above","th","are","considered","Returns","--","--","--","-","idx",":","array","of","shape","(","nlsets",")","indices","of","the","vertices","that","are","local","maxima","height",":","array","of","shape","(","nlsets",")","the","depth","of","the","local","maxima","depth","[","idx","[","i","]","]","=","q","means","that","idx","[","i","]","is","a","q-order","maximum","Note","that","this","is","also","the","diameter","of","the","basins","associated","with","local","maxima","parents",":","array","of","shape","(","nlsets",")","the","label","of","the","maximum","which","dominates","each","local","maximum","i.e",".","it","describes","the","hierarchy","of","the","local","maxima","label",":","array","of","shape","(","self.V",")","a","labelling","of","thevertices","according","to","their","bassin"]
code: def threshold_bifurcations(self, refdim=0, th=NEGINF):
      """Analysis of the level sets of the field:
      Bifurcations are defined as changes in the topology in the level sets
      when the level (threshold) is varied
      This can been thought of as a kind of Morse analysis
  
      Parameters
      ----------
      th: float, optional,
          threshold so that only values above th are considered
  
      Returns
      -------
      idx: array of shape (nlsets)
           indices of the vertices that are local maxima
      height: array of shape (nlsets)
              the depth of the local maxima
              depth[idx[i]] = q means that idx[i] is a q-order maximum
              Note that this is also the diameter of the basins
              associated with local maxima
      parents: array of shape (nlsets)
               the label of the maximum which dominates each local maximum
               i.e. it describes the hierarchy of the local maxima
      label: array of shape (self.V)
             a labelling of thevertices according to their bassin
      """
      from numpy import ma
  
      if np.size(self.field) == 0:
          raise ValueError("No field has been defined so far")
      if self.field.shape[1] - 1 < refdim:
          raise ValueError("refdim>field.shape[1]")
  
      label = -np.ones(self.V, np.int_)
  
      # create a subfield(thresholding)
      sf = self.subfield(self.field[:, refdim] >= th)
      initial_field = sf.field[:, refdim].copy()
      sf.field = initial_field.copy()
  
      # explore the subfield
      order = np.argsort(-initial_field)
      rows = sf.to_coo_matrix().tolil().rows
      llabel = -np.ones(sf.V, np.int_)
      parent, root = np.arange(2 * self.V), np.arange(2 * self.V)
      # q will denote the region index
      q = 0
      for i in order:
          if (llabel[rows[i]] > -1).any():
              nlabel = np.unique(llabel[rows[i]])
              if nlabel[0] == -1:
                  nlabel = nlabel[1:]
              nlabel = np.unique(root[nlabel])
              if len(nlabel) == 1:
                  # we are at a regular point
                  llabel[i] = nlabel[0]
              else:
                  # we are at a saddle point
                  llabel[i] = q
                  parent[nlabel] = q
                  root[nlabel] = q
                  for j in nlabel:
                      root[root == j] = q
                  q += 1
          else:
              # this is a new component
              llabel[i] = q
              q += 1
      parent = parent[:q]
  
      # write all the depth values
      label[self.field[:, refdim] >= th] = llabel
      idx = np.array(
          [
              ma.array(
                  self.field[:, refdim], mask=(label != c)
              ).argmax()
              for c in range(q)
          ]
      )
      return idx, parent, label
  
imports: from warnings import warn
  import numpy
  from .graph import Graph, WeightedGraph
label_desc: Use image node_id 13 for calling the Field obj's underlying member method code with example usage: obj.threshold_bifurcations(refdim, th) and returns: idx,  parent,  label