Salome HOME
Merge akl/tests_update: update tests
[modules/paravis.git] / src / PV_SWIG / presentations.py
index a9f26e1455b7624bbbab78dbaf1971b099dab57a..5169a60d57220c3b87f36dc08ec460a5678af354 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2010-2012  CEA/DEN, EDF R&D
+# Copyright (C) 2010-2014  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -32,12 +32,15 @@ import warnings
 from math import sqrt, sin, cos, radians
 from string import upper
 
-import pvsimple as pv
+# Do not use pv as a short name.
+# It is a name of function from numpy and may be redefined implicitly by 'from numpy import *' call.
+# import pvsimple as pv
+import pvsimple as pvs
 #try:
 #    # TODO(MZN): to be removed (issue with Point Sprite texture)
 #    #import paravisSM as sm
 #except:
-#    import paraview.simple as pv
+#    import paraview.simple as pvs
 #    import paraview.servermanager as sm
 
 
@@ -195,7 +198,7 @@ def process_prs_for_test(prs, view, picture_name, show_bar=True):
         os.makedirs(pic_dir)
 
     # Save picture
-    pv.WriteImage(file_name, view=view, Magnification=1)
+    pvs.WriteImage(file_name, view=view, Magnification=1)
 
 
 def reset_view(view=None):
@@ -206,7 +209,7 @@ def reset_view(view=None):
 
     """
     if not view:
-        view = pv.GetRenderView()
+        view = pvs.GetRenderView()
 
     # Camera preferences
     view.CameraFocalPoint = [0.0, 0.0, 0.0]
@@ -221,13 +224,13 @@ def reset_view(view=None):
     view.CameraParallelProjection = 1
 
     view.ResetCamera()
-    pv.Render(view=view)
+    pvs.Render(view=view)
 
 
 def hide_all(view, to_remove=False):
     """Hide all representations in the view."""
     if not view:
-        view = pv.GetRenderView()
+        view = pvs.GetRenderView()
 
     rep_list = view.Representations
     for rep in rep_list:
@@ -235,7 +238,7 @@ def hide_all(view, to_remove=False):
             rep.Visibility = 0
         if to_remove:
             view.Representations.remove(rep)
-    pv.Render(view=view)
+    pvs.Render(view=view)
 
 
 def display_only(prs, view=None):
@@ -243,7 +246,7 @@ def display_only(prs, view=None):
     hide_all(view)
     if (hasattr(prs, 'Visibility') and prs.Visibility != 1):
         prs.Visibility = 1
-    pv.Render(view=view)
+    pvs.Render(view=view)
 
 
 def set_visible_lines(xy_prs, lines):
@@ -672,10 +675,10 @@ def get_calc_magnitude(proxy, array_entity, array_name):
     # Transform vector array to scalar array if possible
     nb_components = get_nb_components(proxy, array_entity, array_name)
     if (nb_components > 1):
-        calculator = pv.Calculator(proxy)
-        attribute_mode = "point_data"
+        calculator = pvs.Calculator(proxy)
+        attribute_mode = "Point Data"
         if array_entity != EntityType.NODE:
-            attribute_mode = "cell_data"
+            attribute_mode = "Cell Data"
         calculator.AttributeMode = attribute_mode
         if (nb_components == 2):
             # Workaroud: calculator unable to compute magnitude
@@ -705,10 +708,10 @@ def get_add_component_calc(proxy, array_entity, array_name):
 
     nb_components = get_nb_components(proxy, array_entity, array_name)
     if nb_components == 2:
-        calculator = pv.Calculator(proxy)
-        attribute_mode = "point_data"
+        calculator = pvs.Calculator(proxy)
+        attribute_mode = "Point Data"
         if array_entity != EntityType.NODE:
-            attribute_mode = "cell_data"
+            attribute_mode = "Cell Data"
         calculator.AttributeMode = attribute_mode
         expression = "iHat * " + array_name + "_X + jHat * " + array_name + "_Y + kHat * 0"
         calculator.Function = expression
@@ -739,6 +742,9 @@ def select_cells_with_data(proxy, on_points=None, on_cells=None):
     types with data for even one field (from available) will be selected.
 
     """
+    if not hasattr(proxy, 'Entity'):
+        return
+    
     #all_cell_types = proxy.CellTypes.Available
     all_cell_types = proxy.Entity.Available
     all_arrays = list(proxy.CellArrays.GetData())
@@ -827,7 +833,7 @@ def extract_groups_for_field(proxy, field_name, field_entity, force=False):
 
     # Extract groups if necessary
     if force or (len(groups_to_extract) < len(initial_groups)):
-        extract_group = pv.ExtractGroup(proxy)
+        extract_group = pvs.ExtractGroup(proxy)
         extract_group.Groups = groups_to_extract
         extract_group.UpdatePipeline()
         source = extract_group
@@ -864,7 +870,7 @@ def add_scalar_bar(field_name, nb_components,
         title = "\n".join([title, vector_mode])
 
     # Create scalar bar
-    scalar_bar = pv.CreateScalarBar(Enabled=1)
+    scalar_bar = pvs.CreateScalarBar(Enabled=1)
     scalar_bar.Orientation = 'Vertical'
     scalar_bar.Title = title
     scalar_bar.LookupTable = lookup_table
@@ -887,7 +893,7 @@ def add_scalar_bar(field_name, nb_components,
     scalar_bar.LabelShadow = 1
 
     # Add the scalar bar to the view
-    pv.GetRenderView().Representations.append(scalar_bar)
+    pvs.GetRenderView().Representations.append(scalar_bar)
 
     # Reassign the current bar
     _current_bar = scalar_bar
@@ -904,7 +910,7 @@ def get_bar():
 
 def get_lookup_table(field_name, nb_components, vector_mode='Magnitude'):
     """Get lookup table for the given field."""
-    lookup_table = pv.GetLookupTableForArray(field_name, nb_components)
+    lookup_table = pvs.GetLookupTableForArray(field_name, nb_components)
 
     if vector_mode == 'Magnitude':
         lookup_table.VectorMode = vector_mode
@@ -981,9 +987,15 @@ def get_group_names(proxy, mesh_name, entity, wo_nogroups=False):
 def get_time(proxy, timestamp_nb):
     """Get time value by timestamp number."""
     # Check timestamp number
-    timestamps = proxy.TimestepValues.GetData()
+    timestamps = []
+    
+    if (hasattr(proxy, 'TimestepValues')):
+        timestamps = proxy.TimestepValues.GetData()
+    elif (hasattr(proxy.Input, 'TimestepValues')):
+        timestamps = proxy.Input.TimestepValues.GetData()
+
     if ((timestamp_nb - 1) not in xrange(len(timestamps))):
-        raise ValueError("Timestamp number is out of range: " + timestamp_nb)
+        raise ValueError("Timestamp number is out of range: " + str(timestamp_nb))
 
     # Return time value
     return timestamps[timestamp_nb - 1]
@@ -1062,15 +1074,15 @@ def ScalarMapOnField(proxy, entity, field_name, timestamp_nb,
     time_value = get_time(proxy, timestamp_nb)
 
     # Set timestamp
-    pv.GetRenderView().ViewTime = time_value
-    pv.UpdatePipeline(time_value, proxy)
+    pvs.GetRenderView().ViewTime = time_value
+    pvs.UpdatePipeline(time_value, proxy)
 
     # Extract only groups with data for the field
     new_proxy = extract_groups_for_field(proxy, field_name, entity,
                                          force=True)
 
     # Get Scalar Map representation object
-    scalarmap = pv.GetRepresentation(new_proxy)
+    scalarmap = pvs.GetRepresentation(new_proxy)
 
     # Get lookup table
     lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
@@ -1130,11 +1142,11 @@ def CutPlanesOnField(proxy, entity, field_name, timestamp_nb,
     time_value = get_time(proxy, timestamp_nb)
 
     # Set timestamp
-    pv.GetRenderView().ViewTime = time_value
-    pv.UpdatePipeline(time_value, proxy)
+    pvs.GetRenderView().ViewTime = time_value
+    pvs.UpdatePipeline(time_value, proxy)
 
     # Create slice filter
-    slice_filter = pv.Slice(proxy)
+    slice_filter = pvs.Slice(proxy)
     slice_filter.SliceType = "Plane"
 
     # Set cut planes normal
@@ -1148,7 +1160,7 @@ def CutPlanesOnField(proxy, entity, field_name, timestamp_nb,
     slice_filter.SliceOffsetValues = positions
 
     # Get Cut Planes representation object
-    cut_planes = pv.GetRepresentation(slice_filter)
+    cut_planes = pvs.GetRepresentation(slice_filter)
 
     # Get lookup table
     lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
@@ -1220,11 +1232,11 @@ def CutLinesOnField(proxy, entity, field_name, timestamp_nb,
     time_value = get_time(proxy, timestamp_nb)
 
     # Set timestamp
-    pv.GetRenderView().ViewTime = time_value
-    pv.UpdatePipeline(time_value, proxy)
+    pvs.GetRenderView().ViewTime = time_value
+    pvs.UpdatePipeline(time_value, proxy)
 
     # Create base plane
-    base_plane = pv.Slice(proxy)
+    base_plane = pvs.Slice(proxy)
     base_plane.SliceType = "Plane"
 
     # Set base plane normal
@@ -1244,7 +1256,7 @@ def CutLinesOnField(proxy, entity, field_name, timestamp_nb,
         base_plane = proxy
 
     # Create cutting planes
-    cut_planes = pv.Slice(base_plane)
+    cut_planes = pvs.Slice(base_plane)
     cut_planes.SliceType = "Plane"
 
     # Set cutting planes normal and get positions
@@ -1270,9 +1282,9 @@ def CutLinesOnField(proxy, entity, field_name, timestamp_nb,
             point2 = [bounds[1], bounds[3], bounds[5]]
 
             # Create plot over line filter
-            pol = pv.PlotOverLine(cut_planes,
+            pol = pvs.PlotOverLine(cut_planes,
                                   Source="High Resolution Line Source")
-            pv.RenameSource('Y' + str(index), pol)
+            pvs.RenameSource('Y' + str(index), pol)
             pol.Source.Point1 = point1
             pol.Source.Point2 = point2
             pol.UpdatePipeline()
@@ -1284,7 +1296,7 @@ def CutLinesOnField(proxy, entity, field_name, timestamp_nb,
     cut_planes.UpdatePipeline()
 
     # Get Cut Lines representation object
-    cut_lines = pv.GetRepresentation(cut_planes)
+    cut_lines = pvs.GetRepresentation(cut_planes)
 
     # Get lookup table
     lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
@@ -1342,17 +1354,17 @@ def CutSegmentOnField(proxy, entity, field_name, timestamp_nb,
     time_value = get_time(proxy, timestamp_nb)
 
     # Set timestamp
-    pv.GetRenderView().ViewTime = time_value
-    pv.UpdatePipeline(time_value, proxy)
+    pvs.GetRenderView().ViewTime = time_value
+    pvs.UpdatePipeline(time_value, proxy)
 
     # Create plot over line filter
-    pol = pv.PlotOverLine(proxy, Source="High Resolution Line Source")
+    pol = pvs.PlotOverLine(proxy, Source="High Resolution Line Source")
     pol.Source.Point1 = point1
     pol.Source.Point2 = point2
     pol.UpdatePipeline()
 
     # Get Cut Segment representation object
-    cut_segment = pv.GetRepresentation(pol)
+    cut_segment = pvs.GetRepresentation(pol)
 
     # Get lookup table
     lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
@@ -1410,8 +1422,8 @@ def VectorsOnField(proxy, entity, field_name, timestamp_nb,
     time_value = get_time(proxy, timestamp_nb)
 
     # Set timestamp
-    pv.GetRenderView().ViewTime = time_value
-    pv.UpdatePipeline(time_value, proxy)
+    pvs.GetRenderView().ViewTime = time_value
+    pvs.UpdatePipeline(time_value, proxy)
 
     # Extract only groups with data for the field
     new_proxy = extract_groups_for_field(proxy, field_name, entity)
@@ -1419,7 +1431,7 @@ def VectorsOnField(proxy, entity, field_name, timestamp_nb,
 
     # Cell centers
     if is_data_on_cells(proxy, field_name):
-        cell_centers = pv.CellCenters(source)
+        cell_centers = pvs.CellCenters(source)
         cell_centers.VertexCells = 1
         source = cell_centers
 
@@ -1431,7 +1443,7 @@ def VectorsOnField(proxy, entity, field_name, timestamp_nb,
         source = calc
 
     # Glyph
-    glyph = pv.Glyph(source)
+    glyph = pvs.Glyph(source)
     glyph.Vectors = vector_array
     glyph.ScaleMode = 'vector'
     glyph.MaskPoints = 0
@@ -1464,7 +1476,7 @@ def VectorsOnField(proxy, entity, field_name, timestamp_nb,
     glyph.UpdatePipeline()
 
     # Get Vectors representation object
-    vectors = pv.GetRepresentation(glyph)
+    vectors = pvs.GetRepresentation(glyph)
 
     # Get lookup table
     lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
@@ -1530,18 +1542,18 @@ def DeformedShapeOnField(proxy, entity, field_name,
     time_value = get_time(proxy, timestamp_nb)
 
     # Set timestamp
-    pv.GetRenderView().ViewTime = time_value
-    pv.UpdatePipeline(time_value, proxy)
+    pvs.GetRenderView().ViewTime = time_value
+    pvs.UpdatePipeline(time_value, proxy)
 
     # Extract only groups with data for the field
     new_proxy = extract_groups_for_field(proxy, field_name, entity)
 
     # Do merge
-    source = pv.MergeBlocks(new_proxy)
+    source = pvs.MergeBlocks(new_proxy)
 
     # Cell data to point data
     if is_data_on_cells(proxy, field_name):
-        cell_to_point = pv.CellDatatoPointData()
+        cell_to_point = pvs.CellDatatoPointData()
         cell_to_point.PassCellData = 1
         source = cell_to_point
 
@@ -1553,7 +1565,7 @@ def DeformedShapeOnField(proxy, entity, field_name,
         source = calc
 
     # Warp by vector
-    warp_vector = pv.WarpByVector(source)
+    warp_vector = pvs.WarpByVector(source)
     warp_vector.Vectors = [vector_array]
     if scale_factor is not None:
         warp_vector.ScaleFactor = scale_factor
@@ -1563,7 +1575,7 @@ def DeformedShapeOnField(proxy, entity, field_name,
         warp_vector.ScaleFactor = def_scale
 
     # Get Deformed Shape representation object
-    defshape = pv.GetRepresentation(warp_vector)
+    defshape = pvs.GetRepresentation(warp_vector)
 
     # Get lookup table
     lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
@@ -1641,8 +1653,8 @@ def DeformedShapeAndScalarMapOnField(proxy, entity, field_name,
     time_value = get_time(proxy, timestamp_nb)
 
     # Set timestamp
-    pv.GetRenderView().ViewTime = time_value
-    pv.UpdatePipeline(time_value, proxy)
+    pvs.GetRenderView().ViewTime = time_value
+    pvs.UpdatePipeline(time_value, proxy)
 
     # Set scalar field by default
     scalar_field_entity = scalar_entity
@@ -1655,11 +1667,11 @@ def DeformedShapeAndScalarMapOnField(proxy, entity, field_name,
     new_proxy = extract_groups_for_field(proxy, field_name, entity)
 
     # Do merge
-    source = pv.MergeBlocks(new_proxy)
+    source = pvs.MergeBlocks(new_proxy)
 
     # Cell data to point data
     if is_data_on_cells(proxy, field_name):
-        cell_to_point = pv.CellDatatoPointData(source)
+        cell_to_point = pvs.CellDatatoPointData(source)
         cell_to_point.PassCellData = 1
         source = cell_to_point
 
@@ -1671,7 +1683,7 @@ def DeformedShapeAndScalarMapOnField(proxy, entity, field_name,
         source = calc
 
     # Warp by vector
-    warp_vector = pv.WarpByVector(source)
+    warp_vector = pvs.WarpByVector(source)
     warp_vector.Vectors = [vector_array]
     if scale_factor is not None:
         warp_vector.ScaleFactor = scale_factor
@@ -1681,7 +1693,7 @@ def DeformedShapeAndScalarMapOnField(proxy, entity, field_name,
         warp_vector.ScaleFactor = def_scale
 
     # Get Defromed Shape And Scalar Map representation object
-    defshapemap = pv.GetRepresentation(warp_vector)
+    defshapemap = pvs.GetRepresentation(warp_vector)
 
     # Get lookup table
     lookup_table = get_lookup_table(scalar_field, nb_components, vector_mode)
@@ -1755,14 +1767,14 @@ def Plot3DOnField(proxy, entity, field_name, timestamp_nb,
     time_value = get_time(proxy, timestamp_nb)
 
     # Set timestamp
-    pv.GetRenderView().ViewTime = time_value
-    pv.UpdatePipeline(time_value, proxy)
+    pvs.GetRenderView().ViewTime = time_value
+    pvs.UpdatePipeline(time_value, proxy)
 
     # Extract only groups with data for the field
     new_proxy = extract_groups_for_field(proxy, field_name, entity)
 
     # Do merge
-    merge_blocks = pv.MergeBlocks(new_proxy)
+    merge_blocks = pvs.MergeBlocks(new_proxy)
     merge_blocks.UpdatePipeline()
 
     poly_data = None
@@ -1782,7 +1794,7 @@ def Plot3DOnField(proxy, entity, field_name, timestamp_nb,
                                            radians(angle1), radians(angle2))
 
         # Create slice filter
-        slice_filter = pv.Slice(merge_blocks)
+        slice_filter = pvs.Slice(merge_blocks)
         slice_filter.SliceType = "Plane"
 
         # Set cutting plane normal
@@ -1804,7 +1816,7 @@ def Plot3DOnField(proxy, entity, field_name, timestamp_nb,
     use_normal = 0
     # Geometry filter
     if not poly_data or poly_data.GetDataInformation().GetNumberOfCells() == 0:
-        geometry_filter = pv.GeometryFilter(merge_blocks)
+        geometry_filter = pvs.GeometryFilter(merge_blocks)
         poly_data = geometry_filter
         use_normal = 1  # TODO(MZN): workaround
 
@@ -1814,7 +1826,7 @@ def Plot3DOnField(proxy, entity, field_name, timestamp_nb,
 
     if is_data_on_cells(poly_data, field_name):
         # Cell data to point data
-        cell_to_point = pv.CellDatatoPointData(poly_data)
+        cell_to_point = pvs.CellDatatoPointData(poly_data)
         cell_to_point.PassCellData = 1
         source = cell_to_point
 
@@ -1827,7 +1839,7 @@ def Plot3DOnField(proxy, entity, field_name, timestamp_nb,
         source = calc
 
     # Warp by scalar
-    warp_scalar = pv.WarpByScalar(source)
+    warp_scalar = pvs.WarpByScalar(source)
     warp_scalar.Scalars = scalars
     warp_scalar.Normal = normal
     warp_scalar.UseNormal = use_normal
@@ -1843,7 +1855,7 @@ def Plot3DOnField(proxy, entity, field_name, timestamp_nb,
 
     if (is_contour):
         # Contours
-        contour = pv.Contour(warp_scalar)
+        contour = pvs.Contour(warp_scalar)
         contour.PointMergeMethod = "Uniform Binning"
         contour.ContourBy = ['POINTS', field_name]
         scalar_range = get_data_range(proxy, entity,
@@ -1853,7 +1865,7 @@ def Plot3DOnField(proxy, entity, field_name, timestamp_nb,
         source = contour
 
     # Get Plot 3D representation object
-    plot3d = pv.GetRepresentation(source)
+    plot3d = pvs.GetRepresentation(source)
 
     # Get lookup table
     lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
@@ -1915,18 +1927,18 @@ def IsoSurfacesOnField(proxy, entity, field_name, timestamp_nb,
     time_value = get_time(proxy, timestamp_nb)
 
     # Set timestamp
-    pv.GetRenderView().ViewTime = time_value
-    pv.UpdatePipeline(time_value, proxy)
+    pvs.GetRenderView().ViewTime = time_value
+    pvs.UpdatePipeline(time_value, proxy)
 
     # Extract only groups with data for the field
     new_proxy = extract_groups_for_field(proxy, field_name, entity)
 
     # Do merge
-    source = pv.MergeBlocks(new_proxy)
+    source = pvs.MergeBlocks(new_proxy)
 
     # Transform cell data into point data if necessary
     if is_data_on_cells(proxy, field_name):
-        cell_to_point = pv.CellDatatoPointData(source)
+        cell_to_point = pvs.CellDatatoPointData(source)
         cell_to_point.PassCellData = 1
         source = cell_to_point
 
@@ -1939,7 +1951,7 @@ def IsoSurfacesOnField(proxy, entity, field_name, timestamp_nb,
         source = calc
 
     # Contour filter settings
-    contour = pv.Contour(source)
+    contour = pvs.Contour(source)
     contour.ComputeScalars = 1
     contour.ContourBy = contour_by
 
@@ -1956,7 +1968,7 @@ def IsoSurfacesOnField(proxy, entity, field_name, timestamp_nb,
     contour.Isosurfaces = surfaces
 
     # Get Iso Surfaces representation object
-    isosurfaces = pv.GetRepresentation(contour)
+    isosurfaces = pvs.GetRepresentation(contour)
 
     # Get lookup table
     lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
@@ -2037,7 +2049,7 @@ def GaussPointsOnField(proxy, entity, field_name,
     time_value = get_time(proxy, timestamp_nb)
 
     # Set timestamp
-    pv.GetRenderView().ViewTime = time_value
+    pvs.GetRenderView().ViewTime = time_value
     proxy.UpdatePipeline(time=time_value)
 
     # Extract only groups with data for the field
@@ -2048,12 +2060,12 @@ def GaussPointsOnField(proxy, entity, field_name,
 
     # If no quadrature point array is passed, use cell centers
     if field_name in qp_arrays:
-        generate_qp = pv.GenerateQuadraturePoints(source)
+        generate_qp = pvs.GenerateQuadraturePoints(source)
         generate_qp.SelectSourceArray = ['CELLS', 'ELGA_Offset']
         source = generate_qp
     else:
         # Cell centers
-        cell_centers = pv.CellCenters(source)
+        cell_centers = pvs.CellCenters(source)
         cell_centers.VertexCells = 1
         source = cell_centers
 
@@ -2070,7 +2082,7 @@ def GaussPointsOnField(proxy, entity, field_name,
             source = calc
 
         # Warp by vector
-        warp_vector = pv.WarpByVector(source)
+        warp_vector = pvs.WarpByVector(source)
         warp_vector.Vectors = [vector_array]
         if scale_factor is not None:
             warp_vector.ScaleFactor = scale_factor
@@ -2082,7 +2094,7 @@ def GaussPointsOnField(proxy, entity, field_name,
         source = warp_vector
 
     # Get Gauss Points representation object
-    gausspnt = pv.GetRepresentation(source)
+    gausspnt = pvs.GetRepresentation(source)
 
     # Get lookup table
     lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
@@ -2163,6 +2175,140 @@ def GaussPointsOnField(proxy, entity, field_name,
 
     return gausspnt
 
+def GaussPointsOnField1(proxy, entity, field_name,
+                        timestamp_nb,
+                        is_colored=True, color=None,
+                        primitive=GaussType.SPHERE,
+                        is_proportional=True,
+                        max_pixel_size=256,
+                        multiplier=None,
+                        vector_mode='Magnitude'):
+    """Creates Gauss Points on the given field. Use GaussPoints() Paraview interface.
+
+    Arguments:
+    proxy: the pipeline object, containig data
+    entity: the field entity type from PrsTypeEnum
+    field_name: the field name
+    timestamp_nb: the number of time step (1, 2, ...)
+    is_colored -- defines whether the Gauss Points will be multicolored,
+    using the corresponding data values
+    color: defines the presentation color as [R, G, B] triple. Taken into
+    account only if is_colored is False.
+    primitive: primitive type from GaussType
+    is_proportional: if True, the size of primitives will depends on
+    the gauss point value
+    max_pixel_size: the maximum sizr of the Gauss Points primitive in pixels
+    multiplier: coefficient between data values and the size of primitives
+    If not passed by user, default scale will be computed.
+    vector_mode: the mode of transformation of vector values into
+    scalar values, applicable only if the field contains vector values.
+    Possible modes: 'Magnitude' - vector module;
+    'X', 'Y', 'Z' - vector components.
+
+    Returns:
+      Gauss Points as representation object.
+
+    """
+    # Get time value
+    time_value = get_time(proxy, timestamp_nb)
+
+    # Set timestamp
+    pvs.GetRenderView().ViewTime = time_value
+    proxy.UpdatePipeline(time=time_value)
+
+    # Create Gauss Points object
+    source = pvs.GaussPoints(proxy)
+    source.UpdatePipeline()
+  
+    # Get Gauss Points representation object
+    gausspnt = pvs.GetRepresentation(source)
+
+    # Get lookup table
+    entity_data_info = None
+    point_data_info = source.GetPointDataInformation()
+    if field_name in point_data_info.keys():
+        entity_data_info = point_data_info
+    else:
+        entity_data_info = source.GetCellDataInformation()
+    nb_components = entity_data_info[field_name].GetNumberOfComponents()
+    
+    lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
+
+    # Set field range if necessary
+    data_range = get_data_range(proxy, entity,
+                                field_name, vector_mode)
+    lookup_table.LockScalarRange = 1
+    lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0]
+
+    # Set display properties
+    if is_colored:
+        gausspnt.ColorAttributeType = EntityType.get_pvtype(entity)
+        gausspnt.ColorArrayName = field_name
+    else:
+        gausspnt.ColorArrayName = ''
+        if color:
+            gausspnt.DiffuseColor = color
+
+    gausspnt.LookupTable = lookup_table
+
+    # Add scalar bar
+    add_scalar_bar(field_name, nb_components,
+                   vector_mode, lookup_table, time_value)
+
+    # Set point sprite representation
+    gausspnt.Representation = 'Point Sprite'
+
+    # Point sprite settings
+    gausspnt.InterpolateScalarsBeforeMapping = 0
+    gausspnt.MaxPixelSize = max_pixel_size
+
+    # Render mode
+    gausspnt.RenderMode = GaussType.get_mode(primitive)
+
+    #if primitive == GaussType.SPRITE:
+        # Set texture
+        # TODO(MZN): replace with pvsimple high-level interface
+    #    texture = sm.CreateProxy("textures", "SpriteTexture")
+    #    alphamprop = texture.GetProperty("AlphaMethod")
+    #    alphamprop.SetElement(0, 2)  # Clamp
+    #    alphatprop = texture.GetProperty("AlphaThreshold")
+    #    alphatprop.SetElement(0, 63)
+    #    maxprop = texture.GetProperty("Maximum")
+    #    maxprop.SetElement(0, 255)
+    #    texture.UpdateVTKObjects()
+
+    #    gausspnt.Texture = texture
+        #gausspnt.Texture.AlphaMethod = 'Clamp'
+        #gausspnt.Texture.AlphaThreshold = 63
+        #gausspnt.Texture.Maximum= 255
+
+    # Proportional radius
+    gausspnt.RadiusUseScalarRange = 0
+    gausspnt.RadiusIsProportional = 0
+
+    if is_proportional:
+        mult = multiplier
+        if mult is None:
+            mult = abs(0.1 / data_range[1])
+
+        gausspnt.RadiusScalarRange = data_range
+        gausspnt.RadiusTransferFunctionEnabled = 1
+        gausspnt.RadiusMode = 'Scalar'
+        gausspnt.RadiusArray = ['POINTS', field_name]
+        if nb_components > 1:
+            v_comp = get_vector_component(vector_mode)
+            gausspnt.RadiusVectorComponent = v_comp
+        gausspnt.RadiusTransferFunctionMode = 'Table'
+        gausspnt.RadiusScalarRange = data_range
+        gausspnt.RadiusUseScalarRange = 1
+        gausspnt.RadiusIsProportional = 1
+        gausspnt.RadiusProportionalFactor = mult
+    else:
+        gausspnt.RadiusTransferFunctionEnabled = 0
+        gausspnt.RadiusMode = 'Constant'
+        gausspnt.RadiusArray = ['POINTS', 'Constant Radius']
+
+    return gausspnt
 
 def StreamLinesOnField(proxy, entity, field_name, timestamp_nb,
                        direction='BOTH', is_colored=False, color=None,
@@ -2202,18 +2348,18 @@ def StreamLinesOnField(proxy, entity, field_name, timestamp_nb,
     time_value = get_time(proxy, timestamp_nb)
 
     # Set timestamp
-    pv.GetRenderView().ViewTime = time_value
-    pv.UpdatePipeline(time_value, proxy)
+    pvs.GetRenderView().ViewTime = time_value
+    pvs.UpdatePipeline(time_value, proxy)
 
     # Extract only groups with data for the field
     new_proxy = extract_groups_for_field(proxy, field_name, entity)
 
     # Do merge
-    source = pv.MergeBlocks(new_proxy)
+    source = pvs.MergeBlocks(new_proxy)
 
     # Cell data to point data
     if is_data_on_cells(proxy, field_name):
-        cell_to_point = pv.CellDatatoPointData(source)
+        cell_to_point = pvs.CellDatatoPointData(source)
         cell_to_point.PassCellData = 1
         cell_to_point.UpdatePipeline()
         source = cell_to_point
@@ -2227,7 +2373,7 @@ def StreamLinesOnField(proxy, entity, field_name, timestamp_nb,
         source = calc
 
     # Stream Tracer
-    stream = pv.StreamTracer(source)
+    stream = pvs.StreamTracer(source)
     stream.SeedType = "Point Source"
     stream.Vectors = ['POINTS', vector_array]
     stream.SeedType = "Point Source"
@@ -2238,7 +2384,7 @@ def StreamLinesOnField(proxy, entity, field_name, timestamp_nb,
     # Get Stream Lines representation object
     if is_empty(stream):
         return None
-    streamlines = pv.GetRepresentation(stream)
+    streamlines = pvs.GetRepresentation(stream)
 
     # Get lookup table
     lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
@@ -2293,7 +2439,7 @@ def MeshOnEntity(proxy, mesh_name, entity):
     prs = None
     if (proxy.GetDataInformation().GetNumberOfPoints() or
         proxy.GetDataInformation().GetNumberOfCells()):
-        prs = pv.GetRepresentation(proxy)
+        prs = pvs.GetRepresentation(proxy)
         prs.ColorArrayName = ''
 
     return prs
@@ -2333,7 +2479,7 @@ def MeshOnGroup(proxy, group_name):
             nb_items = proxy.GetDataInformation().GetNumberOfCells()
 
         if nb_items:
-            prs = pv.GetRepresentation(proxy)
+            prs = pvs.GetRepresentation(proxy)
             prs.ColorArrayName = ''
 
     return prs
@@ -2358,7 +2504,7 @@ def CreatePrsForFile(paravis_instance, file_name, prs_types,
 
     try:
         paravis_instance.ImportFile(file_name)
-        proxy = pv.GetActiveSource()
+        proxy = pvs.GetActiveSource()
         if proxy is None:
             print "FAILED"
         else:
@@ -2368,7 +2514,7 @@ def CreatePrsForFile(paravis_instance, file_name, prs_types,
         print "FAILED"
     else:
         # Get view
-        view = pv.GetRenderView()
+        view = pvs.GetRenderView()
 
         # Create required presentations for the proxy
         CreatePrsForProxy(proxy, view, prs_types,