simple Module

For generated server-side proxies, please refer to Available readers, sources, writers, filters and animation cues

simple is a module for using paraview server manager in Python. It provides a simple convenience layer to functionality provided by the C++ classes wrapped to Python as well as the servermanager module.

A simple example:

from paraview.simple import *

# Create a new sphere proxy on the active connection and register it
# in the sources group.
sphere = Sphere(ThetaResolution=16, PhiResolution=32)

# Apply a shrink filter
shrink = Shrink(sphere)

# Turn the visiblity of the shrink object on.
Show(shrink)

# Render the scene
Render()

Create a camera link between two view proxies. A name must be given so that the link can be referred to by name. If a link with the given name already exists it will be removed first.

paraview.simple.AnimateReader(reader=None, view=None, filename=None)[source]

This is a utility function that, given a reader and a view animates over all time steps of the reader. If the optional filename is provided, a movie is created (type depends on the extension of the filename.

paraview.simple.AssignLookupTable(arrayObject, LUTName, rangeOveride=[])[source]

Assign a lookup table to an array by lookup table name. The array may ber obtained from a ParaView source in it’s point or cell data. The lookup tables available in ParaView’s GUI are loaded by default. To get a list of the available lookup table names see GetLookupTableNames. To load a custom lookup table see LoadLookupTable.

paraview.simple.ClearSelection(proxy=None)[source]

Clears the selection on the active source.

paraview.simple.ColorBy(rep=None, value=None)[source]

Set scalar color. This will automatically setup the color maps and others necessary state for the representations. ‘rep’ must be the display properties proxy i.e. the value returned by GetDisplayProperties() function. If none is provided the display properties for the active source will be used, if possible.

paraview.simple.Connect(ds_host=None, ds_port=11111, rs_host=None, rs_port=11111)[source]

Creates a connection to a server. Example usage:

> Connect("amber") # Connect to a single server at default port
> Connect("amber", 12345) # Connect to a single server at port 12345
> Connect("amber", 11111, "vis_cluster", 11111) # connect to data server, render server pair
paraview.simple.Create2DRenderView(detachedFromLayout=False, **params)[source]

“Create the standard 3D render view with the 2D interaction mode turned ON. See CreateView for arguments documentation

paraview.simple.CreateBarChartView(detachedFromLayout=False, **params)[source]

“Create Bar Chart view. See CreateView for arguments documentation

paraview.simple.CreateComparativeBarChartView(detachedFromLayout=False, **params)[source]

“Create comparative Bar Chart view. See CreateView for arguments documentation

paraview.simple.CreateComparativeRenderView(detachedFromLayout=False, **params)[source]

“Create Comparative view. See CreateView for arguments documentation

paraview.simple.CreateComparativeXYPlotView(detachedFromLayout=False, **params)[source]

“Create comparative XY plot Chart view. See CreateView for arguments documentation

paraview.simple.CreateLayout(name=None)[source]

Create a new layout with no active view.

paraview.simple.CreateLookupTable(**params)[source]

Create and return a lookup table. Optionally, parameters can be given to assign to the lookup table.

paraview.simple.CreateParallelCoordinatesChartView(detachedFromLayout=False, **params)[source]

“Create Parallele coordinate Chart view. See CreateView for arguments documentation

paraview.simple.CreatePiecewiseFunction(**params)[source]

Create and return a piecewise function. Optionally, parameters can be given to assign to the piecewise function.

paraview.simple.CreateRenderView(detachedFromLayout=False, **params)[source]

“Create standard 3D render view. See CreateView for arguments documentation

paraview.simple.CreateScalarBar(**params)[source]

Create and return a scalar bar widget. The returned widget may be added to a render view by appending it to the view’s representations The widget must have a valid lookup table before it is added to a view. It is possible to pass the lookup table (and other properties) as arguments to this method:

lt = MakeBlueToRedLt(3.5, 7.5)
bar = CreateScalarBar(LookupTable=lt, Title="Velocity")
GetRenderView().Representations.append(bar)

By default the returned widget is selectable and resizable.

paraview.simple.CreateView(view_xml_name, detachedFromLayout=False, **params)[source]

Creates and returns the specified proxy view based on its name/label. If detachedFromLayout is true, the view will no be grabbed by the layout hence not visible unless it is attached after. This also set params keywords arguments as view properties.

paraview.simple.CreateWriter(filename, proxy=None, **extraArgs)[source]

Creates a writer that can write the data produced by the source proxy in the given file format (identified by the extension). If no source is provided, then the active source is used. This doesn’t actually write the data, it simply creates the writer and returns it.

paraview.simple.CreateXYPlotView(detachedFromLayout=False, **params)[source]

Create XY plot Chart view. See CreateView for arguments documentation

paraview.simple.Delete(proxy=None)[source]

Deletes the given pipeline object or the active source if no argument is specified.

paraview.simple.Disconnect(ns=None, force=True)[source]

Free the current active session

paraview.simple.ExportView(filename, view=None, **params)[source]

Export a view to the specified output file.

paraview.simple.ExtendFileSeries(proxy=None)[source]

For a reader proxy that supports reading files series, detect any new files added to the series and update the reader’s filename property. If no proxy is provided, active source is used.

paraview.simple.FindSource(name)[source]

Return a proxy base on the name that was used to register it into the ProxyManager. Example usage:

Cone(guiName='MySuperCone')
Show()
Render()
myCone = FindSource('MySuperCone')
paraview.simple.FindView(name)[source]

Return a view proxy on the name that was used to register it into the ProxyManager. Example usage:

CreateRenderView(guiName='RenderView1')
myView = FindSource('RenderView1')
paraview.simple.FindViewOrCreate(name, viewtype)[source]

Returns the view, if a view with the given name exists and is of the the given type, otherwise creates a new view of the requested type.

paraview.simple.GetActiveCamera()[source]

Returns the active camera for the active view. The returned object is an instance of vtkCamera.

paraview.simple.GetActiveSource()[source]

Returns the active source.

paraview.simple.GetActiveView()[source]

Returns the active view.

paraview.simple.GetActiveViewOrCreate(viewtype)[source]

Returns the active view, if the active view is of the given type, otherwise creates a new view of the requested type.

paraview.simple.GetAnimationScene()[source]

Returns the application-wide animation scene. ParaView has only one global animation scene. This method provides access to that. Users are free to create additional animation scenes directly, but those scenes won’t be shown in the ParaView GUI.

paraview.simple.GetAnimationTrack(propertyname_or_property, index=None, proxy=None)[source]

Returns an animation cue for the property. If one doesn’t exist then a new one will be created. Typical usage:

track = GetAnimationTrack("Center", 0, sphere) or
track = GetAnimationTrack(sphere.GetProperty("Radius")) or

# this returns the track to animate visibility of the active source in
# all views.
track = GetAnimationTrack("Visibility")

For animating properties on implicit planes etc., use the following signatures:

track = GetAnimationTrack(slice.SliceType.GetProperty("Origin"), 0) or
track = GetAnimationTrack("Origin", 0, slice.SliceType)
paraview.simple.GetCameraTrack(view=None)[source]

Returns the camera animation track for the given view. If no view is specified, active view will be used. If no exisiting camera animation track is found, a new one will be created.

paraview.simple.GetColorTransferFunction(arrayname, **params)[source]

Get the color transfer function used to mapping a data array with the given name to colors. This may create a new color transfer function if none exists, or return an existing one

paraview.simple.GetDisplayProperties(proxy=None, view=None)[source]

“Given a pipeline object and view, returns the corresponding representation object. If pipeline object and/or view are not specified, active objects are used.

paraview.simple.GetDisplayProperty(*arguments, **keywords)[source]

Same as GetProperty, except that if no ‘proxy’ is passed, it will use the active display properties, rather than the active source

paraview.simple.GetLayout(view=None)[source]

Return the layout containing the give view, if any. If no view is specified, active view is used.

paraview.simple.GetLayoutByName(name)[source]

Return the first layout with the given name, if any.

paraview.simple.GetLayouts()[source]

Returns the layout proxies on the active session. Layout proxies are used to place views in a grid.

paraview.simple.GetLookupTableForArray(arrayname, num_components, **params)[source]

Used to get an existing lookuptable for a array or to create one if none exists. Keyword arguments can be passed in to initialize the LUT if a new one is created. * DEPRECATED *: Use GetColorTransferFunction instead

paraview.simple.GetLookupTableNames()[source]

Return a list containing the currently available lookup table names. A name maybe used to assign a lookup table to an array. See AssignLookupTable.

paraview.simple.GetOpacityTransferFunction(arrayname, **params)[source]

Get the opacity transfer function used to mapping a data array with the given name to opacity. This may create a new opacity transfer function if none exists, or return an existing one

paraview.simple.GetParaViewSourceVersion()[source]

Returns the paraview source version string e.g. ‘paraview version x.x.x, Date: YYYY-MM-DD’.

paraview.simple.GetParaViewVersion()[source]

Returns the version of the ParaView build

paraview.simple.GetProperty(*arguments, **keywords)[source]

Get one property of the given pipeline object. If keywords are used, you can set the proxy and the name of the property that you want to get like in the following example:

GetProperty({proxy=sphere, name="Radius"})
If it’s arguments that are used, then you have two case:
  • if only one argument is used that argument will be the property name.
  • if two arguments are used then the first one will be the proxy and the second one the property name.

Several example are given below:

GetProperty({name="Radius"})
GetProperty({proxy=sphereProxy, name="Radius"})
GetProperty( sphereProxy, "Radius" )
GetProperty( "Radius" )
paraview.simple.GetRenderView()[source]

Returns the active view if there is one. Else creates and returns a new view.

paraview.simple.GetRenderViews()[source]

Returns all render views as a list.

paraview.simple.GetRepresentation(proxy=None, view=None)[source]

“Given a pipeline object and view, returns the corresponding representation object. If pipeline object and view are not specified, active objects are used.

paraview.simple.GetRepresentations()[source]

Returns all representations (display properties).

paraview.simple.GetScalarBar(ctf, view=None)[source]

Returns the scalar bar for color transfer function in the given view. If view is None, the active view will be used, if possible. This will either return an existing scalar bar or create a new one.

paraview.simple.GetSources()[source]

Given the name of a source, return its Python object.

paraview.simple.GetTimeKeeper()[source]

Returns the time-keeper for the active session. Timekeeper is often used to manage time step information known to the ParaView application.

paraview.simple.GetTimeTrack()[source]

Returns the animation track used to control the time requested from all readers/filters during playback. This is the “TimeKeeper - Time” track shown in ParaView’s ‘Animation View’.

paraview.simple.GetViewProperties(view=None)[source]

“Same as GetActiveView(), this API is provided just for consistency with GetDisplayProperties().

paraview.simple.GetViewProperty(*arguments, **keywords)[source]

Same as GetProperty, except that if no ‘proxy’ is passed, it will use the active view properties, rather than the active source

paraview.simple.GetViews(viewtype=None)[source]

Returns all views. If viewtype is specified, only the views of the specified type are returned

paraview.simple.GetViewsInLayout(layout=None)[source]

Returns a list of views in the given layout. If not layout is specified, the layout for the active view is used, if possible.

paraview.simple.Hide(proxy=None, view=None)[source]

Turns the visibility of a given pipeline object off in the given view. If pipeline object and/or view are not specified, active objects are used.

paraview.simple.Hide3DWidgets(proxy=None)[source]

If possible in the current environment, this method will request the application to hide the 3D widget(s) for proxy

paraview.simple.HideAll(view=None)[source]

Hide all pipeline sources in the given view. If view is not specified, active view is used.

paraview.simple.HideScalarBarIfNotNeeded(lut, view=None)[source]

Hides the given scalar bar if it is not used by any of the displayed data.

paraview.simple.HideUnusedScalarBars(view=None)[source]

Hides all unused scalar bars from the view. A scalar bar is used if some data is shown in that view that is coloring using the transfer function shown by the scalar bar.

paraview.simple.ImportPresets(filename)[source]

Import presets from a file. The file can be in the legacy color map xml format or in the new JSON format. Returns True on success.

paraview.simple.Interact(view=None)[source]

Call this method to start interacting with a view. This method will block till the interaction is done. This method will simply return if the local process cannot support interactions.

paraview.simple.LoadCustomFilters(filename, ns=None)[source]

Loads a custom filter XML file and updates this module with new constructors if any. If you loaded the simple module with from paraview.simple import *, make sure to pass globals() as an argument.

paraview.simple.LoadDistributedPlugin(pluginname, remote=True, ns=None)[source]

Loads a plugin that’s distributed with the executable. This uses the information known about plugins distributed with ParaView to locate the shared library for the plugin to load. Raises a RuntimeError if the plugin was not found.

paraview.simple.LoadLookupTable(fileName)[source]

Read the lookup tables in the named file and append them to the global collection of lookup tables. The newly loaded lookup tables may then be used with AssignLookupTable function.

paraview.simple.LoadPlugin(filename, remote=True, ns=None)[source]

Loads a ParaView plugin and updates this module with new constructors if any. The remote argument (default to True) is to specify whether the plugin will be loaded on client (remote=False) or on server (remote=True). If you loaded the simple module with from paraview.simple import *, make sure to pass globals() as an argument:

LoadPlugin("myplugin", False, globals()) # to load on client
LoadPlugin("myplugin", True, globals())  # to load on server
LoadPlugin("myplugin", ns=globals())     # to load on server

Otherwise, the new functions will not appear in the global namespace.

paraview.simple.LoadState(filename, connection=None)[source]
paraview.simple.LoadXML(xmlstring, ns=None)[source]

Given a server manager XML as a string, parse and process it. If you loaded the simple module with from paraview.simple import *, make sure to pass globals() as the second arguments: LoadXML(xmlstring, globals()) Otherwise, the new functions will not appear in the global namespace.

paraview.simple.LocateView(displayProperties=None)[source]

Given a displayProperties object i.e. the object returned by GetDisplayProperties() or Show() functions, this function will locate a view to which the displayProperties object corresponds.

paraview.simple.MakeBlueToRedLT(min, max)[source]

Create a LookupTable that go from blue to red using the scalar range provided by the min and max arguments.

paraview.simple.OpenDataFile(filename, **extraArgs)[source]

Creates a reader to read the give file, if possible. This uses extension matching to determine the best reader possible. If a reader cannot be identified, then this returns None.

paraview.simple.ReloadFiles(proxy=None)[source]

Forces the proxy to reload the data files. If no proxy is provided, active source is used.

Remove a camera link with the given name.

paraview.simple.RemoveLayout(proxy=None)[source]

Remove the provided layout, if none is provided, remove the layout containing the active view. If it is the last layout it will create a new one with the same name as the removed one.

paraview.simple.RemoveViewsAndLayouts()[source]
paraview.simple.RenameLayout(newName, proxy=None)[source]

Renames the given layout. If the given proxy is not registered in the layout group this method will have no effect. If no layout is provided, the active layout is used.

paraview.simple.RenameProxy(proxy, group, newName)[source]

Renames the given proxy.

paraview.simple.RenameSource(newName, proxy=None)[source]

Renames the given source. If the given proxy is not registered in the sources group this method will have no effect. If no source is provided, the active source is used.

paraview.simple.RenameView(newName, proxy=None)[source]

Renames the given view. If the given proxy is not registered in the views group this method will have no effect. If no view is provided, the active view is used.

paraview.simple.Render(view=None)[source]

Renders the given view (default value is active view)

paraview.simple.RenderAllViews()[source]

Render all views

paraview.simple.ResetCamera(view=None)[source]

Resets the settings of the camera to preserver orientation but include the whole scene. If an argument is not provided, the active view is used.

paraview.simple.ReverseConnect(port=11111)[source]

Create a reverse connection to a server. Listens on port and waits for an incoming connection from the server.

paraview.simple.SaveData(filename, proxy=None, **extraArgs)[source]

Save data produced by ‘proxy’ in a file. If no proxy is specified the active source is used. Properties to configure the writer can be passed in as keyword arguments. Example usage:

SaveData("sample.pvtp", source0)
SaveData("sample.csv", FieldAssociation="Points")
paraview.simple.SaveScreenshot(filename, view=None, layout=None, magnification=None, quality=None, **params)[source]
paraview.simple.SaveState(filename)[source]
paraview.simple.SelectCells(query=None, proxy=None)[source]

Select cells satisfying the query. If query is None, then all cells are selected. If proxy is None, then the active source is used.

paraview.simple.SelectPoints(query=None, proxy=None)[source]

Select points satisfying the query. If query is None, then all points are selected. If proxy is None, then the active source is used.

paraview.simple.SetActiveConnection(connection=None, ns=None)[source]

Set the active connection. If the process was run without multi-server enabled and this method is called with a non-None argument while an ActiveConnection is present, it will raise a RuntimeError.

paraview.simple.SetActiveSource(source)[source]

Sets the active source.

paraview.simple.SetActiveView(view)[source]

Sets the active view.

paraview.simple.SetDisplayProperties(proxy=None, view=None, **params)[source]

Sets one or more display properties of the given pipeline object. If an argument is not provided, the active source is used. Pass a list of property_name=value pairs to this function to set property values. For example:

SetProperties(Color=[1, 0, 0], LineWidth=2)
paraview.simple.SetProperties(proxy=None, **params)[source]

Sets one or more properties of the given pipeline object. If an argument is not provided, the active source is used. Pass a list of property_name=value pairs to this function to set property values. For example:

SetProperties(Center=[1, 2, 3], Radius=3.5)
paraview.simple.SetViewProperties(view=None, **params)[source]

Sets one or more properties of the given view. If an argument is not provided, the active view is used. Pass a list of property_name=value pairs to this function to set property values. For example:

SetProperties(Background=[1, 0, 0], UseImmediateMode=0)
paraview.simple.Show(proxy=None, view=None, **params)[source]

Turns the visibility of a given pipeline object on in the given view. If pipeline object and/or view are not specified, active objects are used.

paraview.simple.Show3DWidgets(proxy=None)[source]

If possible in the current environment, this method will request the application to show the 3D widget(s) for proxy

paraview.simple.UpdatePipeline(time=None, proxy=None)[source]

Updates (executes) the given pipeline object for the given time as necessary (i.e. if it did not already execute). If no source is provided, the active source is used instead.

paraview.simple.UpdateScalarBars(view=None)[source]

Hides all unused scalar bar and shows used scalar bars. A scalar bar is used if some data is shown in that view that is coloring using the transfer function shown by the scalar bar.

paraview.simple.WriteAnimation(filename, **params)[source]

Writes the current animation as a file. Optionally one can specify arguments that qualify the saved animation files as keyword arguments. Accepted options are as follows:

  • Magnification (integer) : set the maginification factor for the saved animation.
  • Quality (0 [worst] or 1 or 2 [best]) : set the quality of the generated movie (if applicable).
  • Subsampling (integer) : setting whether the movie encoder should use subsampling of the chrome planes or not, if applicable. Since the human eye is more sensitive to brightness than color variations, subsampling can be useful to reduce the bitrate. Default value is 0.
  • BackgroundColor (3-tuple of doubles) : set the RGB background color to use to fill empty spaces in the image.
  • FrameRate (double): set the frame rate (if applicable).
  • StartFileCount (int): set the first number used for the file name (23 => i.e. image-0023.png).
  • PlaybackTimeWindow ([double, double]): set the time range that should be used to play a subset of the total animation time. (By default the whole application will play).
paraview.simple.WriteAnimationGeometry(filename, view=None)[source]

Save the animation geometry from a specific view to a file specified. The animation geometry is written out as a PVD file. If no view is specified, the active view will be used of possible.

paraview.simple.WriteImage(filename, view=None, **params)[source]

Saves the given view (or the active one if none is given) as an image. Optionally, you can specify the writer and the magnification using the Writer and Magnification named arguments. For example:

WriteImage("foo.mypng", aview, Writer=vtkPNGWriter, Magnification=2)

If no writer is provided, the type is determined from the file extension. Currently supported extensions are png, bmp, ppm, tif, tiff, jpg and jpeg. The writer is a VTK class that is capable of writing images. Magnification is used to determine the size of the written image. The size is obtained by multiplying the size of the view with the magnification. Rendering may be done using tiling to obtain the correct size without resizing the view.

** DEPRECATED: Use SaveScreenshot() instead. **

paraview.simple.demo1()[source]

Simple demo that create the following pipeline:

sphere - shrink +
cone            + > append
paraview.simple.demo2(fname='/Users/berk/Work/ParaView/ParaViewData/Data/disk_out_ref.ex2')[source]

This demo shows the use of readers, data information and display properties.