cortex-lab / KiloSort

GPU code for spike sorting
GNU General Public License v2.0
176 stars 100 forks source link

Sort Units to Electrodes #57

Open RoscoeOBrian opened 7 years ago

RoscoeOBrian commented 7 years ago

Hello, I'm using KiloSort on my 6x10 multielectrode data. In the end I get a template.npy and a template_ind.npy file. Both provide me with the template waveforms. But I dont now how to link the templates to the units I get out of cluster_groups.csv file. What I want is basically a figure like you see it in the GUI during the manual sorting. With my channels in a 6x10 order and the waveforms sorted by unit and displayed on the electrodes, where they occur.

The following code basically gives me this figure, but it seems, like the units are displayed in a random order and not only on the electrodes, where they occur.

`ch_channels=readNPY('channel_map.npy'); ch_pos=readNPY('channel_positions.npy'); templates=readNPY('templates.npy'); templates_ind=readNPY('templates_ind.npy');

ch_map_list=[]; for i=1:size(ch_map,1) ch_map_list=[ch_map_list ch_map(i,:)]; end

figure('Position',[87 33 1769 945]); for a=1:60 for i=1:size(templates,1) hold on subplot(6,10,a) plot(templates(i,:,ch_map_list(1,a)+1)) end ylim([-0.5 0.5]) xlim([20 80]) end`

image

marius10p commented 7 years ago

Hi,

I am not sure what issue you are reporting. Have you used the field "kcoords" to limit units to be only on their own electrodes? Whether you have or haven't, you can find for each unit its largest channel, and use that as your reference.

You might find some of the following information useful as well

https://github.com/kwikteam/phy-contrib/blob/master/docs/template-gui.md http://data.cortexlab.net/dualPhase3/