findAbehavAllConditions.m 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. clear all
  2. load('behavdata/dat.mat')
  3. aCue{1}=squeeze(accrot_cu_uncue(:,1,:)); %Accuracy 1st Test
  4. bCue{1}=squeeze(bias_cue(:,1,:)); %Bias 1st Test
  5. aCue{2}=squeeze(accrot_cu_uncue(:,2,:)); %Accuracy 2st Test
  6. bCue{2}=squeeze(bias_uncue(:,1,:)); %Bias 2st Test
  7. %Averaging between 1st and 2nd test
  8. aCueg = ((aCue{1}+aCue{2})./2)
  9. bCueg = ((bCue{1}+bCue{2})./2)
  10. %% order the data in standard presentation
  11. ao=deg2rad(accrot_cu_uncue(:,3,1))
  12. ao2=abs(2*pi-ao) %move anticlockwise
  13. ao3=(angdiff(-ao2,-(ones(16,1).*pi*1.5)))+pi
  14. [ao2,ao3]
  15. [bb ind]=sort(ao3)
  16. aCueo=aCueg(ind,:)
  17. bCueo=bCueg(ind,:)
  18. %%
  19. % aCueGo = ((aCue1o+aCue2o)./2)
  20. % bCueGo = ((bCue1o+bCue2o)./2)
  21. %% With general accuracy (1st and 2nd test combined)
  22. % Keep C=1
  23. %
  24. % (i) SSQ based on ave between acuSSQ and biasSSQ
  25. % (ii) SSQ based only biasSSQ
  26. % (iii) SSQ based on ave between acuSSQ and biasSSQ (but acuSSQ is calculated on general accu)
  27. %%
  28. BestParams=nan(size(accrot_cu_uncue,3),4);
  29. parfor ppp =1:size(accrot_cu_uncue,3)
  30. aaCue=(aCueo(:,ppp)');
  31. bbCue=(bCueo(:,ppp)');
  32. CvetIn=0:0.1:1;%vector grid search of C
  33. BestParams(ppp,:)=gridsearch_jld(aaCue,bbCue,0,2,CvetIn,0.1); % This fuction is the the same as original, but we can add some input (ssqmat only based on accu,granularity for the grid search)
  34. end
  35. %%
  36. all=BestParams
  37. %%
  38. s=BestParams(1,1); % noise (in memory/decision-making)
  39. A=BestParams(1,2); % Key Parameter (squircle) 0: all circle; 1: all square
  40. C=BestParams(1,3); % Reduce noise near cardinal by this factor (1: off)
  41. makefig=0;
  42. behB=bCueo(:,ppp)'; %BehaviouralBias
  43. figure;
  44. [yourAccu(:,ppp) yourBias(:,ppp)]=squircleBehave2compB(s,A,C,behB,makefig);
  45. %% Changing format
  46. Params{1}= squeeze(BestParams(:,:,1));% info about test 1
  47. Params{2}= squeeze(BestParams(:,:,2));% info about test 1
  48. %% Anova
  49. %%
  50. %% and Group plot
  51. figure;
  52. for test=1:0
  53. oi=bCueo{test};
  54. yourBias=[];
  55. yourAccu=[];
  56. for ppp=1:size(oi,2)
  57. behB=oi(:,ppp)'; %BehaviouralBias
  58. s=Params{test}(ppp,1); % noise (in memory/decision-making)
  59. A=Params{test}(ppp,2); % Key Parameter (squircle) 0: all circle; 1: all square
  60. C=Params{test}(ppp,3); % Reduce noise near cardinal by this factor (1: off)
  61. makefig=0;
  62. [yourAccu(:,ppp) yourBias(:,ppp)]=squircleBehave2compB(s,A,C,behB,makefig);
  63. end
  64. subplot(1,2,test)
  65. quickplotcompB(bb',mean(yourBias,2)',mean(oi,2)',['Group plot Bias - test- ' num2str(test)]);
  66. end
  67. %%
  68. for ig=1:2;
  69. if ig==1
  70. p=1:15;
  71. else
  72. p=16:29;
  73. end
  74. figure;
  75. counter=1;
  76. for ppp =p
  77. behB=bCue1o(:,ppp)'; %BehaviouralBias
  78. s=BestParams(ppp,1); % noise (in memory/decision-making)
  79. A=BestParams(ppp,2); % Key Parameter (squircle) 0: all circle; 1: all square
  80. C=BestParams(ppp,3); % Reduce noise near cardinal by this factor (1: off)
  81. makefig=0;
  82. subplot(4,4,counter)
  83. [yourAccu yourBias]=squircleBehave2compB(s,A,C,behB,makefig);
  84. rlim([0 1]);
  85. counter=counter+1;
  86. end
  87. end
  88. %%
  89. colores=(colormap((winter(6))));
  90. figure
  91. %Cue Acc
  92. for ppp=1:29
  93. subplot(6,5,ppp)
  94. accrottask_mod=accrot_cu_uncue;
  95. accrottask_mod(size(accrottask_mod,1)+1,:,:)=accrot_cu_uncue(1,:,:);
  96. dat=squeeze(accrottask_mod(:,1,ppp));
  97. ap=(dat);
  98. theta=deg2rad(accrottask_mod(:,3,1));
  99. theta2=(max(theta)-theta);
  100. theta3=abs(2*pi-theta);
  101. chance=ap;
  102. chance(:)=0.5;
  103. polarplot(theta3,chance,'k-.','Color',colores(5,:),'LineWidth',1.5);hold on;
  104. polarplot(theta3,ap,'-','Color',colores(3,:),'LineWidth',1.5);hold on;
  105. r=polarplot(theta3,ap,'o','Color',colores(3,:),'MarkerFaceColor',colores(5,:),'LineWidth',2);
  106. set(gca,'ThetaZeroLocation','top','FontSize',12);hold on;
  107. title(['sigma = ' num2str(BestParams(ppp,1)) ' A= ' num2str(BestParams(ppp,2))])
  108. end