holoviews.operation package#
Submodules#
- holoviews.operation.datashader module
AggState
AggregationOperation
LineAggregationOperation
SpreadingOperation
aggregate
area_aggregate
bundle_graph
contours_rasterize
curve_aggregate
datashade
directly_connect_edges
dynspread
geom_aggregate
geometry_rasterize
inspect
inspect_base
inspect_mask
inspect_points
inspect_polygons
overlay_aggregate
quadmesh_rasterize
rasterize
rectangle_aggregate
regrid
segments_aggregate
shade
spikes_aggregate
split_dataframe()
spread
spread_aggregate
stack
trimesh_rasterize
- holoviews.operation.downsample module
- holoviews.operation.element module
- holoviews.operation.normalization module
- holoviews.operation.resample module
- holoviews.operation.stats module
- holoviews.operation.timeseries module
Module contents#
- 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’.
Parameter Definitions
mode = Selector(default='data', label='Mode', names={}, objects=['data', 'display'])
The mode of the Compositor object which may be either ‘data’ or ‘display’.
backends = List(bounds=(0, None), default=[], label='Backends')
Defines which backends to apply the Compositor for.
operation = Parameter(allow_None=True, label='Operation')
The Operation to apply when collapsing overlays.
pattern = String(default='', label='Pattern')
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 = String(allow_None=True, default='', label='Group')
The group identifier for the output of this particular compositor
kwargs = Dict(allow_None=True, class_=<class 'dict'>, label='Kwargs')
Optional set of parameters to pass to the operation.
transfer_options = Boolean(default=False, label='Transfer options')
Whether to transfer the options from the input to the output.
transfer_parameters = Boolean(default=False, label='Transfer parameters')
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.
Parameter Definitions
group = String(default='Operation', label='Group')
The group string used to identify the output of the Operation. By default this should match the operation name.
dynamic = Selector(default='default', label='Dynamic', names={}, objects=['default', True, False])
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 = ClassSelector(allow_None=True, class_=(<class 'dict'>, <class 'tuple'>), default={}, label='Input ranges')
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 = Boolean(default=False, label='Link inputs')
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 = ClassSelector(class_=(<class 'dict'>, <class 'list'>), default=[], label='Streams')
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.
- 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’])
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, link_inputs, streamsdatatype = List(bounds=(0, None), default=['xarray', 'grid'], label='Datatype')
The grid interface types to use when constructing the gridded Dataset.
- 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: dynamic, input_ranges, link_inputs, streamsgroup = String(default='', label='Group')
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 = Parameter(default=<class 'holoviews.element.raster.Image'>, label='Output type')
The output type of the chain operation. Must be supplied if the chain is to be used as a channel operation.
operations = List(bounds=(0, None), class_=<class 'holoviews.core.operation.Operation'>, default=[], item_type=<class 'holoviews.core.operation.Operation'>, label='Operations')
A list of Operations (or Operation instances) that are applied on the input from left to right.
- 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, link_inputs, streamsfn = Callable(default=<function mean at 0x10881a1f0>, label='Fn')
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.
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. 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.
Added 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#
>>> import numpy as np >>> 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) np.float32(0.54999924)
Computing the mean in float64 is more accurate:
>>> np.mean(a, dtype=np.float64) 0.55000000074505806 # may vary
Computing the mean in timedelta64 is available:
>>> b = np.array([1, 3], dtype="timedelta64[D]") >>> np.mean(b) np.timedelta64(2,'D')
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
- 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: dynamic, input_ranges, link_inputs, streamsgroup = String(default='Level', label='Group')
The group assigned to the output contours.
levels = ClassSelector(class_=(<class 'list'>, <class 'int'>), default=10, label='Levels')
A list of scalar values used to specify the contour levels.
filled = Boolean(default=False, label='Filled')
Whether to generate filled contours
overlaid = Boolean(default=False, label='Overlaid')
Whether to overlay the contour on the supplied 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: dynamic, input_ranges, link_inputs, streamsgroup = String(default='Convolution', label='Group')
The group assigned to the convolved output.
kernel_roi = NumericTuple(default=(0, 0, 0, 0), label='Kernel roi', length=4)
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.
- 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, input_rangesdynamic = Boolean(default=True, label='Dynamic')
Enables dynamic processing by default.
link_inputs = Boolean(default=True, label='Link inputs')
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 = ClassSelector(class_=(<class 'dict'>, <class 'list'>), default=[<class 'holoviews.streams.RangeXY'>], label='Streams')
List of streams that are applied if dynamic=True, allowing for dynamic interaction with the plot.
max_samples = Integer(default=5000, inclusive_bounds=(True, True), label='Max samples')
Maximum number of samples to display at the same time.
random_seed = Integer(default=42, inclusive_bounds=(True, True), label='Random seed')
Seed used to initialize randomization.
x_range = NumericTuple(allow_None=True, label='X range', length=2)
The x_range as a tuple of min and max x-value. Auto-ranges if set to None.
y_range = NumericTuple(allow_None=True, label='Y range', length=2)
The x_range as a tuple of min and max y-value. Auto-ranges if set to None.
- class holoviews.operation.dendrogram(*, adjoined, adjoint_dims, main_dim, main_element, optimal_ordering, dynamic, group, input_ranges, link_inputs, streams, name)[source]#
Bases:
Operation
The dendrogram operation computes one or two adjoint dendrogram of the data along the specified dimension(s). The operation uses the scipy dendrogram algorithm to compute the tree structure of the data. The operation is typically used to visualize hierarchical clustering of the data.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, link_inputs, streamsadjoined = Boolean(default=True, label='Adjoined')
Whether to adjoin the dendrogram(s) to the main plot
adjoint_dims = List(bounds=(0, None), class_=<class 'str'>, default=[], item_type=<class 'str'>, label='Adjoint dims')
The adjoint dimension to cluster on
main_dim = String(default='', label='Main dim')
The main dimension to cluster on
main_element = ClassSelector(class_=<class 'holoviews.core.data.Dataset'>, default=<class 'holoviews.element.raster.HeatMap'>, label='Main element')
The Element type to use for the main plot if the input is a Dataset.
optimal_ordering = Boolean(default=False, label='Optimal ordering')
If True, the linkage matrix will be reordered so that the distance between successive leaves is minimal. This results in a more intuitive tree structure when the data are visualized. defaults to False, because this algorithm can be slow, particularly on large datasets. See for more information: https://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.hierarchy.linkage.html#scipy.cluster.hierarchy.linkage
- 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, link_inputs, streamsoutput_type = Parameter(default=<class 'holoviews.element.raster.RGB'>, label='Output type')
The output type of the factor operation. By default, if three overlaid Images elements are supplied, the corresponding RGB element will be returned.
args = List(bounds=(0, None), default=[], label='Args')
The list of positional argument to pass to the factory
kwargs = Dict(class_=<class 'dict'>, default={}, label='Kwargs')
The dict of keyword arguments to pass to the factory
- class holoviews.operation.function(*, args, fn, input_type, kwargs, output_type, dynamic, group, input_ranges, link_inputs, streams, name)[source]#
Bases:
Operation
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, link_inputs, streamsoutput_type = ClassSelector(allow_None=True, class_=<class 'type'>, label='Output type')
The output type of the method operation
input_type = ClassSelector(allow_None=True, class_=<class 'type'>, label='Input type')
The object type the method is defined on
fn = Callable(label='Fn')
The function to apply.
args = List(bounds=(0, None), default=[], label='Args')
The list of positional argument to pass to the method
kwargs = Dict(class_=<class 'dict'>, default={}, label='Kwargs')
The dict of keyword arguments to pass to the method
- 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
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: dynamic, input_ranges, link_inputs, streamsgroup = String(default='Gradient', label='Group')
The group assigned to the output gradient matrix.
- class holoviews.operation.histogram(*, bin_range, bins, cumulative, dimension, frequency_label, groupby, groupby_range, 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, link_inputs, streamsbin_range = NumericTuple(allow_None=True, label='Bin range', length=2)
Specifies the range within which to compute the bins.
bins = ClassSelector(allow_None=True, class_=(<class 'numpy.ndarray'>, <class 'list'>, <class 'tuple'>, <class 'str'>), label='Bins')
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 = Boolean(default=False, label='Cumulative')
Whether to compute the cumulative histogram
dimension = String(allow_None=True, label='Dimension')
Along which dimension of the Element to compute the histogram.
frequency_label = String(allow_None=True, label='Frequency label')
Format string defining the label of the frequency dimension of the Histogram.
groupby = ClassSelector(allow_None=True, class_=(<class 'str'>, <class 'holoviews.core.dimension.Dimension'>), label='Groupby')
Defines a dimension to group the Histogram returning an NdOverlay of Histograms.
groupby_range = Selector(default='shared', label='Groupby range', names={}, objects=['shared', 'separated'])
Whether to group the histograms along the same range or separate them.
log = Boolean(default=False, label='Log')
Whether to use base 10 logarithmic samples for the bin edges.
mean_weighted = Boolean(default=False, label='Mean weighted')
Whether the weighted frequencies are averaged.
normed = Selector(default=False, label='Normed', names={}, objects=[True, False, 'integral', 'height'])
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 = Boolean(default=False, label='Nonzero')
Whether to use only nonzero values when computing the histogram
num_bins = Integer(default=20, inclusive_bounds=(True, True), label='Num bins')
Number of bins in the histogram .
weight_dimension = String(allow_None=True, label='Weight dimension')
Name of the dimension the weighting should be drawn from
style_prefix = String(allow_None=True, label='Style prefix')
Used for setting a common style for histograms in a HoloMap or AdjointLayout.
- 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: dynamic, input_ranges, link_inputs, streamsgroup = String(default='Transform', label='Group')
The group assigned to the resulting overlay.
spec = String(default='', label='Spec')
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 = Number(default=0, inclusive_bounds=(True, True), label='Fill')
default_range = Tuple(default=(0, 1), label='Default range', length=2)
The default range that will be set on the value_dimension of any automatically created blank image elements.
- 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, link_inputs, streamsinterpolation = Selector(default='steps-mid', label='Interpolation', names={}, objects=['steps-pre', 'steps-mid', 'steps-post', 'linear'])
Controls the transition point of the step along the x-axis.
- 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
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, link_inputs, streamsoutput_type = ClassSelector(allow_None=True, class_=<class 'type'>, label='Output type')
The output type of the method operation
input_type = ClassSelector(allow_None=True, class_=<class 'type'>, label='Input type')
The object type the method is defined on
method_name = String(default='__call__', label='Method name')
The method name
args = List(bounds=(0, None), default=[], label='Args')
The list of positional argument to pass to the method
kwargs = Dict(class_=<class 'dict'>, default={}, label='Kwargs')
The dict of keyword arguments to pass to the method
- 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: dynamic, input_ranges, link_inputs, streamsgroup = String(default='Operation', label='Group')
The group assigned to the result after having applied the operator.
output_type = Parameter(allow_None=True, label='Output type')
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 = Callable(label='Op')
The operation used to generate a new HoloViews object returned by the operation. By default, the identity operation is applied.
- 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: dynamic, input_ranges, link_inputs, streamsgroup = String(default='Threshold', label='Group')
The group assigned to the thresholded output.
level = Number(default=0.5, inclusive_bounds=(True, True), label='Level')
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 = Number(default=1.0, inclusive_bounds=(True, True), label='High')
The value given to elements greater than (or equal to) the threshold.
low = Number(default=0.0, inclusive_bounds=(True, True), label='Low')
The value given to elements below the threshold.
- 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)
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: dynamic, input_ranges, link_inputs, streamsgroup = String(default='Transform', label='Group')
The group assigned to the result after applying the transform.
operator = Callable(allow_None=True, label='Operator')
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.