def clip(self, a, m, M, out=None): # use slow-clip selector = np.less(a, m) + 2*np.greater(a, M) return selector.choose((a, m, M), out=out) # Handy functions