holoviews.operation.normalization module#

Data normalization operations.

Normalizing input data into a valid range is a common operation and often required before further processing. The semantics of normalization are dependent on the element type being normalized making it difficult to provide a general and consistent interface.

The Normalization class is used to define such an interface and subclasses are used to implement the appropriate normalization operations per element type. Unlike display normalization, data normalizations result in transformations to the stored data within each element.

class holoviews.operation.normalization.Normalization(*, data_range, keys, ranges, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Base class for all normalization operation.

This class standardizes how normalization is specified using the ranges and keys parameter. The ranges parameter is designed to be very flexible, allowing a concise description for simple normalization while allowing complex key- and element- specific normalization to also be specified.

Parameter Definitions


Parameters inherited from:

holoviews.core.operation.Operation: group, dynamic, input_ranges, link_inputs, streams

data_range = Boolean(default=False, label='Data range')

Whether normalization is allowed to use the minimum and maximum values of the existing data to infer an appropriate range

ranges = ClassSelector(allow_None=True, class_=(<class 'dict'>, <class 'list'>), default={}, label='Ranges')

The simplest value of this parameter is None to skip all normalization. The next simplest value is an empty dictionary to only applies normalization to Dimensions with explicitly declared ranges. The next most common specification is a dictionary of values and tuple ranges. The value keys are the names of the dimensions to be normalized and the tuple ranges are of form (lower-bound, upper-bound). For instance, you could specify: {‘Height’:(0, 200), ‘z’:(0,1)} In this case, any element with a ‘Height’ or ‘z’ dimension (or both) will be normalized to the supplied ranges. Finally, element-specific normalization may also be specified by supplying a match tuple of form (<type>, <group>, <label>). A 1- or 2-tuple may be supplied by omitting the <group>, <label> or just the <label> components respectively. This tuple key then uses the dictionary value-range specification described above. For instance, you could normalize only the Image elements of group pattern using: {(‘Image’,’Pattern’):{‘Height’:(0, 200), ‘z’:(0,1)}}) Key-wise normalization is possible for all these formats by supplying a list of such dictionary specification that will then be zipped with the keys parameter (if specified).

keys = List(allow_None=True, bounds=(0, None), label='Keys')

If supplied, this list of keys is zipped with the supplied list of ranges. These keys are used to supply key specific normalization for HoloMaps containing matching key values, enabling per-element normalization.

get_ranges(element, key)[source]#

Method to get the appropriate normalization range dictionary given a key and element.

process_element(element, key, ranges=None, keys=None, **params)[source]#

The process_element method allows a single element to be operated on given an externally supplied key.

class holoviews.operation.normalization.raster_normalization(*, data_range, keys, ranges, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Normalization

Normalizes elements of type Raster.

For Raster elements containing (NxM) data, this will normalize the array/matrix into the specified range if value_dimension matches a key in the ranges dictionary.

For elements containing (NxMxD) data, the (NxM) components of the third dimensional are normalized independently if the corresponding value dimensions are selected by the ranges dictionary.

Parameter Definitions


Parameters inherited from:

holoviews.core.operation.Operation: group, dynamic, input_ranges, link_inputs, streams

holoviews.operation.normalization.Normalization: data_range, ranges, keys

class holoviews.operation.normalization.subcoordinate_group_ranges(*, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Compute the data range group-wise in a subcoordinate_y overlay, and set the dimension range of each Chart element based on the value computed for its group.

This operation is useful to visually apply a group-wise min-max normalisation.

Parameter Definitions


Parameters inherited from:

holoviews.core.operation.Operation: group, dynamic, input_ranges, link_inputs, streams