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_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)