Utilities¶
Common¶
colour.utilities
handle_numpy_errors (**kwargs) |
Decorator for handling Numpy errors. |
ignore_numpy_errors (function) |
Wrapper for given function. |
raise_numpy_errors (function) |
Wrapper for given function. |
print_numpy_errors (function) |
Wrapper for given function. |
warn_numpy_errors (function) |
Wrapper for given function. |
ignore_python_warnings (function) |
Decorator for ignoring Python warnings. |
batch (iterable[, k]) |
Returns a batch generator from given iterable. |
is_openimageio_installed ([raise_exception]) |
Returns if OpenImageIO is installed and available. |
is_pandas_installed ([raise_exception]) |
Returns if Pandas is installed and available. |
is_iterable (a) |
Returns if given \(a\) variable is iterable. |
is_string (a) |
Returns if given \(a\) variable is a string like variable. |
is_numeric (a) |
Returns if given \(a\) variable is a number. |
is_integer (a) |
Returns if given \(a\) variable is an integer under given threshold. |
filter_kwargs (function, **kwargs) |
Filters keyword arguments incompatible with the given function signature. |
first_item (a) |
Return the first item of an iterable. |
Array¶
colour.utilities
as_numeric (a[, type_]) |
Converts given \(a\) variable to numeric. |
as_namedtuple (a, named_tuple) |
Converts given \(a\) variable to given namedtuple class instance. |
closest_indexes (a, b) |
Returns the \(a\) variable closest element indexes to reference \(b\) variable elements. |
closest (a, b) |
Returns the \(a\) variable closest elements to reference \(b\) variable elements. |
normalise_maximum (a[, axis, factor, clip]) |
Normalises given array_like \(a\) variable values by \(a\) variable maximum value and optionally clip them between. |
interval (distribution[, unique]) |
Returns the interval size of given distribution. |
is_uniform (distribution) |
Returns if given distribution is uniform. |
in_array (a, b[, tolerance]) |
Tests whether each element of an array is also present in a second array within given tolerance. |
tstack (a) |
Stacks arrays in sequence along the last axis (tail). |
tsplit (a) |
Splits arrays in sequence along the last axis (tail). |
row_as_diagonal (a) |
Returns the per row diagonal matrices of the given array. |
dot_vector (m, v) |
Convenient wrapper around np.einsum() with the following subscripts: ‘…ij,…j->…i’. |
dot_matrix (a, b) |
Convenient wrapper around np.einsum() with the following subscripts: ‘…ij,…jk->…ik’. |
orient (a, orientation) |
Orient given array according to given orientation value. |
centroid (a) |
Computes the centroid indexes of given \(a\) array. |
linear_conversion (a, old_range, new_range) |
Performs a simple linear conversion of given array between the old and new ranges. |
fill_nan (a[, method, default]) |
Fills given array NaNs according to given method. |
ndarray_write (*args, **kwds) |
A context manager setting given array writeable to perform an operation and then read-only. |
Data Structures¶
colour.utilities
CaseInsensitiveMapping ([data]) |
Implements a case-insensitive mutable mapping / dict object. |
Lookup |
Extends dict type to provide a lookup by value(s). |
Structure (*args, **kwargs) |
Defines an object similar to C/C++ structured type. |
Verbose¶
colour.utilities
message_box (message[, width, padding]) |
Prints a message inside a box. |
warning (*args, **kwargs) |
Issues a warning. |
filter_warnings ([state, colour_warnings_only]) |
Filters Colour and also optionally overall Python warnings. |
suppress_warnings (*args, **kwds) |
A context manager filtering Colour and also optionally overall Python warnings. |
numpy_print_options (*args, **kwds) |
A context manager implementing context changes to Numpy print behaviour. |
Ancillary Objects
colour.utilities
ColourWarning |
This is the base class of Colour warnings. |