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: Returns a subfield of self, with only vertices such that valid > 0
  
  Parameters
  ----------
  valid: array of shape (self.V),
         nonzero for vertices to be retained
  
  Returns
  -------
  F: Field instance,
     the desired subfield of self
  
  Notes
  -----
  The vertices are renumbered as [1..p] where p = sum(valid>0) when
  sum(valid) == 0 then None is returned
docstr_tok: ["Returns","a","subfield","of","self",",","with","only","vertices","such","that","valid",">","0","Parameters","--","--","--","--","--","valid",":","array","of","shape","(","self.V",")",",","nonzero","for","vertices","to","be","retained","Returns","--","--","--","-","F",":","Field","instance",",","the","desired","subfield","of","self","Notes","--","--","-","The","vertices","are","renumbered","as","[","1","..","p","]","where","p","=","sum","(","valid",">","0",")","when","sum","(","valid",")","==","0","then","None","is","returned"]
code: def subfield(self, valid):
      """Returns a subfield of self, with only vertices such that valid > 0
  
      Parameters
      ----------
      valid: array of shape (self.V),
             nonzero for vertices to be retained
  
      Returns
      -------
      F: Field instance,
         the desired subfield of self
  
      Notes
      -----
      The vertices are renumbered as [1..p] where p = sum(valid>0) when
      sum(valid) == 0 then None is returned
      """
      G = self.subgraph(valid)
      if G is None:
          return None
      field = self.field[valid]
      if len(G.edges) == 0:
          edges = np.array([[], []]).T
      else:
          edges = G.edges
      return Field(G.V, edges, G.weights, field)
  
imports: from warnings import warn
  import numpy
  from .graph import Graph, WeightedGraph
label_desc: Use image node_id 18 for calling the Field obj's underlying member method code with example usage: obj.subfield(valid) and returns: Field, None