0001
0002
0003
0004
0005
0006
0007 dname='/data/meg/arzounian/DA_131218/';
0008
0009
0010
0011
0012
0013
0014 fnames={
0015 'DA_131218_p14_001_spontan_open'
0016 'DA_131218_002_spontan_closed'
0017 'DA_131218_003_spontan_closed_off'
0018 };
0019
0020 start=[65 40 120];
0021 stop=[925 760 1900];
0022
0023 iFile=3;
0024 fname=fnames{iFile};
0025
0026 disp('read data...');
0027 h=sopen([dname,fname]);
0028 sr=h.SampleRate;
0029 x=sread(h);
0030 sclose(h);
0031 disp('done')
0032
0033
0034 x=x(start(iFile)*sr:stop(iFile)*sr,1:37);
0035
0036
0037 HPF=15;
0038 x=nt_demean(x,1:round(sr/HPF));
0039 [B,A]=butter(2,HPF/(sr/2),'high');
0040 x=filter(B,A,x);
0041 x=x(round(sr/HPF)+1:end,:);
0042
0043
0044
0045 DSR=sr/256;
0046 x=nt_dsample(x,DSR);
0047 sr=sr/DSR;
0048
0049
0050 window=30*sr;
0051 T=10*sr;
0052 nSmooth=floor(window/T);
0053
0054 tic
0055 x0=x;
0056 x=nt_pca(x);
0057 [tocomps,ii]=nt_peaky([],x,T,nSmooth);
0058 [~,idx]=sort(ii);
0059
0060
0061 zz=nt_mmat(x,tocomps);
0062 zz=nt_normcol(zz);
0063
0064 figure(1);
0065 imagescc((filter(ones(round(10*sr),1),1,abs(zz)).^0.5)'); title('all')
0066 title('Reconstruction')
0067 toc
0068
0069 figure(2); clf
0070 subplot 121; plot(kurtosis(zz), '.-'); title('kurtosis'); xlabel('component')
0071 subplot 122; imagescc(nt_cov(zz)); title('covariance matrix'); xlabel('component'); ylabel('component');
0072
0073 figure(3); clf
0074 imagescc(nt_xcov(nt_normcol(x0),nt_normcol(zz)));
0075 xlabel('component'); ylabel('electrode'); title('electrode/component covariance');
0076
0077 figure(4); clf;
0078 nt_spect_plot2(nt_dsample(zz,2),1024,[],[],sr/2)
0079 title('spectra of components');
0080
0081