def _scipy_univariate_kde(data, bw, gridsize, cut, clip):
 try:
  kde = stats.gaussian_kde(data, bw_method=bw)
 except TypeError:
  kde = stats.gaussian_kde(data)
  if (bw != 'scott'):
   msg = 'Ignoring bandwidth choice, please upgrade scipy to use a different bandwidth.'
   warnings.warn(msg, UserWarning)
 if isinstance(bw, string_types):
  bw = ('scotts' if (bw == 'scott') else bw)
  bw = (getattr(kde, ('%s_factor' % bw))() * np.std(data))
 grid = _kde_support(data, bw, gridsize, cut, clip)
 y = kde(grid)
 return (grid, y)

def _scipy_univariate_kde ( data , bw , gridsize , cut , clip ) : try : kde = stats . gaussian_kde ( data , bw_method = bw ) except TypeError : kde = stats . gaussian_kde ( data ) if ( bw != 'scott' ) : msg = 'Ignoring bandwidth choice, please upgrade scipy to use a different bandwidth.' warnings . warn ( msg , UserWarning ) if isinstance ( bw , string_types ) : bw = ( 'scotts' if ( bw == 'scott' ) else bw ) bw = ( getattr ( kde , ( '%s_factor' % bw ) ) ( ) * np . std ( data ) ) grid = _kde_support ( data , bw , gridsize , cut , clip ) y = kde ( grid ) return ( grid , y )
compute a univariate kernel density estimate using scipy .