Closed zhouyi0812 closed 4 months ago
until https://github.com/kushalkolar/mesmerize-viz/issues/42 install pygfx and fpl from specific commits:
pip install git+https://github.com/pygfx/pygfx.git@2927712faeb867412a233b3efc8743ba1cc4cb11
pip install "fastplotlib[notebook] @ git+https://github.com/fastplotlib/fastplotlib.git@418a73b2aef82043af004f392faf6b4d2c577deb"
note that the min required python version is 3.10
I followed the instruction above to install within mescore environment and restart the computer but I still have the same issue, thank you!
and my python version is Python 3.10.8
I just released a pypi package for mesviz which gives you the versions of fastplotlib
and pygfx
that mesviz works with: https://github.com/kushalkolar/mesmerize-viz?tab=readme-ov-file#installation
Hello,
When I run the visualization, there is an error message: ZeroDivisionError Traceback (most recent call last) Cell In[22], line 2 1 # to show the correlation and pnr images ----> 2 iw_corr_pnr = fpl.ImageWidget( 3 [corr, pnr], 4 names=["corr", "pnr"], 5 grid_plot_kwargs={"size": (650, 300)}, 6 cmap="turbo", 7 ) 9 # mcorr vids, we will display thresholded mcorr vids 10 mcorr_vids = [mcorr_movie.astype(np.float32) for i in range(4)]
File ~\miniforge3\envs\mescore\lib\site-packages\fastplotlib\widgets\image.py:561, in ImageWidget.init(self, data, dims_order, slider_dims, window_funcs, frame_apply, grid_shape, names, grid_plot_kwargs, histogram_widget, kwargs) 557 # update the default kwargs with any user-specified kwargs 558 # user specified kwargs will overwrite the defaults 559 grid_plot_kwargs_default.update(grid_plot_kwargs) --> 561 self._gridplot: GridPlot = GridPlot(shape=grid_shape, grid_plot_kwargs_default) 563 for data_ix, (d, subplot) in enumerate(zip(self.data, self.gridplot)): 564 if self._names is not None:
File ~\miniforge3\envs\mescore\lib\site-packages\fastplotlib\layouts_gridplot.py:93, in GridPlot.init(self, shape, cameras, controller_types, controller_ids, canvas, renderer, size, names) 90 else: 91 self.names = None ---> 93 canvas, renderer = make_canvas_and_renderer(canvas, renderer) 95 if isinstance(cameras, str): 96 # create the array representing the views for each subplot in the grid 97 cameras = np.array([cameras] self.shape[0] self.shape[1]).reshape( 98 self.shape 99 )
File ~\miniforge3\envs\mescore\lib\site-packages\fastplotlib\layouts_utils.py:89, in make_canvas_and_renderer(canvas, renderer) 83 raise ValueError( 84 f"canvas option must either be a valid WgpuCanvas implementation, a pygfx Texture" 85 f" or a str from the following options: {CANVAS_OPTIONS}" 86 ) 88 if renderer is None: ---> 89 renderer = WgpuRenderer(canvas) 91 return canvas, renderer
File ~\miniforge3\envs\mescore\lib\site-packages\pygfx\renderers\wgpu_renderer.py:136, in WgpuRenderer.init(self, target, pixel_ratio, pixel_filter, show_fps, blend_mode, sort_objects, enable_events, gamma_correction, *args, **kwargs) 132 raise TypeError( 133 f"Render target must be a Canvas or Texture, not a {target.class.name}" 134 ) 135 self._target = target --> 136 self.pixel_ratio = pixel_ratio 137 self.pixel_filter = pixel_filter 139 # Make sure we have a shared object (the first renderer creates the instance)
File ~\miniforge3\envs\mescore\lib\site-packages\pygfx\renderers\wgpu_renderer.py:234, in WgpuRenderer.pixel_ratio(self, value) 232 target_lsize = self.logical_size 233 # Determine target ratio --> 234 target_ratio = target_psize[0] / target_lsize[0] 235 # Use 2 on non-hidpi displays. On hidpi displays follow target. 236 self._pixel_ratio = float(target_ratio) if target_ratio > 1 else 2.0
ZeroDivisionError: division by zero
Thank you