MCPcopy Create free account
hub / github.com/Lauriat/funct / clip

Method clip

funct/Array.py:307–314  ·  view source on GitHub ↗

Clip the values in the Array between the interval (`_min`, `_max`).

(self, _min, _max, inplace=False)

Source from the content-addressed store, hash-verified

305 return Array(itertools.accumulate(self, l))
306
307 def clip(self, _min, _max, inplace=False):
308 """
309 Clip the values in the Array between the interval (`_min`, `_max`).
310 """
311 a = map(lambda e: max(min(e, _max), _min), self)
312 if inplace:
313 return self.__setinplace(a, inplace)
314 return Array(a)
315
316 def clip_(self, _min, _max):
317 """ Clip the values in the Array in-place. """

Callers 1

testMethod · 0.95

Calls 2

__setinplaceMethod · 0.95
ArrayClass · 0.85

Tested by 1

testMethod · 0.76