/[escript]/trunk/pyvisi_old/examples/seismicOffsetPlot1.py
ViewVC logotype

Contents of /trunk/pyvisi_old/examples/seismicOffsetPlot1.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 786 - (show annotations)
Tue Jul 25 04:58:05 2006 UTC (13 years, 1 month ago) by gross
File MIME type: text/x-python
File size: 2667 byte(s)
switched off pyvisi
1 # $Id: seismicOffsetPlot1.py,v 1.3 2005/11/08 08:23:45 paultcochrane Exp $
2 """
3 Example of plotting multiple curves offset from each other with pyvisi
4
5 This is an example with simulated seismic data
6
7 @var __author__: name of author
8 @var __license__: licence agreement
9 @var __copyright__: copyrights
10 @var __url__: url entry point on documentation
11 @var __version__: version
12 @var __date__: date of the version
13 """
14
15 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
16 http://www.access.edu.au
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __author__="Paul Cochrane"
21 __url__="http://www.iservo.edu.au/esys"
22 __version__="$Revision$"
23 __date__="$Date$"
24
25
26 import sys
27 numArgs = len(sys.argv)
28 if numArgs == 1:
29 ren_mod = "vtk"
30 else:
31 ren_mod = sys.argv[1]
32
33 # set up some data to plot
34 from Numeric import *
35
36 # read in the data (being fortunate we know how much data there is)
37 fp = open('waves.dat')
38 t = zeros((100), typecode=Float)
39 x = zeros((13), typecode=Float)
40 data = zeros((100,13), typecode=Float)
41 for i in range(100):
42 for j in range(13):
43 line = fp.readline()
44 arr = line.split()
45 t[i] = float(arr[0])
46 x[j] = float(arr[1])
47 data[i,j] = float(arr[2])
48 fp.close()
49
50 # example code for how a user would write a script in pyvisi
51 from esys.pyvisi import * # base level visualisation stuff
52 #from esys.pyvisi.utils import * # pyvisi specific utils
53 # import the objects to render the scene using the specific renderer
54 if ren_mod == "gnuplot":
55 from esys.pyvisi.renderers.gnuplot import * # gnuplot
56 elif ren_mod == "vtk":
57 from esys.pyvisi.renderers.vtk import * # vtk
58 else:
59 raise ValueError, "Unknown renderer module"
60
61 # define the scene object
62 # a Scene is a container for all of the kinds of things you want to put
63 # into your plot for instance, images, meshes, arrow/vector/quiver plots,
64 # contour plots, spheres etc.
65 scene = Scene()
66
67 # create a LinePlot object
68 plot = LinePlot(scene)
69
70 # add some helpful info to the plot
71 plot.title = 'Sample seismic data'
72 plot.xlabel = 't'
73 plot.ylabel = 'y'
74
75 plot.linestyle = 'lines'
76
77 # assign some data to the plot
78 plot.setData(t, data[:,0], data[:,1], data[:,2], data[:,3],
79 data[:,4], data[:,5], data[:,6], data[:,7], data[:,8],
80 data[:,9], data[:,10], data[:,11], data[:,12], offset=True)
81
82 # render the scene to screen
83 scene.render(pause=True, interactive=True)
84
85 # save the scene to file
86 scene.save(fname="seismicOffsetPlot1.png", format=PngImage())
87
88 # vim: expandtab shiftwidth=4:
89

  ViewVC Help
Powered by ViewVC 1.1.26