class documentation

class Metric(Validatable):

Constructor: Metric()

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 No summary
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: float, direction: float, colors: np.ndarray) -> np.ndarray:

"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.

def recalculate(self, sampling_volume: SamplingVolume, field: Field, progress_callback: Callable) -> bool:

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: dict, alpha_preset: dict):

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: list[np.ndarray], vectors: np.ndarray, dL: int, polarity: int) -> np.ndarray:

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: int, vectors: np.ndarray) -> np.ndarray:

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: str, color_is_log: bool, color_norm_values, color_norm_min: float, color_norm_max: float, alpha_is_log: bool, alpha_norm_values: np.ndarray, alpha_norm_min: float, alpha_norm_max: float, colors: np.ndarray) -> np.ndarray:

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: np.ndarray =

Undocumented

_limits: dict =

Undocumented