Package Bio :: Package Graphics :: Module ColorSpiral :: Class ColorSpiral
[hide private]
[frames] | no frames]

Class ColorSpiral

source code

object --+
         |
        ColorSpiral

Implement a spiral path through HSV colour space.

This class provides functions for sampling points along a logarithmic
spiral path through HSV colour space.

The spiral is described by r = a * exp(b * t) where r is the distance
from the axis of the HSV cylinder to the current point in the spiral,
and t is the angle through which the spiral has turned to reach the
current point. a and b are (positive, real) parameters that control the
shape of the spiral.

a: the starting direction of the spiral
b: the number of revolutions about the axis made by the spiral

We permit the spiral to move along the cylinder ('in V-space') between
v_init and v_final, to give a gradation in V (essentially, brightness),
along the path, where v_init, v_final are in [0,1].

A brightness 'jitter' may also be provided as an absolute value in
V-space, to aid in distinguishing consecutive colour points on the
path.

Instance Methods [hide private]
 
__init__(self, a=1, b=0.33, v_init=0.85, v_final=0.5, jitter=0.05)
Initialise a logarithmic spiral path through HSV colour space
source code
 
get_colors(self, k, offset=0.1)
Generate k different RBG colours evenly-space on the spiral.
source code
 
_get_a(self) source code
 
_set_a(self, value) source code
 
_get_b(self) source code
 
_set_b(self, value) source code
 
_get_v_init(self) source code
 
_set_v_init(self, value) source code
 
_get_v_final(self) source code
 
_set_v_final(self, value) source code
 
_get_jitter(self) source code
 
_set_jitter(self, value) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  a
Parameter controlling initial spiral direction (a > 0)
  b
Parameter controlling rate spiral revolves around axis (b > 0)
  v_init
Initial value of V (brightness) for the spiral (range 0 to 1)
  v_final
Final value of V (brightness) for the spiral (range 0 to 1)
  jitter
Degree of V (brightness) jitter to add to each color (range 0 to 1)

Inherited from object: __class__

Method Details [hide private]

__init__(self, a=1, b=0.33, v_init=0.85, v_final=0.5, jitter=0.05)
(Constructor)

source code 
Initialise a logarithmic spiral path through HSV colour space

Arguments:

o a - Parameter a for the spiral, controls the initial spiral
      direction. a > 0

o b - parameter b for the spiral, controls the rate at which the
      spiral revolves around the axis. b > 0

o v_init - initial value of V (brightness) for the spiral.
           v_init in [0,1]

o v_final - final value of V (brightness) for the spiral
           v_final in [0,1]

o jitter - the degree of V (brightness) jitter to add to each
           selected colour. The amount of jitter will be selected
           from a uniform random distribution [-jitter, jitter],
           and V will be maintained in [0,1].

Overrides: object.__init__

get_colors(self, k, offset=0.1)

source code 
Generate k different RBG colours evenly-space on the spiral.

A generator returning the RGB colour space values for k
evenly-spaced points along the defined spiral in HSV space.

Arguments:

o k - the number of points to return

o offset - how far along the spiral path to start.


Property Details [hide private]

a

Parameter controlling initial spiral direction (a > 0)

Get Method:
_get_a(self)
Set Method:
_set_a(self, value)

b

Parameter controlling rate spiral revolves around axis (b > 0)

Get Method:
_get_b(self)
Set Method:
_set_b(self, value)

v_init

Initial value of V (brightness) for the spiral (range 0 to 1)

Get Method:
_get_v_init(self)
Set Method:
_set_v_init(self, value)

v_final

Final value of V (brightness) for the spiral (range 0 to 1)

Get Method:
_get_v_final(self)
Set Method:
_set_v_final(self, value)

jitter

Degree of V (brightness) jitter to add to each color (range 0 to 1)

Get Method:
_get_jitter(self)
Set Method:
_set_jitter(self, value)