def biweight_location(a, c=6.0, M=None, axis=None):
 a = np.asanyarray(a)
 if (M is None):
  M = np.median(a, axis=axis)
 if (axis is not None):
  M = np.expand_dims(M, axis=axis)
 d = (a - M)
 mad = median_absolute_deviation(a, axis=axis)
 if (axis is not None):
  mad = np.expand_dims(mad, axis=axis)
 u = (d / (c * mad))
 mask = (np.abs(u) >= 1)
 u = ((1 - (u ** 2)) ** 2)
 u[mask] = 0
 return (M.squeeze() + ((d * u).sum(axis=axis) / u.sum(axis=axis)))

def biweight_location ( a , c = 6.0 , M = None , axis = None ) : a = np . asanyarray ( a ) if ( M is None ) : M = np . median ( a , axis = axis ) if ( axis is not None ) : M = np . expand_dims ( M , axis = axis ) d = ( a - M ) mad = median_absolute_deviation ( a , axis = axis ) if ( axis is not None ) : mad = np . expand_dims ( mad , axis = axis ) u = ( d / ( c * mad ) ) mask = ( np . abs ( u ) >= 1 ) u = ( ( 1 - ( u ** 2 ) ) ** 2 ) u [ mask ] = 0 return ( M . squeeze ( ) + ( ( d * u ) . sum ( axis = axis ) / u . sum ( axis = axis ) ) )
compute the biweight location .