/[escript]/trunk/doc/examples/pyvisi/movie.py
ViewVC logotype

Contents of /trunk/doc/examples/pyvisi/movie.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (show annotations)
Thu Sep 25 23:11:13 2008 UTC (10 years, 5 months ago) by ksteube
File MIME type: text/x-python
File size: 2610 byte(s)
Copyright updated in all files

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
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 __url__="http://www.uq.edu.au/esscc/escript-finley"
21
22 """
23 Author: John Ngui, john.ngui@uq.edu.au
24 """
25
26 # Import the necessary modules.
27 from esys.pyvisi import Scene, DataCollector, Map, Camera, Velocity, Legend
28 from esys.pyvisi import Movie, LocalPosition
29 from esys.pyvisi.constant import *
30 import os
31
32 PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
33 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
34 X_SIZE = 800
35 Y_SIZE = 800
36
37 SCALAR_FIELD_POINT_DATA = "temp"
38 FILE_2D = "tempvel-"
39 IMAGE_NAME = "movie"
40 JPG_RENDERER = Renderer.ONLINE_JPG
41
42 # Create a Scene.
43 s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
44 y_size = Y_SIZE)
45
46 # Create a DataCollector reading from a XML file.
47 dc1 = DataCollector(source = Source.XML)
48 dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA)
49
50 # Create a Map.
51 m1 = Map(scene = s, data_collector = dc1,
52 viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
53 outline = True)
54
55 # Create a Camera.
56 cam1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
57
58 # Create a movie.
59 mov = Movie()
60 #lst = []
61
62 # Read in one file one after another and render the object.
63 for i in range(938, 949):
64 dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
65 FILE_2D + "%06d.vtu") % i)
66
67 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, \
68 IMAGE_NAME + "%06d.jpg") % i)
69
70 #lst.append(IMAGE_NAME + "%06d.jpg" % i)
71
72 # Images (first and last inclusive) from which the movie is to be generated.
73 mov.imageRange(input_directory = PYVISI_EXAMPLE_IMAGES_PATH,
74 first_image = IMAGE_NAME + "000938.jpg",
75 last_image = IMAGE_NAME + "000948.jpg")
76
77 # Alternatively, a list of images can be specified.
78 #mov.imageList(input_directory = PYVISI_EXAMPLE_IMAGES_PATH, image_list = lst)
79
80 # Generate the movie.
81 mov.makeMovie(os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "movie.mpg"))
82

  ViewVC Help
Powered by ViewVC 1.1.26