Skip to content

Commit

Permalink
small fixes and perfornamce updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoigts committed Oct 8, 2017
1 parent 9db0f57 commit abc9935
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
17 changes: 16 additions & 1 deletion sc_loadmuadata.m
Expand Up @@ -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);'


Expand Down Expand Up @@ -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);

Expand Down
18 changes: 17 additions & 1 deletion sc_mua2features.m
Expand Up @@ -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);
Expand All @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions sc_updateclusterimages.m
Expand Up @@ -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]);

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion simple_clust.m
Expand Up @@ -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
Expand Down

0 comments on commit abc9935

Please sign in to comment.