code: def _diag_indices(n, ndim=2):
      # diag_indices function present in numpy 1.4 and later.  This for
      # compatibility with numpy < 1.4
      idx = np.arange(n)
      return (idx,) * ndim
  
file_path: nipy/nipy/algorithms/segmentation/segmentation.py
imports: import numpy
  from ._segmentation import _interaction_energy, _ve_step
label_desc: Use image node_id 1 for calling a global function with example usage: _diag_indices(n, ndim) and returns: unknown