class_docstr: This class is intended to represent a set of inter-subject regions
  It should inherit from some abstract multiple ROI class,
  not implemented yet.
docstr: Compute the density of a component as a kde
  
  Parameters
  ----------
  k: int (<= self.k) or None
     component upon which the density is computed
     if None, the sum is taken over k
  coord: array of shape(n, self.dom.em_dim), optional
      a set of input coordinates
  sigma: float, optional
         kernel size
  
  Returns
  -------
  kde: array of shape(n)
       the density sampled at the coords
docstr_tok: ["Compute","the","density","of","a","component","as","a","kde","Parameters","--","--","--","--","--","k",":","int","(","<","=","self.k",")","or","None","component","upon","which","the","density","is","computed","if","None",",","the","sum","is","taken","over","k","coord",":","array","of","shape","(","n",",","self.dom.em_dim",")",",","optional","a","set","of","input","coordinates","sigma",":","float",",","optional","kernel","size","Returns","--","--","--","-","kde",":","array","of","shape","(","n",")","the","density","sampled","at","the","coords"]
code: def kernel_density(self, k=None, coord=None, sigma=1.0):
      """Compute the density of a component as a kde
  
      Parameters
      ----------
      k: int (<= self.k) or None
         component upon which the density is computed
         if None, the sum is taken over k
      coord: array of shape(n, self.dom.em_dim), optional
          a set of input coordinates
      sigma: float, optional
             kernel size
  
      Returns
      -------
      kde: array of shape(n)
           the density sampled at the coords
      """
      from nipy.algorithms.utils.fast_distance import euclidean_distance
  
      if coord is None:
          coord = self.domain.coord
      if k is None:
          kde = np.zeros(coord.shape[0])
          for k in range(self.k):
              pos = self.position[k]
              dist = euclidean_distance(pos, coord)
              kde += np.exp(-(dist**2) / (2 * sigma**2)).sum(0)
      else:
          k = int(k)
          pos = self.position[k]
          dist = euclidean_distance(pos, coord)
          kde = np.exp(-(dist**2) / (2 * sigma**2)).sum(0)
      return kde / (2 * np.pi * sigma**2) ** (pos.shape[1] / 2)
  
file_path: nipy/nipy/labs/spatial_models/structural_bfls.py
imports: import numpy
  from scipy import stats
label_desc: Use image node_id 3 for calling the LandmarkRegions obj's underlying member method code with example usage: obj.kernel_density(k, coord, sigma) and returns: unknown