cortex-lab / phy

phy: interactive visualization and manual spike sorting of large-scale ephys data
BSD 3-Clause "New" or "Revised" License
318 stars 157 forks source link

Error when trying to quit #1075

Open m-beau opened 3 years ago

m-beau commented 3 years ago

Phy simply freezes when trying to quit it, forcing me to force-kill the process to exit the app.

Steps to reproduce the problem: either hit ctrl+q or click on the quit cross or file->quit

m-beau commented 3 years ago

And very worryingly, it leads to error due to ungraceful closing:

11:07:49.984 [D] init:68 Start capturing exceptions. 11:07:52.339 [W] model:545 Unreferenced clusters found in templates (generally not a problem) 11:07:52.341 [D] model:560 Loading spike clusters. 11:07:54.014 [W] model:567 Unreferenced clusters found in spike_clusters (generally not a problem) 11:07:54.017 [D] model:507 No channel shank file found. 11:07:54.018 [D] model:627 Loading templates. 11:07:54.019 [D] model:654 Templates are dense. 11:07:54.019 [D] model:604 Loading spike waveforms. 11:07:54.019 [D] model:609 Skipping spike waveforms that do not exist, they will be extracted on the fly from the raw data as needed. 11:07:54.019 [D] model:660 Loading the whitening matrix. 11:07:54.020 [D] model:667 Loading the inverse of the whitening matrix. 11:07:54.023 [D] model:164 Loading traces at /mnt/6C2E-653C/transitory_spikesorting/20-08-07_MB059/20-08-07_MB059_probe2/20-08-07_MB059_probe2.ap.bin. 11:07:54.023 [D] model:696 Loading features. 11:07:54.024 [D] model:711 Features are sparse. 11:07:54.025 [D] model:733 Loading template features. 11:07:54.026 [D] model:743 Template features are sparse. 11:07:54.027 [D] model:442 Load cluster_celltype.tsv. 11:07:54.028 [D] _misc:319 Read /mnt/6C2E-653C/transitory_spikesorting/20-08-07_MB059/20-08-07_MB059_probe2/cluster_celltype.tsv. 11:07:54.028 [D] model:442 Load cluster_group.tsv. 11:07:54.030 [D] _misc:319 Read /mnt/6C2E-653C/transitory_spikesorting/20-08-07_MB059/20-08-07_MB059_probe2/cluster_group.tsv. 11:07:54.046 [D] context:100 Initialize joblib cache dir at /mnt/6C2E-653C/transitory_spikesorting/20-08-07_MB059/20-08-07_MB059_probe2/.phy. 11:07:54.046 [D] context:101 Reducing the size of the cache if needed. 11:07:54.507 [D] base:102 Add filter high_pass. 11:07:54.507 [D] config:31 Load config file /home/maxime/.phy/phy_config.py. 11:07:54.508 [D] plugin:74 Scanning /home/maxime/.phy/plugins. 11:07:54.508 [D] plugin:78 Found plugin module n_spikes_view.py. 11:07:54.509 [D] plugin:36 Register plugin n_spikes_view.ExampleNspikesViewsPlugin. 11:07:54.509 [D] plugin:145 Loading 1 plugins. 11:07:54.509 [D] plugin:156 Attached plugin ExampleNspikesViewsPlugin. 11:07:54.510 [D] context:126 Load memcache for phy.apps.base._get_template_waveforms. 11:07:54.510 [D] context:126 Load memcache for phy.apps.base.get_mean_spike_template_amplitudes. 11:07:54.511 [D] context:126 Load memcache for phy.apps.base.get_template_counts. 11:07:54.512 [D] context:126 Load memcache for phy.apps.base.get_template_for_cluster. 11:07:54.514 [D] context:126 Load memcache for phy.apps.template.gui.get_template_amplitude. 11:07:54.515 [D] context:126 Load memcache for phy.apps.base.get_cluster_amplitude. 11:07:54.515 [D] context:126 Load memcache for phy.apps.base.get_mean_firing_rate. 11:07:54.516 [D] context:126 Load memcache for phy.apps.base.get_best_channel. 11:07:54.519 [D] context:126 Load memcache for phy.apps.template.gui.get_best_channels. 11:07:54.520 [D] context:126 Load memcache for phy.apps.base.get_channel_shank. 11:07:54.521 [D] context:126 Load memcache for phy.apps.base.get_probe_depth. 11:07:54.521 [D] context:126 Load memcache for phy.apps.base.peak_channel_similarity. 11:07:54.676 [E] init:62 An error has occurred (ValueError): EOF: reading array data, expected 262144 bytes got 259907 Traceback (most recent call last): File "/home/maxime/anaconda3/envs/phy2/bin/phy", line 8, in sys.exit(phycli()) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/click/core.py", line 1025, in call return self.main(args, kwargs) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/click/core.py", line 955, in main rv = self.invoke(ctx) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/click/core.py", line 1517, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/click/core.py", line 1279, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/click/core.py", line 710, in invoke return callback(args, kwargs) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/click/decorators.py", line 18, in new_func return f(get_current_context(), *args, kwargs) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/init.py", line 159, in cli_template_gui template_gui(params_path, kwargs) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/template/gui.py", line 198, in template_gui controller = TemplateController(model=load_model(params_path), dir_path=dir_path, *kwargs) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/base.py", line 447, in init super(TemplateMixin, self).init(args, kwargs) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/base.py", line 898, in init self._set_supervisor() File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/template/gui.py", line 94, in _set_supervisor super(TemplateController, self)._set_supervisor() File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/base.py", line 989, in _set_supervisor context=self.context, File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/cluster/supervisor.py", line 636, in init spc = context.load('spikes_per_cluster') if context else None File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/utils/context.py", line 208, in load return load_pickle(path) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/phylib/utils/_misc.py", line 144, in load_pickle return load(path) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 585, in load obj = _unpickle(fobj, filename, mmap_mode) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 504, in _unpickle obj = unpickler.load() File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/pickle.py", line 1088, in load dispatchkey[0] File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 342, in load_build self.stack.append(array_wrapper.read(self)) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 187, in read array = self.read_array(unpickler) File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 138, in read_array read_size, "array data") File "/home/maxime/anaconda3/envs/phy2/lib/python3.7/site-packages/joblib/numpy_pickle_utils.py", line 226, in _read_bytes raise ValueError(msg % (error_template, size, len(data))) ValueError: EOF: reading array data, expected 262144 bytes got 259907

m-beau commented 3 years ago

The bug above was solved by deleting the cache in /.phy (but phy still cannot close gracefully