holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.69k stars 402 forks source link

Regression from 1.15.0 with python callables #5622

Open ludwigVonKoopa opened 1 year ago

ludwigVonKoopa commented 1 year ago

Hi,

I've been playing around with holoviews and datashader operation, and discovered some changes between v1.14.9 and v1.15.0.

I usually build custom datashader operations for dynamic visualisation of big dataset, and i have to optimize operations for the visualisation to be smooth.

Before 1.14.9, when the holoviews.core.operation.Operation._process function was called, every print method was sent to the browser console log. With holoviews >= 1.15.0, it seems print are no longer in the browser console.

example gif with holoviews 1.14.9 : holoviews_v1 14 9

same example with holoviews 1.15.0 : holoviews_v1 15 0

with upgrading 1.14.9 => 1.15.0, I noticed that the number of call to holoviews.core.operation.Operation._process was reduced for pane movement, the holoviews object wait till the click is released which i agree is a massive improvement (callbacks no longer stacks). Same for zooming which wait until the zoom is finished instead of computing the image every zoom done.

I noticed in the changelog that there was changes made with javascript callbacks (pull https://github.com/holoviz/holoviews/pull/4329) and some commits are about javascript, but i did not dig deeper about it because my javascript knowledge is limited.

Is the delete of print in webbrowser console log something wanted ? Is there a way to have both print in logs AND improvements about callbacks number and stacking ?

For now, i have to develop my functions in 1.14.9 in order to have logs when i play with panning and zooming, to see how many times my function take to rasterize for example, or some logs. Then i deploy those function in an conda env with holoviews >= 1.15.0.

Thanks

hoxbro commented 1 year ago

Can you update your holoviews version to 1.15.4 and see if the problem still occurs?

If it does, please paste your code for easy access.

ludwigVonKoopa commented 1 year ago

Hi,

Same thing with holoviews 1.15.4 : holoviews_v1 15 4

code to reproduce (same code used for gif) :

import holoviews as hv
import numpy as np
hv.extension("bokeh")

from holoviews.operation.datashader import rasterize, spread
class custom_operation(rasterize):
    iteration = 0

    def _process(self, element, key=None):
        x, y = self.p.x_range if self.p.x_range else (0.0, 0.0)
        print(f"{self.iteration:03d} | x={x:10.6f}, y={y:10.6f}")
        self.iteration += 1
        return super()._process(element, key)

random_points = np.random.multivariate_normal((0,0), [[0.1, 0.1], [0.1, 1.0]], (1000,))
spread(custom_operation( hv.Points(random_points, label="Points") ))

(I used spread operation only for visualisation purpose, or the points won't be big enough for the gif. The problem still occur without this operation)