Extras¶
This module requires additional installation of numpy and matplotlib.
Using functionality from this file requires extra dependencies.
-
pyparadigm.extras.
apply_color_map
(name: str, mat: numpy.ndarray = None, normalize=True)[source]¶ returns an RGB matrix scaled by a matplotlib color map, if normalize is False the matrix must only have values in the range [0, 1]
-
pyparadigm.extras.
mat_to_surface
(mat: numpy.ndarray, transformer=<function to_24bit_gray>)[source]¶ Can be used to create a pygame.Surface from a 2d numpy array.
By default a grey image with scaled colors is returned, but using the transformer argument any transformation can be used.
- Parameters
mat (np.ndarray) – the matrix to create the surface of.
transformer (Callable[np.ndarray[np.ndarray]]) – function that transforms the matrix to a valid color matrix, i.e. it must have 3dimension, were the 3rd dimension are the color channels. For each channel a value between 0 and 255 is allowed