From b018934b45eaf53c038c69b10cd1becd7727754f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 16 Jan 2013 18:45:10 +0000 Subject: [PATCH] simplified code, added functionality to export raw list --- lib/damask/colormaps.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/damask/colormaps.py b/lib/damask/colormaps.py index e47e75b4b..0a9bba16c 100644 --- a/lib/damask/colormaps.py +++ b/lib/damask/colormaps.py @@ -63,7 +63,6 @@ class Color(): return self # ------------------------------------------------------------------ def asModel(self,toModel = 'RGB'): - print self.__class__(self.model,self.color) return self.__class__(self.model,self.color).to(toModel) # ------------------------------------------------------------------ # convert H(ue) S(aturation) L(uminance) to R(red) G(reen) B(lue) @@ -375,12 +374,9 @@ class Colormap(): RGB_Matrix.append(color.color) RGB_Matrix_cropped = croppedVector(RGB_Matrix) - if format.lower() == 'paraview': - colormap = write_paraview(RGB_Matrix_cropped) - if format.lower() == 'gmsh': - colormap = write_gmsh(RGB_Matrix_cropped) - if format.lower() == 'raw': - colormap = write_raw(RGB_Matrix_cropped) - colormapStr = str(colormap) - - return colormapStr \ No newline at end of file + return {\ + 'paraview': write_paraview, + 'gmsh': write_gmsh, + 'raw': write_raw, + 'list': lambda x: x, + }[format.lower()](RGB_Matrix_cropped)