/[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 1083 by jongui, Wed Apr 11 22:33:52 2007 UTC revision 1084 by jongui, Thu Apr 12 05:19:22 2007 UTC
# Line 233  Including methods from \ActorTwoD. Line 233  Including methods from \ActorTwoD.
233    
234  \subsection{Data Visualization Classes}  \subsection{Data Visualization Classes}
235  This subsection details the instances used to process and manipulate the source  This subsection details the instances used to process and manipulate the source
236  data.  data. The typical usage of the classes is also shown.
237    
238  One point to note is that the source can either be point or cell data. If the  One point to note is that the source can either be point or cell data. If the
239  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
# Line 253  can either be colored or grey-scaled, de Line 253  can either be colored or grey-scaled, de
253  The following are some of the methods available:\\  The following are some of the methods available:\\
254  Methods from \ActorThreeD.  Methods from \ActorThreeD.
255    
256  A typical usage of \Map is shown below, which can be found in  A typical usage of \Map is shown below.
 \texttt{\PyvisiExampleDirectory}.  
257    
258  \begin{python}  \begin{python}
259  # Import the necessary modules.  # Import the necessary modules.
# Line 359  Methods from \ActorThreeD, \GlyphThreeD Line 358  Methods from \ActorThreeD, \GlyphThreeD
358    
359  \subsubsection{\VelocityOnPlaneCut class}  \subsubsection{\VelocityOnPlaneCut class}
360    
361  \begin{classdesc}{VelocityOnPlaneCut}{scene, data_collector,  \begin{classdesc}{VelocityOnPlaneCut}{scene, data_collector,
362  arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR,  arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR,
363  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR,  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR,
364  cell_to_point = False, outline = True}  cell_to_point = False, outline = True}
# Line 370  it shows a vector field using arrows cut Line 369  it shows a vector field using arrows cut
369  The following are some of the methods available:\\  The following are some of the methods available:\\
370  Methods from \ActorThreeD, \GlyphThreeD, \Transform and \MaskPoints.  Methods from \ActorThreeD, \GlyphThreeD, \Transform and \MaskPoints.
371    
372  A typical usage of \VelocityOnPlaneCut is shown below, which can be found in  A typical usage of \VelocityOnPlaneCut is shown below.
 \texttt{\PyvisiExampleDirectory}.  
373    
374  \begin{python}  \begin{python}
375  # Import the necessary modules  # Import the necessary modules
# Line 469  The following are some of the methods av Line 467  The following are some of the methods av
467  Methods from \ActorThreeD, \Sphere, \TensorGlyph, \Transform, \Clipper  Methods from \ActorThreeD, \Sphere, \TensorGlyph, \Transform, \Clipper
468  and \MaskPoints.  and \MaskPoints.
469    
470  A typical usage of \EllipsoidOnPlaneClip is shown below, which can be found in  A typical usage of \EllipsoidOnPlaneClip is shown below.
 \texttt{\PyvisiExampleDirectory}.  
471    
472  \begin{python}  \begin{python}
473  # Import the necessary modules  # Import the necessary modules
# Line 527  class can also be used to generate iso s Line 524  class can also be used to generate iso s
524  The following are some of the methods available:\\  The following are some of the methods available:\\
525  Methods from \ActorThreeD and \ContourModule.  Methods from \ActorThreeD and \ContourModule.
526    
527  A typical usage of \Contour is shown below, which can be found in  A typical usage of \Contour is shown below.
 \texttt{\PyvisiExampleDirectory}.  
528    
529  \begin{python}  \begin{python}
530  # Import the necessary modules  # Import the necessary modules
# Line 606  modes, either using vector data or scala Line 602  modes, either using vector data or scala
602  The following are some of the methods available:\\  The following are some of the methods available:\\
603  Methods from \ActorThreeD, \PointSource, \StreamLineModule and \Tube.  Methods from \ActorThreeD, \PointSource, \StreamLineModule and \Tube.
604    
605  A typical usage of \StreamLine is shown below, which can be found in  A typical usage of \StreamLine is shown below.
 \texttt{\PyvisiExampleDirectory}.  
606    
607  \begin{python}  \begin{python}
608  # Import the necessary modules.  # Import the necessary modules.
# Line 661  Similarly, the plane can be deformated e Line 656  Similarly, the plane can be deformated e
656  The following are some of the methods available:\\  The following are some of the methods available:\\
657  Methods from \ActorThreeD, \Warp and \Transform.  Methods from \ActorThreeD, \Warp and \Transform.
658    
659  A typical usage of \Carpet is shown below, which can be found in  A typical usage of \Carpet is shown below.
 \texttt{\PyvisiExampleDirectory}.  
660    
661  \begin{python}  \begin{python}
662  # Import the necessary modules.  # Import the necessary modules.
# Line 707  s.render(PYVISI_EXAMPLE_IMAGES_PATH + IM Line 701  s.render(PYVISI_EXAMPLE_IMAGES_PATH + IM
701    
702  \begin{classdesc}{Image}{scene, image_reader, viewport = Viewport.SOUTH_WEST}  \begin{classdesc}{Image}{scene, image_reader, viewport = Viewport.SOUTH_WEST}
703  Class that displays an image which can be scaled (upwards and downwards). The  Class that displays an image which can be scaled (upwards and downwards). The
704  image can also be translated and rotated along the X, Y and Z axes.  image can also be translated and rotated along the X, Y and Z axes. One of
705    the most common use of this feature is pasting an image on a surface map.
706  \end{classdesc}  \end{classdesc}
707    
708  The following are some of the methods available:\\  The following are some of the methods available:\\
709  Methods from \ActorThreeD, \PlaneSource and \Transform.  Methods from \ActorThreeD, \PlaneSource and \Transform.
710    
711  A typical usage of \Image is shown below, which can be found in  A typical usage of \Image is shown below.
 \texttt{\PyvisiExampleDirectory}.  
712    
713  \begin{python}  \begin{python}
714  # Import the necessary modules.  # Import the necessary modules.
# Line 971  Mask every nth point. Line 965  Mask every nth point.
965  Enables the randomization of the points selected for masking.  Enables the randomization of the points selected for masking.
966  \end{methoddesc}  \end{methoddesc}
967    
 \section{Online Rendering Mechnism}  
968    
969  %\begin{table}  % ############################################################################
 %\begin{tabular}{c c c}  
 %\includegraphics[width=\thumbnailwidth]{figures/Map} &  
 %\includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneCut} &  
 %\includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneClip} \\  
 %1 & 2 & 3 \\  
 %\includegraphics[width=\thumbnailwidth]{figures/MapOnScalarClip}  \\  
 %4  
 %\end{tabular}  
 %\end{table}  
970    
971    
972    \section{Sample Output}
973    The following section displays a list of sample outputs.  
974    
975    \begin{table}[h]
976    \begin{tabular}{c c c}
977    \includegraphics[width=\thumbnailwidth]{figures/Map} &
978    \includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneCut} &
979    \includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneClip} \\
980    Map & MapOnPlaneCut & MapOnPlaneClip \\
981    \includegraphics[width=\thumbnailwidth]{figures/MapOnScalarClip} &
982    \includegraphics[width=\thumbnailwidth]{figures/Velocity} &
983    \includegraphics[width=\thumbnailwidth]{figures/VelocityOnPlaneCut}  \\
984    MapOnScalarClip & Velocity & VelocityOnPlaneCut \\
985    \includegraphics[width=\thumbnailwidth]{figures/VelocityOnPlaneClip} &
986    \includegraphics[width=\thumbnailwidth]{figures/Ellipsoid} &
987    \includegraphics[width=\thumbnailwidth]{figures/EllipsoidOnPlaneCut}  \\
988    VelocityOnPlaneClip & Ellipsoid & EllipsoidOnPlaneCut \\
989    \includegraphics[width=\thumbnailwidth]{figures/EllipsoidOnPlaneClip} &
990    \includegraphics[width=\thumbnailwidth]{figures/Contour} &
991    \includegraphics[width=\thumbnailwidth]{figures/ContourOnPlaneCut}  \\
992    EllipsoidOnPlaneClip & Contour & ContourOnPlaneCut \\
993    \includegraphics[width=\thumbnailwidth]{figures/ContourOnPlaneClip} &
994    \includegraphics[width=\thumbnailwidth]{figures/StreamLine} &
995    \includegraphics[width=\thumbnailwidth]{figures/Carpet}  \\
996    ContourOnPlaneClip & StreamLine & Carpet \\
997    \end{tabular}
998    \caption{Sample output}
999    \end{table}
1000    
1001    
1002    % #############################################################################
1003    
1004    
1005    \section{Complex Examples}
1006    The following scripts show some of the more complex examples.
1007    
1008  %\begin{tabular}{c c c c}  \textsf{Reading A Series of Files}
 %\includegraphics[scale = 0.1]{figures/EscriptDiagram1} &  
 %\includegraphics[scale = 0.1]{figures/EscriptDiagram1} &  
 %\includegraphics[scale = 0.1]{figures/EscriptDiagram1} &  
 %\includegraphics[scale = 0.1]{figures/EscriptDiagram1} \\  
 %1 & 2 & 3 & 4  
 %\end{tabular}  
1009    
1010    \begin{python}
1011    # Import the necessary modules.
1012    from esys.pyvisi import Scene, DataCollector, Contour, Camera
1013    from esys.pyvisi.constant import *
1014    
1015    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes/"
1016    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images/"
1017    X_SIZE = 400
1018    Y_SIZE = 300
1019    
1020    SCALAR_FIELD_POINT_DATA_1 = "lava"
1021    SCALAR_FIELD_POINT_DATA_2 = "talus"
1022    FILE_2D = "phi_talus_lava."
1023    FIRST_FILE_NAME = "phi_talus_lava.0099.vtu"
1024    
1025    IMAGE_NAME = "seriesofreads"
1026    JPG_RENDERER = Renderer.ONLINE_JPG
1027    
1028    
1029    # Create a Scene.
1030    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
1031            y_size = Y_SIZE)
1032    
1033    # Create a DataCollector reading from a XML file. An initial file must always
1034    # be assigned when the DataCollector is created, although the same file is
1035    # read again in the for-loop.  
1036    dc1 = DataCollector(source = Source.XML)
1037    dc1.setFileName(file_name = PYVISI_EXAMPLE_MESHES_PATH + FIRST_FILE_NAME)
1038    dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_1)
1039    
1040    # Create a Contour.
1041    mosc1 = Contour(scene = s, data_collector = dc1,
1042            viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
1043            outline = True)
1044    mosc1.generateContours(0)
1045    
1046    # Create a second DataCollector reading from the same XML file. An initial
1047    # file must always be assigned when the DataCollector is created,
1048    # although the same file is read again in the for-loop.  
1049    dc2 = DataCollector(source = Source.XML)
1050    dc2.setFileName(file_name = PYVISI_EXAMPLE_MESHES_PATH + FIRST_FILE_NAME)
1051    dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)
1052    
1053    # Create a second Contour.
1054    mosc2 = Contour(scene = s, data_collector = dc2,
1055            viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
1056            outline = True)
1057    mosc2.generateContours(0)
1058    
1059    # Read in one file one after another and render the object.
1060    for i in range(99, 104):
1061        dc1.setFileName(file_name =  PYVISI_EXAMPLE_MESHES_PATH + FILE_2D +
1062                "%04d.vtu" % i)
1063        dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_1)
1064        dc2.setFileName(file_name =  PYVISI_EXAMPLE_MESHES_PATH + FILE_2D +
1065                "%04d.vtu" % i)
1066        dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)
1067    
1068        s.render(PYVISI_EXAMPLE_IMAGES_PATH + IMAGE_NAME + "%04d.jpg" % i)
1069    \end{python}
1070    
1071    \textsf{Manipulating A Single File with A Series of Translation}
1072    
1073    \begin{python}
1074    # Import the necessary modules.
1075    from esys.pyvisi import Scene, DataCollector, MapOnPlaneCut, Camera
1076    from esys.pyvisi.constant import *
1077    
1078    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes/"
1079    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images/"
1080    X_SIZE = 400
1081    Y_SIZE = 400
1082    
1083  same word on rendering, off-line, on-line, how to rotate, zoom, close the window, ...  SCALAR_FIELD_POINT_DATA = "temperature"
1084    FILE_3D = "interior_3D.xml"
1085    IMAGE_NAME = "seriesofcuts"
1086    JPG_RENDERER = Renderer.ONLINE_JPG
1087    
1088    
1089    # Create a Scene.
1090    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
1091            y_size = Y_SIZE)
1092    
1093    # Create a DataCollector reading from a XML file.
1094    dc1 = DataCollector(source = Source.XML)
1095    dc1.setFileName(file_name = PYVISI_EXAMPLE_MESHES_PATH + FILE_3D)
1096    dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA)
1097    
1098    # Create a MapOnPlaneCut.
1099    mopc1 = MapOnPlaneCut(scene = s, data_collector = dc1,
1100            viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
1101            outline = True)
1102    mopc1.setPlaneToYZ(offset = 0.1)
1103    
1104    # Create a Camera.
1105    c1 = Camera(scene = s, data_collector = dc1, viewport = Viewport.SOUTH_WEST)
1106    c1.isometricView()
1107    
1108    # Render the object with multiple cuts from a series of translation.
1109    for i in range(0, 5):
1110        s.render(PYVISI_EXAMPLE_IMAGES_PATH + IMAGE_NAME + "%02d.jpg" % i)
1111        mopc1.translate(0.6,0,0)
1112    \end{python}
1113    
 %==============================================  
 \section{How to Make a Movie}  

Legend:
Removed from v.1083  
changed lines
  Added in v.1084

  ViewVC Help
Powered by ViewVC 1.1.26