Package topo :: Package plotting :: Module palette :: Class Palette
[hide private]
[frames] | no frames]

Class Palette

source code

                       object --+    
                                |    
param.parameterized.Parameterized --+
                                    |
                                   Palette
Known Subclasses:

Each palette has 3*256 values that are keyed by an index. This base class takes in a list of 256 triples.

A Palette object has 256 triples of RGB values ranging from 0 ... 255. The purpose of the class is to maintain an accurate palette conversion between a number (0..255) and an RGB triple even as the background of the plots change. If the background is Black, then the 0 intensity should often be 0, but if the background of the Plot should be white, then the 0 intensity should probably be 255. This automatic updating is possible through the use of Dynamic Parameters, and lambda functions.

This class stores a passed in variable named colors. If the variable is a lambda function that gives the 256 triples, then it will evaluate the lambda each time a datarequest is made. If it is a static list, then the palette is fixed. It may be possible to make Palette a 'pure' Dynamic parameter, with different types of palettes setting the lambda. More power to you if you do that.

Nested Classes [hide private]

Inherited from param.parameterized.Parameterized: __metaclass__

Instance Methods [hide private]
 
__init__(self, **params)
Does not fill in the colors, must call with a set function call preferably from a subclass of Palette
source code
 
set(self, colors)
Colors is a list of 256 triples, each with a 0..255 RGB value or a lambda function that generates the list.
source code
 
flat(self)
Return the palette in a flat form of 768 numbers.
source code
 
color(self, pos)
Return the tuple of RGB color found at pos in color list
source code
 
colors(self)
Return the complete list of palette colors in tuple form
source code

Inherited from param.parameterized.Parameterized: __getstate__, __repr__, __setstate__, __str__, debug, defaults, force_new_dynamic_value, get_param_values, get_value_generator, inspect_value, message, print_param_values, script_repr, set_dynamic_time_fn, state_pop, state_push, verbose, warning

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Methods [hide private]

Inherited from param.parameterized.Parameterized: params, print_param_defaults

Class Variables [hide private]
  background = param.Dynamic(default= BLACK_BACKGROUND)
  colors_ = param.Dynamic(default= F())

Inherited from param.parameterized.Parameterized: name, print_level

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **params)
(Constructor)

source code 
Does not fill in the colors, must call with a set function call preferably from a subclass of Palette
Overrides: object.__init__

set(self, colors)

source code 
Colors is a list of 256 triples, each with a 0..255 RGB value or a lambda function that generates the list. Lambdas will be necessary for dynamic shifts in black or white background changes.

flat(self)

source code 
Return the palette in a flat form of 768 numbers. If the colors parameter is a callable object, call it for the list of values.