Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting single channel plexon data #238

Closed
AamnaLawrence opened this issue Sep 29, 2020 · 6 comments · Fixed by #595
Closed

Sorting single channel plexon data #238

AamnaLawrence opened this issue Sep 29, 2020 · 6 comments · Fixed by #595

Comments

@AamnaLawrence
Copy link

I have recorded spike activity using a tungsten electrode using plexon recording system. I converted the .plx to .mat file and then the .mat file to a .dat file using the following piece of code

aa=fopen("nameoffile.dat","w");
fwrite(aa,x,"int16");
fclose(aa);

x has the dimension 1 by number of time points.
I tried to make a single channel probe however, it does not seem to work.

Can kilosort2 sort single channel data?

I also made a dummy channel dataset having 16 channels in which all contained random data and one of them had the spike data. I used the linear 16x1 probe layout but I could not even see my spike data in the "Data view". What am I missing here?

@marius10p
Copy link
Contributor

It cannot sort single-channel data, but the way you wrote the binary file seems right. If you want to add dummy channels, make sure they are 0s. There could be a data scaling issue in the Data view, and possibly when you write your channels to int16. You would need to convert to the range that int16 expects, so -2^15 to 2^15.

@AamnaLawrence
Copy link
Author

Thank for your help. Now I can see the traces

KS2
However, when I click on Run All, I get the error "Error running kilosort. Undefined function or variable 'W'
Error saving data for Phy!'

@marius10p
Copy link
Contributor

The GUI errors are not informative... can you please look in the Matlab command line to and paste the entire output?

@AamnaLawrence
Copy link
Author

Sure!

Getting channel whitening matrix...
Channel-whitening matrix computed.
Time 4s. Loading raw data and applying filters...
Time 4s. Finished preprocessing 19 batches.
Time 0s. Determining good channels..
found 132 threshold crossings in 40.22 seconds of data
found 15 bad channels
Time 1s. Computing whitening matrix..
Getting channel whitening matrix...
Channel-whitening matrix computed.
Time 1s. Loading raw data and applying filters...
Time 2s. Finished preprocessing 19 batches.
Obtained 7 PC waveforms in 0.27 seconds
Warning: data batch #1 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
time 0.02, pre clustered 1 / 19 batches
Warning: data batch #2 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #3 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #4 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #5 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #6 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #7 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #8 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #9 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #10 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #11 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #12 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #13 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #14 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #15 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #16 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #17 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #18 only had 0 spikes

In clusterSingleBatches (line 95)
In ksGUI/runSpikesort (line 782)
In ksGUI/runAll (line 628)
In ksGUI>@(,)obj.runAll() (line 319)
Warning: data batch #19 only had 0 spikes

@marius10p
Copy link
Contributor

Looks like it wasn't able to find any spikes. I recommend a few things, try these one by one:

  1. use much longer recording
  2. increase batch size by 10x or 100x
  3. set ops.minfr_goodchannels = 0 so it doesn't drop channels
  4. try the latest Kilosort2.5.

@GoktugAlkan
Copy link

GoktugAlkan commented Jun 5, 2023

Hello @marius10p @AamnaLawrence ,

I am currently struggling with running KS 2.5 with a single-channel recording. The data is approximately 10 minutes long and there are spikes inside. KS 1.0 was able to detect those.

As in KS 1.0 I am inserting the data into a format with 3 dummy channels (zero signals). The fourth channel has the actual data. This described procedure is the same as in KS 1.0, which delivered good results. Since we assume that the template-matching might have improved, we want to switch to KS 2.5. However, adding the dummy channels leads to problems in KS 2.5. The error message that I get is below:

Error using matlab.internal.math.interp1
The sample points must be finite.

Error in interp1 (line 188)
        VqLite = matlab.internal.math.interp1(X,V,method,method,Xqcol);

Error in shift_batch_on_disk2 (line 14)
    shifts = interp1(ysamp, shifts, rez.yc, 'makima', 'extrap');

Error in datashift2 (line 138)
        dprev = shift_batch_on_disk2(rez, ibatch, dshift(ibatch, :), yblk, sig, dprev);

Error in testKS25 (line 130)
rez = datashift2(rez, 1); % last input is for shifting data

Do you have any ideas? Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants