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)[source]

returns an RGB matrix scaled by a matplotlib color map

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
pyparadigm.extras.to_24bit_gray(mat: numpy.ndarray)[source]

returns a matrix that contains RGB channels, and colors scaled from 0 to 255