12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- % f1=figure;
- mypath='/mnt/Vol2/kropff/analyisis/figs/theta_new/fig2abc-openfield theta/clean_test/';
- files=dir([mypath 'peak_matr_final_f2_*.db']);
- close all;
- for ifile=14%1:numel(files) % 14 10
- p=load([mypath files(ifile).name],'-mat');%3 6 8
- data=p.out.data{1};
- %%
- % close all;
- f=figure;
- subplot(2,1,1)
- sel=1:numel(data.v);
- speeds=data.v(sel)';
- accs=[0 speeds(3:end)-speeds(1:end-2) 0]/.04;
- % ths=smooth_theta(accs,0.1); %0.06
- ths=smooth_theta2(accs,1-exp(-.1)); %0.06
- raccs=accs;
- raccs(raccs<0)=0;
- plot(sel/50,(speeds)/std(speeds),'r');
- hold on;
- plot(sel/50,accs/std(accs),'b');
- plot(sel/50,ths/std(accs),'g');
- xlim([0 10])
- %
- % sel2=true(size(speeds));
- ths=8+ths/100;
- da=20; abins=-5:5;
- dv=5; vbins=0:12;
- rv=round(speeds/dv);
- ra=round(accs/da);
- vfr=arrayfun(@(x) mean(ths(rv==x)),vbins);
- afr=arrayfun(@(x) mean(ths(ra==x)),abins);
- m8=vfr(1);%mean(ths);
- [th_f5,th_s5]=mybp(ths-m8,0.5);
- [th_f1,th_s1]=mybp(ths-m8,0.1);
- [th_f3,th_s3]=mybp(ths-m8,0.3);
- vfr_f=arrayfun(@(x) mean(th_f5(rv==x))+m8,vbins);
- vfr_s=arrayfun(@(x) mean(th_s5(rv==x))+m8,vbins);
- afr_f=arrayfun(@(x) mean(th_f1(ra==x))+m8,abins);
- afr_s=arrayfun(@(x) mean(th_s1(ra==x))+m8,abins);
- subplot(2,2,3)
- plot(vbins*dv,[vfr; vfr_s; vfr_f]');
- axis([0 50 7.8 9.1])
- golden(2.5)
- subplot(2,2,4)
- plot(abins*da,[afr; afr_s; afr_f]');
- axis([-120 140 7.8 9.1])
- set(gca,'YTick',6:.5:12);
- [corr(speeds',ths') corr(accs',ths');
- corr(speeds',th_f5') corr(accs',th_f1');
- corr(speeds',th_s5') corr(accs',th_s1')]
- drawnow;
- end
- function [th_f,th_s]=mybp(ths,f1)
- th_f=real(bandpass_and_hilbert(ths',f1,100,50)');
- th_f=abs(th_f).*cos(angle(th_f));
- th_s=bandpass_and_hilbert(ths',0,f1,50)';
- th_s=abs(th_s).*cos(angle(th_s));
- end
|