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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.26