def triang(M, sym=True):
 if _len_guards(M):
  return np.ones(M)
 (M, needs_trunc) = _extend(M, sym)
 n = np.arange(1, (((M + 1) // 2) + 1))
 if ((M % 2) == 0):
  w = (((2 * n) - 1.0) / M)
  w = np.r_[(w, w[::(-1)])]
 else:
  w = ((2 * n) / (M + 1.0))
  w = np.r_[(w, w[(-2)::(-1)])]
 return _truncate(w, needs_trunc)

def triang ( M , sym = True ) : if _len_guards ( M ) : return np . ones ( M ) ( M , needs_trunc ) = _extend ( M , sym ) n = np . arange ( 1 , ( ( ( M + 1 ) // 2 ) + 1 ) ) if ( ( M % 2 ) == 0 ) : w = ( ( ( 2 * n ) - 1.0 ) / M ) w = np . r_ [ ( w , w [ : : ( - 1 ) ] ) ] else : w = ( ( 2 * n ) / ( M + 1.0 ) ) w = np . r_ [ ( w , w [ ( - 2 ) : : ( - 1 ) ] ) ] return _truncate ( w , needs_trunc )
return a triangular window .