def triu(m, k=0):
    m = asanyarray(m)
    out = multiply((1-tri(m.shape[0], m.shape[1], k-1, int)),m)
    return out

# borrowed from John Hunter and matplotlib
Upper triangle of an array.
dataset/ETHPy150Open nipy/nitime/nitime/index_utils.py/triu