cortex-lab / phy

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

Phy is not able to generate FeatureView nor TemplateFeatureView in its GUI #1071

Open tobe2098 opened 3 years ago

tobe2098 commented 3 years ago

The error stands : "15:03:52.934 [W] gui:671 Could not create view FeatureView" and "15:03:54.478 [W] gui:671 Could not create view TemplateFeatureView". Resetting with --clear-state or --clear-cache does not solve the issue. I will post any additional information that you might need on request.

alejandrotorrado commented 3 years ago

I just set up Phy yesterday and am running into the same issue.

tobe2098 commented 3 years ago

Update: Seems that the problem is Kilosort related, sessions that used K2.5 had no problem but those that used K3.0 had this issue

JudithLim commented 3 years ago

I'm having the same issue when using the Kiwk-Gui on spiking data sorted with Klusta, so it might not necessarily be KiloSort related. In case it might be handy, I get the following output:

Traceback (most recent call last):
  File "c:\users\judith\anaconda3\envs\phy2\lib\site-packages\phy\gui\qt.py", line 532, in run
    result = self.fn(*self.args, **self.kwargs)
  File "c:\users\judith\anaconda3\envs\phy2\lib\site-packages\phy\cluster\views\base.py", line 171, in _worker
    self.on_select(cluster_ids=cluster_ids, **kwargs)
  File "c:\users\judith\anaconda3\envs\phy2\lib\site-packages\phy\cluster\views\base.py", line 142, in on_select
    self.plot(**kwargs)
  File "c:\users\judith\anaconda3\envs\phy2\lib\site-packages\phy\cluster\views\waveform.py", line 337, in plot
    self._plot_cluster(bunch)
  File "c:\users\judith\anaconda3\envs\phy2\lib\site-packages\phy\cluster\views\waveform.py", line 212, in _plot_cluster
    assert masks.shape == (n_spikes_clu, n_channels)
AssertionError
11:17:08.736 [W] gui:671              Could not create view FeatureView.
m-col commented 3 years ago

@tobe2098 I did a bit of debugging and we are hitting https://github.com/cortex-lab/phy/blob/master/phy/apps/base.py#L391, blocking the creation of the feature view. It seems our setup (sorting with kilosort via spikeinterface) is causing kilosort not to output the files needed for phylib to create feature view (i.e. not 'pc_features.npy'). It is likely the spikeinterface code that handles kilosort 3 needs a bit of ironing out as it's very new.

This seems to be a different error to what you are seeing @JudithLim.

m-col commented 3 years ago

Looks like it has been discussed on the kilosort issue tracker -- https://github.com/MouseLand/Kilosort/issues/317 -- and will be back at some point.

JudithLim commented 3 years ago

@m-col Yea, you're probably right. I can't seem to get klustakwik2 properly installed within the phy2 environment, so that's probably where the error is coming from.

MiguelVillavicencio commented 3 years ago

Hello All, I introduced myself with Kilosort by using the version 3 and had the same problem (No Feature/Template Views). So guided by the comments here I switched to Kilosort 2.5 and tried but this time phy crashes and does not even run/open the GUI. I don't know if one version 3 configurations prevents version 2.5 to open or if my phy is 'tied' to one of those versions, do you have any suggestion in this regard? (I am kind of stuck: I cannot finalize my sorting without the Feature view and I cannot use K2.5 either)

jamespherman commented 2 years ago

Bump - what's going on with this issue?

Zoe0793 commented 2 years ago

A temporary work around has been stated here: https://github.com/MouseLand/Kilosort/issues/429

Aghileh commented 2 years ago

Hi All,

I am working with Kilosort 2.5 and I could not get FeatureView. I tried KS3 and the problem did not solve, still, I could not get FeatureView. I need it for manual checking after automatic spike sorting.

I don’t have these outputs after KS 2.5 pc_features.npy pc_features_ind.npy template_feature_ind.npy cluster_groups.cvs

Do you know how I can fix the problem?! Many thanks.

jamespherman commented 2 years ago

I was able to get FeatureView back in 2.5 by uncommenting / commenting-out a bunch of lines of code. I tried doing the same thing in KS3 and could not make it work.

I don't have the code handy right now so I can't give you all the information, but I can describe the process I used to identify which lines to uncomment: I noticed that the npy/csv files you mentioned above were not being generated because the variables that are stored in the files are empty when KS tries to write them. I worked backwards from the write point, setting breakpoints at progressively earlier spots in the code and discovered that at some point the variables are not empty, but they are overwritten with empty ("[]") to avoid carrying them around (there are some comments about wanting to avoid holding them in memory, iirc). I commented out the lines of code where the variables were overwritten with empty, and the files were written.

I hope this helps, and good luck! I hope FeatureView comes back, I consider KS unusable without it, personally.

Aghileh commented 2 years ago

I was able to get FeatureView back in 2.5 by uncommenting / commenting-out a bunch of lines of code. I tried doing the same thing in KS3 and could not make it work.

I don't have the code handy right now so I can't give you all the information, but I can describe the process I used to identify which lines to uncomment: I noticed that the npy/csv files you mentioned above were not being generated because the variables that are stored in the files are empty when KS tries to write them. I worked backwards from the write point, setting breakpoints at progressively earlier spots in the code and discovered that at some point the variables are not empty, but they are overwritten with empty ("[]") to avoid carrying them around (there are some comments about wanting to avoid holding them in memory, iirc). I commented out the lines of code where the variables were overwritten with empty, and the files were written.

I hope this helps, and good luck! I hope FeatureView comes back, I consider KS unusable without it, personally.

Thanks for your reply and explanation. I checked, seems that cProj, iNeigh, iNeghPC, cProjPC is empty in rez file. should I find the line that they overwrite as empty?! or are they other fields that you checked before?!

AHSAN-PA commented 4 months ago

We can fix FeatureView. Please refer https://github.com/cortex-lab/phy/issues/1267 and https://github.com/cortex-lab/phy/issues/1145.