def color_surface_cylinder(self, surf): self.writeMessageToLog("Color cylindrically") cc = Cylinder_Color() try: cmin, cmax = cc.value_range(surf.surfacePieces[0]) except: #keep for older version of chimera, e.g. v1.2509 vertices, triangles = surf.surfacePieces[0].geometry cmin, cmax = cc.value_range(vertices, vertex_xform=None) if cmin is None: cmin = 0 if cmax is None: cmax = 1.0 crange = cmax - cmin cc.origin = [0,0,0] self.writeMessageToLog("%.3f,%.3f"%(cmin,cmax)) if self.colors is None: ### green, yellow, orange data_values = (cmin, .625*crange+cmin, .75*crange+cmin, .875*crange+cmin, cmax) #key: red,green,blue,opacity #order: orange, yellow, green, cyan, blue colors = [(0.8,0.4,0.1,1), (0.8,0.8,0.1,1), (0.4,0.8,0.1,1), (0.1,0.8,0.1,1), (0.1,0.8,0.8,1)] else: ### set colors colors = self.getColors() data_values = (.125*crange+cmin, .5*crange+cmin, .875*crange+cmin) cc.colormap = Color_Map(data_values, colors) color_surface(surf, cc, caps_only = False, auto_update = False)
def color_surface_height(self, surf): self.writeMessageToLog("Color by height") hc = Height_Color() hc.origin = [0, 0, 0] try: hmin, hmax = hc.value_range(surf.surfacePieces[0]) except: #keep for older version of chimera, e.g. v1.2509 vertices, triangles = surf.surfacePieces[0].geometry hmin, hmax = hc.value_range(vertices, vertex_xform=None) hrange = hmax - hmin self.writeMessageToLog("%.3f,%.3f" % (hmin, hmax)) #key: red,green,blue,opacity if self.colors is None: ### red, white blue data_values = (.125 * hrange + hmin, .25 * hrange + hmin, .5 * hrange + hmin, .75 * hrange + hmin, .875 * hrange + hmin) colors = [(0.8, 0.2, 0.2, 1), (0.8, 0.5, 0.5, 1), (0.8, 0.8, 0.8, 1), (0.5, 0.5, 0.8, 1), (0.2, 0.2, 0.8, 1)] else: ### set colors colors = self.getColors() data_values = (.125 * hrange + hmin, .5 * hrange + hmin, .875 * hrange + hmin) hc.colormap = Color_Map(data_values, colors) color_surface(surf, hc, caps_only=False, auto_update=False)
def color_surface_radially(self, surf): self.writeMessageToLog("Color radially") rc = Radial_Color() rc.origin = [0, 0, 0] try: rmin, rmax = rc.value_range(surf.surfacePieces[0]) except: #keep for older version of chimera, e.g. v1.2509 vertices, triangles = surf.surfacePieces[0].geometry rmin, rmax = rc.value_range(vertices, vertex_xform=None) rrange = rmax - rmin self.writeMessageToLog("%.3f,%.3f" % (rmin, rmax)) #key: red,green,blue,opacity #order: red, yellow, green, cyan, blue if self.colors is None: data_values = (.5 * rmax, .625 * rmax, .75 * rmax, .875 * rmax, rmax) colors = [(0.9, 0.1, 0.1, 1), (0.9, 0.9, 0.1, 1), (0.1, 0.9, 0.1, 1), (0.1, 0.9, 0.9, 1), (0.1, 0.1, 0.9, 1)] else: ### set colors colors = self.getColors() data_values = (.125 * rrange + rmin, .5 * rrange + rmin, .875 * rrange + rmin) rc.colormap = Color_Map(data_values, colors) color_surface(surf, rc, caps_only=False, auto_update=False)
def color_surface_height(self, surf): self.writeMessageToLog("Color by height") hc = Height_Color() hc.origin = [0,0,0] try: hmin, hmax = hc.value_range(surf.surfacePieces[0]) except: #keep for older version of chimera, e.g. v1.2509 vertices, triangles = surf.surfacePieces[0].geometry hmin, hmax = hc.value_range(vertices, vertex_xform=None) hrange = hmax-hmin self.writeMessageToLog("%.3f,%.3f"%(hmin,hmax)) #key: red,green,blue,opacity if self.colors is None: ### red, white blue data_values = (.125*hrange+hmin, .25*hrange+hmin, .5*hrange+hmin, .75*hrange+hmin, .875*hrange+hmin) colors = [(0.8,0.2,0.2,1), (0.8,0.5,0.5,1), (0.8,0.8,0.8,1), (0.5,0.5,0.8,1), (0.2,0.2,0.8,1)] else: ### set colors colors = self.getColors() data_values = (.125*hrange+hmin, .5*hrange+hmin, .875*hrange+hmin) hc.colormap = Color_Map(data_values, colors) color_surface(surf, hc, caps_only = False, auto_update = False)
def color_surface_radially(self, surf): self.writeMessageToLog("Color radially") rc = Radial_Color() rc.origin = [0,0,0] try: rmin, rmax = rc.value_range(surf.surfacePieces[0]) except: #keep for older version of chimera, e.g. v1.2509 vertices, triangles = surf.surfacePieces[0].geometry rmin, rmax = rc.value_range(vertices, vertex_xform=None) rrange = rmax-rmin self.writeMessageToLog("%.3f,%.3f"%(rmin,rmax)) #key: red,green,blue,opacity #order: red, yellow, green, cyan, blue if self.colors is None: data_values = (.5*rmax, .625*rmax, .75*rmax, .875*rmax, rmax) colors = [(0.9,0.1,0.1,1), (0.9,0.9,0.1,1), (0.1,0.9,0.1,1), (0.1,0.9,0.9,1), (0.1,0.1,0.9,1)] else: ### set colors colors = self.getColors() data_values = (.125*rrange+rmin, .5*rrange+rmin, .875*rrange+rmin) rc.colormap = Color_Map(data_values, colors) color_surface(surf, rc, caps_only = False, auto_update = False)