Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

B_WaveformAnalysisDATA_earlyTrain.m 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. % extraction des data pour une waveform analysis puis k-mean methods pour
  2. % clusteriser les differents de neurons
  3. clear all; clc; close all;
  4. load('RearlyTraining.mat')
  5. WFlength=800; %total duration of the waevform 800microseconds
  6. bins=25;%bins=25microsecond
  7. time=(bins:bins:WFlength);
  8. runAnalysis=1;
  9. for i=1:size(R.WF,1)
  10. if sum(R.WF(i,:))==0
  11. R.WFanalysis(i,2)=0;
  12. R.WFanalysis(i,3)=0;
  13. else
  14. [maxValue, MaxIndex] = max(R.WF(i,:));
  15. [minValue, MinIndex] = min(R.WF(i,:));
  16. PeakValleyW=abs(time(MaxIndex)-time(MinIndex));
  17. PeakValleyM=abs(maxValue-minValue);
  18. R.WFanalysis(i,2)=PeakValleyM;
  19. idx = find(diff(R.WF(i,:) >= minValue/2));
  20. x2 = time(idx) + (minValue/2 - R.WF(i,idx)) .* (time(idx+1) - time(idx)) ./ (R.WF(i,idx+1) - R.WF(i,idx));
  21. if length(x2)==1
  22. R.WFanalysis(i,3)=NaN;
  23. else
  24. ValleyFWHM=x2(2)-x2(1);
  25. R.WFanalysis(i,3)=ValleyFWHM;
  26. end
  27. end
  28. end
  29. selection=R.WFanalysis(:,2)~=0;
  30. X=R.WFanalysis(selection,:);
  31. idx(1:sum(selection),1)=1;
  32. idx(X(:,1)>20,1)=2; % threshold 20Hz to separate MSN from FSI
  33. idx(idx(:,1)==2 & X(:,3)>150,1)=0;
  34. idx(X(:,1)<20 & X(:,1)>12.5 & idx(:,1)==1,1)=0; % intermediate frequencies = not classified
  35. for Y=1:size(idx,1)
  36. if idx(Y,1)==1
  37. color(Y,:)=[255/255 0/255 0/255];%MSN
  38. sizeplot(Y,1)=50;
  39. elseif idx(Y,1)==2
  40. color(Y,:)=[0 255/255 0/255];%FSI
  41. sizeplot(Y,1)=50;
  42. elseif idx(Y,1)==3
  43. color(Y,:)=[0/255 0/255 255/255]; %TAN
  44. sizeplot(Y,1)=50;
  45. elseif idx(Y,1)==0
  46. color(Y,:)=[0/255 0/255 0/255];%unclassified
  47. sizeplot(Y,1)=5;
  48. end
  49. end
  50. figure;
  51. subplot(3,4,[1 2 3 5 6 7 9 10 11])
  52. scatter(X(:,1),X(:,3),sizeplot,color)
  53. hold on
  54. title(strcat('all neurons clustering kmean'))
  55. xlabel('FR') % x-axis label
  56. ylabel('half-width')% y-axis label
  57. hold off
  58. Celltype(1:length(selection),1)=R.SESSION;
  59. Celltype(1:length(selection),2)=0;
  60. Celltype(selection,2)=idx(:,1);
  61. save('Celltype_earlyTraining.mat','Celltype')