wave_clus
wave_clus copied to clipboard
Some questions when use the batch functions
Hi Fernando, I am new to spike sorting and I would really appreciate if you could answer some questions that I have.
First of all, I want to sort the interictal spikes, which always last about 70ms, and most energy concentrate below 200Hz. The sampling_rate was 20000Hz, so each spike contains 1400 samples. I use the Do_clustering function following the step: 1. The spikes detected and save in matlab variable (numbers*spike_length); 2. set index(time in ms), spikes(in uV), and save as 'someting_spikes.mat'; 3. run Do_clustering. I can get some results,but I still confuse about them.
- Do I need to do Get_spikes first ?
- The raw each spike contains 1400 samples, do I need to do downsample function? How many samples should maintain in each spike is the best? Could you show me a rang?
- I saw par.sort_fmin=300,par_sort_fmax=3000, is it suit for my sorting?
- When each spike contains more samples, the inspk is larger. Dose it mean more coeffecients were chose to do separation? And how can I get the same picture as on wave_clus when I choose the 'spike features'?
- Do I need to change other parameters?
Thank you very much.
Hi,
- Yes, but just to for align the spikes, if you have them well align to the maximum/minimum, don't follow this step. The file (not named 'spikes_[something].mat') should include a matrix named spikes (nr. of spikes x length of the spikes) plus a vector index with the spike times (in ms).
- It will be crazy for the algorithm to handle so many samples. A downsampling to 128 or 258 samples will be perfect.
- Using Get_spikes with spikes or just Do_clustering doesn't apply that parameters.
- Yes inspk could be as high as the number of samples * par.max_inputs. That picture in wave_clus is just the first two features. If you really want a 2D representation of the clusters maybe you could load inspk and then use a method like t-SNE.
- If you just use Do_clustering you could try with par.scales 1 o 2 units higher. Using Get_spikes first, you need to change par.w_pre, par.w_post , and par.alignment_window as well.
Thank you very much for reply me so quickly. But I do not quite understand : 1. how to try with par.scales 1 o 2 units higher, could you show me some more details? 2. I saw the default par.w_pre=20, par.w_post=44, and the final wave length is 64, so you also do the downsampling in wave_clus? And if I choose the length 128, it means I should set par.w_pre=x, and the par.w_post=128-x? 3. The par.alignment_window defaults 10, how can I change it according to my data?
thanks again.
- To change a parameter edit the file set_parameters.m, the current value is 4 (line 63), change it to 5 or 6 and run Do_clustering again.
- Yes and the x should be the approximate position of the peak of the spike. If you will use the Get_spikes use 128+14 samples in the file with the unaligned data (the extra 7 samples in each border will help the interpolation and allow the peak alignment).
- That depends of how unaligned is your data, but I guess that 10 will be enough.
Thank you very much, I will follow your advice and try again.
Hi Fernando, Sorry to bother you again, last time you suggest me using tsne function to draw the feature picture, but I still have some questions with it, please help me with that. The inspk contains 32*10 values, but in fact just 13 different groups. I used tsne function as [a,b]=tsne(inspk,'NumDimensions',2,'NumPCAComponents',3); but the results appeared 32 different points according to wave_clus 13 different points, I do not know how to improve it.
Thank you very much!
Different groups == Clusters? I don't know if I'm understanding correctly, are you saying that wave_clus give you 13 clusters but you can see 32 using tsne? tsne is just a way to plot things and it get more and more forced when you increase the original dimensions probably that is the reason.
Sorry for my confusing description, let me say it again. I had 13 spikes, and I copied some of them twice, so I had 32 spikes in the end, and each spike had 10 wavelet features.
About the tsne, I can't help you with the details of the implementation. But if you have less that 500 different spikes, I'm not sure that wave_clus can find real clusters there
Hi,
Thanks for helping me with the code, but I have some new questions.
First I detected the spikes with 'Get_spikes' function, but I just want to do cluster to some of the spikes, not all of them. The following choices are what I would like to to, please tell me which one should I chose? Or could you give me a better advice? Thanks a lot.
- Do cluster to all the spikes, and then choose those I want, according to the cluster they belong to, do average again, and plot the result.
- Separate the raw data first, get spikes and do cluster? Which I worry about the threshold is changed.
- Before do cluster, choose spikes I want, change the parameters in '_spikes.mat', and do cluster. But I am confuse about the parameters in the '_spikes.mat', especially about the index, psegment and sr_psegment. If you suggest me to do like this, please tell me how to change them.
Best, Rong
- This is a acceptable alternative, you could accept some clusters and the merge the others in a big multinuit class. I don't understand what do you mean with "average again".
- I don't know how do you want to separate the raw data. Do you mean remove segments with high noise?
- This is a acceptable alternative. The index variable is the time in ms of each spike,. The psegment variables are just to plot the small piece of filtered data in the figure (they are useless for the sorting)
Hi,
Thanks for your reply, I will take the third choice. Another question is if the sampling rate is 2000Hz, how long is the spike wave last , is that 1/2000*64=0.032 s?
Best, Rong
Fernando J. Chaure [email protected] 于2021年1月5日周二 下午4:36写道:
- This is a acceptable alternative, you could accept some clusters and the merge the others in a big multinuit class. I don't understand what do you mean with "average again".
- I don't know how do you want to separate the raw data. Do you mean remove segments with high noise?
- This is a acceptable alternative. The index variable is the time in ms of each spike,. The psegment variables are just to plot the small piece of filtered data in the figure (they are useless for the sorting)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/csn-le/wave_clus/issues/157#issuecomment-754966101, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOF2ZBIWWCY2RME3HT6SPTTSYOO7ZANCNFSM4KCRZWXA .
You said that your sampling rate was 20 KHz therefore the waveform will contain 3.2ms
Hi,
I am still confuse about the result. I plot the first wave from '_spikes.mat', plot(spikes(1,:)), and then I plot the second wave, from '.mat', 'Data' is used for spike detection, and the 'index' contained the spike time, plot(Data(index(1)-22:index(1)+43)), why these two wave forms are not the same? I think the second one contains 3.2ms, but the first one is less than 3.2ms. Please help me with this. Thank you.
Fernando J. Chaure [email protected] 于2021年1月6日周三 上午4:06写道:
You said that your sampling rate was 20 KHz therefore the waveform will contain 3.2ms
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/csn-le/wave_clus/issues/157#issuecomment-755236352, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOF2ZBN3L53VV2RAQVJIYFLSYQ7ZRANCNFSM4KCRZWXA .
There are multiple steps in the preprocessing: filtering (one filter for deteccion and other for sorting [the spikes saved on the file]) and alignment using interpolation.
Hi,
I understand it is a complicated process, but I still want to make sure that, the final result from 'spikes' which always contain (a64) values, how long will each wave (164) contain? Thanks.
Fernando J. Chaure [email protected] 于2021年1月6日周三 上午10:56写道:
There are multiple steps in the preprocessing: filtering (one filter for deteccion and other for sorting [the spikes saved on the file]) and alignment using interpolation.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/csn-le/wave_clus/issues/157#issuecomment-755458854, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOF2ZBNC534OVIZB4VB54Y3SYSP4HANCNFSM4KCRZWXA .
the spikes will have par.w_pre+par.w_post samples (64 by default) with a sampling rate of 20 kHz that equals to 3.2 ms
Hi Fernando,
Thanks again for your patience, I still have a question: what method do you use to get the 'mean wave form' with each cluster? (The thicker colored curve in each cluster picture)
Best, Rong
Fernando J. Chaure [email protected] 于2021年1月6日周三 上午11:28写道:
the spikes will have par.w_pre+par.w_post samples (64 by default) with a sampling rate of 20 kHz that equals to 3.2 ms
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/csn-le/wave_clus/issues/157#issuecomment-755480932, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOF2ZBONEID7F24DOBJOFQTSYSTVBANCNFSM4KCRZWXA .
the mean (sample by sample) of all the spikes for that class
Hi,
I am sorry to bother you again, but would you show me how to detect and sort spikes from multiple channels(10 or more) data at one time with wave_clus? I would like to detect one channel's spikes with/without the effect of the neighbor channels. Thanks very much.
Best, Rong
On both cases, you need a file with the raw data per channel. The detection for single-channel is calling Get_spikes for each channel, and for polytrodes the instructions are here. Finally, just sort the detected spikes using Do_clustering with the '*_spikes.mat' files created in the detections.
It is possible but I wouldn't recommend using Wave_clus for more than 4 channels, that is out of the scope of the method. There are other spike sorting methods specially designed to analyze recording with a high number of neighbour channels.