[cig-commits] r8621 - short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/figs

brad at geodynamics.org brad at geodynamics.org
Fri Dec 7 21:11:46 PST 2007


Author: brad
Date: 2007-12-07 21:11:45 -0800 (Fri, 07 Dec 2007)
New Revision: 8621

Modified:
   short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/figs/plot_error.py
   short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/figs/plot_soln.py
Log:
Added color bars to plotting scripts.

Modified: short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/figs/plot_error.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/figs/plot_error.py	2007-12-08 01:15:14 UTC (rev 8620)
+++ short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/figs/plot_error.py	2007-12-08 05:11:45 UTC (rev 8621)
@@ -13,7 +13,8 @@
 from plot_geometry import PlotScene
 
 shape = "tet4"
-res = 1000
+res = 500
+showSlice = True
 
 class PlotError(PlotScene):
 
@@ -21,8 +22,9 @@
 
   def run(self):    
     from enthought.mayavi.sources.vtk_data_source import VTKDataSource
-    from enthought.mayavi.filters.cell_to_point_data import CellToPointData
-    from enthought.mayavi.modules.iso_surface import IsoSurface
+    from enthought.mayavi.filters.threshold import Threshold
+    from enthought.mayavi.modules.surface import Surface
+    from enthought.mayavi.modules.scalar_cut_plane import ScalarCutPlane
 
     self._setupScene()
     data = self._readData()
@@ -31,12 +33,25 @@
     script.add_source(VTKDataSource(data=data))
     script.engine.current_object.name = "Error"
 
-    ptdata = CellToPointData()
-    script.add_filter(ptdata)
+    threshold = Threshold()
+    script.add_filter(threshold)
+    threshold.lower_threshold = -3.5
+    
+    surf = Surface()
+    script.add_filter(surf)
+    if showSlice:
+      surf.actor.property.opacity = 0.2
+      slice = ScalarCutPlane()
+      script.add_module(slice)
+      slice.implicit_plane.origin = (12.0, 12.0, -12.0)
+      slice.implicit_plane.normal = (0, -1.0, 0.0)
 
-    surf = IsoSurface()
-    script.add_module(surf)
-    
+    colorbar = script.engine.current_object.module_manager.scalar_lut_manager
+    colorbar.show_scalar_bar = True
+    colorbar.data_range = (-3.5, -2.0)
+    colorbar.number_of_labels = 7
+    colorbar.scalar_bar.label_format = "%-4.2f"
+
     return
 
 

Modified: short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/figs/plot_soln.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/figs/plot_soln.py	2007-12-08 01:15:14 UTC (rev 8620)
+++ short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/figs/plot_soln.py	2007-12-08 05:11:45 UTC (rev 8621)
@@ -14,6 +14,7 @@
 
 shape = "tet4"
 res = 1000
+scaleFactor = 2.0
 
 class PlotSoln(PlotScene):
 
@@ -34,6 +35,7 @@
     script.engine.current_object.name = "Solution"
 
     warp = WarpVector()
+    warp.filter.scale_factor = scaleFactor
     script.add_filter(warp)
 
     norm = ExtractVectorNorm()
@@ -46,8 +48,16 @@
     glyph.actor.property.color = (1,1,1)
     glyph.actor.mapper.scalar_visibility = False
     glyph.glyph.glyph_position = 'tail'
+    glyph.glyph.glyph.scale_factor = scaleFactor
     glyph.glyph.glyph_source = glyph.glyph.glyph_list[1]
     
+    colorbar = script.engine.current_object.module_manager.scalar_lut_manager
+    colorbar.show_scalar_bar = True
+    colorbar.data_range = (0.0, 0.5)
+    colorbar.number_of_labels = 6
+    colorbar.scalar_bar.label_format = "%3.1f"
+    colorbar.data_name = "Displacement [m]"
+
     return
 
 



More information about the cig-commits mailing list