<s> from chaco . api import ColorMapper <EOL> import numpy as N <EOL> import pkg_resources <EOL> def _rotate ( x , y , angle ) : <EOL> r , theta = N . hypot ( x , y ) , N . arctan2 ( y , x ) <EOL> theta += angle <EOL> return r * ( N . cos ( theta ) , N . sin ( theta ) ) <EOL> def isoluminant ( rng , num_cycles = <NUM_LIT:1> , num_colors = <NUM_LIT> , reverse = False , ** traits ) : <EOL> """<STR_LIT>""" <EOL> window = N . sqrt ( <NUM_LIT> ) / <NUM_LIT> * N . bartlett ( num_colors ) <EOL> t = N . linspace ( N . sqrt ( <NUM_LIT> ) , <NUM_LIT:0.0> , num_colors ) <EOL> operand = ( t - N . sqrt ( <NUM_LIT> ) / <NUM_LIT> ) * num_cycles * <NUM_LIT> * N . pi / N . sqrt ( <NUM_LIT> ) <EOL> r0 = t <EOL> g0 = window * N . cos ( operand ) <EOL> b0 = window * N . sin ( operand ) <EOL> r1 , g1 = _rotate ( r0 , g0 , N . arcsin ( <NUM_LIT:1.0> / N . sqrt ( <NUM_LIT> ) ) ) <EOL> b1 = b0 <EOL> r2 , b2 = _rotate ( r1 , b1 , N . pi / <NUM_LIT> ) <EOL> g2 = g1 <EOL> r = r2 . clip ( <NUM_LIT:0.0> , <NUM_LIT:1.0> ) <EOL> g = g2 . clip ( <NUM_LIT:0.0> , <NUM_LIT:1.0> ) <EOL> b = b2 . clip ( <NUM_LIT:0.0> , <NUM_LIT:1.0> ) <EOL> the_map = N . vstack ( ( r , g , b ) ) . T <EOL> return ColorMapper . from_palette_array ( the_map [ : : - <NUM_LIT:1> if reverse else <NUM_LIT:1> ] , <EOL> range = rng , ** traits ) <EOL> def awesome ( rng , ** traits ) : <EOL> """<STR_LIT>""" <EOL> stream = pkg_resources . resource_stream ( __name__ , '<STR_LIT>' ) <EOL> return ColorMapper . from_palette_array ( N . loadtxt ( stream , delimiter = '<STR_LIT:U+002C>' ) , <EOL> range = rng , ** traits ) </s>
