def barthann(M, sym=True):
 if _len_guards(M):
  return np.ones(M)
 (M, needs_trunc) = _extend(M, sym)
 n = np.arange(0, M)
 fac = np.abs(((n / (M - 1.0)) - 0.5))
 w = ((0.62 - (0.48 * fac)) + (0.38 * np.cos(((2 * np.pi) * fac))))
 return _truncate(w, needs_trunc)

def barthann ( M , sym = True ) : if _len_guards ( M ) : return np . ones ( M ) ( M , needs_trunc ) = _extend ( M , sym ) n = np . arange ( 0 , M ) fac = np . abs ( ( ( n / ( M - 1.0 ) ) - 0.5 ) ) w = ( ( 0.62 - ( 0.48 * fac ) ) + ( 0.38 * np . cos ( ( ( 2 * np . pi ) * fac ) ) ) ) return _truncate ( w , needs_trunc )
return a modified bartlett-hann window .