spyrit.misc.color.spectral_colorization

spyrit.misc.color.spectral_colorization(M_gray, wav, axis=None)[source]

Colorize the last dimension of an array

Args:

M_gray (np.ndarray): Grayscale array where the last dimension is the spectral dimension. This is an A-by-C array, where A can indicate multiple dimensions (e.g., 4-by-3-by-7) and C is the number of spectral channels.

wav (np.ndarray): Wavelenth. This is a 1D array of size C.

axis (None or int or tuple of ints, optional): Axis or axes along which the grayscale input is normalized. By default, global normalization across all axes is considered.

Returns:

M_color (np.ndarray): Color array with an extra dimension. This is an A-by-C-by-3 array.