Stéfan van der Walt wrote: > Maybe > > (np.sign(a) | 1) * np.maximum(np.abs(a), min_value) > > is a little bit easier on the eye.
nice! that does it. somehow I never think of using or. Alan G Isaac wrote: > idx = np.abs(a)<min_value > a[idx] = min_value*(np.sign(a[idx]) + (a[idx]==0)) that's do it too, but it's a bit more wordy, and I'm guessing slower, though that's really irrelevant here. thanks all, -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
