holoviews.operation Package#


operation Package#

class holoviews.operation.Compositor(pattern, operation, group, mode, transfer_options=False, transfer_parameters=False, output_type=None, backends=None, **kwargs)[source]#

Bases: Parameterized

A Compositor is a way of specifying an operation to be automatically applied to Overlays that match a specified pattern upon display.

Any Operation that takes an Overlay as input may be used to define a compositor.

For instance, a compositor may be defined to automatically display three overlaid monochrome matrices as an RGB image as long as the values names of those matrices match ‘R’, ‘G’ and ‘B’.

mode = param.ObjectSelector(allow_refs=False, default=’data’, label=’Mode’, names={}, nested_refs=False, objects=[‘data’, ‘display’], rx=<param.reactive.reactive_ops object at 0x72aba58c57b0>)

The mode of the Compositor object which may be either ‘data’ or ‘display’.

backends = param.List(allow_refs=False, bounds=(0, None), default=[], label=’Backends’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58c5510>)

Defines which backends to apply the Compositor for.

operation = param.Parameter(allow_None=True, allow_refs=False, label=’Operation’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58c57b0>)

The Operation to apply when collapsing overlays.

pattern = param.String(allow_refs=False, default=’’, label=’Pattern’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58c5cc0>)

The overlay pattern to be processed. An overlay pattern is a sequence of elements specified by dotted paths separated by * . For instance the following pattern specifies three overlaid matrices with values of ‘RedChannel’, ‘GreenChannel’ and ‘BlueChannel’ respectively: ‘Image.RedChannel * Image.GreenChannel * Image.BlueChannel. This pattern specification could then be associated with the RGB operation that returns a single RGB matrix for display.

group = param.String(allow_None=True, allow_refs=False, default=’’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58c5810>)

The group identifier for the output of this particular compositor

kwargs = param.Dict(allow_None=True, allow_refs=False, class_=<class ‘dict’>, label=’Kwargs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58c50c0>)

Optional set of parameters to pass to the operation.

transfer_options = param.Boolean(allow_refs=False, default=False, label=’Transfer options’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58c5c90>)

Whether to transfer the options from the input to the output.

transfer_parameters = param.Boolean(allow_refs=False, default=False, label=’Transfer parameters’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58c50f0>)

Whether to transfer plot options which match to the operation.

apply(value, input_ranges, backend=None)[source]#

Apply the compositor on the input with the given input ranges.

classmethod collapse(holomap, ranges=None, mode='data')[source]#

Given a map of Overlays, apply all applicable compositors.

classmethod collapse_element(overlay, ranges=None, mode='data', backend=None)[source]#

Finds any applicable compositor and applies it.

classmethod map(obj, mode='data', backend=None)[source]#

Applies compositor operations to any HoloViews element or container using the map method.

match_level(overlay)[source]#

Given an overlay, return the match level and applicable slice of the overall overlay. The level an integer if there is a match or None if there is no match.

The level integer is the number of matching components. Higher values indicate a stronger match.

property output_type#

Returns the operation output_type unless explicitly overridden in the kwargs.

classmethod strongest_match(overlay, mode, backend=None)[source]#

Returns the single strongest matching compositor operation given an overlay. If no matches are found, None is returned.

The best match is defined as the compositor operation with the highest match value as returned by the match_level method.

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

Bases: ParameterizedFunction

An Operation process an Element or HoloMap at the level of individual elements or overlays. If a holomap is passed in as input, a processed holomap is returned as output where the individual elements have been transformed accordingly. An Operation may turn overlays in new elements or vice versa.

An Operation can be set to be dynamic, which will return a DynamicMap with a callback that will apply the operation dynamically. An Operation may also supply a list of Stream classes on a streams parameter, which can allow dynamic control over the parameters on the operation.

group = param.String(allow_refs=False, default=’Operation’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58f9210>)

The group string used to identify the output of the Operation. By default this should match the operation name.

dynamic = param.ObjectSelector(allow_refs=False, default=’default’, label=’Dynamic’, names={}, nested_refs=False, objects=[‘default’, True, False], rx=<param.reactive.reactive_ops object at 0x72aba58f8ca0>)

Whether the operation should be applied dynamically when a specific frame is requested, specified as a Boolean. If set to ‘default’ the mode will be determined based on the input type, i.e. if the data is a DynamicMap it will stay dynamic.

input_ranges = param.ClassSelector(allow_None=True, allow_refs=False, class_=(<class ‘dict’>, <class ‘tuple’>), default={}, label=’Input ranges’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58f9930>)

Ranges to be used for input normalization (if applicable) in a format appropriate for the Normalization.ranges parameter. By default, no normalization is applied. If key-wise normalization is required, a 2-tuple may be supplied where the first component is a Normalization.ranges list and the second component is Normalization.keys.

link_inputs = param.Boolean(allow_refs=False, default=False, label=’Link inputs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58f8ca0>)

If the operation is dynamic, whether or not linked streams should be transferred from the operation inputs for backends that support linked streams. For example if an operation is applied to a DynamicMap with an RangeXY, this switch determines whether the corresponding visualization should update this stream with range changes originating from the newly generated axes.

streams = param.ClassSelector(allow_refs=False, class_=(<class ‘dict’>, <class ‘list’>), default=[], label=’Streams’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58f9870>)

List of streams that are applied if dynamic=True, allowing for dynamic interaction with the plot.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

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

Bases: Operation

Generates a gridded Dataset of 2D aggregate arrays indexed by the first two dimensions of the passed Element, turning all remaining dimensions into value dimensions. The key dimensions of the gridded array are treated as categorical indices. Useful for data indexed by two independent categorical variables such as a table of population values indexed by country and year. Data that is indexed by continuous dimensions should be binned before aggregation. The aggregation will retain the global sorting order of both dimensions.

>> table = Table([(‘USA’, 2000, 282.2), (‘UK’, 2005, 58.89)],

kdims=[‘Country’, ‘Year’], vdims=[‘Population’])

>> categorical_aggregate2d(table) Dataset({‘Country’: [‘USA’, ‘UK’], ‘Year’: [2000, 2005],

‘Population’: [[ 282.2 , np.nan], [np.nan, 58.89]]},

kdims=[‘Country’, ‘Year’], vdims=[‘Population’])

Parameters inherited from:

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

datatype = param.List(allow_refs=False, bounds=(0, None), default=[‘xarray’, ‘grid’], label=’Datatype’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba58f85e0>)

The grid interface types to use when constructing the gridded Dataset.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.chain(*, operations, output_type, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Defining an Operation chain is an easy way to define a new Operation from a series of existing ones. The argument is a list of Operation (or Operation instances) that are called in sequence to generate the returned element.

chain(operations=[gradient, threshold.instance(level=2)])

This operation can accept an Image instance and would first compute the gradient before thresholding the result at a level of 2.0.

Instances are only required when arguments need to be passed to individual operations so the resulting object is a function over a single argument.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba577bbe0>)

The group assigned to the result after having applied the chain. Defaults to the group produced by the last operation in the chain

output_type = param.Parameter(allow_refs=False, default=<class ‘holoviews.element.raster.Image’>, label=’Output type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba577bd60>)

The output type of the chain operation. Must be supplied if the chain is to be used as a channel operation.

operations = param.List(allow_refs=False, bounds=(0, None), class_=<class ‘holoviews.core.operation.Operation’>, default=[], item_type=<class ‘holoviews.core.operation.Operation’>, label=’Operations’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba577bbe0>)

A list of Operations (or Operation instances) that are applied on the input from left to right.

find(operation, skip_nonlinked=True)[source]#

Returns the first found occurrence of an operation while performing a backward traversal of the chain pipeline.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Image

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

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

Bases: Operation

Given an overlay of Element types, collapse into single Element object using supplied function. Collapsing aggregates over the key dimensions of each object applying the supplied fn to each group.

This is an example of an Operation that does not involve any Raster types.

Parameters inherited from:

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

fn = param.Callable(allow_refs=False, default=<function mean at 0x72abfda83370>, label=’Fn’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba577a1a0>)

The function that is used to collapse the curve y-values for each x-value.

fn(axis=None, dtype=None, out=None, keepdims=<no value>, *, where=<no value>)[source]#

Compute the arithmetic mean along the specified axis.

Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.

Parameters#

aarray_like

Array containing numbers whose mean is desired. If a is not an array, a conversion is attempted.

axisNone or int or tuple of ints, optional

Axis or axes along which the means are computed. The default is to compute the mean of the flattened array.

New in version 1.7.0.

If this is a tuple of ints, a mean is performed over multiple axes, instead of a single axis or all the axes as before.

dtypedata-type, optional

Type to use in computing the mean. For integer inputs, the default is float64; for floating point inputs, it is the same as the input dtype.

outndarray, optional

Alternate output array in which to place the result. The default is None; if provided, it must have the same shape as the expected output, but the type will be cast if necessary. See ufuncs-output-type for more details.

keepdimsbool, optional

If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.

If the default value is passed, then keepdims will not be passed through to the mean method of sub-classes of ndarray, however any non-default value will be. If the sub-class’ method does not implement keepdims any exceptions will be raised.

wherearray_like of bool, optional

Elements to include in the mean. See ~numpy.ufunc.reduce for details.

New in version 1.20.0.

Returns#

mndarray, see dtype parameter above

If out=None, returns a new array containing the mean values, otherwise a reference to the output array is returned.

See Also#

average : Weighted average std, var, nanmean, nanstd, nanvar

Notes#

The arithmetic mean is the sum of the elements along the axis divided by the number of elements.

Note that for floating-point input, the mean is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higher-precision accumulator using the dtype keyword can alleviate this issue.

By default, float16 results are computed using float32 intermediates for extra precision.

Examples#

>>> a = np.array([[1, 2], [3, 4]])
>>> np.mean(a)
2.5
>>> np.mean(a, axis=0)
array([2., 3.])
>>> np.mean(a, axis=1)
array([1.5, 3.5])

In single precision, mean can be inaccurate:

>>> a = np.zeros((2, 512*512), dtype=np.float32)
>>> a[0, :] = 1.0
>>> a[1, :] = 0.1
>>> np.mean(a)
0.54999924

Computing the mean in float64 is more accurate:

>>> np.mean(a, dtype=np.float64)
0.55000000074505806 # may vary

Specifying a where argument:

>>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]])
>>> np.mean(a)
12.0
>>> np.mean(a, where=[[True], [False], [False]])
9.0
classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.contours(*, filled, levels, overlaid, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Given a Image with a single channel, annotate it with contour lines for a given set of contour levels.

The return is an NdOverlay with a Contours layer for each given level, overlaid on top of the input Image.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Level’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5779c90>)

The group assigned to the output contours.

levels = param.ClassSelector(allow_refs=False, class_=(<class ‘list’>, <class ‘int’>), default=10, label=’Levels’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba57790f0>)

A list of scalar values used to specify the contour levels.

filled = param.Boolean(allow_refs=False, default=False, label=’Filled’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba577a950>)

Whether to generate filled contours

overlaid = param.Boolean(allow_refs=False, default=False, label=’Overlaid’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba577aec0>)

Whether to overlay the contour on the supplied Element.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Overlay

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

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

Bases: Operation

Apply a convolution to an overlay using the top layer as the kernel for convolving the bottom layer. Both Image elements in the input overlay should have a single value dimension.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Convolution’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba576dc60>)

The group assigned to the convolved output.

kernel_roi = param.NumericTuple(allow_refs=False, default=(0, 0, 0, 0), label=’Kernel roi’, length=4, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba576dae0>)

A 2-dimensional slice of the kernel layer to use in the convolution in lbrt (left, bottom, right, top) format. By default, no slicing is applied.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Image

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.decimate(*, max_samples, random_seed, x_range, y_range, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Decimates any column based Element to a specified number of random rows if the current element defined by the x_range and y_range contains more than max_samples. By default the operation returns a DynamicMap with a RangeXY stream allowing dynamic downsampling.

Parameters inherited from:

dynamic = param.Boolean(allow_refs=False, default=True, label=’Dynamic’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5779b10>)

Enables dynamic processing by default.

link_inputs = param.Boolean(allow_refs=False, default=True, label=’Link inputs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba577ad70>)

By default, the link_inputs parameter is set to True so that when applying shade, backends that support linked streams update RangeXY streams on the inputs of the shade operation.

streams = param.ClassSelector(allow_refs=False, class_=(<class ‘dict’>, <class ‘list’>), default=[<class ‘holoviews.streams.RangeXY’>], label=’Streams’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba57788b0>)

List of streams that are applied if dynamic=True, allowing for dynamic interaction with the plot.

max_samples = param.Integer(allow_refs=False, default=5000, inclusive_bounds=(True, True), label=’Max samples’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba577a410>)

Maximum number of samples to display at the same time.

random_seed = param.Integer(allow_refs=False, default=42, inclusive_bounds=(True, True), label=’Random seed’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5779c60>)

Seed used to initialize randomization.

x_range = param.NumericTuple(allow_None=True, allow_refs=False, label=’X range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba577b130>)

The x_range as a tuple of min and max x-value. Auto-ranges if set to None.

y_range = param.NumericTuple(allow_None=True, allow_refs=False, label=’Y range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5778ee0>)

The x_range as a tuple of min and max y-value. Auto-ranges if set to None.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.factory(*, args, kwargs, output_type, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Simple operation that constructs any element that accepts some other element as input. For instance, RGB and HSV elements can be created from overlays of Image elements.

Parameters inherited from:

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

output_type = param.Parameter(allow_refs=False, default=<class ‘holoviews.element.raster.RGB’>, label=’Output type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba577b370>)

The output type of the factor operation. By default, if three overlaid Images elements are supplied, the corresponding RGB element will be returned.

args = param.List(allow_refs=False, bounds=(0, None), default=[], label=’Args’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba577a560>)

The list of positional argument to pass to the factory

kwargs = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={}, label=’Kwargs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5779d20>)

The dict of keyword arguments to pass to the factory

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of RGB

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.function(*, args, fn, input_type, kwargs, output_type, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Parameters inherited from:

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

output_type = param.ClassSelector(allow_None=True, allow_refs=False, class_=<class ‘type’>, label=’Output type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba574f1f0>)

The output type of the method operation

input_type = param.ClassSelector(allow_None=True, allow_refs=False, class_=<class ‘type’>, label=’Input type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba574cac0>)

The object type the method is defined on

fn = param.Callable(allow_refs=False, label=’Fn’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba574c670>)

The function to apply.

args = param.List(allow_refs=False, bounds=(0, None), default=[], label=’Args’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba574ed70>)

The list of positional argument to pass to the method

kwargs = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={}, label=’Kwargs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba574f220>)

The dict of keyword arguments to pass to the method

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

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

Bases: Operation

Compute the gradient plot of the supplied Image.

If the Image value dimension is cyclic, the smallest step is taken considered the cyclic range

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Gradient’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba576ea10>)

The group assigned to the output gradient matrix.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Image

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.histogram(*, bin_range, bins, cumulative, dimension, frequency_label, groupby, log, mean_weighted, nonzero, normed, num_bins, style_prefix, weight_dimension, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Returns a Histogram of the input element data, binned into num_bins over the bin_range (if specified) along the specified dimension.

Parameters inherited from:

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

bin_range = param.NumericTuple(allow_None=True, allow_refs=False, label=’Bin range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5759720>)

Specifies the range within which to compute the bins.

bins = param.ClassSelector(allow_None=True, allow_refs=False, class_=(<class ‘numpy.ndarray’>, <class ‘list’>, <class ‘tuple’>, <class ‘str’>), label=’Bins’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba575b2b0>)

An explicit set of bin edges or a method to find the optimal set of bin edges, e.g. ‘auto’, ‘fd’, ‘scott’ etc. For more documentation on these approaches see the np.histogram_bin_edges documentation.

cumulative = param.Boolean(allow_refs=False, default=False, label=’Cumulative’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba57594b0>)

Whether to compute the cumulative histogram

dimension = param.String(allow_None=True, allow_refs=False, label=’Dimension’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5758730>)

Along which dimension of the Element to compute the histogram.

frequency_label = param.String(allow_None=True, allow_refs=False, label=’Frequency label’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5759660>)

Format string defining the label of the frequency dimension of the Histogram.

groupby = param.ClassSelector(allow_None=True, allow_refs=False, class_=(<class ‘str’>, <class ‘holoviews.core.dimension.Dimension’>), label=’Groupby’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba575b730>)

Defines a dimension to group the Histogram returning an NdOverlay of Histograms.

log = param.Boolean(allow_refs=False, default=False, label=’Log’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba575b7f0>)

Whether to use base 10 logarithmic samples for the bin edges.

mean_weighted = param.Boolean(allow_refs=False, default=False, label=’Mean weighted’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba575a1a0>)

Whether the weighted frequencies are averaged.

normed = param.ObjectSelector(allow_refs=False, default=False, label=’Normed’, names={}, nested_refs=False, objects=[True, False, ‘integral’, ‘height’], rx=<param.reactive.reactive_ops object at 0x72aba575a920>)

Controls normalization behavior. If True or ‘integral’, then density=True is passed to np.histogram, and the distribution is normalized such that the integral is unity. If False, then the frequencies will be raw counts. If ‘height’, then the frequencies are normalized such that the max bin height is unity.

nonzero = param.Boolean(allow_refs=False, default=False, label=’Nonzero’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba575a140>)

Whether to use only nonzero values when computing the histogram

num_bins = param.Integer(allow_refs=False, default=20, inclusive_bounds=(True, True), label=’Num bins’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba575a920>)

Number of bins in the histogram .

weight_dimension = param.String(allow_None=True, allow_refs=False, label=’Weight dimension’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba575b0a0>)

Name of the dimension the weighting should be drawn from

style_prefix = param.String(allow_None=True, allow_refs=False, label=’Style prefix’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba57588e0>)

Used for setting a common style for histograms in a HoloMap or AdjointLayout.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.image_overlay(*, default_range, fill, spec, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Operation to build a overlay of images to a specification from a subset of the required elements.

This is useful for reordering the elements of an overlay, duplicating layers of an overlay or creating blank image elements in the appropriate positions.

For instance, image_overlay may build a three layered input suitable for the RGB factory operation even if supplied with one or two of the required channels (creating blank channels for the missing elements).

Note that if there is any ambiguity regarding the match, the strongest match will be used. In the case of a tie in match strength, the first layer in the input is used. One successful match is always required.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Transform’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5725120>)

The group assigned to the resulting overlay.

spec = param.String(allow_refs=False, default=’’, label=’Spec’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5726320>)

Specification of the output Overlay structure. For instance: Image.R * Image.G * Image.B Will ensure an overlay of this structure is created even if (for instance) only (Image.R * Image.B) is supplied. Elements in the input overlay that match are placed in the appropriate positions and unavailable specification elements are created with the specified fill group.

fill = param.Number(allow_refs=False, default=0, inclusive_bounds=(True, True), label=’Fill’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5725120>)

default_range = param.Tuple(allow_refs=False, default=(0, 1), label=’Default range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5726320>)

The default range that will be set on the value_dimension of any automatically created blank image elements.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Overlay

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

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

Bases: Operation

Resamples a Curve using the defined interpolation method, e.g. to represent changes in y-values as steps.

Parameters inherited from:

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

interpolation = param.ObjectSelector(allow_refs=False, default=’steps-mid’, label=’Interpolation’, names={}, nested_refs=False, objects=[‘steps-pre’, ‘steps-mid’, ‘steps-post’, ‘linear’], rx=<param.reactive.reactive_ops object at 0x72aba576f3a0>)

Controls the transition point of the step along the x-axis.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.method(*, args, input_type, kwargs, method_name, output_type, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Operation that wraps a method call

Parameters inherited from:

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

output_type = param.ClassSelector(allow_None=True, allow_refs=False, class_=<class ‘type’>, label=’Output type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5724460>)

The output type of the method operation

input_type = param.ClassSelector(allow_None=True, allow_refs=False, class_=<class ‘type’>, label=’Input type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba57250c0>)

The object type the method is defined on

method_name = param.String(allow_refs=False, default=’__call__’, label=’Method name’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba57246a0>)

The method name

args = param.List(allow_refs=False, bounds=(0, None), default=[], label=’Args’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5727790>)

The list of positional argument to pass to the method

kwargs = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={}, label=’Kwargs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5724160>)

The dict of keyword arguments to pass to the method

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

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

Bases: Operation

The most generic operation that wraps any callable into an Operation. The callable needs to accept an HoloViews component and a key (that may be ignored) and must return a new HoloViews component.

This class may be useful for turning a HoloViews method into an operation to define as compositor operation. For instance, the following definition:

operation.instance(op=lambda x, k: x.collapse(np.subtract))

Could be used to implement a collapse operation to subtracts the data between Rasters in an Overlay.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Operation’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5727430>)

The group assigned to the result after having applied the operator.

output_type = param.Parameter(allow_None=True, allow_refs=False, label=’Output type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5724790>)

The output element type which may be None to disable type checking. May be used to declare useful information to other code in HoloViews, e.g. required for tab-completion support of operations registered with compositors.

op = param.Callable(allow_refs=False, label=’Op’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5726380>)

The operation used to generate a new HoloViews object returned by the operation. By default, the identity operation is applied.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.threshold(*, high, level, low, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Threshold a given Image whereby all values higher than a given level map to the specified high value and all values lower than that level map to the specified low value.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Threshold’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba57267d0>)

The group assigned to the thresholded output.

level = param.Number(allow_refs=False, default=0.5, inclusive_bounds=(True, True), label=’Level’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5725510>)

The value at which the threshold is applied. Values lower than the threshold map to the ‘low’ value and values above map to the ‘high’ value.

high = param.Number(allow_refs=False, default=1.0, inclusive_bounds=(True, True), label=’High’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5724ac0>)

The value given to elements greater than (or equal to) the threshold.

low = param.Number(allow_refs=False, default=0.0, inclusive_bounds=(True, True), label=’Low’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba5727d90>)

The value given to elements below the threshold.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Image

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

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

Bases: Operation

Generic Operation to transform an input Image or RGBA element into an output Image. The transformation is defined by the supplied callable that accepts the data of the input Image (typically a numpy array) and returns the transformed data of the output Image.

This operator is extremely versatile; for instance, you could implement an alternative to the explicit threshold operator with:

operator=lambda x: np.clip(x, 0, 0.5)

Alternatively, you can implement a transform computing the 2D autocorrelation using the scipy library with:

operator=lambda x: scipy.signal.correlate2d(x, x)

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Transform’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba572d0f0>)

The group assigned to the result after applying the transform.

operator = param.Callable(allow_None=True, allow_refs=False, label=’Operator’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba572d360>)

Function of one argument that transforms the data in the input Image to the data in the output Image. By default, acts as the identity function such that the output matches the input.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Image

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.


datashader Module#


downsample Module#

Inheritance diagram of holoviews.operation.downsample

Implements downsampling algorithms for large 1D datasets.

The algorithms implemented in this module have been adapted from predict-idlab/plotly-resampler and are reproduced along with the original license:

MIT License

Copyright (c) 2022 Jonas Van Der Donckt, Jeroen Van Der Donckt, Emiel Deprost.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

class holoviews.operation.downsample.downsample1d(*, algorithm, minmax_ratio, neighbor_points, parallel, height, pixel_ratio, width, x_range, x_sampling, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: ResampleOperation1D

Implements downsampling of a regularly sampled 1D dataset.

If available uses the tsdownsampler library to perform massively accelerated downsampling.

Parameters inherited from:

holoviews.core.operation.Operation: group, input_ranges

holoviews.operation.resample.LinkableOperation: link_inputs

holoviews.operation.resample.ResampleOperation1D: dynamic, streams, x_range, x_sampling, width, height, pixel_ratio

algorithm = param.Selector(allow_refs=False, default=’lttb’, label=’Algorithm’, names={}, nested_refs=False, objects=[‘lttb’, ‘nth’, ‘viewport’, ‘minmax’, ‘minmax-lttb’, ‘m4’], rx=<param.reactive.reactive_ops object at 0x72aba396cd60>)

The algorithm to use for downsampling: - lttb: Largest Triangle Three Buckets downsample algorithm. - nth: Selects every n-th point. - viewport: Selects all points in a given viewport. - minmax: Selects the min and max value in each bin (requires tsdownsampler). - m4: Selects the min, max, first and last value in each bin (requires tsdownsampler). - minmax-lttb: First selects n_out * minmax_ratio min and max values, then further reduces these to n_out values using the Largest Triangle Three Buckets algorithm (requires tsdownsampler).

parallel = param.Boolean(allow_refs=False, default=False, label=’Parallel’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba396ceb0>)

The number of threads to use (if tsdownsampler is available).

minmax_ratio = param.Integer(allow_refs=False, bounds=(0, None), default=4, inclusive_bounds=(True, True), label=’Minmax ratio’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba396cca0>)

For the minmax-lttb algorithm determines the ratio of candidate values to generate with the minmax algorithm before further downsampling with LTTB.

neighbor_points = param.Boolean(allow_None=True, allow_refs=False, label=’Neighbor points’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba396ceb0>)

Whether to add the neighbor points to the range before downsampling. By default this is only enabled for the viewport algorithm.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.


element Module#

Inheritance diagram of holoviews.operation.element

Collection of either extremely generic or simple Operation examples.

class holoviews.operation.element.apply_when(*, operation, predicate, name)[source]#

Bases: ParameterizedFunction

Applies a selection depending on the current zoom range. If the supplied predicate function returns a True it will apply the operation otherwise it will return the raw element after the selection. For example the following will apply datashading if the number of points in the current viewport exceed 1000 otherwise just returning the selected points element:

apply_when(points, operation=datashade, predicate=lambda x: x > 1000)

operation = param.Callable(allow_refs=False, label=’Operation’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c6e30>)

predicate = param.Callable(allow_None=True, allow_refs=False, label=’Predicate’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c6d40>)

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

class holoviews.operation.element.chain(*, operations, output_type, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Defining an Operation chain is an easy way to define a new Operation from a series of existing ones. The argument is a list of Operation (or Operation instances) that are called in sequence to generate the returned element.

chain(operations=[gradient, threshold.instance(level=2)])

This operation can accept an Image instance and would first compute the gradient before thresholding the result at a level of 2.0.

Instances are only required when arguments need to be passed to individual operations so the resulting object is a function over a single argument.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3865600>)

The group assigned to the result after having applied the chain. Defaults to the group produced by the last operation in the chain

output_type = param.Parameter(allow_refs=False, default=<class ‘holoviews.element.raster.Image’>, label=’Output type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3865450>)

The output type of the chain operation. Must be supplied if the chain is to be used as a channel operation.

operations = param.List(allow_refs=False, bounds=(0, None), class_=<class ‘holoviews.core.operation.Operation’>, default=[], item_type=<class ‘holoviews.core.operation.Operation’>, label=’Operations’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3865600>)

A list of Operations (or Operation instances) that are applied on the input from left to right.

find(operation, skip_nonlinked=True)[source]#

Returns the first found occurrence of an operation while performing a backward traversal of the chain pipeline.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Image

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.collapse(*, fn, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Given an overlay of Element types, collapse into single Element object using supplied function. Collapsing aggregates over the key dimensions of each object applying the supplied fn to each group.

This is an example of an Operation that does not involve any Raster types.

Parameters inherited from:

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

fn = param.Callable(allow_refs=False, default=<function mean at 0x72abfda83370>, label=’Fn’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c42b0>)

The function that is used to collapse the curve y-values for each x-value.

fn(axis=None, dtype=None, out=None, keepdims=<no value>, *, where=<no value>)[source]#

Compute the arithmetic mean along the specified axis.

Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.

Parameters#

aarray_like

Array containing numbers whose mean is desired. If a is not an array, a conversion is attempted.

axisNone or int or tuple of ints, optional

Axis or axes along which the means are computed. The default is to compute the mean of the flattened array.

New in version 1.7.0.

If this is a tuple of ints, a mean is performed over multiple axes, instead of a single axis or all the axes as before.

dtypedata-type, optional

Type to use in computing the mean. For integer inputs, the default is float64; for floating point inputs, it is the same as the input dtype.

outndarray, optional

Alternate output array in which to place the result. The default is None; if provided, it must have the same shape as the expected output, but the type will be cast if necessary. See ufuncs-output-type for more details.

keepdimsbool, optional

If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.

If the default value is passed, then keepdims will not be passed through to the mean method of sub-classes of ndarray, however any non-default value will be. If the sub-class’ method does not implement keepdims any exceptions will be raised.

wherearray_like of bool, optional

Elements to include in the mean. See ~numpy.ufunc.reduce for details.

New in version 1.20.0.

Returns#

mndarray, see dtype parameter above

If out=None, returns a new array containing the mean values, otherwise a reference to the output array is returned.

See Also#

average : Weighted average std, var, nanmean, nanstd, nanvar

Notes#

The arithmetic mean is the sum of the elements along the axis divided by the number of elements.

Note that for floating-point input, the mean is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higher-precision accumulator using the dtype keyword can alleviate this issue.

By default, float16 results are computed using float32 intermediates for extra precision.

Examples#

>>> a = np.array([[1, 2], [3, 4]])
>>> np.mean(a)
2.5
>>> np.mean(a, axis=0)
array([2., 3.])
>>> np.mean(a, axis=1)
array([1.5, 3.5])

In single precision, mean can be inaccurate:

>>> a = np.zeros((2, 512*512), dtype=np.float32)
>>> a[0, :] = 1.0
>>> a[1, :] = 0.1
>>> np.mean(a)
0.54999924

Computing the mean in float64 is more accurate:

>>> np.mean(a, dtype=np.float64)
0.55000000074505806 # may vary

Specifying a where argument:

>>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]])
>>> np.mean(a)
12.0
>>> np.mean(a, where=[[True], [False], [False]])
9.0
classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.contours(*, filled, levels, overlaid, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Given a Image with a single channel, annotate it with contour lines for a given set of contour levels.

The return is an NdOverlay with a Contours layer for each given level, overlaid on top of the input Image.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Level’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba38664d0>)

The group assigned to the output contours.

levels = param.ClassSelector(allow_refs=False, class_=(<class ‘list’>, <class ‘int’>), default=10, label=’Levels’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37dcbe0>)

A list of scalar values used to specify the contour levels.

filled = param.Boolean(allow_refs=False, default=False, label=’Filled’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3866ef0>)

Whether to generate filled contours

overlaid = param.Boolean(allow_refs=False, default=False, label=’Overlaid’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba38673d0>)

Whether to overlay the contour on the supplied Element.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Overlay

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.convolve(*, kernel_roi, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Apply a convolution to an overlay using the top layer as the kernel for convolving the bottom layer. Both Image elements in the input overlay should have a single value dimension.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Convolution’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c6f50>)

The group assigned to the convolved output.

kernel_roi = param.NumericTuple(allow_refs=False, default=(0, 0, 0, 0), label=’Kernel roi’, length=4, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c58a0>)

A 2-dimensional slice of the kernel layer to use in the convolution in lbrt (left, bottom, right, top) format. By default, no slicing is applied.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Image

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.decimate(*, max_samples, random_seed, x_range, y_range, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Decimates any column based Element to a specified number of random rows if the current element defined by the x_range and y_range contains more than max_samples. By default the operation returns a DynamicMap with a RangeXY stream allowing dynamic downsampling.

Parameters inherited from:

dynamic = param.Boolean(allow_refs=False, default=True, label=’Dynamic’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3866680>)

Enables dynamic processing by default.

link_inputs = param.Boolean(allow_refs=False, default=True, label=’Link inputs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c7250>)

By default, the link_inputs parameter is set to True so that when applying shade, backends that support linked streams update RangeXY streams on the inputs of the shade operation.

streams = param.ClassSelector(allow_refs=False, class_=(<class ‘dict’>, <class ‘list’>), default=[<class ‘holoviews.streams.RangeXY’>], label=’Streams’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c6f80>)

List of streams that are applied if dynamic=True, allowing for dynamic interaction with the plot.

max_samples = param.Integer(allow_refs=False, default=5000, inclusive_bounds=(True, True), label=’Max samples’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c6050>)

Maximum number of samples to display at the same time.

random_seed = param.Integer(allow_refs=False, default=42, inclusive_bounds=(True, True), label=’Random seed’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c6fb0>)

Seed used to initialize randomization.

x_range = param.NumericTuple(allow_None=True, allow_refs=False, label=’X range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c6860>)

The x_range as a tuple of min and max x-value. Auto-ranges if set to None.

y_range = param.NumericTuple(allow_None=True, allow_refs=False, label=’Y range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c7250>)

The x_range as a tuple of min and max y-value. Auto-ranges if set to None.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.factory(*, args, kwargs, output_type, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Simple operation that constructs any element that accepts some other element as input. For instance, RGB and HSV elements can be created from overlays of Image elements.

Parameters inherited from:

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

output_type = param.Parameter(allow_refs=False, default=<class ‘holoviews.element.raster.RGB’>, label=’Output type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3866350>)

The output type of the factor operation. By default, if three overlaid Images elements are supplied, the corresponding RGB element will be returned.

args = param.List(allow_refs=False, bounds=(0, None), default=[], label=’Args’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3867c70>)

The list of positional argument to pass to the factory

kwargs = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={}, label=’Kwargs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3867190>)

The dict of keyword arguments to pass to the factory

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of RGB

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.function(*, args, fn, input_type, kwargs, output_type, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Parameters inherited from:

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

output_type = param.ClassSelector(allow_None=True, allow_refs=False, class_=<class ‘type’>, label=’Output type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba368c3d0>)

The output type of the method operation

input_type = param.ClassSelector(allow_None=True, allow_refs=False, class_=<class ‘type’>, label=’Input type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba38677c0>)

The object type the method is defined on

fn = param.Callable(allow_refs=False, label=’Fn’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba38669e0>)

The function to apply.

args = param.List(allow_refs=False, bounds=(0, None), default=[], label=’Args’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3865c00>)

The list of positional argument to pass to the method

kwargs = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={}, label=’Kwargs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3865b70>)

The dict of keyword arguments to pass to the method

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

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

Bases: Operation

Compute the gradient plot of the supplied Image.

If the Image value dimension is cyclic, the smallest step is taken considered the cyclic range

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Gradient’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba396ece0>)

The group assigned to the output gradient matrix.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Image

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.gridmatrix(*, chart_type, diagonal_operation, diagonal_type, overlay_dims, name)[source]#

Bases: ParameterizedFunction

The gridmatrix operation takes an Element or HoloMap of Elements as input and creates a GridMatrix object, which plots each dimension in the Element against each other dimension. This provides a very useful overview of high-dimensional data and is inspired by pandas and seaborn scatter_matrix implementations.

chart_type = param.Parameter(allow_refs=False, default=<class ‘holoviews.element.chart.Scatter’>, label=’Chart type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369a1d0>)

The Element type used to display bivariate distributions of the data.

diagonal_type = param.Parameter(allow_None=True, allow_refs=False, label=’Diagonal type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37c52d0>)

The Element type along the diagonal, may be a Histogram or any other plot type which can visualize a univariate distribution. This parameter overrides diagonal_operation.

diagonal_operation = param.Parameter(allow_refs=False, default=<class ‘holoviews.operation.element.histogram’>, label=’Diagonal operation’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37dc250>)

The operation applied along the diagonal, may be a histogram-operation or any other function which returns a viewable element.

overlay_dims = param.List(allow_refs=False, bounds=(0, None), default=[], label=’Overlay dims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba37de2f0>)

If a HoloMap is supplied, this will allow overlaying one or more of its key dimensions.

chart_type[source]#

alias of Scatter

diagonal_operation[source]#

alias of histogram

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

class holoviews.operation.element.histogram(*, bin_range, bins, cumulative, dimension, frequency_label, groupby, log, mean_weighted, nonzero, normed, num_bins, style_prefix, weight_dimension, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Returns a Histogram of the input element data, binned into num_bins over the bin_range (if specified) along the specified dimension.

Parameters inherited from:

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

bin_range = param.NumericTuple(allow_None=True, allow_refs=False, label=’Bin range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369a830>)

Specifies the range within which to compute the bins.

bins = param.ClassSelector(allow_None=True, allow_refs=False, class_=(<class ‘numpy.ndarray’>, <class ‘list’>, <class ‘tuple’>, <class ‘str’>), label=’Bins’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369bfa0>)

An explicit set of bin edges or a method to find the optimal set of bin edges, e.g. ‘auto’, ‘fd’, ‘scott’ etc. For more documentation on these approaches see the np.histogram_bin_edges documentation.

cumulative = param.Boolean(allow_refs=False, default=False, label=’Cumulative’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369aad0>)

Whether to compute the cumulative histogram

dimension = param.String(allow_None=True, allow_refs=False, label=’Dimension’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369b010>)

Along which dimension of the Element to compute the histogram.

frequency_label = param.String(allow_None=True, allow_refs=False, label=’Frequency label’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369be20>)

Format string defining the label of the frequency dimension of the Histogram.

groupby = param.ClassSelector(allow_None=True, allow_refs=False, class_=(<class ‘str’>, <class ‘holoviews.core.dimension.Dimension’>), label=’Groupby’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369bdf0>)

Defines a dimension to group the Histogram returning an NdOverlay of Histograms.

log = param.Boolean(allow_refs=False, default=False, label=’Log’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369b430>)

Whether to use base 10 logarithmic samples for the bin edges.

mean_weighted = param.Boolean(allow_refs=False, default=False, label=’Mean weighted’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369bdc0>)

Whether the weighted frequencies are averaged.

normed = param.ObjectSelector(allow_refs=False, default=False, label=’Normed’, names={}, nested_refs=False, objects=[True, False, ‘integral’, ‘height’], rx=<param.reactive.reactive_ops object at 0x72aba369b3d0>)

Controls normalization behavior. If True or ‘integral’, then density=True is passed to np.histogram, and the distribution is normalized such that the integral is unity. If False, then the frequencies will be raw counts. If ‘height’, then the frequencies are normalized such that the max bin height is unity.

nonzero = param.Boolean(allow_refs=False, default=False, label=’Nonzero’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369bd90>)

Whether to use only nonzero values when computing the histogram

num_bins = param.Integer(allow_refs=False, default=20, inclusive_bounds=(True, True), label=’Num bins’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369b3d0>)

Number of bins in the histogram .

weight_dimension = param.String(allow_None=True, allow_refs=False, label=’Weight dimension’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369be50>)

Name of the dimension the weighting should be drawn from

style_prefix = param.String(allow_None=True, allow_refs=False, label=’Style prefix’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369a680>)

Used for setting a common style for histograms in a HoloMap or AdjointLayout.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.image_overlay(*, default_range, fill, spec, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Operation to build a overlay of images to a specification from a subset of the required elements.

This is useful for reordering the elements of an overlay, duplicating layers of an overlay or creating blank image elements in the appropriate positions.

For instance, image_overlay may build a three layered input suitable for the RGB factory operation even if supplied with one or two of the required channels (creating blank channels for the missing elements).

Note that if there is any ambiguity regarding the match, the strongest match will be used. In the case of a tie in match strength, the first layer in the input is used. One successful match is always required.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Transform’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369a8f0>)

The group assigned to the resulting overlay.

spec = param.String(allow_refs=False, default=’’, label=’Spec’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3698460>)

Specification of the output Overlay structure. For instance: Image.R * Image.G * Image.B Will ensure an overlay of this structure is created even if (for instance) only (Image.R * Image.B) is supplied. Elements in the input overlay that match are placed in the appropriate positions and unavailable specification elements are created with the specified fill group.

fill = param.Number(allow_refs=False, default=0, inclusive_bounds=(True, True), label=’Fill’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369add0>)

default_range = param.Tuple(allow_refs=False, default=(0, 1), label=’Default range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3699e40>)

The default range that will be set on the value_dimension of any automatically created blank image elements.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Overlay

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.interpolate_curve(*, interpolation, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Resamples a Curve using the defined interpolation method, e.g. to represent changes in y-values as steps.

Parameters inherited from:

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

interpolation = param.ObjectSelector(allow_refs=False, default=’steps-mid’, label=’Interpolation’, names={}, nested_refs=False, objects=[‘steps-pre’, ‘steps-mid’, ‘steps-post’, ‘linear’], rx=<param.reactive.reactive_ops object at 0x72aba369b5e0>)

Controls the transition point of the step along the x-axis.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.method(*, args, input_type, kwargs, method_name, output_type, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Operation that wraps a method call

Parameters inherited from:

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

output_type = param.ClassSelector(allow_None=True, allow_refs=False, class_=<class ‘type’>, label=’Output type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3699d50>)

The output type of the method operation

input_type = param.ClassSelector(allow_None=True, allow_refs=False, class_=<class ‘type’>, label=’Input type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba36b4100>)

The object type the method is defined on

method_name = param.String(allow_refs=False, default=’__call__’, label=’Method name’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3699180>)

The method name

args = param.List(allow_refs=False, bounds=(0, None), default=[], label=’Args’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba36b4100>)

The list of positional argument to pass to the method

kwargs = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={}, label=’Kwargs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3698eb0>)

The dict of keyword arguments to pass to the method

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.operation(*, op, output_type, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

The most generic operation that wraps any callable into an Operation. The callable needs to accept an HoloViews component and a key (that may be ignored) and must return a new HoloViews component.

This class may be useful for turning a HoloViews method into an operation to define as compositor operation. For instance, the following definition:

operation.instance(op=lambda x, k: x.collapse(np.subtract))

Could be used to implement a collapse operation to subtracts the data between Rasters in an Overlay.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Operation’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba369b610>)

The group assigned to the result after having applied the operator.

output_type = param.Parameter(allow_None=True, allow_refs=False, label=’Output type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3698fd0>)

The output element type which may be None to disable type checking. May be used to declare useful information to other code in HoloViews, e.g. required for tab-completion support of operations registered with compositors.

op = param.Callable(allow_refs=False, label=’Op’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3699ba0>)

The operation used to generate a new HoloViews object returned by the operation. By default, the identity operation is applied.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.threshold(*, high, level, low, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Threshold a given Image whereby all values higher than a given level map to the specified high value and all values lower than that level map to the specified low value.

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Threshold’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba36baaa0>)

The group assigned to the thresholded output.

level = param.Number(allow_refs=False, default=0.5, inclusive_bounds=(True, True), label=’Level’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba36bbf10>)

The value at which the threshold is applied. Values lower than the threshold map to the ‘low’ value and values above map to the ‘high’ value.

high = param.Number(allow_refs=False, default=1.0, inclusive_bounds=(True, True), label=’High’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba36bb2e0>)

The value given to elements greater than (or equal to) the threshold.

low = param.Number(allow_refs=False, default=0.0, inclusive_bounds=(True, True), label=’Low’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba36ba050>)

The value given to elements below the threshold.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Image

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.element.transform(*, operator, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Generic Operation to transform an input Image or RGBA element into an output Image. The transformation is defined by the supplied callable that accepts the data of the input Image (typically a numpy array) and returns the transformed data of the output Image.

This operator is extremely versatile; for instance, you could implement an alternative to the explicit threshold operator with:

operator=lambda x: np.clip(x, 0, 0.5)

Alternatively, you can implement a transform computing the 2D autocorrelation using the scipy library with:

operator=lambda x: scipy.signal.correlate2d(x, x)

Parameters inherited from:

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

group = param.String(allow_refs=False, default=’Transform’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba36bbe20>)

The group assigned to the result after applying the transform.

operator = param.Callable(allow_None=True, allow_refs=False, label=’Operator’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba36bb310>)

Function of one argument that transforms the data in the input Image to the data in the output Image. By default, acts as the identity function such that the output matches the input.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

output_type[source]#

alias of Image

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.


normalization Module#

Inheritance diagram of holoviews.operation.normalization

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.

Parameters inherited from:

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

data_range = param.Boolean(allow_refs=False, default=False, label=’Data range’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba33e4a00>)

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

ranges = param.ClassSelector(allow_None=True, allow_refs=False, class_=(<class ‘dict’>, <class ‘list’>), default={}, label=’Ranges’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba33e5870>)

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 = param.List(allow_None=True, allow_refs=False, bounds=(0, None), label=’Keys’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba33e49d0>)

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.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

get_ranges(element, key)[source]#

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

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

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.

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

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.

Parameters inherited from:

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

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

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

get_ranges(element, key)[source]#

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

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

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.

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.


resample Module#

Inheritance diagram of holoviews.operation.resample
class holoviews.operation.resample.LinkableOperation(*, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Abstract baseclass for operations supporting linked inputs.

Parameters inherited from:

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

link_inputs = param.Boolean(allow_refs=False, default=True, label=’Link inputs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3463760>)

By default, the link_inputs parameter is set to True so that when applying an operation, backends that support linked streams update RangeXY streams on the inputs of the operation. Disable when you do not want the resulting plot to be interactive, e.g. when trying to display an interactive plot a second time.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.resample.ResampleOperation1D(*, height, pixel_ratio, width, x_range, x_sampling, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: LinkableOperation

Abstract baseclass for resampling operations

Parameters inherited from:

dynamic = param.Boolean(allow_refs=False, default=True, label=’Dynamic’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba32a0670>)

Enables dynamic processing by default.

streams = param.ClassSelector(allow_refs=False, class_=(<class ‘dict’>, <class ‘list’>), default=[<class ‘holoviews.streams.PlotSize’>, <class ‘holoviews.streams.RangeX’>], label=’Streams’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba32a1fc0>)

List or dictionary of streams that are applied if dynamic=True, allowing for dynamic interaction with the plot.

x_range = param.Tuple(allow_None=True, allow_refs=False, label=’X range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba32a1bd0>)

The x_range as a tuple of min and max x-value. Auto-ranges if set to None.

x_sampling = param.Number(allow_None=True, allow_refs=False, inclusive_bounds=(True, True), label=’X sampling’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba32a37c0>)

Specifies the smallest allowed sampling interval along the x axis.

width = param.Integer(allow_refs=False, default=400, inclusive_bounds=(True, True), label=’Width’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba32a23e0>)

The width of the output image in pixels.

height = param.Integer(allow_refs=False, default=400, inclusive_bounds=(True, True), label=’Height’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba32a2470>)

The height of the output image in pixels.

pixel_ratio = param.Number(allow_None=True, allow_refs=False, bounds=(0, None), inclusive_bounds=(False, False), label=’Pixel ratio’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba32a1c90>)

Pixel ratio applied to the height and width. Useful for higher resolution screens where the PlotSize stream reports ‘nominal’ dimensions in pixels that do not match the physical pixels. For instance, setting pixel_ratio=2 can give better results on Retina displays. Also useful for using lower resolution for speed. If not set explicitly, the zoom level of the browsers will be used, if available.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.resample.ResampleOperation2D(*, element_type, expand, precompute, target, y_range, y_sampling, height, pixel_ratio, width, x_range, x_sampling, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: ResampleOperation1D

Abstract baseclass for resampling operations

Parameters inherited from:

holoviews.core.operation.Operation: group, input_ranges

holoviews.operation.resample.LinkableOperation: link_inputs

holoviews.operation.resample.ResampleOperation1D: x_range, x_sampling, width, height, pixel_ratio

dynamic = param.Boolean(allow_refs=False, default=True, label=’Dynamic’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba32a2d10>)

Enables dynamic processing by default.

streams = param.ClassSelector(allow_refs=False, class_=(<class ‘dict’>, <class ‘list’>), default=[<class ‘holoviews.streams.PlotSize’>, <class ‘holoviews.streams.RangeXY’>], label=’Streams’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3463370>)

List or dictionary of streams that are applied if dynamic=True, allowing for dynamic interaction with the plot.

expand = param.Boolean(allow_refs=False, default=True, label=’Expand’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3460a30>)

Whether the x_range and y_range should be allowed to expand beyond the extent of the data. Setting this value to True is useful for the case where you want to ensure a certain size of output grid, e.g. if you are doing masking or other arithmetic on the grids. A value of False ensures that the grid is only just as large as it needs to be to contain the data, which will be faster and use less memory if the resulting aggregate is being overlaid on a much larger background.

y_range = param.Tuple(allow_None=True, allow_refs=False, label=’Y range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3462f80>)

The y-axis range as a tuple of min and max y value. Auto-ranges if set to None.

y_sampling = param.Number(allow_None=True, allow_refs=False, inclusive_bounds=(True, True), label=’Y sampling’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba34616c0>)

Specifies the smallest allowed sampling interval along the y axis.

target = param.ClassSelector(allow_None=True, allow_refs=False, class_=<class ‘holoviews.core.data.Dataset’>, label=’Target’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3463070>)

A target Dataset which defines the desired x_range, y_range, width and height.

element_type = param.ClassSelector(allow_refs=False, class_=(<class ‘holoviews.core.data.Dataset’>,), default=<class ‘holoviews.element.raster.Image’>, label=’Element type’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3463370>)

The type of the returned Elements, must be a 2D Dataset type.

precompute = param.Boolean(allow_refs=False, default=False, label=’Precompute’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3462470>)

Whether to apply precomputing operations. Precomputing can speed up resampling operations by avoiding unnecessary recomputation if the supplied element does not change between calls. The cost of enabling this option is that the memory used to represent this internal state is not freed between calls.

element_type[source]#

alias of Image

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.


stats Module#

Inheritance diagram of holoviews.operation.stats
class holoviews.operation.stats.bivariate_kde(*, bandwidth, bw_method, contours, cut, filled, levels, n_samples, x_range, y_range, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Computes a 2D kernel density estimate (KDE) of the first two dimensions in the input data. Kernel density estimation is a non-parametric way to estimate the probability density function of a random variable.

The KDE works by placing 2D Gaussian kernel at each sample with the supplied bandwidth. These kernels are then summed to produce the density estimate. By default a good bandwidth is determined using the bw_method but it may be overridden by an explicit value.

Parameters inherited from:

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

contours = param.Boolean(allow_refs=False, default=True, label=’Contours’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3357010>)

Whether to compute contours from the KDE, determines whether to return an Image or Contours/Polygons.

bw_method = param.ObjectSelector(allow_refs=False, default=’scott’, label=’Bw method’, names={}, nested_refs=False, objects=[‘scott’, ‘silverman’], rx=<param.reactive.reactive_ops object at 0x72aba3356da0>)

Method of automatically determining KDE bandwidth

bandwidth = param.Number(allow_None=True, allow_refs=False, inclusive_bounds=(True, True), label=’Bandwidth’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3356fe0>)

Allows supplying explicit bandwidth value rather than relying on scott or silverman method.

cut = param.Number(allow_refs=False, default=3, inclusive_bounds=(True, True), label=’Cut’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3356da0>)

Draw the estimate to cut * bw from the extreme data points.

filled = param.Boolean(allow_refs=False, default=False, label=’Filled’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3357220>)

Controls whether to return filled or unfilled contours.

levels = param.ClassSelector(allow_refs=False, class_=(<class ‘list’>, <class ‘int’>), default=10, label=’Levels’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3356d70>)

A list of scalar values used to specify the contour levels.

n_samples = param.Integer(allow_refs=False, default=100, inclusive_bounds=(True, True), label=’N samples’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3356fb0>)

Number of samples to compute the KDE over.

x_range = param.NumericTuple(allow_None=True, allow_refs=False, label=’X range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba33571f0>)

The x_range as a tuple of min and max x-value. Auto-ranges if set to None.

y_range = param.NumericTuple(allow_None=True, allow_refs=False, label=’Y range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3356f80>)

The x_range as a tuple of min and max y-value. Auto-ranges if set to None.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.stats.univariate_kde(*, bandwidth, bin_range, bw_method, cut, dimension, filled, groupby, n_samples, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Computes a 1D kernel density estimate (KDE) along the supplied dimension. Kernel density estimation is a non-parametric way to estimate the probability density function of a random variable.

The KDE works by placing a Gaussian kernel at each sample with the supplied bandwidth. These kernels are then summed to produce the density estimate. By default a good bandwidth is determined using the bw_method but it may be overridden by an explicit value.

Parameters inherited from:

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

bw_method = param.ObjectSelector(allow_refs=False, default=’scott’, label=’Bw method’, names={}, nested_refs=False, objects=[‘scott’, ‘silverman’], rx=<param.reactive.reactive_ops object at 0x72aba3357730>)

Method of automatically determining KDE bandwidth

bandwidth = param.Number(allow_None=True, allow_refs=False, inclusive_bounds=(True, True), label=’Bandwidth’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3357e50>)

Allows supplying explicit bandwidth value rather than relying on scott or silverman method.

cut = param.Number(allow_refs=False, default=3, inclusive_bounds=(True, True), label=’Cut’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3357730>)

Draw the estimate to cut * bw from the extreme data points.

bin_range = param.NumericTuple(allow_None=True, allow_refs=False, label=’Bin range’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3357e80>)

Specifies the range within which to compute the KDE.

dimension = param.String(allow_None=True, allow_refs=False, label=’Dimension’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3357760>)

Along which dimension of the Element to compute the KDE.

filled = param.Boolean(allow_refs=False, default=True, label=’Filled’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba3357580>)

Controls whether to return filled or unfilled KDE.

n_samples = param.Integer(allow_refs=False, default=100, inclusive_bounds=(True, True), label=’N samples’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba33576d0>)

Number of samples to compute the KDE over.

groupby = param.ClassSelector(allow_None=True, allow_refs=False, class_=(<class ‘str’>, <class ‘holoviews.core.dimension.Dimension’>), label=’Groupby’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba33576a0>)

Defines a dimension to group the Histogram returning an NdOverlay of Histograms.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.


timeseries Module#

Inheritance diagram of holoviews.operation.timeseries
class holoviews.operation.timeseries.RollingBase(*, center, min_periods, rolling_window, name)[source]#

Bases: Parameterized

Parameters shared between rolling and rolling_outlier_std.

center = param.Boolean(allow_refs=False, default=True, label=’Center’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba31d7a60>)

Whether to set the x-coordinate at the center or right edge of the window.

min_periods = param.Integer(allow_None=True, allow_refs=False, inclusive_bounds=(True, True), label=’Min periods’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba31d7820>)

Minimum number of observations in window required to have a value (otherwise result is NaN).

rolling_window = param.Integer(allow_refs=False, default=10, inclusive_bounds=(True, True), label=’Rolling window’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba31d7a30>)

The window size over which to operate.

class holoviews.operation.timeseries.resample(*, closed, function, label, rule, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Resamples a timeseries of dates with a frequency and function.

Parameters inherited from:

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

closed = param.ObjectSelector(allow_None=True, allow_refs=False, label=’Closed’, names={}, nested_refs=False, objects=[‘left’, ‘right’], rx=<param.reactive.reactive_ops object at 0x72aba31d66e0>)

Which side of bin interval is closed

function = param.Callable(allow_refs=False, default=<function mean at 0x72abfda83370>, label=’Function’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba320ff40>)

Function for computing new values out of existing ones.

label = param.ObjectSelector(allow_refs=False, default=’right’, label=’Label’, names={}, nested_refs=False, objects=[‘right’], rx=<param.reactive.reactive_ops object at 0x72aba31d66b0>)

The bin edge to label the bin with.

rule = param.String(allow_refs=False, default=’D’, label=’Rule’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba320ff40>)

A string representing the time interval over which to apply the resampling

function(axis=None, dtype=None, out=None, keepdims=<no value>, *, where=<no value>)[source]#

Compute the arithmetic mean along the specified axis.

Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.

Parameters#

aarray_like

Array containing numbers whose mean is desired. If a is not an array, a conversion is attempted.

axisNone or int or tuple of ints, optional

Axis or axes along which the means are computed. The default is to compute the mean of the flattened array.

New in version 1.7.0.

If this is a tuple of ints, a mean is performed over multiple axes, instead of a single axis or all the axes as before.

dtypedata-type, optional

Type to use in computing the mean. For integer inputs, the default is float64; for floating point inputs, it is the same as the input dtype.

outndarray, optional

Alternate output array in which to place the result. The default is None; if provided, it must have the same shape as the expected output, but the type will be cast if necessary. See ufuncs-output-type for more details.

keepdimsbool, optional

If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.

If the default value is passed, then keepdims will not be passed through to the mean method of sub-classes of ndarray, however any non-default value will be. If the sub-class’ method does not implement keepdims any exceptions will be raised.

wherearray_like of bool, optional

Elements to include in the mean. See ~numpy.ufunc.reduce for details.

New in version 1.20.0.

Returns#

mndarray, see dtype parameter above

If out=None, returns a new array containing the mean values, otherwise a reference to the output array is returned.

See Also#

average : Weighted average std, var, nanmean, nanstd, nanvar

Notes#

The arithmetic mean is the sum of the elements along the axis divided by the number of elements.

Note that for floating-point input, the mean is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higher-precision accumulator using the dtype keyword can alleviate this issue.

By default, float16 results are computed using float32 intermediates for extra precision.

Examples#

>>> a = np.array([[1, 2], [3, 4]])
>>> np.mean(a)
2.5
>>> np.mean(a, axis=0)
array([2., 3.])
>>> np.mean(a, axis=1)
array([1.5, 3.5])

In single precision, mean can be inaccurate:

>>> a = np.zeros((2, 512*512), dtype=np.float32)
>>> a[0, :] = 1.0
>>> a[1, :] = 0.1
>>> np.mean(a)
0.54999924

Computing the mean in float64 is more accurate:

>>> np.mean(a, dtype=np.float64)
0.55000000074505806 # may vary

Specifying a where argument:

>>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]])
>>> np.mean(a)
12.0
>>> np.mean(a, where=[[True], [False], [False]])
9.0
classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.timeseries.rolling(*, function, window_type, dynamic, group, input_ranges, link_inputs, streams, center, min_periods, rolling_window, name)[source]#

Bases: Operation, RollingBase

Applies a function over a rolling window.

Parameters inherited from:

holoviews.operation.timeseries.RollingBase: center, min_periods, rolling_window

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

window_type = param.ObjectSelector(allow_None=True, allow_refs=False, label=’Window type’, names={}, nested_refs=False, objects=[‘boxcar’, ‘triang’, ‘blackman’, ‘hamming’, ‘bartlett’, ‘parzen’, ‘bohman’, ‘blackmanharris’, ‘nuttall’, ‘barthann’, ‘kaiser’, ‘gaussian’, ‘general_gaussian’, ‘slepian’], rx=<param.reactive.reactive_ops object at 0x72aba31d6fe0>)

The shape of the window to apply

function = param.Callable(allow_refs=False, default=<function mean at 0x72abfda83370>, label=’Function’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba31d7eb0>)

The function to apply over the rolling window.

function(axis=None, dtype=None, out=None, keepdims=<no value>, *, where=<no value>)[source]#

Compute the arithmetic mean along the specified axis.

Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.

Parameters#

aarray_like

Array containing numbers whose mean is desired. If a is not an array, a conversion is attempted.

axisNone or int or tuple of ints, optional

Axis or axes along which the means are computed. The default is to compute the mean of the flattened array.

New in version 1.7.0.

If this is a tuple of ints, a mean is performed over multiple axes, instead of a single axis or all the axes as before.

dtypedata-type, optional

Type to use in computing the mean. For integer inputs, the default is float64; for floating point inputs, it is the same as the input dtype.

outndarray, optional

Alternate output array in which to place the result. The default is None; if provided, it must have the same shape as the expected output, but the type will be cast if necessary. See ufuncs-output-type for more details.

keepdimsbool, optional

If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.

If the default value is passed, then keepdims will not be passed through to the mean method of sub-classes of ndarray, however any non-default value will be. If the sub-class’ method does not implement keepdims any exceptions will be raised.

wherearray_like of bool, optional

Elements to include in the mean. See ~numpy.ufunc.reduce for details.

New in version 1.20.0.

Returns#

mndarray, see dtype parameter above

If out=None, returns a new array containing the mean values, otherwise a reference to the output array is returned.

See Also#

average : Weighted average std, var, nanmean, nanstd, nanvar

Notes#

The arithmetic mean is the sum of the elements along the axis divided by the number of elements.

Note that for floating-point input, the mean is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higher-precision accumulator using the dtype keyword can alleviate this issue.

By default, float16 results are computed using float32 intermediates for extra precision.

Examples#

>>> a = np.array([[1, 2], [3, 4]])
>>> np.mean(a)
2.5
>>> np.mean(a, axis=0)
array([2., 3.])
>>> np.mean(a, axis=1)
array([1.5, 3.5])

In single precision, mean can be inaccurate:

>>> a = np.zeros((2, 512*512), dtype=np.float32)
>>> a[0, :] = 1.0
>>> a[1, :] = 0.1
>>> np.mean(a)
0.54999924

Computing the mean in float64 is more accurate:

>>> np.mean(a, dtype=np.float64)
0.55000000074505806 # may vary

Specifying a where argument:

>>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]])
>>> np.mean(a)
12.0
>>> np.mean(a, where=[[True], [False], [False]])
9.0
classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.operation.timeseries.rolling_outlier_std(*, sigma, dynamic, group, input_ranges, link_inputs, streams, center, min_periods, rolling_window, name)[source]#

Bases: Operation, RollingBase

Detect outliers using the standard deviation within a rolling window.

Outliers are the array elements outside sigma standard deviations from the smoothed trend line, as calculated from the trend line residuals.

The rolling window is controlled by parameters shared with the rolling operation via the base class RollingBase, to make it simpler to use the same settings for both.

Parameters inherited from:

holoviews.operation.timeseries.RollingBase: center, min_periods, rolling_window

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

sigma = param.Number(allow_refs=False, default=2.0, inclusive_bounds=(True, True), label=’Sigma’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x72aba320dde0>)

Minimum sigma before a value is considered an outlier.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

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

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.