I passed a dataset through Kilosort3. In order to curate the data using Phy, I first ran this command:
phy extract-waveforms params.py
and this generated the following three files:
_phy_spikes_subset.channels.npy
_phy_spikes_subset.spikes.npy
_phy_spikes_subset.waveforms.npy
I then ran phy template-gui params.py and was able to merge/split clusters and label then as "good", "mua", or "noise." So far so good.
I am now playing around with phylib's model class in Python. I load the model like this:
from phylib.io.model import load_model
model = load_model("params.py")
I tried running this command:
model.get_cluster_spike_waveforms(cluster_id=0)
But it breaks. As far as I can tell, model.get_cluster_spike_waveforms() calls model.get_waveforms(), which then has two options:
If the spikes are pre-computed, it calls traces.get_spike_waveforms()
If the spikes are not pre-computed, it loads the waveforms directly from the raw data, which is a lot slower, by calling traces.extract_spike_waveforms()
In my case, the spikes are pre-computed because of the 3 files I generated (all starting with "phy"). The break happens when traces.get_spike_waveforms() runs this command:
I passed a dataset through Kilosort3. In order to curate the data using Phy, I first ran this command:
phy extract-waveforms params.py
and this generated the following three files:
I then ran
phy template-gui params.py
and was able to merge/split clusters and label then as "good", "mua", or "noise." So far so good.I am now playing around with phylib's model class in Python. I load the model like this:
I tried running this command:
model.get_cluster_spike_waveforms(cluster_id=0)
But it breaks. As far as I can tell, model.get_cluster_spike_waveforms() calls model.get_waveforms(), which then has two options:
In my case, the spikes are pre-computed because of the 3 files I generated (all starting with "phy"). The break happens when traces.get_spike_waveforms() runs this command:
assert np.all(np.isin(spike_ids, spike_waveforms.spike_ids))
In other words, for some reason not all values in spike_ids are to be found in spike_waveforms.spike_ids. I am not sure why.
The problem goes away if I remove the three phy files -- it looks like traces.extract_spike_waveforms() is able to get the job done.
With that said, it would be nice to know if there is an easy fix to this, or if there is something wrong with my workflow.
Thank you :)