Skip to content

Commit 2bd4569

Browse files
committed
improved docstring of the clip method
1 parent ca47434 commit 2bd4569

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

larray/core/array.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6017,23 +6017,25 @@ def transpose(self, *args):
60176017
def clip(self, minval=None, maxval=None, out=None):
60186018
r"""Clip (limit) the values in an array.
60196019
6020-
Given an interval, values outside the interval are clipped to the interval edges.
6020+
Given an interval, values outside the interval are clipped to the interval bounds.
60216021
For example, if an interval of [0, 1] is specified, values smaller than 0 become 0,
60226022
and values larger than 1 become 1.
60236023
60246024
Parameters
60256025
----------
60266026
minval : scalar or array-like, optional
6027-
Minimum value. If None, clipping is not performed on lower interval edge.
6028-
Not more than one of `minval` and `maxval` may be None.
6027+
Minimum value. If None, clipping is not performed on lower bound.
60296028
Defaults to None.
60306029
maxval : scalar or array-like, optional
6031-
Maximum value. If None, clipping is not performed on upper interval edge.
6032-
Not more than one of `minval` and `maxval` may be None.
6030+
Maximum value. If None, clipping is not performed on upper bound.
60336031
Defaults to None.
60346032
out : LArray, optional
60356033
The results will be placed in this array.
60366034
6035+
Notes
6036+
-----
6037+
At least either `minval` or `maxval` must be defined.
6038+
60376039
Returns
60386040
-------
60396041
LArray
@@ -6058,15 +6060,15 @@ def clip(self, minval=None, maxval=None, out=None):
60586060
a1 0 1 2
60596061
a2 2 2 2
60606062
6061-
Clipping on lower interval edge only
6063+
Clipping on lower bound only
60626064
60636065
>>> arr.clip(0)
60646066
a\b b0 b1 b2
60656067
a0 0 0 0
60666068
a1 0 1 2
60676069
a2 3 4 5
60686070
6069-
Clipping on upper interval edge only
6071+
Clipping on upper bound only
60706072
60716073
>>> arr.clip(maxval=2)
60726074
a\b b0 b1 b2

0 commit comments

Comments
 (0)