-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Dear Spikeinterface team,
I have started to use the GUI for curation. After exporting the curation to a JSON file, I loaded the file as a dictionary so that I can use apply_curation to have a clean sorting analyser (only merged and deleted units). Things worked well until here because when I loaded this clean sorting analyser into the GUI again, I bumped into this error. Did anyone know how to deal with this?
ValueError Traceback (most recent call last)
Cell In[72], line 1
----> 1 run_mainwindow(clean_sorting_analyzer)
2 # %gui qt
3 # sw.plot_sorting_summary(sorting_analyzer, backend="spikeinterface_gui")File c:\Users\neuroPC\anaconda3\envs\spike_interface\lib\site-packages\spikeinterface_gui\main.py:156, in run_mainwindow(analyzer, mode, with_traces, curation, curation_dict, label_definitions, displayed_unit_properties, extra_unit_properties, skip_extensions, recording, start_app, layout_preset, layout, address, port, panel_start_server_kwargs, panel_window_servable, verbose, user_settings, disable_save_settings_button)
151 warnings.filterwarnings('ignore', category=UserWarning, message=".QObject::connect.")
154 app = mkQApp()
--> 156 win = QtMainWindow(controller, layout_dict=layout_dict, user_settings=user_settings)
157 win.setWindowTitle('SpikeInterface GUI')
158 # Set window iconFile c:\Users\neuroPC\anaconda3\envs\spike_interface\lib\site-packages\spikeinterface_gui\backend_qt.py:172, in QtMainWindow.init(self, controller, parent, layout_dict, user_settings)
169 self.controller.signal_handler.deactivate()
170 for view in self.views.values():
171 # refresh do not work because view are not yet visible at init
--> 172 view._refresh()
173 self.controller.signal_handler.activate()File c:\Users\neuroPC\anaconda3\envs\spike_interface\lib\site-packages\spikeinterface_gui\view_base.py:124, in ViewBase._refresh(self, **kwargs)
122 def _refresh(self, **kwargs):
123 if self.backend == "qt":
--> 124 self._qt_refresh(**kwargs)
125 elif self.backend == "panel":
126 self._panel_refresh(**kwargs)File c:\Users\neuroPC\anaconda3\envs\spike_interface\lib\site-packages\spikeinterface_gui\metricsview.py:126, in MetricsView._qt_refresh(self)
123 elif c == r:
124 values1 = units_table[visible_metrics[r]].values
--> 126 count, bins = np.histogram(values1, bins=self.settings['num_bins'])
127 curve = pg.PlotCurveItem(bins, count, stepMode='center', fillLevel=0, brush=white_brush, pen=white_brush)
128 plot.addItem(curve)File c:\Users\neuroPC\anaconda3\envs\spike_interface\lib\site-packages\numpy\lib\histograms.py:780, in histogram(a, bins, range, density, weights)
680 r"""
681 Compute the histogram of a dataset.
682
(...)
776
777 """
778 a, weights = _ravel_and_check_weights(a, weights)
--> 780 bin_edges, uniform_bins = _get_bin_edges(a, bins, range, weights)
782 # Histogram is an integer or a float array depending on the weights.
783 if weights is None:File c:\Users\neuroPC\anaconda3\envs\spike_interface\lib\site-packages\numpy\lib\histograms.py:426, in _get_bin_edges(a, bins, range, weights)
423 if n_equal_bins < 1:
424 raise ValueError('binsmust be positive, when an integer')
--> 426 first_edge, last_edge = _get_outer_edges(a, range)
428 elif np.ndim(bins) == 1:
429 bin_edges = np.asarray(bins)File c:\Users\neuroPC\anaconda3\envs\spike_interface\lib\site-packages\numpy\lib\histograms.py:323, in _get_outer_edges(a, range)
321 first_edge, last_edge = a.min(), a.max()
322 if not (np.isfinite(first_edge) and np.isfinite(last_edge)):
--> 323 raise ValueError(
324 "autodetected range of [{}, {}] is not finite".format(first_edge, last_edge))
326 # expand empty range to avoid divide by zero
327 if first_edge == last_edge:ValueError: autodetected range of [nan, nan] is not finite
Below is my code.
from spikeinterface_gui import run_mainwindow
from spikeinterface.curation import apply_curation
with open("/merged_list.json") as f:
curation_dict=json.load(f)
clean_sorting_analyzer = apply_curation(sorting_analyzer,curation_dict_or_model=curation_dict)
run_mainwindow(clean_sorting_analyzer)
Here are the version of my coding environment
spikeinterface 0.103.2
spikeinterface-gui 0.12.0
python 3.10.14
Windows 11
Here is the json file
merged_list.json
Many thanks and Merry Christmas in advance!
Chiyu