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