0001
0002
0003
0004
0005
0006
0007
0008
0009 clear;
0010 disp(mfilename);
0011 help(mfilename)
0012
0013 FNAME=[fileparts(which('nt_version')), '/DATA/Fichier_1815_lfp.mat'];
0014 if ~exist(FNAME);
0015 disp(['file ',FNAME,' not found, get it at http://cognition.ens.fr/Audition/adc/NoiseTools/DATA/']);
0016 return
0017 end
0018
0019 load (FNAME);
0020 x=xx; clear xx
0021 sr=LFPSampleRate;
0022 [nsample,nchan,ntrial,nfreq]=size(x);
0023 t=(0:nsample-1)'/sr;
0024
0025
0026 x=squeeze(mean(x,3));
0027 x=x(find(t<=0.1),:,:,:);
0028 nsample=size(x,1);
0029 x=nt_demean(x);
0030
0031
0032
0033
0034
0035 to_otc=zeros(nchan,nfreq);
0036 c0=nt_cov(x);
0037 for iBias=1:nfreq
0038 c1=nt_cov(x(:,:,iBias));
0039 [todss]=nt_dss0(c0,c1);
0040 todss=todss(:,1);
0041 to_otc(:,iBias)=todss;
0042 end
0043
0044
0045 otc=zeros(nsample,nfreq,nfreq);
0046 for iBias=1:nfreq
0047 z=nt_mmat(x,to_otc(:,iBias));
0048 otc(:,iBias,:)=z;
0049 end
0050
0051
0052 a=nt_unfold(otc);
0053 aa=nt_pca(a);
0054 for iBias=1:nfreq
0055 if aa(:,1)'*a(:,iBias)<0
0056 otc(:,iBias,:)=-otc(:,iBias,:);
0057 to_otc(:,iBias)=-to_otc(:,iBias);
0058 end
0059 end
0060
0061
0062
0063
0064
0065
0066
0067
0068 zz=squeeze(sqrt(mean(otc.^2,1)));
0069 zz=nt_normcol(zz);
0070
0071
0072 xx=squeeze(sqrt(mean(x.^2)))';
0073 xx=nt_normcol(xx);
0074
0075 figure(1); clf
0076 subplot 211
0077 nt_imagescc(xx'); title('electrode tuning curves');
0078 xlabel('stim freq (.56 - 36 kHz)');
0079 ylabel('electrode');
0080
0081 subplot 212
0082 nt_imagescc(zz); title('optimally tuned components');
0083 xlabel('stim freq (.56 - 36 kHz)');
0084 ylabel('bias freq (.56 - 36 kHz)');
0085
0086
0087 figure(2); clf
0088 plot([xx(:,11), zz(:,70)]);
0089 xlabel('stim freq (.56 - 36 kHz)');
0090 nt_linecolors([],[1 3]);
0091 legend('electrode #11','component #70', 'location', 'northwest'); legend boxoff
0092 title('example tuning curves');
0093
0094 figure(3); clf
0095 subplot 121;
0096 nt_imagescc(squeeze(x(:,11,:)))
0097 xlabel('stim freq (.56 - 36 kHz)');
0098 ylabel('time (0-100ms)');
0099 title('electrode 11');
0100 subplot 122;
0101 nt_imagescc(squeeze(otc(:,72,:)))
0102 xlabel('stim freq (.56 - 36 kHz)');
0103 ylabel('time (0-100ms)');
0104 title('component 72');
0105
0106 figure(4); clf
0107 nt_imagescc(to_otc)
0108 xlabel('bias freq (.56 - 36 kHz)');
0109 ylabel('electrode');
0110 title('weights for each component');
0111