1
# Copyright (c) 1996, 1997, The Regents of the University of California.
2
# All rights reserved. See Legal.htm for full text and disclaimer.
5
from scipy_base.fastumath import *
12
i = raw_input ("Type in any string to continue; ^C to return to prompt. ")
15
print "This is a test of the Python interface to the Limeil Lab graphics"
16
print "package, Narcisse. You need Narcisse to be running. Fire it up by"
17
print "doing setenv PORT_SERVEUR 0, typing /dist/basis/Narcisse/bin/Narcisse &,"
18
print "and then do another senetv PORT_SERVEUR to the port number which"
19
print "appears in the Narcisse GUI."
28
# The following computations define an interesting 3d surface.
31
arange (1, kmax + 1, typecode = Float), ones (lmax, Float))
33
ones (kmax, Float), arange (1, lmax + 1, typecode = Float))
34
zt = 5. + xr + .2 * rand (kmax, lmax) # ranf (xr)
35
rt = 100. + yr + .2 * rand (kmax, lmax) # ranf (yr)
37
z = z + .02 * z * rand (kmax, lmax) # ranf (z)
38
ut = rt/sqrt (rt ** 2 + zt ** 2)
39
vt = zt/sqrt (rt ** 2 + zt ** 2)
40
ireg = multiply.outer ( ones (kmax), ones (lmax))
44
ireg [1:15, 12:lmax]=3
46
freg=ireg + .2 * (1. - rand (kmax, lmax)) # ranf (ireg))
47
freg=array (freg, Float)
48
#rt [4:6, 4:6] = -1.e8
49
z [3:10, 3:12] = z [3:10, 3:12] * .9
50
z [5, 5] = z [5, 5] * .9
51
z [17:22, 15:18] = z [17:22, 15:18] * 1.2
52
z [16, 16] = z [16, 16] * 1.1
54
s1 = Surface (x = zt, y = rt, z = freg, mask = "max")
55
g1 = Graph3d (s1, titles = "Rotating mesh", theta = 45., phi = 5., roll = 0.0)
58
g1.quick_plot (roll = (i + 1) * 22.5)
60
g1.quick_plot (surface = 1, opt_3d = "i3", titles = ["(1) contour lines" ,
61
"Different options of viewing mesh"], text = "Region 2",
62
text_color = "black", text_size = 20, text_pos = [.20, .35])
64
g1.quick_plot (surface = 1, opt_3d = "s3", titles = ["(2) smooth coloring",
65
"Different options of viewing mesh"])
67
g1.quick_plot (surface = 1, opt_3d = "w3", titles = ["(3) colored mesh",
68
"Different options of viewing mesh"])
70
s2 = Surface (x = zt + vt, y = rt + vt, z = freg + ut,
71
mask = "sort", opt_3d = "w3")
72
g1 = Graph3d ( [s1, s2], connect = 1, text = " ", roll = 0.0,
73
titles = "Mesh follows velocity field one time step")
76
# The following is good but comment it out if you want to save time.
78
g1.quick_plot (titles = ["Mesh follows velocity field one time step",
79
"(Animation)"], phi = 5. + 10. * (i + 1))
82
g1.quick_plot (theta = 45. - 10. * (i + 1))