Math Operationsο
Array Mathο
- class PVGeo.filters.math.ArrayMath(**kwargs)[source]ο
Bases:
FilterPreserveTypeBase
This filter allows the user to select two input data arrays on which to perform math operations. The input arrays are used in their order of selection for the operations.
- Parameters:
multiplier (float) β a static shifter/scale factor across the array after normalization.
new_name (str) β The new arrayβs string name
operation (str, int, or callable) β The operation as a string key, int index, or callable method
Available Math Operations:
add: This adds the two data arrays together
subtract: This subtracts input array 2 from input array 1
multiply: Multiplies the two data arrays together
divide: Divide input array 1 by input array 2 (arr1/arr2)
correlate: Use np.correlate(arr1, arr2, mode=βsameβ)
- RequestData(request, inInfo, outInfo)[source]ο
Used by pipeline to perform operation and generate output
- SetInputArrayToProcess(idx, port, connection, field, name)[source]ο
Used to set the input array(s)
- Parameters:
idx (int) β the index of the array to process
port (int) β input port (use 0 if unsure)
connection (int) β the connection on the port (use 0 if unsure)
field (int) β the array field (0 for points, 1 for cells, 2 for field, and 6 for row)
name (int) β the name of the array
- static _correlate(arr1, arr2)[source]ο
Use
np.correlate()
onmode='same'
on two selected arrays from one input.
- _math_up(pdi, pdo)[source]ο
Make sure to pass array names and integer associated fields. Use helpers to get these properties.
- apply(input_data_object, array_name_0, array_name_1)[source]ο
Run the algorithm on an input data object, specifying array names
- static get_operation(idx)[source]ο
Gets a math operation based on an index in the keys
- Returns:
the math operation method
- Return type:
callable
- static get_operation_names()[source]ο
Gets a list of the math operation keys
- Returns:
the keys for getting the math operations
- Return type:
list(str)
- static get_operations()[source]ο
Returns the math operation methods as callable objects in a dictionary
Arrays To RGBAο
- class PVGeo.filters.math.ArraysToRGBA(**kwargs)[source]ο
Bases:
FilterPreserveTypeBase
Use arrays from input data object to set an RGBA array. Sets colors and transparencies.
- SetInputArrayToProcess(idx, port, connection, field, name)[source]ο
Used to set the input array(s)
- Parameters:
idx (int) β the index of the array to process
port (int) β input port (use 0 if unsure)
connection (int) β the connection on the port (use 0 if unsure)
field (int) β the array field (0 for points, 1 for cells, 2 for field, and 6 for row)
name (int) β the name of the array
Normalize Arrayο
- class PVGeo.filters.math.NormalizeArray(**kwargs)[source]ο
Bases:
FilterPreserveTypeBase
This filter allows the user to select an array from the input data set to be normalized. The filter will append another array to that data set for the output. The user can specify how they want to rename the array, can choose a multiplier, and can choose from several types of common normalizations (more functionality added as requested).
- Parameters:
multiplier (float) β a static shifter/scale factor across the array after normalization.
new_name (str) β The new arrayβs string name
absolute (bool) β
normalization (str, int, or callable) β The operation as a string key, integer index, or callable method
Normalization Types:
feature_scale: Feature Scale
standard_score: tandard Score
log10: Natural Log
natural_log: Log Base 10
just_multiply: Only Multiply by Multiplier
- SetInputArrayToProcess(idx, port, connection, field, name)[source]ο
Used to set the input array(s)
- Parameters:
idx (int) β the index of the array to process
port (int) β input port (use 0 if unsure)
connection (int) β the connection on the port (use 0 if unsure)
field (int) β the array field (0 for points, 1 for cells, 2 for field, and 6 for row)
name (int) β the name of the array
- apply(input_data_object, array_name)[source]ο
Run the algorithm on an input data object, specifying the array
- static get_array_range(pdi, field, name)[source]ο
Returns a tuple of the range for a
vtkDataArray
on avtkDataObject
.
- static get_normalization(idx)[source]ο
Gets a normalization based on an index in the keys
- Returns:
the normalization method
- Return type:
callable
- static get_normalization_names()[source]ο
Gets a list of the normalization keys
- Returns:
the keys for getting the normalizations
- Return type:
list(str)
- static get_normalizations()[source]ο
All Available normalizations
- Returns:
dictionary of callable methods for normalizing an array
- Return type:
dict
- set_multiplier(val)[source]ο
This is a static shifter/scale factor across the array after normalization.
Percent Thresholdο
- class PVGeo.filters.math.PercentThreshold(percent=50, invert=False, **kwargs)[source]ο
Bases:
FilterBase
Allows user to select a percent of the data range to threshold. This will find the data range of the selected input array and remove the bottom percent. This can be reversed using the invert property.
- SetInputArrayToProcess(idx, port, connection, field, name)[source]ο
Used to set the input array(s)
- Parameters:
idx (int) β the index of the array to process
port (int) β input port (use 0 if unsure)
connection (int) β the connection on the port (use 0 if unsure)
field (int) β the array field (0 for points, 1 for cells, 2 for field, and 6 for row)
name (int) β the name of the array
- apply(input_data_object, array_name)[source]ο
Run the algorithm on an input data object, specifying the array