--- /home/sjplimp/oldpizza/src/raster.py 2005-09-07 10:13:09.000000000 -0600
+++ /home/sjplimp/pizza/src/raster.py 2005-09-14 09:56:58.000000000 -0600
@@ -22,6 +22,8 @@
r.trans(x,y) translate by x,y in view window (def = 0,0)
r.zoom(0.5) scale image by factor (def = 1)
r.box(0/1/2) 0/1/2 = none/variable/fixed box
+r.box(0/1/2,"green") set box color
+r.box(0/1/2,"red",4) set box edge thickness
r.file = "image" file prefix for created images (def = "image")
r.show(N) show image of snapshot at timestep N
@@ -69,19 +71,20 @@
by default, 100 types are assigned
if an atom/bond/tri has type > # defined properties, it becomes type = 1
-from vizinfo import colors add new color nickname
-colors["nickname"] = [R,G,B] RGB values from 0.0 to 1.0
+from vizinfo import colors access color list
+print colors list defined color names and RGB values
+colors["nickname"] = [R,G,B] set new RGB values from 0 to 255
- pre-defined colors are red, green, blue, purple, cyan, yellow, black, white
+ 140 pre-defined colors: red, green, blue, purple, yellow, black, white, etc
"""
# History
# 8/05, Steve Plimpton (SNL): original version
+# 9/05, Steve Plimpton (SNL): adjusted box and label attributes
# ToDo list
# when do aselect with select str while looping N times on same timestep
# would not let you grow # of atoms selected
-# need to allow color and radius for box lines
# Variables
# ztheta = vertical angle from z-azis to view from
@@ -91,11 +94,13 @@
# distance = characteristic size of simulation scene (largest dim)
# file = filename prefix to use for images produced
# boxflag = 0/1/2 for drawing simulation box: none/variable/fixed
-# eye = eye position in Raster3D header file (set to 50.0)
-# bg = color of background
+# bxcol = color of box
+# bxthick = thickness of box
+# bgcol = color of background
# amap = settings for atom types
# tmap = settings for triangle types
# bmap = settings for bond types
+# eye = eye position in Raster3D header file (set to 50.0)
# Imports and external programs
@@ -126,6 +131,8 @@
self.file = "image"
self.boxflag = 0
+ self.bxcol = [1,1,0]
+ self.bxthick = 0.3
self.bgcol = [0,0,0]
self.labels = []
self.panflag = 0
@@ -141,9 +148,10 @@
# --------------------------------------------------------------------
- def bg(self,bcolor):
+ def bg(self,color):
from vizinfo import colors
- self.bgcol = colors[bcolor]
+ self.bgcol = [colors[color][0]/255.0,colors[color][1]/255.0,
+ colors[color][2]/255.0]
# --------------------------------------------------------------------
@@ -176,14 +184,22 @@
# --------------------------------------------------------------------
- def box(self,n):
- self.boxflag = n
+ def box(self,*args):
+ self.boxflag = args[0]
+ if len(args) > 1:
+ from vizinfo import colors
+ self.bxcol = [colors[args[1]][0]/255.0,colors[args[1]][1]/255.0,
+ colors[args[1]][2]/255.0]
+ if len(args) > 2: self.bxthick = args[2]
# --------------------------------------------------------------------
-
+ # scale down point-size by 3x
+
def label(self,x,y,font,point,color,text):
from vizinfo import colors
- list = [x,y,fontlist[font],point,"Left",colors[color],text]
+ scaledcolor = [colors[color][0]/255.0,colors[color][1]/255.0,
+ colors[color][2]/255.0]
+ list = [x,y,fontlist[font],point/3.0,"Left",scaledcolor,text]
self.labels.append(list)
# --------------------------------------------------------------------
@@ -355,7 +371,7 @@
self.ztrans,1.6*self.distance/self.scale)
print >>f,header,
- if self.boxflag: box_write(f,box)
+ if self.boxflag: box_write(f,box,self.bxcol,self.bxthick)
ncolor = self.vizinfo.nacolor
for atom in atoms:
@@ -460,36 +476,39 @@
# --------------------------------------------------------------------
# draw a 12-edge box around simulation domain
-def box_write(f,box):
+def box_write(f,box,color,thick):
xlo,ylo,zlo = box[0],box[1],box[2]
xhi,yhi,zhi = box[3],box[4],box[5]
-
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xlo,ylo,zlo,xhi,ylo,zlo)
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xlo,yhi,zlo,xhi,yhi,zlo)
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xlo,ylo,zhi,xhi,ylo,zhi)
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xlo,yhi,zhi,xhi,yhi,zhi)
-
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xlo,ylo,zlo,xlo,yhi,zlo)
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xhi,ylo,zlo,xhi,yhi,zlo)
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xlo,ylo,zhi,xlo,yhi,zhi)
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xhi,ylo,zhi,xhi,yhi,zhi)
-
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xlo,ylo,zlo,xlo,ylo,zhi)
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xhi,ylo,zlo,xhi,ylo,zhi)
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xlo,yhi,zlo,xlo,yhi,zhi)
- print >>f,"3\n%g %g %g 0.3 %g %g %g 0.3 0.8 0.8 0.0" % \
- (xhi,yhi,zlo,xhi,yhi,zhi)
+ red = color[0]
+ green = color[1]
+ blue = color[2]
+
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xlo,ylo,zlo,thick,xhi,ylo,zlo,thick,red,green,blue)
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xlo,yhi,zlo,thick,xhi,yhi,zlo,thick,red,green,blue)
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xlo,ylo,zhi,thick,xhi,ylo,zhi,thick,red,green,blue)
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xlo,yhi,zhi,thick,xhi,yhi,zhi,thick,red,green,blue)
+
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xlo,ylo,zlo,thick,xlo,yhi,zlo,thick,red,green,blue)
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xhi,ylo,zlo,thick,xhi,yhi,zlo,thick,red,green,blue)
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xlo,ylo,zhi,thick,xlo,yhi,zhi,thick,red,green,blue)
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xhi,ylo,zhi,thick,xhi,yhi,zhi,thick,red,green,blue)
+
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xlo,ylo,zlo,thick,xlo,ylo,zhi,thick,red,green,blue)
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xhi,ylo,zlo,thick,xhi,ylo,zhi,thick,red,green,blue)
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xlo,yhi,zlo,thick,xlo,yhi,zhi,thick,red,green,blue)
+ print >>f,"3\n%g %g %g %g %g %g %g %g %g %g %g" % \
+ (xhi,yhi,zlo,thick,xhi,yhi,zhi,thick,red,green,blue)
# --------------------------------------------------------------------
# compute 3x3 rotation matrix for viewing angle
--- /home/sjplimp/oldpizza/src/svg.py 2005-09-14 10:01:11.000000000 -0600
+++ /home/sjplimp/pizza/src/svg.py 2005-09-14 09:57:12.000000000 -0600
@@ -22,6 +22,8 @@
s.trans(x,y) translate by x,y in view window (def = 0,0)
s.zoom(0.5) scale image by factor (def = 1)
s.box(0/1/2) 0/1/2 = none/variable/fixed box
+s.box(0/1/2,"green") set box color
+s.box(0/1/2,"red",4) set box edge thickness
s.file = "image" file prefix for created images (def = "image")
s.thick = 2.0 pixel thickness of black atom border
@@ -69,23 +71,23 @@
by default, 100 types are assigned
if an atom/bond/tri has type > # defined properties, it becomes type = 1
-
-from vizinfo import colors add new color nickname
-colors["nickname"] = [R,G,B] RGB values from 0.0 to 1.0
- pre-defined colors are red, green, blue, purple, cyan, yellow, black, white
+from vizinfo import colors access color list
+print colors list defined color names and RGB values
+colors["nickname"] = [R,G,B] set new RGB values from 0 to 255
+
+ 140 pre-defined colors: red, green, blue, purple, yellow, black, white, etc
"""
# History
# 8/05, Matt Jones (BYU): original version
+# 9/05, Steve Plimpton: adjusted box and label attributes
# ToDo list
# when do aselect with select str while looping N times on same timestep
# would not let you grow # of atoms selected
# box draw overlays all atoms, needs to be z-clipped
# might have to draw as segments and include segments in z-sort
-# labels are not using colors from color table
-# need to allow color and radius for box lines
# Variables
# ztheta = vertical angle from z-azis to view from
@@ -95,7 +97,9 @@
# distance = characteristic size of simulation scene (largest dim)
# file = filename prefix to use for images produced
# boxflag = 0/1/2 for drawing simulation box: none/variable/fixed
-# bg = color of background
+# bxcol = color of box
+# bxthick = thickness of box
+# bgcol = color of background
# amap = settings for atom types
# tmap = settings for triangle types
# bmap = settings for bond types
@@ -124,6 +128,8 @@
self.file = "image"
self.boxflag = 0
+ self.bxcol = [1,1,0]
+ self.bxthick = 0.3
self.bgcol = [0,0,0]
self.labels = []
self.panflag = 0
@@ -140,9 +146,10 @@
# --------------------------------------------------------------------
- def bg(self,bcolor):
+ def bg(self,color):
from vizinfo import colors
- self.bgcol = colors[bcolor]
+ self.bgcol = [colors[color][0]/255.0,colors[color][1]/255.0,
+ colors[color][2]/255.0]
# --------------------------------------------------------------------
@@ -165,8 +172,13 @@
# --------------------------------------------------------------------
- def box(self,flag):
- self.boxflag = flag
+ def box(self,*args):
+ self.boxflag = args[0]
+ if len(args) > 1:
+ from vizinfo import colors
+ self.bxcol = [colors[args[1]][0]/255.0,colors[args[1]][1]/255.0,
+ colors[args[1]][2]/255.0]
+ if len(args) > 2: self.bxthick = args[2]
# --------------------------------------------------------------------
@@ -305,9 +317,11 @@
# --------------------------------------------------------------------
- def label(self,x,y,font,size,color,text):
- list = [((x*self.max_x)+(self.max_x/2.0)),
- ((self.max_y/2.0)-(y*self.max_y)),font,size,color,text]
+ def label(self,x,y,font,point,color,text):
+ from vizinfo import colors
+ scaledcolor = [colors[color][0]/255.0,colors[color][1]/255.0,
+ colors[color][2]/255.0]
+ list = [x,y,fontlist[font],point,scaledcolor,text]
self.labels.append(list)
# --------------------------------------------------------------------
@@ -519,15 +533,20 @@
color[0]*255,color[1]*255,color[2]*255)
elif flag == 1:
- for label in self.labels:
- print >>f,'
Colors are specified with a string, e.g. "red". The 8 pre-defined -colors are listed below. Additional colors can be defined by -importing from the vizinfo module and assigning a nickname to an RGB +
Colors are specified with a string, e.g. "red". There are 140 +pre-defined colors from this WWW page which can be +examined by importing the "colors" variable from "vizinfo". New +colors can be defined by assigning a nickname of your choice to an RGB triplet, as described below.
+ +Usage:
r = raster(d) create Raster3d wrapper for data in d @@ -79,6 +82,8 @@ r.trans(x,y) translate by x,y in view window (def = 0,0) r.zoom(0.5) scale image by factor (def = 1) r.box(0/1/2) 0/1/2 = none/variable/fixed box +r.box(0/1/2,"green") set box color +r.box(0/1/2,"red",4) set box edge thickness r.file = "image" file prefix for created images (def = "image")
r.show(N) show image of snapshot at timestep N @@ -126,10 +131,11 @@by default, 100 types are assigned if an atom/bond/tri has type > # defined properties, it becomes type = 1-from vizinfo import colors add new color nickname -colors["nickname"] = [R,G,B] RGB values from 0.0 to 1.0 +from vizinfo import colors access color list +print colors list defined color names and RGB values +colors["nickname"] = [R,G,B] set new RGB values from 0 to 255-pre-defined colors are red, green, blue, purple, cyan, yellow, black, white +140 pre-defined colors: red, green, blue, purple, yellow, black, white, etcRelated tools:
--- /home/sjplimp/oldpizza/doc/svg.txt 2005-09-14 10:01:11.000000000 -0600 +++ /home/sjplimp/pizza/doc/svg.txt 2005-09-14 09:56:16.000000000 -0600 @@ -56,11 +56,14 @@ setting. Thus displayed colors can be keyed to atom velocity or other properties. -Colors are specified with a string, e.g. "red". The 8 pre-defined -colors are listed below. Additional colors can be defined by -importing from the vizinfo module and assigning a nickname to an RGB +Colors are specified with a string, e.g. "red". There are 140 +pre-defined colors from "this WWW page"_colortable which can be +examined by importing the "colors" variable from "vizinfo". New +colors can be defined by assigning a nickname of your choice to an RGB triplet, as described below. +:link(colortable,http://www.oreilly.com/catalog/wdnut/excerpt/color_names.html) + [Usage:] s = svg(d) create SVG object for data in d :pre @@ -74,6 +77,8 @@ s.trans(x,y) translate by x,y in view window (def = 0,0) s.zoom(0.5) scale image by factor (def = 1) s.box(0/1/2) 0/1/2 = none/variable/fixed box +s.box(0/1/2,"green") set box color +s.box(0/1/2,"red",4) set box edge thickness s.file = "image" file prefix for created images (def = "image") s.thick = 2.0 pixel thickness of black atom border :pre @@ -122,10 +127,11 @@ by default, 100 types are assigned if an atom/bond/tri has type > # defined properties, it becomes type = 1 :pre -from vizinfo import colors add new color nickname -colors\["nickname"\] = \[R,G,B\] RGB values from 0.0 to 1.0 :pre +from vizinfo import colors access color list +print colors list defined color names and RGB values +colors\["nickname"\] = \[R,G,B\] set new RGB values from 0 to 255 :pre - pre-defined colors are red, green, blue, purple, cyan, yellow, black, white :pre + 140 pre-defined colors: red, green, blue, purple, yellow, black, white, etc :pre [Related tools:] --- /home/sjplimp/oldpizza/doc/svg.html 2005-09-14 10:01:11.000000000 -0600 +++ /home/sjplimp/pizza/doc/svg.html 2005-09-14 09:56:26.000000000 -0600 @@ -59,11 +59,14 @@ setting. Thus displayed colors can be keyed to atom velocity or other properties. -Colors are specified with a string, e.g. "red". The 8 pre-defined -colors are listed below. Additional colors can be defined by -importing from the vizinfo module and assigning a nickname to an RGB +
Colors are specified with a string, e.g. "red". There are 140 +pre-defined colors from this WWW page which can be +examined by importing the "colors" variable from "vizinfo". New +colors can be defined by assigning a nickname of your choice to an RGB triplet, as described below.
+ +Usage:
s = svg(d) create SVG object for data in d @@ -77,6 +80,8 @@ s.trans(x,y) translate by x,y in view window (def = 0,0) s.zoom(0.5) scale image by factor (def = 1) s.box(0/1/2) 0/1/2 = none/variable/fixed box +s.box(0/1/2,"green") set box color +s.box(0/1/2,"red",4) set box edge thickness s.file = "image" file prefix for created images (def = "image") s.thick = 2.0 pixel thickness of black atom border@@ -125,10 +130,11 @@by default, 100 types are assigned if an atom/bond/tri has type > # defined properties, it becomes type = 1-from vizinfo import colors add new color nickname -colors["nickname"] = [R,G,B] RGB values from 0.0 to 1.0 +from vizinfo import colors access color list +print colors list defined color names and RGB values +colors["nickname"] = [R,G,B] set new RGB values from 0 to 255-pre-defined colors are red, green, blue, purple, cyan, yellow, black, white +140 pre-defined colors: red, green, blue, purple, yellow, black, white, etcRelated tools:
--- /home/sjplimp/oldpizza/examples/test_raster.py 2005-09-07 10:13:10.000000000 -0600 +++ /home/sjplimp/pizza/examples/test_raster.py 2005-09-14 09:42:15.000000000 -0600 @@ -16,11 +16,11 @@ a1 = animate("tmp0*png") from vizinfo import colors -colors["gray"] = [0.5,0.5,0.5] r.acol([1,4,6,8,9],["gray","red","blue","green","yellow"]) r.arad(range(9),0.3) -r.label(0.2,0.4,'h',15,"red","test label") +r.label(0.2,0.4,'h',15,"red","test label #1") +r.label(-0.2,-0.4,'h',15,"yellow","test label #2") print "kill image window when ready to contine ..." r.show(0) --- /home/sjplimp/oldpizza/examples/test_svg.py 2005-09-07 10:13:10.000000000 -0600 +++ /home/sjplimp/pizza/examples/test_svg.py 2005-09-14 09:50:03.000000000 -0600 @@ -15,11 +15,11 @@ s.all() from vizinfo import colors -colors["gray"] = [0.5,0.5,0.5] s.acol([1,4,6,8,9],["gray","red","blue","green","yellow"]) s.arad(range(9),0.3) -s.label(0.2,0.4,'h',15,"red","test label") +s.label(0.2,0.4,'h',15,"red","test label #1") +s.label(-0.2,-0.4,'h',15,"yellow","test label #2") print "kill image window when ready to contine ..." s.show(0)