def tsem(a, limits=None, inclusive=(True, True), axis=0, ddof=1):
 a = ma.asarray(a).ravel()
 if (limits is None):
  n = float(a.count())
  return (a.std(axis=axis, ddof=ddof) / ma.sqrt(n))
 am = trima(a.ravel(), limits, inclusive)
 sd = np.sqrt(am.var(axis=axis, ddof=ddof))
 return (sd / np.sqrt(am.count()))

def tsem ( a , limits = None , inclusive = ( True , True ) , axis = 0 , ddof = 1 ) : a = ma . asarray ( a ) . ravel ( ) if ( limits is None ) : n = float ( a . count ( ) ) return ( a . std ( axis = axis , ddof = ddof ) / ma . sqrt ( n ) ) am = trima ( a . ravel ( ) , limits , inclusive ) sd = np . sqrt ( am . var ( axis = axis , ddof = ddof ) ) return ( sd / np . sqrt ( am . count ( ) ) )
compute the trimmed standard error of the mean .