use predefined maps in damask.Colormap class; no need for a colorMap config file anymore

This commit is contained in:
Christoph Kords 2013-05-28 14:18:21 +00:00
parent 7c42facfe0
commit 10a32dc17b
2 changed files with 12 additions and 26 deletions

View File

@ -1,10 +0,0 @@
# name|synonym H,S,L H,S,L
gray|grey 0.00000,1.00,1.00 0.00000,0.00,0.15
red 0.0,1.0,0.14 0.0,0.35,0.91
green 0.33333,1.0,0.140 0.33333,0.35,0.91
blue 0.66,1.0,0.14 0.66,0.35,0.91
seaweed 0.78000,1.0,0.1 0.40000,0.1,0.9
bluebrown 0.65,0.53,0.49 0.11,0.75,0.38
redgreen 0.97,0.96,0.36 0.33333,1.0,0.14
redblue 0.97,0.96,0.36 0.65,0.53,0.49
bluered 0.65,0.53,0.49 0.97,0.96,0.36

View File

@ -102,9 +102,6 @@ parser.add_option("-b", "--baseindex", type = "int",\
parser.add_option("-n", "--colorcount", type = "int",\
dest = "colorcount",\
help = "number of colors [%default]")
parser.add_option("-c", "--config", type='string', \
dest = "config",\
help = "configuration file [%default]")
parser.add_option("-v", "--verbose", action="store_true",\
dest = "verbose",\
help = "write Mentat command stream also to stdout [%default]")
@ -112,28 +109,27 @@ parser.add_option("-v", "--verbose", action="store_true",\
parser.set_defaults(port = 40007)
parser.set_defaults(baseIdx = 32)
parser.set_defaults(colorcount = 32)
parser.set_defaults(config = 'colorMap.config')
parser.set_defaults(inverse = False)
parser.set_defaults(palette = False)
parser.set_defaults(palettef = False)
parser.set_defaults(verbose = False)
msg = []
(options, colors) = parser.parse_args()
config = readConfig(options.config,sys.argv[0])
if len(colors) > 0 and colors[0] in config:
left = config[colors[0]][{True:'right',False:'left' }[options.inverse]]
right = config[colors[0]][{True:'left' ,False:'right'}[options.inverse]]
elif len(colors) == 2:
left = map(float, colors[{True:1,False:0}[options.inverse]].split(','))
right = map(float, colors[{True:0,False:1}[options.inverse]].split(','))
if len(colors) > 0 and colors[0] in damask.Colormap.__predefined__:
theMap = damask.Colormap().usePredefined(colors[0])
else:
left = {True:[0.0,0.0,0.0],False:[0.0,0.0,1.0]}[options.inverse]
right = {True:[0.0,0.0,1.0],False:[0.0,0.0,0.0]}[options.inverse]
theMap = damask.Colormap(damask.Color('HSL',left),damask.Color('HSL',right))
if len(colors) == 2:
left = map(float, colors[0].split(','))
right = map(float, colors[1].split(','))
else:
left = [0.0,0.0,1.0]
right = [0.0,0.0,0.0]
theMap = damask.Colormap(damask.Color('HSL',left),damask.Color('HSL',right))
if options.inverse:
theMap = theMap.invert()
theColors = theMap.export(format='list',steps=options.colorcount)
if options.palette or options.palettef: