class documentation

class Metric(Validatable):

View In Hierarchy

Provides different metrics, used for mapping some field vector properties to some color and alpha range.
Static Method boost_colors "Boosts" an array of color values.
Method __init__ Initializes an empty metric.
Method recalculate Recalculates color and alpha values for field.
Method set Sets the parameters.
Class Variable LengthScale Undocumented
Class Variable LogNormMin Undocumented
Instance Variable alpha_preset Undocumented
Instance Variable color_preset Undocumented
Property colors Returns calculated colors.
Property limits Returns calculated limits.
Static Method _divergence_worker Calculates the divergence values of a list of vectors.
Static Method _norm_worker Calculates the norm values of a list of vectors.
Static Method _normalize_worker Normalizes color and alpha norm values, populates final color values.
Instance Variable _colors Undocumented
Instance Variable _limits Undocumented

Inherited from Validatable:

Method valid.setter
Property valid True if valid, False if invalid
Instance Variable _valid Undocumented
@staticmethod
@ConditionalDecorator(get_jit_enabled(), jit, nopython=True, parallel=True)
def boost_colors(boost, direction, colors):
"Boosts" an array of color values.
Parameters
boost:floatBoost value
direction:floatBoost direction
colors:np.ndarrayColors (ordered list of 4-tuples)
Returns
np.ndarrayColors (ordered list of 4-tuples)
def __init__(self):

Initializes an empty metric.

This class holds a pair of metric presets. Using these metric presets, colors (including alpha channel) and field limits are calculated.

@validator
def recalculate(self, sampling_volume, field, progress_callback):
Recalculates color and alpha values for field.
Parameters
sampling_volume:SamplingVolumeSamplingVolume
field:FieldField
progress_callback:CallableProgress callback
Returns
boolTrue (currently non-interruptable)
def set(self, color_preset, alpha_preset):
Sets the parameters.
Parameters
color_preset:DictColor metric preset (dictionary)
alpha_preset:DictAlpha metric preset (dictionary)
LengthScale: float =

Undocumented

LogNormMin: float =

Undocumented

alpha_preset =

Undocumented

color_preset =

Undocumented

@property
@require_valid
colors: np.ndarray =
Returns calculated colors.
@property
@require_valid
limits: Dict =
Returns calculated limits.
@staticmethod
@ConditionalDecorator(get_jit_enabled(), jit, nopython=True, parallel=True)
def _divergence_worker(sampling_volume_neighborhood_indices, vectors, dL, polarity):
Calculates the divergence values of a list of vectors.
Parameters
sampling_volume_neighborhood_indices:List[np.ndarray]Ordered list of sampling volume neighborhood indices
vectors:np.ndarrayOrdered list of 3D vectors
dL:intLength element
polarity:intPolarity filter (-1: Keep values <= 0; 0: Keep all values; +1: Keep values >= 0)
Returns
np.ndarrayNorm values
@staticmethod
@ConditionalDecorator(get_jit_enabled(), jit, nopython=True, parallel=True)
def _norm_worker(norm_type, vectors):
Calculates the norm values of a list of vectors.
Parameters
norm_type:intNorm type
vectors:np.ndarrayOrdered list of 3D vectors
Returns
np.ndarrayNorm values
@staticmethod
@ConditionalDecorator(get_jit_enabled(), jit, nopython=True, parallel=True)
def _normalize_worker(color_map_id, color_is_log, color_norm_values, color_norm_min, color_norm_max, alpha_is_log, alpha_norm_values, alpha_norm_min, alpha_norm_max, colors):
Normalizes color and alpha norm values, populates final color values.
Parameters
color_map_id:strColor map ID
color_is_log:boolSelects logarithmic normalizer for color
color_norm_valuesColor norm values
color_norm_min:floatMinimum color norm value
color_norm_max:floatMaximum color norm value
alpha_is_log:boolSelects logarithmic normalizer for alpha
alpha_norm_values:np.ndarrayAlpha norm values
alpha_norm_min:floatMinimum alpha norm value
alpha_norm_max:floatMaximum alpha norm value
colors:np.ndarrayColor value list to populate (list of 4D vectors)
Returns
np.ndarrayColor values (list of 4D vectors)
_colors =

Undocumented

_limits =

Undocumented