2

numpy中这些函数有对应的方法吗?

def arg_less(inarray,threshold):
    return np.nonzero(inarray<threshold)

def arg_greater(inarray,threshold):
    return np.nonzero(inarray>threshold)

def arg_between(inarray,lowerbound,upperbound):
    if lowerbound>=upperbound:
        raise ValueError('the first argument is lower bound, lower bound bigger than upper bound!')
    else:
        return np.nonzero((inarray>lowerbound)|(inarray<upperbound))

def arg_outside(inarray,lowerbound,upperbound):
    if lowerbound>=upperbound:
        raise ValueError('the first argument is lower bound, lower bound bigger than upper bound!')
    else:
        return np.nonzero((inarray<lowerbound)&(inarray>upperbound))

谢谢大家。

4

0 回答 0