Skip to content

Commit c557979

Browse files
committed
Update docstrings in colour.utilities package.
1 parent 0f5e955 commit c557979

File tree

12 files changed

+155
-153
lines changed

12 files changed

+155
-153
lines changed

colour/utilities/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@
302302
# --- API Changes and Deprecation Management ---#
303303
# ----------------------------------------------------------------------------#
304304
class utilities(ModuleAPI):
305-
"""Define a class acting like the *utilities* module."""
305+
"""Class acting like the *utilities* module."""
306306

307307
def __getattr__(self, attribute: str) -> Any:
308-
"""Return the value from the attribute with given name."""
308+
"""Retrieve the value from the specified attribute."""
309309

310310
return super().__getattr__(attribute)
311311

colour/utilities/array.py

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Array Utilities
33
===============
44
5-
Define array utilities objects.
5+
Array utilities objects.
66
77
References
88
----------
@@ -197,7 +197,7 @@ def values(self) -> tuple:
197197
@property
198198
def items(self) -> tuple:
199199
"""
200-
Getter property for the :class:`dataclass`-like class items, i.e., the
200+
Getter property for the :class:`dataclass`-like class items, i.e., the
201201
field names and values.
202202
203203
Returns
@@ -490,7 +490,7 @@ def arithmetical_operation(
490490
self, a: Any, operation: str, in_place: bool = False
491491
) -> Dataclass:
492492
"""
493-
Perform given arithmetical operation with :math:`a` operand on the
493+
Perform specified arithmetical operation with :math:`a` operand on the
494494
:class:`dataclass`-like class.
495495
496496
Parameters
@@ -550,8 +550,8 @@ def as_array(
550550
dtype: Type[DType] | None = None,
551551
) -> NDArray:
552552
"""
553-
Convert given variable :math:`a` to :class:`numpy.ndarray` using given
554-
:class:`numpy.dtype`.
553+
Convert specified variable :math:`a` to :class:`numpy.ndarray` using
554+
specified :class:`numpy.dtype`.
555555
556556
Parameters
557557
----------
@@ -595,8 +595,8 @@ def as_int(
595595
) -> DTypeInt | NDArrayInt: ...
596596
def as_int(a: ArrayLike, dtype: Type[DTypeInt] | None = None) -> DTypeInt | NDArrayInt:
597597
"""
598-
Attempt to convert given variable :math:`a` to :class:`numpy.integer`
599-
using given :class:`numpy.dtype`. If variable :math:`a` is not a scalar or
598+
Attempt to convert specified variable :math:`a` to :class:`numpy.integer`
599+
using specified :class:`numpy.dtype`. If variable :math:`a` is not a scalar or
600600
0-dimensional, it is converted to :class:`numpy.ndarray`.
601601
602602
Parameters
@@ -649,8 +649,8 @@ def as_float(
649649
a: ArrayLike, dtype: Type[DTypeFloat] | None = None
650650
) -> DTypeFloat | NDArrayFloat:
651651
"""
652-
Attempt to convert given variable :math:`a` to :class:`numpy.floating`
653-
using given :class:`numpy.dtype`. If variable :math:`a` is not a scalar or
652+
Attempt to convert specified variable :math:`a` to :class:`numpy.floating`
653+
using specified :class:`numpy.dtype`. If variable :math:`a` is not a scalar or
654654
0-dimensional, it is converted to :class:`numpy.ndarray`.
655655
656656
Parameters
@@ -698,8 +698,8 @@ def as_float(
698698

699699
def as_int_array(a: ArrayLike, dtype: Type[DTypeInt] | None = None) -> NDArrayInt:
700700
"""
701-
Convert given variable :math:`a` to :class:`numpy.ndarray` using given
702-
:class:`numpy.dtype`.
701+
Convert specified variable :math:`a` to :class:`numpy.ndarray` using
702+
specified :class:`numpy.dtype`.
703703
704704
Parameters
705705
----------
@@ -733,8 +733,8 @@ def as_int_array(a: ArrayLike, dtype: Type[DTypeInt] | None = None) -> NDArrayIn
733733

734734
def as_float_array(a: ArrayLike, dtype: Type[DTypeFloat] | None = None) -> NDArrayFloat:
735735
"""
736-
Convert given variable :math:`a` to :class:`numpy.ndarray` using given
737-
:class:`numpy.dtype`.
736+
Convert specified variable :math:`a` to :class:`numpy.ndarray` using
737+
specified :class:`numpy.dtype`.
738738
739739
Parameters
740740
----------
@@ -768,7 +768,8 @@ def as_float_array(a: ArrayLike, dtype: Type[DTypeFloat] | None = None) -> NDArr
768768

769769
def as_int_scalar(a: ArrayLike, dtype: Type[DTypeInt] | None = None) -> int:
770770
"""
771-
Convert given :math:`a` variable to :class:`numpy.integer` using given
771+
Convert specified :math:`a` variable to :class:`numpy.integer` using
772+
specified
772773
:class:`numpy.dtype`.
773774
774775
Parameters
@@ -806,7 +807,8 @@ def as_int_scalar(a: ArrayLike, dtype: Type[DTypeInt] | None = None) -> int:
806807

807808
def as_float_scalar(a: ArrayLike, dtype: Type[DTypeFloat] | None = None) -> float:
808809
"""
809-
Convert given :math:`a` variable to :class:`numpy.floating` using given
810+
Convert specified :math:`a` variable to :class:`numpy.floating` using
811+
specified
810812
:class:`numpy.dtype`.
811813
812814
Parameters
@@ -847,7 +849,7 @@ def set_default_int_dtype(
847849
) -> None:
848850
"""
849851
Set *Colour* default :class:`numpy.integer` precision by setting
850-
:attr:`colour.constant.DTYPE_INT_DEFAULT` attribute with given
852+
:attr:`colour.constant.DTYPE_INT_DEFAULT` attribute with specified
851853
:class:`numpy.dtype` wherever the attribute is imported.
852854
853855
Parameters
@@ -897,7 +899,7 @@ def set_default_float_dtype(
897899
) -> None:
898900
"""
899901
Set *Colour* default :class:`numpy.floating` precision by setting
900-
:attr:`colour.constant.DTYPE_FLOAT_DEFAULT` attribute with given
902+
:attr:`colour.constant.DTYPE_FLOAT_DEFAULT` attribute with specified
901903
:class:`numpy.dtype` wherever the attribute is imported.
902904
903905
Parameters
@@ -918,7 +920,7 @@ def set_default_float_dtype(
918920
setting the *COLOUR_SCIENCE__DEFAULT_FLOAT_DTYPE* environment variable,
919921
for example `set COLOUR_SCIENCE__DEFAULT_FLOAT_DTYPE=float32`.
920922
- Some definition returning a single-scalar ndarray might not honour the
921-
given *float* precision: https://github.com/numpy/numpy/issues/16353
923+
specified *float* precision: https://github.com/numpy/numpy/issues/16353
922924
923925
Examples
924926
--------
@@ -1109,7 +1111,7 @@ def to_domain_1(
11091111
dtype: Type[DTypeFloat] | None = None,
11101112
) -> NDArray:
11111113
"""
1112-
Scale given array :math:`a` to domain **'1'**. The behaviour is as
1114+
Scale specified array :math:`a` to domain **'1'**. The behaviour is as
11131115
follows:
11141116
11151117
- If *Colour* domain-range scale is **'Reference'** or **'1'**, the
@@ -1171,7 +1173,7 @@ def to_domain_10(
11711173
dtype: Type[DTypeFloat] | None = None,
11721174
) -> NDArray:
11731175
"""
1174-
Scale given array :math:`a` to domain **'10'**, used by
1176+
Scale specified array :math:`a` to domain **'10'**, used by
11751177
*Munsell Renotation System*. The behaviour is as follows:
11761178
11771179
- If *Colour* domain-range scale is **'Reference'**, the
@@ -1238,7 +1240,7 @@ def to_domain_100(
12381240
dtype: Type[DTypeFloat] | None = None,
12391241
) -> NDArray:
12401242
"""
1241-
Scale given array :math:`a` to domain **'100'**. The behaviour is as
1243+
Scale specified array :math:`a` to domain **'100'**. The behaviour is as
12421244
follows:
12431245
12441246
- If *Colour* domain-range scale is **'Reference'** or **'100'**
@@ -1300,7 +1302,7 @@ def to_domain_degrees(
13001302
dtype: Type[DTypeFloat] | None = None,
13011303
) -> NDArray:
13021304
"""
1303-
Scale given array :math:`a` to degrees domain. The behaviour is as
1305+
Scale specified array :math:`a` to degrees domain. The behaviour is as
13041306
follows:
13051307
13061308
- If *Colour* domain-range scale is **'Reference'**, the
@@ -1367,7 +1369,7 @@ def to_domain_int(
13671369
dtype: Type[DTypeFloat] | None = None,
13681370
) -> NDArray:
13691371
"""
1370-
Scale given array :math:`a` to int domain. The behaviour is as follows:
1372+
Scale specified array :math:`a` to int domain. The behaviour is as follows:
13711373
13721374
- If *Colour* domain-range scale is **'Reference'**, the
13731375
definition is almost entirely by-passed and will conveniently convert
@@ -1439,7 +1441,7 @@ def from_range_1(
14391441
dtype: Type[DTypeFloat] | None = None,
14401442
) -> NDArray:
14411443
"""
1442-
Scale given array :math:`a` from range **'1'**. The behaviour is as
1444+
Scale specified array :math:`a` from range **'1'**. The behaviour is as
14431445
follows:
14441446
14451447
- If *Colour* domain-range scale is **'Reference'** or **'1'**, the
@@ -1505,7 +1507,7 @@ def from_range_10(
15051507
dtype: Type[DTypeFloat] | None = None,
15061508
) -> NDArray:
15071509
"""
1508-
Scale given array :math:`a` from range **'10'**, used by
1510+
Scale specified array :math:`a` from range **'10'**, used by
15091511
*Munsell Renotation System*. The behaviour is as follows:
15101512
15111513
- If *Colour* domain-range scale is **'Reference'**, the
@@ -1576,7 +1578,7 @@ def from_range_100(
15761578
dtype: Type[DTypeFloat] | None = None,
15771579
) -> NDArray:
15781580
"""
1579-
Scale given array :math:`a` from range **'100'**. The behaviour is as
1581+
Scale specified array :math:`a` from range **'100'**. The behaviour is as
15801582
follows:
15811583
15821584
- If *Colour* domain-range scale is **'Reference'** or **'100'**
@@ -1642,7 +1644,7 @@ def from_range_degrees(
16421644
dtype: Type[DTypeFloat] | None = None,
16431645
) -> NDArray:
16441646
"""
1645-
Scale given array :math:`a` from degrees range. The behaviour is as
1647+
Scale specified array :math:`a` from degrees range. The behaviour is as
16461648
follows:
16471649
16481650
- If *Colour* domain-range scale is **'Reference'**, the
@@ -1713,7 +1715,7 @@ def from_range_int(
17131715
dtype: Type[DTypeFloat] | None = None,
17141716
) -> NDArray:
17151717
"""
1716-
Scale given array :math:`a` from int range. The behaviour is as follows:
1718+
Scale specified array :math:`a` from int range. The behaviour is as follows:
17171719
17181720
- If *Colour* domain-range scale is **'Reference'**, the
17191721
definition is entirely by-passed.
@@ -2002,7 +2004,7 @@ def closest(a: ArrayLike, b: ArrayLike) -> NDArray:
20022004

20032005
def interval(distribution: ArrayLike, unique: bool = True) -> NDArray:
20042006
"""
2005-
Return the interval size of given distribution.
2007+
Return the interval size of specified distribution.
20062008
20072009
Parameters
20082010
----------
@@ -2064,7 +2066,7 @@ def interval(distribution: ArrayLike, unique: bool = True) -> NDArray:
20642066

20652067
def is_uniform(distribution: ArrayLike) -> bool:
20662068
"""
2067-
Return whether given distribution is uniform.
2069+
Return whether specified distribution is uniform.
20682070
20692071
Parameters
20702072
----------
@@ -2097,7 +2099,7 @@ def is_uniform(distribution: ArrayLike) -> bool:
20972099
def in_array(a: ArrayLike, b: ArrayLike, tolerance: Real = EPSILON) -> NDArray:
20982100
"""
20992101
Return whether each element of the array :math:`a` is also present in the
2100-
array :math:`b` within given tolerance.
2102+
array :math:`b` within specified tolerance.
21012103
21022104
Parameters
21032105
----------
@@ -2113,7 +2115,7 @@ def in_array(a: ArrayLike, b: ArrayLike, tolerance: Real = EPSILON) -> NDArray:
21132115
-------
21142116
:class:`numpy.ndarray`
21152117
A bool array with array :math:`a` shape describing whether an
2116-
element of array :math:`a` is present in array :math:`b` within given
2118+
element of array :math:`a` is present in array :math:`b` within specified
21172119
tolerance.
21182120
21192121
References
@@ -2143,7 +2145,7 @@ def tstack(
21432145
dtype: Type[DTypeBoolean] | Type[DTypeReal] | None = None,
21442146
) -> NDArray:
21452147
"""
2146-
Stack given array of arrays :math:`a` along the last axis (tail) to
2148+
Stack specified array of arrays :math:`a` along the last axis (tail) to
21472149
produce a stacked array.
21482150
21492151
It is used to stack an array of arrays produced by the
@@ -2206,7 +2208,7 @@ def tsplit(
22062208
dtype: Type[DTypeBoolean] | Type[DTypeReal] | None = None,
22072209
) -> NDArray:
22082210
"""
2209-
Split given stacked array :math:`a` along the last axis (tail) to produce
2211+
Split specified stacked array :math:`a` along the last axis (tail) to produce
22102212
an array of arrays.
22112213
22122214
It is used to split a stacked array produced by the
@@ -2265,7 +2267,7 @@ def tsplit(
22652267

22662268
def row_as_diagonal(a: ArrayLike) -> NDArray:
22672269
"""
2268-
Return the rows of given array :math:`a` as diagonal matrices.
2270+
Return the rows of specified array :math:`a` as diagonal matrices.
22692271
22702272
Parameters
22712273
----------
@@ -2328,7 +2330,7 @@ def orient(
23282330
) = "Ignore",
23292331
) -> NDArray:
23302332
"""
2331-
Orient given array :math:`a` according to given orientation.
2333+
Orient specified array :math:`a` according to specified orientation.
23322334
23332335
Parameters
23342336
----------
@@ -2389,7 +2391,7 @@ def orient(
23892391

23902392
def centroid(a: ArrayLike) -> NDArrayInt:
23912393
"""
2392-
Return the centroid indexes of given array :math:`a`.
2394+
Return the centroid indexes of specified array :math:`a`.
23932395
23942396
Parameters
23952397
----------
@@ -2436,7 +2438,7 @@ def fill_nan(
24362438
default: Real = 0,
24372439
) -> NDArray:
24382440
"""
2439-
Fill given array :math:`a` NaN values according to given method.
2441+
Fill specified array :math:`a` NaN values according to specified method.
24402442
24412443
Parameters
24422444
----------
@@ -2477,7 +2479,7 @@ def fill_nan(
24772479

24782480
def has_only_nan(a: ArrayLike) -> bool:
24792481
"""
2480-
Return whether given array :math:`a` contains only NaN values.
2482+
Return whether specified array :math:`a` contains only NaN values.
24812483
24822484
Parameters
24832485
----------
@@ -2509,7 +2511,7 @@ def has_only_nan(a: ArrayLike) -> bool:
25092511
@contextmanager
25102512
def ndarray_write(a: ArrayLike) -> Generator:
25112513
"""
2512-
Define a context manager setting given array :math:`a` writeable to
2514+
Define a context manager setting specified array :math:`a` writeable to
25132515
operate one and then read-only.
25142516
25152517
Parameters
@@ -2569,7 +2571,7 @@ def zeros(
25692571
Returns
25702572
-------
25712573
:class:`numpy.ndarray`
2572-
Array of given shape and :class:`numpy.dtype`, filled with zeros.
2574+
Array of specified shape and :class:`numpy.dtype`, filled with zeros.
25732575
25742576
Examples
25752577
--------
@@ -2607,7 +2609,7 @@ def ones(
26072609
Returns
26082610
-------
26092611
:class:`numpy.ndarray`
2610-
Array of given shape and type, filled with ones.
2612+
Array of specified shape and type, filled with ones.
26112613
26122614
Examples
26132615
--------
@@ -2647,7 +2649,7 @@ def full(
26472649
Returns
26482650
-------
26492651
:class:`numpy.ndarray`
2650-
Array of given shape and :class:`numpy.dtype`, filled with given value.
2652+
Array of specified shape and :class:`numpy.dtype`, filled with specified value.
26512653
26522654
Examples
26532655
--------
@@ -2731,7 +2733,7 @@ def index_along_last_axis(a: ArrayLike, indexes: ArrayLike) -> NDArray:
27312733
>>> np.array_equal(index_along_last_axis(a, indexes), np.min(a, axis=-1))
27322734
True
27332735
2734-
In particular, this can be used to manipulate the indexes given by
2736+
In particular, this can be used to manipulate the indexes specified by
27352737
functions like :func:`np.min` before indexing the array. For example, to
27362738
get elements directly following the smallest elements:
27372739
@@ -2757,7 +2759,7 @@ def index_along_last_axis(a: ArrayLike, indexes: ArrayLike) -> NDArray:
27572759

27582760
def format_array_as_row(a: ArrayLike, decimals: int = 7, separator: str = " ") -> str:
27592761
"""
2760-
Format given array :math:`a` as a row.
2762+
Format specified array :math:`a` as a row.
27612763
27622764
Parameters
27632765
----------

0 commit comments

Comments
 (0)