holoviews.operation.downsample module#

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 tsdownsample library to perform massively accelerated downsampling.

Parameter Definitions


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 = Selector(default='lttb', label='Algorithm', names={}, objects=['lttb', 'nth', 'viewport', 'minmax', 'minmax-lttb', 'm4'])

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 tsdownsample). - m4: Selects the min, max, first and last value in each bin (requires tsdownsample). - 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 tsdownsample).

parallel = Boolean(default=False, label='Parallel')

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

minmax_ratio = Integer(bounds=(0, None), default=4, inclusive_bounds=(True, True), label='Minmax ratio')

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

neighbor_points = Boolean(allow_None=True, label='Neighbor points')

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