class_docstr: Simple class to construct AffineTransform instances with slice notation
  like np.ogrid/np.mgrid.
  
  >>> c = CoordinateSystem('xy', 'input')
  >>> g = Grid(c)
  >>> points = g[-1:1:21j,-2:4:31j]
  >>> points.coordmap.affine
  array([[ 0.1,  0. , -1. ],
         [ 0. ,  0.2, -2. ],
         [ 0. ,  0. ,  1. ]])
  
  >>> print(points.coordmap.function_domain)
  CoordinateSystem(coord_names=('i0', 'i1'), name='product', coord_dtype=float64)
  >>> print(points.coordmap.function_range)
  CoordinateSystem(coord_names=('x', 'y'), name='input', coord_dtype=float64)
  
  >>> points.shape
  (21, 31)
  >>> print(points.transposed_values.shape)
  (2, 21, 31)
  >>> print(points.values.shape)
  (651, 2)
docstr: Initialize Grid object
  
  Parameters
  ----------
  coords: ``CoordinateMap`` or ``CoordinateSystem``
     A coordinate map to be 'sliced' into. If
     coords is a CoordinateSystem, then an
     AffineTransform instance is created with coords
     with identity transformation.
docstr_tok: ["Initialize","Grid","object","Parameters","--","--","--","--","--","coords",":","``","CoordinateMap","``","or","``","CoordinateSystem","``","A","coordinate","map","to","be","'sliced","'","into",".","If","coords","is","a","CoordinateSystem",",","then","an","AffineTransform","instance","is","created","with","coords","with","identity","transformation","."]
code: def __init__(self, coords):
      """
      Initialize Grid object
  
      Parameters
      ----------
      coords: ``CoordinateMap`` or ``CoordinateSystem``
         A coordinate map to be 'sliced' into. If
         coords is a CoordinateSystem, then an
         AffineTransform instance is created with coords
         with identity transformation.
      """
  
      if isinstance(coords, CoordinateSystem):
          coordmap = AffineTransform.identity(
              coords.coord_names, coords.name
          )
      elif not (isinstance(coords, (CoordinateMap, AffineTransform))):
          raise ValueError(
              "expecting either a CoordinateMap, CoordinateSystem or AffineTransform for Grid"
          )
      else:
          coordmap = coords
      self.coordmap = coordmap
  
file_path: nipy/nipy/core/reference/array_coords.py
imports: import numpy
  from .coordinate_map import AffineTransform, CoordinateMap, compose, shifted_range_origin
  from .coordinate_map import product
  from .coordinate_system import CoordinateSystem
label_desc: Use image node_id 1 to create a new Grid object  with example: obj = Grid(coords)