def estimate_location(a, scale, norm=None, axis=0, initial=None, maxiter=30, tol=1e-06):
 if (norm is None):
  norm = HuberT()
 if (initial is None):
  mu = np.median(a, axis)
 else:
  mu = initial
 for iter in range(maxiter):
  W = norm.weights(((a - mu) / scale))
  nmu = (np.sum((W * a), axis) / np.sum(W, axis))
  if np.alltrue(np.less(np.fabs((mu - nmu)), (scale * tol))):
   return nmu
  else:
   mu = nmu
 raise ValueError(('location estimator failed to converge in %d iterations' % maxiter))

def estimate_location ( a , scale , norm = None , axis = 0 , initial = None , maxiter = 30 , tol = 1e-06 ) : if ( norm is None ) : norm = HuberT ( ) if ( initial is None ) : mu = np . median ( a , axis ) else : mu = initial for iter in range ( maxiter ) : W = norm . weights ( ( ( a - mu ) / scale ) ) nmu = ( np . sum ( ( W * a ) , axis ) / np . sum ( W , axis ) ) if np . alltrue ( np . less ( np . fabs ( ( mu - nmu ) ) , ( scale * tol ) ) ) : return nmu else : mu = nmu raise ValueError ( ( 'location estimator failed to converge in %d iterations' % maxiter ) )
m-estimator of location using self .