paraview.simple.PythonCalculator(*input, **params)
This filter

uses Python to calculate an expression. It depends heavily on the numpy and paraview.vtk modules. To use the parallel functions, mpi4py is also necessary. The expression is evaluated and the resulting scalar value or numpy array is added to the output as an array. See numpy integration and python calculator documentation for the list of available functions. This filter tries to make it easy for the user to write expressions by defining certain variables. The filter tries to assign each array to a variable of the same name. If the name of the array is not a valid Python variable, it may be accessed through a variable with a sanitized version of that array name consisting of only ‘_’ and the alphanumeric characters in the name joined together with no spaces. Point coordinates from datasets that explicitly define them can be accessed using the variable named ‘points’.

Data Descriptors


This property controls which input arrays are defined as variables. This is also the default for output association. Depending on the operation, output association may vary.


The name of the output array.


If this property is set to true, all the cell and point arrays from first input are copied to the output.


The Python expression evaluated during execution. Set of potentially available variables [inputs, points, t_value, t_index, FieldData, PointData, CellData] (i.e.: “Momentum: (%f, %f, %f)” % (XMOM[t_index,0], YMOM[t_index,0], ZMOM[t_index,0]) ). Additional variables, using the fmt library’s syntax, are {timevalue}, and {timeindex}. These variables are always available, and their default values are 0, and 0 respectively.


Set the input of the filter.


The multiline Python expression executed, that should return the output array using the Python “return” keyword. The variables that can be used here are the exact same as the ones available in the single-line expression editor.


This property determines what array type to output. The default is a vtkDoubleArray.


If this property is set to true, the expression is a multiline script that returns the output array.

Data Descriptors inherited from Proxy


dictionary for instance variables (if defined)


list of weak references to the object (if defined)


Initialize = aInitialize(self, connection=None, update=True)

Methods inherited from SourceProxy


Called when the filename of a source proxy is changed.


Returns the associated cell data information.

GetDataInformation(self, idx=None)

This method returns a DataInformation wrapper around a vtkPVDataInformation


Returns the associated cell data information.


Returns the associated point data information.

UpdatePipeline(self, time=None)

This method updates the server-side VTK pipeline and the associated data information. Make sure to update a source to validate the output meta-data.


This method updates the meta-data of the server-side VTK pipeline and the associated information properties

__getitem__(self, idx)

Given a slice, int or string, returns the corresponding output port

Methods inherited from Proxy

GetProperty(self, name)

Given a property name, returns the property object.

GetPropertyValue(self, name)

Returns a scalar for properties with 1 elements, the property itself for vectors.

InitializeFromProxy(self, aProxy, update=True)

Constructor. Assigns proxy to self.SMProxy, updates the server object as well as register the proxy in _pyproxies dictionary.


Returns a list of all property names on this proxy.

SetPropertyWithName(self, pname, arg)

Generic method for setting the value of a property.


Destructor. Cleans up all observers as well as remove the proxy from the _pyproxies dictionary

__eq__(self, other)

Returns true if the underlying SMProxies are the same.

__getattr__(self, name)

With the exception of a few overloaded methods, returns the SMProxy method


Return hash(self).

__init__(self, **args)

Default constructor. It can be used to initialize properties by passing keyword arguments where the key is the name of the property. In addition registrationGroup and registrationName (optional) can be specified (as keyword arguments) to automatically register the proxy with the proxy manager.


Creates an iterator for the properties.

__ne__(self, other)

Returns false if the underlying SMProxies are the same.

__setattr__(self, name, value)

Implement setattr(self, name, value).

add_attribute(self, name, value)

For the full list of servermanager proxies, please refer to Available readers, sources, writers, filters and animation cues