code: def field_from_graph_and_data(g, data):
      """Instantiate a Fieldfrom a WeightedGraph plus some feature data
      Parameters
      ----------
      x: (V, V) scipy.sparse.coo_matrix instance,
         the input matrix
      data: array of shape (V, dim),
            the field data
  
      Returns
      -------
      ifield: resulting field instance
      """
      if data.shape[0] != g.V:
          raise ValueError("data and g do not have consistent shapes")
      ifield = Field(g.V, g.edges, g.weights, data)
      return ifield
  
imports: from warnings import warn
  import numpy
  from .graph import Graph, WeightedGraph
label_desc: Use image node_id 2 for calling a global function with example usage: field_from_graph_and_data(g, data) and returns: ifield