File: slice_demo1.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 (20 lines) | stat: -rwxr-xr-x 524 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
#!/usr/bin/env python

# Example taken from:
# http://www.mathworks.com/access/helpdesk/help/techdoc/ref/slice.html

from scitools.easyviz import *
from time import sleep

BUG = 0.0001 # bug somewhere in _add_slice in vtk_.py
x,y,z = ndgrid(seq(-2,2,.2),seq(-2,2,.25),seq(-2,2,.16),sparse=True)
v = x*exp(-x**2-y**2-z**2)
xslice = [-1.2,.8,2-BUG]
yslice = 2
zslice = [-2+BUG,0]
slice_(x,y,z,v,xslice,yslice,zslice,grid='off')

#hardcopy('tmp_slice1.eps')
#hardcopy('tmp_slice1.png')

raw_input('Press Return key to quit: ')