def rsh(data, points=None):
 data = ma.array(data, copy=False)
 if (points is None):
  points = data
 else:
  points = np.array(points, copy=False, ndmin=1)
 if (data.ndim != 1):
  raise AttributeError('The input array should be 1D only !')
 n = data.count()
 r = idealfourths(data, axis=None)
 h = ((1.2 * (r[(-1)] - r[0])) / (n ** (1.0 / 5)))
 nhi = (data[:, None] <= (points[None, :] + h)).sum(0)
 nlo = (data[:, None] < (points[None, :] - h)).sum(0)
 return ((nhi - nlo) / ((2.0 * n) * h))

def rsh ( data , points = None ) : data = ma . array ( data , copy = False ) if ( points is None ) : points = data else : points = np . array ( points , copy = False , ndmin = 1 ) if ( data . ndim != 1 ) : raise AttributeError ( 'The input array should be 1D only !' ) n = data . count ( ) r = idealfourths ( data , axis = None ) h = ( ( 1.2 * ( r [ ( - 1 ) ] - r [ 0 ] ) ) / ( n ** ( 1.0 / 5 ) ) ) nhi = ( data [ : , None ] <= ( points [ None , : ] + h ) ) . sum ( 0 ) nlo = ( data [ : , None ] < ( points [ None , : ] - h ) ) . sum ( 0 ) return ( ( nhi - nlo ) / ( ( 2.0 * n ) * h ) )
evaluates rosenblatts shifted histogram estimators for each point on the dataset data .