From a17b85cba808150cf1a9c845eb77138f7de05755 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 11 Sep 2013 08:15:05 +0000 Subject: [PATCH] deleted wrong colormap script, was there twice. correct one (modified recently by Philip) is called perceptualUniformColormap --- processing/post/uniformPerceptualColorMap.py | 92 -------------------- 1 file changed, 92 deletions(-) delete mode 100755 processing/post/uniformPerceptualColorMap.py diff --git a/processing/post/uniformPerceptualColorMap.py b/processing/post/uniformPerceptualColorMap.py deleted file mode 100755 index 4f0986e56..000000000 --- a/processing/post/uniformPerceptualColorMap.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python - -import math, string, sys -from damask import Color,Colormap -from optparse import OptionParser, Option - -# ----------------------------- -class extendableOption(Option): -# ----------------------------- -# used for definition of new option parser action 'extend', which enables to take multiple option arguments -# taken from online tutorial http://docs.python.org/library/optparse.html - - ACTIONS = Option.ACTIONS + ("extend",) - STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",) - TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",) - ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",) - - def take_action(self, action, dest, opt, value, values, parser): - if action == "extend": - lvalue = value.split(",") - values.ensure_value(dest, []).extend(lvalue) - else: - Option.take_action(self, action, dest, opt, value, values, parser) - - - -# -------------------------------------------------------------------- - # MAIN -# -------------------------------------------------------------------- - -parser = OptionParser(option_class=extendableOption, usage='%prog options [file]', description = """ -Generate uniform perceptual colormap. - -""" + string.replace('$Id$','\n','\\n') -) - -parser.add_option('-l','--left', dest='left', type='float', nargs=3, \ - help='left color [%default]') -parser.add_option('-r','--right', dest='right', type='float', nargs=3, \ - help='right color [%default]') -parser.add_option('-c','--colormodel', dest='colormodel', \ - help='colormodel of left and right "RGB","HSL","XYZ","CIELAB","MSH" [%default]') -parser.add_option('-f','--format', dest='format', \ - help='output file format "paraview","gmsh","raw" [%default]') -parser.add_option('-s','--steps', dest='steps', type='int', nargs = 1, \ - help='no of interpolation steps [%default]') -parser.add_option('-t','--trim', dest='trim', type='float', nargs = 2, \ - help='trim the colormap w.r.t the given values [%default]') - -parser.set_defaults(colormodel = 'RGB') -parser.set_defaults(format = 'paraview') -parser.set_defaults(steps = 10) -parser.set_defaults(trim = [-1.0,1.0]) -parser.set_defaults(left = [1.0,1.0,1.0]) -parser.set_defaults(right = [0.0,0.0,0.0]) -(options,filenames) = parser.parse_args() - - - -# ----------------------------------------------------------------------------------------------------- - -leftColor = Color(options.colormodel.upper(),list(options.left)) -rightColor = Color(options.colormodel.upper(),list(options.right)) - -myColormap = Colormap(leftColor,rightColor) - - -if filenames == []: - outFile = sys.stdout - outColormap = myColormap.export('uniform perceptual colormap',options.format.lower(),options.steps,list(options.trim)) -else: - outColormap = myColormap.export(filenames[0],options.format.lower(),options.steps,list(options.trim)) - if options.format.lower() == 'paraview': - if filenames[0].endswith('.xml'): - outFile = open('%s'%filenames[0],'w') - else: - outFile = open('%s.xml'%filenames[0],'w') - - elif options.format.lower() == 'gmsh': - if filenames[0].endswith('.msh'): - outFile = open('%s'%filenames[0],'w') - else: - outFile = open('%s.msh'%filenames[0],'w') - - elif options.format.lower() == 'raw': - if filenames[0].endswith('.txt'): - outFile = open('%s'%filenames[0],'w') - else: - outFile = open('%s.txt'%filenames[0],'w') - -outFile.write(outColormap) -outFile.close() \ No newline at end of file