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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 786 - (show annotations)
Tue Jul 25 04:58:05 2006 UTC (13 years, 2 months ago) by gross
File MIME type: text/x-python
File size: 2910 byte(s)
switched off pyvisi
1 # $Id: seismicOffsetPlotExample3.py,v 1.2 2005/03/22 06:22:36 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 and makes use of the x data.
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 # set up some data to plot
28 from Numeric import *
29
30 # read in the data (being fortunate we know how much data there is)
31 fp = open('waves1d.dat')
32 t = zeros((1000), typecode=Float)
33 x = zeros((102), typecode=Float)
34 data = zeros((1000,102), typecode=Float)
35 for i in range(1000):
36 for j in range(102):
37 line = fp.readline()
38 arr = line.split()
39 t[i] = float(arr[0])
40 x[j] = float(arr[1])
41 data[i,j] = float(arr[2])
42 fp.close()
43
44 # example code for how a user would write a script in pyvisi
45 from esys.pyvisi import * # base level visualisation stuff
46 # import the objects to render the scene using the specific renderer
47 from esys.pyvisi.renderers.gnuplot import * # gnuplot
48 #from esys.pyvisi.renderers.vtk import * # vtk
49
50 # define the scene object
51 # a Scene is a container for all of the kinds of things you want to put
52 # into your plot for instance, images, meshes, arrow/vector/quiver plots,
53 # contour plots, spheres etc.
54 scene = Scene()
55
56 # create an OffsetPlot object
57 plot = OffsetPlot(scene)
58
59 # add some helpful info to the plot
60 plot.title = 'Sample seismic data - waves1d.dat, using x and t data'
61 plot.xlabel = 't'
62 plot.ylabel = 'x'
63
64 # assign some data to the plot
65 plot.setData(t, x, data)
66
67 # render the scene to screen
68 scene.render(pause=True, interactive=True)
69
70 # save the scene to file
71 # save as png
72 plot.setData(t, x, data)
73 # have to do this now because we've already
74 # render()ed the scene. This requirement
75 # will be removed in the future.
76 scene.save(fname="seismicOffsetPlotExample3.png", format=PngImage())
77
78 # save as postscript
79 plot.setData(t, x, data)
80 # have to do this now because we've already
81 # save()d the scene. This requirement will
82 # be removed in the future.
83 scene.save(fname="seismicOffsetPlotExample3.ps", format=PsImage())
84
85 # vim: expandtab shiftwidth=4:

  ViewVC Help
Powered by ViewVC 1.1.26