/[escript]/trunk/doc/user/pyvisi.tex
ViewVC logotype

Diff of /trunk/doc/user/pyvisi.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1198 by jongui, Thu Jun 14 05:53:49 2007 UTC revision 1199 by jongui, Wed Jun 20 05:01:30 2007 UTC
# Line 6  Line 6 
6  \section{Introduction}  \section{Introduction}
7  \pyvisi is a Python module that is used to generate 2D and 3D visualization  \pyvisi is a Python module that is used to generate 2D and 3D visualization
8  for escript and its PDE solvers: finley and bruce. This module provides  for escript and its PDE solvers: finley and bruce. This module provides
9  an easy to use interface to the \VTK library (\VTKUrl). There are three  an easy to use interface to the \VTK library (\VTKUrl). Pyvisi can be used to
10    render (generate) surface maps and contours for scalar fields, arrows and
11    streamlines for vector fields, and ellipsoids for tensor fields.  
12    There are three
13  approaches for rendering an object. (1) Online - object is rendered on-screen  approaches for rendering an object. (1) Online - object is rendered on-screen
14  with interaction capability (i.e. zoom and rotate), (2) Offline - object is  with interaction capability (i.e. zoom and rotate), (2) Offline - object is
15  rendered off-screen (no pop-up window) and (3) Display - object is rendered  rendered off-screen (no pop-up window) and (3) Display - object is rendered
16  on-screen but with no interaction capability (able to produce on-the-fly  on-screen but with no interaction capability (on-the-fly
17  animation). All three approaches have the option to save the rendered object  animation). All three approaches have the option to save the rendered object
18  as an image (i.e. jpg).  as an image (i.e. jpg).
19    
20  The following outlines the general guidelines when using Pyvisi:  The following outlines the general steps to use Pyvisi:
21    
22  \begin{enumerate}  \begin{enumerate}
23  \item Create a \Scene instance, a window in which objects are to be rendered on.  \item Create a \Scene instance - a window in which objects are to be
24  \item Create a data input instance (i.e. \DataCollector or \ImageReader), which  rendered on.
25    \item Create a data input instance (i.e. \DataCollector or \ImageReader) -
26  reads and loads the source data for visualization.  reads and loads the source data for visualization.
27  \item Create a data visualization instance (i.e. \Map, \Velocity, \Ellipsoid,  \item Create a data visualization instance (i.e. \Map, \Velocity, \Ellipsoid,
28  \Contour, \Carpet, \StreamLine or \Image), which proccesses and manipulates the  \Contour, \Carpet, \StreamLine or \Image) -  proccesses and manipulates
29  source data.  the source data.
30  \item Create a \Camera or \Light instance, which controls the viewing angle and  \item Create a \Camera or \Light instance - controls the viewing angle and
31  lighting effects.  lighting effects.
32  \item Render the object using either the Online, Offline or Display approach.  \item Render the object - using either the Online, Offline or Display approach.
33  \end{enumerate}  \end{enumerate}
34  \begin{center}  \begin{center}
35  \begin{math}  \begin{math}
36  scene \rightarrow data \; input \rightarrow data \; visualization \rightarrow  scene \rightarrow data \; input \rightarrow data \; visualization \rightarrow
37  camer \, / \, light \rightarrow render  camera \, / \, light \rightarrow render
38  \end{math}  \end{math}
39  \end{center}  \end{center}
40    
# Line 149  elevation and azimuth. Line 153  elevation and azimuth.
153    
154    
155  \subsection{Input Classes}  \subsection{Input Classes}
156    \label{INPUT SEC}
157  This subsection details the instances used to read and load the source data  This subsection details the instances used to read and load the source data
158  for visualization.  for visualization.
159    
160  \subsubsection{\DataCollector class}  \subsubsection{\DataCollector class}
 \label{DATACOLLECTOR SEC}  
161  \begin{classdesc}{DataCollector}{source = Source.XML}  \begin{classdesc}{DataCollector}{source = Source.XML}
162  A data collector is used to read data either from a XML file (using  A data collector is used to read data either from a XML file (using
163  \texttt{setFileName()}) or from an escript object directly (using  \texttt{setFileName()}) or from an escript object directly (using
# Line 223  Including methods from \ActorTwoD. Line 227  Including methods from \ActorTwoD.
227    
228    
229  \subsection{Data Visualization Classes}  \subsection{Data Visualization Classes}
230    \label{DATAVIS SEC}
231  This subsection details the instances used to process and manipulate the source  This subsection details the instances used to process and manipulate the source
232  data. The typical usage of some of the classes are also shown.  data. The typical usage of some of the classes are also shown.
233    
# Line 230  One point to note is that the source can Line 235  One point to note is that the source can
235  source is cell data, a conversion to point data may or may not be  source is cell data, a conversion to point data may or may not be
236  required, in order for the object to be rendered correctly.  required, in order for the object to be rendered correctly.
237  If a conversion is needed, the 'cell_to_point' flag (see below) must  If a conversion is needed, the 'cell_to_point' flag (see below) must
238  be set to 'True', otherwise 'False' (which is the default).  be set to 'True', otherwise 'False' (which is the default). On occasions, an
239    inaccurate object may be rendered from cell data even after conversion.
240    
241  \subsubsection{\Map class}  \subsubsection{\Map class}
242    
# Line 794  by the 'ppmtompeg' command to generate a Line 800  by the 'ppmtompeg' command to generate a
800  \end{classdesc}  \end{classdesc}
801    
802  The following are some of the methods available:\\  The following are some of the methods available:\\
803  \begin{methoddesc}[Movie]{makeMovie}{input_directory, first_image, last_image,  \begin{methoddesc}[Movie]{imageRange}{input_directory, first_image, last_image}
804  movie}  The image range from which the movie is to be generated from.
805    \end{methoddesc}
806    
807    \begin{methoddesc}[Movie]{imageList}{input_directory, image_list}
808    The image list from which the movie is to be generated from.
809    \end{methoddesc}
810    
811    \begin{methoddesc}[Movie]{makeMovie}{movie}
812  Generate the movie.  Generate the movie.
813  \end{methoddesc}  \end{methoddesc}
814    
815  A typical usage of \Image is shown below.  A typical usage of \Movie is shown below.
816    
817  \begin{python}  \begin{python}
818  # Import the necessary modules.  # Import the necessary modules.
# Line 836  cam1 = Camera(scene = s, viewport = View Line 849  cam1 = Camera(scene = s, viewport = View
849    
850  # Create a movie.  # Create a movie.
851  mov = Movie()  mov = Movie()
852    #lst = []
853    
854  # Read in one file one after another and render the object.  # Read in one file one after another and render the object.
855  for i in range(938, 949):  for i in range(938, 949):
# Line 845  for i in range(938, 949): Line 859  for i in range(938, 949):
859      s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, \      s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, \
860              IMAGE_NAME + "%06d.jpg") % i)              IMAGE_NAME + "%06d.jpg") % i)
861    
862  # Generate the movie from the rendered images.      #lst.append(IMAGE_NAME + "%06d.jpg" % i)
863  mov.makeMovie(input_directory = PYVISI_EXAMPLE_IMAGES_PATH,  
864    # Images (first and last inclusive) from which the movie is to be generated.
865    mov.imageRange(input_directory = PYVISI_EXAMPLE_IMAGES_PATH,
866          first_image = IMAGE_NAME + "000938.jpg",          first_image = IMAGE_NAME + "000938.jpg",
867          last_image = IMAGE_NAME + "000948.jpg",          last_image = IMAGE_NAME + "000948.jpg")
868          movie = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "movie.mpg"))  
869    # Alternatively, a list of images can be specified.
870    #mov.imageList(input_directory = PYVISI_EXAMPLE_IMAGES_PATH, image_list = lst)
871    
872    # Generate the movie.
873    mov.makeMovie(os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "movie.mpg"))
874  \end{python}  \end{python}
875    
876    
# Line 860  mov.makeMovie(input_directory = PYVISI_E Line 881  mov.makeMovie(input_directory = PYVISI_E
881  This subsection details the instances used to position the rendered object.  This subsection details the instances used to position the rendered object.
882    
883  \begin{classdesc}{LocalPosition}{x_coor, y_coor}  \begin{classdesc}{LocalPosition}{x_coor, y_coor}
884  Class that defines the local positioning coordinate system (2D).  Class that defines the local positioning (X and Y) coordinate system (2D).
885  \end{classdesc}  \end{classdesc}
886    
887  \begin{classdesc}{GlobalPosition}{x_coor, y_coor, z_coor}  \begin{classdesc}{GlobalPosition}{x_coor, y_coor, z_coor}
888  Class that defines the global positioning coordinate system (3D).  Class that defines the global positioning (X, Y and Z) coordinate system (3D).
889  \end{classdesc}  \end{classdesc}
890    
891    
# Line 872  Class that defines the global positionin Line 893  Class that defines the global positionin
893    
894    
895  \subsection{Supporting Classes}  \subsection{Supporting Classes}
896  This subsection details the supporting classes inherited by the data  This subsection details the supporting classes and their corresponding methods
897  visualization classes (see Section \ref{DATACOLLECTOR SEC}) and their  inherited by the input (see Section \ref{INPUT SEC}) and data
898  available methods.  visualization classes (see Section \ref{DATAVIS SEC}).
899    
900  \subsubsection{\ActorThreeD class}  \subsubsection{\ActorThreeD class}
901    
# Line 1071  Set the displacement scale factor. Line 1092  Set the displacement scale factor.
1092  The following are some of the methods available:  The following are some of the methods available:
1093    
1094  \begin{methoddesc}[MaskPoints]{setRatio}{ratio}  \begin{methoddesc}[MaskPoints]{setRatio}{ratio}
1095  Mask every nth point.  Mask every n'th point.
1096  \end{methoddesc}  \end{methoddesc}
1097    
1098  \begin{methoddesc}[MaskPoints]{randomOn}{}  \begin{methoddesc}[MaskPoints]{randomOn}{}
# Line 1278  while t<0.4: Line 1299  while t<0.4:
1299    
1300  \section{Useful Keys}  \section{Useful Keys}
1301  This section shows some of the useful keys when interacting with the rendered  This section shows some of the useful keys when interacting with the rendered
1302  object.  object (in the Online approach).
1303    
1304  \begin{table}[ht]  \begin{table}[ht]
1305  \begin{center}  \begin{center}
# Line 1316  Keypress 'w' & Modify the representation Line 1337  Keypress 'w' & Modify the representation
1337  \newpage  \newpage
1338    
1339  \section{Sample Output}  \section{Sample Output}
1340  This section displays thumbnails of sample output.    This section displays some of the sample output.  
1341    
1342  \begin{table}[ht]  \begin{table}[ht]
1343  \begin{tabular}{c c c}  \begin{tabular}{c c c}

Legend:
Removed from v.1198  
changed lines
  Added in v.1199

  ViewVC Help
Powered by ViewVC 1.1.26