paraview.simple.Calculator

paraview.simple.Calculator(*input, **params)

The Calculator filter computes a new data array or new point coordinates as a function of existing scalar or vector arrays. If point-centered arrays are used in the computation of a new data array, the resulting array will also be point-centered. Similarly, computations using cell-centered arrays will produce a new cell-centered array. If the function is computing point coordinates, the result of the function must be a three-component vector.

The Calculator interface operates similarly to a scientific calculator. In creating the function to evaluate, the standard order of operations applies. Each of the calculator functions is described below. Unless otherwise noted, enclose the operand in parentheses using the ( and ) buttons.

  • Clear: Erase the current function (displayed in the read-only text box above the calculator buttons).

  • /: Divide one scalar by another. The operands for this function are not required to be enclosed in parentheses.

  • *: Multiply two scalars, or multiply a vector by a scalar (scalar multiple). The operands for this function are not required to be enclosed in parentheses.

  • -: Negate a scalar or vector (unary minus), or subtract one scalar or vector from another. The operands for this function are not required to be enclosed in parentheses.

  • +: Add two scalars or two vectors. The operands for this function are not required to be enclosed in parentheses.

  • sin: Compute the sine of a scalar.

  • cos: Compute the cosine of a scalar.

  • tan: Compute the tangent of a scalar.

  • asin: Compute the arcsine of a scalar.

  • acos: Compute the arccosine of a scalar.

  • atan: Compute the arctangent of a scalar.

  • sinh: Compute the hyperbolic sine of a scalar.

  • cosh: Compute the hyperbolic cosine of a scalar.

  • tanh: Compute the hyperbolic tangent of a scalar.

  • min: Compute minimum of two scalars.

  • max: Compute maximum of two scalars.

  • x^y: Raise one scalar to the power of another scalar. The operands for this function are not required to be enclosed in parentheses.

  • sqrt: Compute the square root of a scalar.

  • exp: Raise e to the power of a scalar.

  • ln: Compute the logarithm of a scalar to the base ‘e’.

  • log10: Compute the logarithm of a scalar to the base 10.

  • ceil: Compute the ceiling of a scalar. floor: Compute the floor of a scalar.

  • abs: Compute the absolute value of a scalar.

  • dot: Compute the dot product of two vectors.

  • cross: Compute cross product of two vectors.

  • mag: Compute the magnitude of a vector.

  • norm: Normalize a vector.

The operands are described below. The digits 0 - 9 and the decimal point are used to enter constant scalar values. iHat, jHat, and kHat are vector constants representing unit vectors in the X, Y, and Z directions, respectively. The scalars menu lists the names of the scalar arrays and the components of the vector arrays of either the point-centered or cell-centered data. The vectors menu lists the names of the point-centered or cell-centered vector arrays. The function will be computed for each point (or cell) using the scalar or vector value of the array at that point (or cell). The filter operates on any type of data set, but the input data set must have at least one scalar or vector array. The arrays can be either point-centered or cell-centered. The Calculator filter’s output is of the same data set type as the input.

The output array type can be specified as an advanced option with the default being of a vtkDoubleArray.

Data Descriptors

AttributeType

This property determines on which types of field data the computation is to be performed on.

CoordinateResults

The value of this property determines whether the results of this computation should be used as point coordinates or as a new array.

Function

This property contains the equation for computing the new array.

FunctionParserType

Hidden property that specifies whether the old (ParaView 5.9 and before) expression parser or new (ParaView 5.10) vtkPVLinearExtrusionFilter is used.

Input

This property specifies the input dataset (vtkDataSet, vtkTable or vtkGraph) to the Calculator filter. The scalar and vector variables may be chosen from this dataset’s arrays.

ReplaceInvalidResults

This property determines whether invalid values in the computation will be replaced with a specific value. (See the ReplacementValue property.)

ReplacementValue

If invalid values in the computation are to be replaced with another value, this property contains that value.

ResultArrayName

This property contains the name for the output array containing the result of this computation.

ResultArrayType

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

ResultNormals

Set whether to output results as point/cell normals. Outputting as normals is only valid with vector results. Point or cell normals are selected using AttributeMode.

ResultTCoords

Set whether to output results as point/cell texture coordinates. Point or cell texture coordinates are selected using AttributeMode. 2-component texture coordinates cannot be generated at this time.

Data Descriptors inherited from Proxy

__dict__

dictionary for instance variables (if defined)

__weakref__

list of weak references to the object (if defined)

Methods

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

Methods inherited from SourceProxy

FileNameChanged(self)

Called when the filename of a source proxy is changed.

GetCellDataInformation(self)

Returns the associated cell data information.

GetDataInformation(self, idx=None)

This method returns a DataInformation wrapper around a vtkPVDataInformation

GetFieldDataInformation(self)

Returns the associated cell data information.

GetPointDataInformation(self)

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.

UpdatePipelineInformation(self)

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.

ListProperties(self)

Returns a list of all property names on this proxy.

SetPropertyWithName(self, pname, arg)

Generic method for setting the value of a property.

__del__(self)

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

__hash__(self)

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.

__iter__(self)

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