Exemple #1
0
class PVGeoNormalizeArray(NormalizeArray):
    def __init__(self):
        NormalizeArray.__init__(self)

    #### SETTERS AND GETTERS ####

    @smproperty.xml(_helpers.get_input_array_xml(nInputPorts=1, n_arrays=1))
    def SetInputArrayToProcess(self, idx, port, connection, field, name):
        return NormalizeArray.SetInputArrayToProcess(self, idx, port,
                                                     connection, field, name)

    @smproperty.doublevector(name="Multiplier", default_values=1.0)
    def set_multiplier(self, val):
        NormalizeArray.set_multiplier(self, val)

    @smproperty.stringvector(name="New Array Name",
                             default_values="Normalized")
    def set_new_array_name(self, name):
        NormalizeArray.set_new_array_name(self, name)

    @smproperty.xml(
        _helpers.get_drop_down_xml(
            name='Normalization',
            command='set_normalization',
            labels=NormalizeArray.get_normalization_names(),
            help=
            'This is the type of normalization to apply to the input array.',
        ))
    def set_normalization(self, norm):
        NormalizeArray.set_normalization(self, norm)

    @smproperty.xml(
        _helpers.get_property_xml(
            name='Absolute Value',
            command='set_take_absolute_value',
            default_values=False,
            help=
            'This will take the absolute value of the array before normalization.',
        ))
    def set_take_absolute_value(self, flag):
        NormalizeArray.set_take_absolute_value(self, flag)

    @smproperty.doublevector(name="Shifter", default_values=0.0)
    def set_shift(self, sft):
        NormalizeArray.set_shift(self, sft)
Exemple #2
0
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 :class:`PVGeo.filters.NormalizeArray`

"""
import numpy as np
import vista
from vista 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)
################################################################################

# Apply the filter
f = NormalizeArray(normalization='feature_scale', new_name='foo')
output = f.apply(mesh, title)
print(output)

################################################################################
output.plot(scalars='foo')
Exemple #3
0
 def set_shift(self, sft):
     NormalizeArray.set_shift(self, sft)
Exemple #4
0
 def set_take_absolute_value(self, flag):
     NormalizeArray.set_take_absolute_value(self, flag)
Exemple #5
0
 def set_normalization(self, norm):
     NormalizeArray.set_normalization(self, norm)
Exemple #6
0
 def set_new_array_name(self, name):
     NormalizeArray.set_new_array_name(self, name)
Exemple #7
0
 def set_multiplier(self, val):
     NormalizeArray.set_multiplier(self, val)
Exemple #8
0
 def SetInputArrayToProcess(self, idx, port, connection, field, name):
     return NormalizeArray.SetInputArrayToProcess(self, idx, port,
                                                  connection, field, name)
Exemple #9
0
 def __init__(self):
     NormalizeArray.__init__(self)