From abc993520256aab7110cfd3c36392212624300e0 Mon Sep 17 00:00:00 2001 From: Jakob Voigts Date: Sun, 8 Oct 2017 16:31:00 -0400 Subject: [PATCH] small fixes and perfornamce updates --- sc_loadmuadata.m | 17 ++++++++++++++++- sc_mua2features.m | 18 +++++++++++++++++- sc_updateclusterimages.m | 8 ++++---- simple_clust.m | 2 +- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/sc_loadmuadata.m b/sc_loadmuadata.m index 2d144d3..6e62f37 100644 --- a/sc_loadmuadata.m +++ b/sc_loadmuadata.m @@ -9,10 +9,22 @@ switch muafile_ext case 'spikes' % open ephys data format - [data, timestamps, info] = load_open_ephys_data(muafile); + [data, timestamps, info] = load_open_ephys_data_faster(muafile); + + % remove end of file? + % cutoff_t=3.9100e+03; + % cutoff=min(find(timestamps>cutoff_t)); + % data=data(1:cutoff,:,:); + % timestamps=timestamps(1:cutoff); + features.chnumstr = info.header.electrode; + features.sourcechannel= str2num(info.header.electrode(end-1:end)); + if numel( features.sourcechannel)==0 + features.sourcechannel= str2num(info.header.electrode(end)); + end; + sourcechannel=features.sourcechannel; % just so we dont overwrite it in 'features=sc_mua2features(mua,s_opt);' @@ -474,6 +486,9 @@ features.waveformscale=0.0001; + mua.waveforms( find(abs(mua.waveforms) > 10000) ) =0; + mua.waveforms( isnan(mua.waveforms) ) =0; + % find appropriate scale for plotting waveforms features.waveformscale=0.1 ./ quantile(mua.waveforms(1:100:end)-mean(mua.waveforms(1:100:end)),.95); diff --git a/sc_mua2features.m b/sc_mua2features.m index 3b86fb7..ddfc39d 100644 --- a/sc_mua2features.m +++ b/sc_mua2features.m @@ -136,6 +136,22 @@ if n==1; features.name{c}=['time']; end; + + %max peak + if 0 + for d=1:mua.ncontacts %size(spike,1) + c=c+1; + %features.data(c,n)= nle(d,n); + + x=spike(trodeboundaries(d):trodeboundaries(d+1)-1); + + features.data(c,n)= -x(9); + + if n==1; features.name{c}=['peak ',num2str(d)]; end; + + end; + end; + %peak height for d=1:mua.ncontacts %size(spike,1) x=spike(trodeboundaries(d):trodeboundaries(d+1)-1); @@ -144,7 +160,7 @@ c=c+1; features.data(c,n)= neo(d); - if n==1; features.name{c}=['peak ',num2str(d)]; end; + if n==1; features.name{c}=['max ',num2str(d)]; end; end; diff --git a/sc_updateclusterimages.m b/sc_updateclusterimages.m index 83e3d44..bbdd2e3 100644 --- a/sc_updateclusterimages.m +++ b/sc_updateclusterimages.m @@ -45,10 +45,11 @@ sfact = features.imagesize/x; features.waveforms_hi=zeros(size(mua.waveforms,1),round(x*sfact)); + ii_intp=round(L_im); for i=1:size( mua.waveforms,1) - if mod(i,4000)==0 + if mod(i,10000)==0 clf; hold on; fill([-2 -2 5 5],[-2 2 2 -2],'k','FaceColor',[.95 .95 .95]); @@ -66,9 +67,8 @@ drawnow; end; - - - features.waveforms_hi(i,:) = interp1(1:x,mua.waveforms(i,:),L_im, 'linear'); % use 'linear' for speed or even 'nearest' + %features.waveforms_hi(i,:) = interp1(1:x,mua.waveforms(i,:),L_im, 'nearest'); % use 'linear' for speed or even 'nearest' + features.waveforms_hi(i,:) = mua.waveforms(i,ii_intp); end; end; end; diff --git a/simple_clust.m b/simple_clust.m index 1d70ef2..3796320 100644 --- a/simple_clust.m +++ b/simple_clust.m @@ -105,7 +105,7 @@ % specify what features to compute: s_opt.features.pca=0; s_opt.features.wavelet=0; -s_opt.features.nonlinear_energy=1; +s_opt.features.nonlinear_energy=0; s_opt.features.max_derivative=1; %% init