File: slice_demo2.py

package info (click to toggle)
scitools 0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 17,252 kB
  • ctags: 2,871
  • sloc: python: 28,744; sh: 112; makefile: 15
file content (68 lines) | stat: -rwxr-xr-x 1,414 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python

# Example taken from:
# http://www.mathworks.com/access/helpdesk/help/techdoc/visualize/f5-3558.html

from scitools.easyviz import *
from time import sleep

# Investigate the Data:
x,y,z,v = flow()

xmin = arrmin(x)
ymin = arrmin(y) 
zmin = arrmin(z)

xmax = arrmax(x) 
ymax = arrmax(y) 
zmax = arrmax(z)

setp(interactive=False)

# Create a Slice Plane at an Angle to the X-Axes:
hslice = surf(linspace(xmin,xmax,100),
              linspace(ymin,ymax,100),
              zeros((100,100)))

#rotate(hslice,[-1,0,0],-45)
xd = hslice.getp('xdata')
yd = hslice.getp('ydata')
zd = hslice.getp('zdata')
#delete(hslice)

# Draw the Slice Planes:
#h = slice_(x,y,z,v,xd,yd,zd)
h = slice_(x,y,z,v,[],[],0)
h.setp(diffuse=.8)
#h.set('FaceColor','interp',
#      'EdgeColor','none',
#      'DiffuseStrength',.8)

hold('on')
#hx = slice_(x,y,z,v,xmax,[],[])
hx = slice_(x,y,z,v,xmax-0.001,[],[])
#set(hx,'FaceColor','interp','EdgeColor','none')

hy = slice_(x,y,z,v,[],ymax,[])
#set(hy,'FaceColor','interp','EdgeColor','none')

#hz = slice_(x,y,z,v,[],[],zmin)
hz = slice_(x,y,z,v,[],[],zmin+0.001)
#set(hz,'FaceColor','interp','EdgeColor','none')

# Define the View:
daspect([1,1,1])
box('on')
grid('off')
view(-38.5,16)
#camzoom(1.4)
camproj('perspective')

# Add Lighting and Specify Colors:
shading('interp')
#colormap(jet(24))
#lightangle(-45,45)

show()

raw_input("Press Return key to quit: ")