(self, array)
return numpy.array(colour_array, dtype='uint8')
Convert an array into an RGB numpy array.
Convert an array into an RGB numpy array.
Convert an array into an RGB numpy array .
def convert_to_rgb(self, array):
        """Convert an array into an RGB numpy array."""
        
        message = 'Converting {} points to RGB values... (this may take a few seconds)'
        try:
            Message(message.format(array.size))
        except AttributeError:
            array = numpy.array(array)
            Message(message.format(array.size))
        
        new = numpy.round(numpy.divide(array - self.min, self._step_size), 0, 'int64')
    
        start_colour = self.cache[0]
        end_colour = self.cache[-1]
        colour_array = [[self.cache[item] if 0 <= item <= self.steps 
                         else start_colour if item < 0 
                         else end_colour for item in sublst] 
                        for sublst in new.tolist()]
                        
        return numpy.array(colour_array, dtype='uint8')
def convert_to_rgb ( self , array ) : message = 'Converting {} points to RGB values... (this may take a few seconds)' try : Message ( message . format ( array . size ) ) except AttributeError : array = numpy . array ( array ) Message ( message . format ( array . size ) ) new = numpy . round ( numpy . divide ( array - self . min , self . _step_size ) , 0 , 'int64' ) start_colour = self . cache [ 0 ] end_colour = self . cache [ - 1 ] colour_array = [ [ self . cache [ item ] if 0 <= item <= self . steps else start_colour if item < 0 else end_colour for item in sublst ] for sublst in new . tolist ( ) ] return numpy . array ( colour_array , dtype = 'uint8' )