nel-lab / mesmerize-core

High level pandas-based API for batch analysis of Calcium Imaging data using CaImAn
Other
58 stars 15 forks source link

Error while running demo notebood 'mcorr_cnmf' #285

Closed pbl007 closed 5 months ago

pbl007 commented 5 months ago

Please be as descriptive as possible about your issue and provide all the information below. If you encounter an error provide full traceback or the Entire error message etc. and screenshots. Assistance is provided by the maintainers on a voluntary basis.

Hi I encountered the following error while running the demo notebook with the Sue demo data downloaded as indicated. Please let me know how to solve this issue and move forward; I'd like to use memserize-core for all future analysis in my lab. Thanks in advance, Pablo


ZeroDivisionError Traceback (most recent call last) Cell In[51], line 1 ----> 1 viz = df.mcorr.viz() 2 viz.show()

File ~/mesmerize-viz/mesmerize_viz/_mcorr.py:446, in MCorrDataFrameVizExtension.viz(self, data_options, start_index, reset_timepoint_on_change, input_movie_kwargs, image_widget_kwargs, data_grid_kwargs) 396 def viz( 397 self, 398 data_options: List[str] = None, (...) 403 data_grid_kwargs: dict = None, 404 ): 405 """ 406 Visualize motion correction output. 407 (...) 443 widget that contains the DataGrid, params text box and ImageWidget 444 """ --> 446 container = McorrVizContainer( 447 dataframe=self._dataframe, 448 data_options=data_options, 449 start_index=start_index, 450 reset_timepoint_on_change=reset_timepoint_on_change, 451 input_movie_kwargs=input_movie_kwargs, 452 image_widget_kwargs=image_widget_kwargs, 453 data_grid_kwargs=data_grid_kwargs 454 ) 456 return container

File ~/mesmerize-viz/mesmerize_viz/_mcorr.py:218, in McorrVizContainer.init(self, dataframe, data_options, start_index, reset_timepoint_on_change, input_movie_kwargs, image_widget_kwargs, data_grid_kwargs) 215 # set the initial widget state with the start index 216 data_arrays = self._get_row_data(index=start_index) --> 218 self._image_widget = ImageWidget( 219 data=data_arrays, 220 names=self._data_options, 221 **self.image_widget_kwargs 222 ) 224 # mean window slider 225 self._slider_mean_window = IntSlider( 226 min=1, 227 step=2, (...) 231 description_tooltip="set a mean rolling window" 232 )

File ~/.conda/envs/mescore/lib/python3.11/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 ~/.conda/envs/mescore/lib/python3.11/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 ~/.conda/envs/mescore/lib/python3.11/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 ~/.conda/envs/mescore/lib/python3.11/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 ~/.conda/envs/mescore/lib/python3.11/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

Screenshots Please include screenshots that describe the issue.

Hardware and environment (please complete the following information):

Additional context Add any other context about the problem here.

kushalkolar commented 5 months ago

Downgrade to pygfx v0.1.17

kushalkolar commented 5 months ago

Hi, I'm guessing you solved this, if not feel free to re-open :)

kushalkolar commented 4 months ago

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