Normalize Array

This example will demonstrate how to perform a normalization or any custom mathematical operation on a single data array for an input data set.

This filter allow 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 two types of common normalizations: Feature Scaling and Standard Score.

This example demos PVGeo.filters.NormalizeArray

import numpy as np
import pyvista
from pyvista import examples
import PVGeo
from PVGeo.filters import NormalizeArray

Create some input data. this can be any vtkDataObject

mesh = examples.load_uniform()
title = 'Spatial Point Data'
mesh.plot(scalars=title)
../../_images/sphx_glr_normalize-array_001.png
# Apply the filter
f = NormalizeArray(normalization='feature_scale', new_name='foo')
output = f.apply(mesh, title)
print(output)

Out:

UniformGrid (0x7f23c252b8e8)
  N Cells:      729
  N Points:     1000
  X Bounds:     0.000e+00, 9.000e+00
  Y Bounds:     0.000e+00, 9.000e+00
  Z Bounds:     0.000e+00, 9.000e+00
  Dimensions:   10, 10, 10
  Spacing:      1.000e+00, 1.000e+00, 1.000e+00
  N Scalars:    3
output.plot(scalars='foo')
../../_images/sphx_glr_normalize-array_002.png

Total running time of the script: ( 0 minutes 2.292 seconds)

Gallery generated by Sphinx-Gallery