123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 |
- mainfolder='';
- addpath(genpath([mainfolder 'subfunctions/']))
- addpath(genpath(['subfunctions/rm_anova2']))
- %%
- % GENERAL DIFFERENCE BETWEEN MODELS DURING DELAY (CUED UNCUED) (cat cardinal model vs
- % anti cardinal model)
- clear all
- mainfolder='';
-
- %% Uncomment to load the data
- %
- % %1 cued
- % folder{1}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_1_cued_cat_udlr_Pearson/']
- % folder{2}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_1_cued_cat_udlr45_Pearson/']
- %
- % %1 uncued
- % folder{3}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_1_uncued_cat_udlr_Pearson/']
- % folder{4}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_1_uncued_cat_udlr45_Pearson/']
- %
- % %2 cued
- % folder{5}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_2_cued_cat_udlr_Pearson/']
- % folder{6}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_2_cued_cat_udlr45_Pearson/']
- %
- % %2 uncued
- % folder{7}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_2_uncued_cat_udlr_Pearson/']
- % folder{8}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_2_uncued_cat_udlr45_Pearson/']
- %
- % % 1 and 2 cued - circle
- % folder{9}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_1_cued_Pearson/']
- % folder{10}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_2_cued_Pearson/']
- %
- %
- % load([mainfolder, 'good_partis.mat']) %list of participant with a good performance
- % partis=good_partis';
- %
- %
- % [RHO_id_group,time]=loadingrsa(folder,partis)
- %
- %
- %
- % %% Loading 2 delay
- %
- % %1 cued
- % folder{1}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_1_cued_cat_udlr_Pearson/']
- % folder{2}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_1_cued_cat_udlr45_Pearson/']
- %
- % %1 uncued
- % folder{3}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_1_uncued_cat_udlr_Pearson/']
- % folder{4}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_1_uncued_cat_udlr45_Pearson/']
- %
- % %2 cued
- % folder{5}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_2_cued_cat_udlr_Pearson/']
- % folder{6}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_2_cued_cat_udlr45_Pearson/']
- %
- % %2 uncued
- % folder{7}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_2_uncued_cat_udlr_Pearson/']
- % folder{8}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_2_uncued_cat_udlr45_Pearson/']
- %
- % % 1 2 cued circle
- % folder{9}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_1_uncued_Pearson/']
- % folder{10}=[mainfolder 'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_2_uncued_Pearson/']
- %
- % load([mainfolder, 'good_partis.mat']) %list of participant with a good performance
- % partis=good_partis';
- %
- % [RHO_id_group2,time2]=loadingrsa(folder,partis)
- %% Optional -> Loading the data ready to be plotted
- load('data_for_plots/Figure_4/data_n41_2022.mat');
- %% delay 1
- %ori1 cued
- a1cued{1}=RHO_id_group{1}; % model model 1
- a1cued{2}=RHO_id_group{2}; % model model 2 (anticardinal)
- %ori1 uncued
- a1uncued{1}=RHO_id_group{3}; % model model 1
- a1uncued{2}=RHO_id_group{4}; % model model 2 (anticardinal)
- %ori2 cued
- a2cued{1}=RHO_id_group{5}; % model model 1
- a2cued{2}=RHO_id_group{6}; % model model 2 (anticardinal)
- %ori2 uncued
- a2uncued{1}=RHO_id_group{7}; % model model 1
- a2uncued{2}=RHO_id_group{8}; % model model 2 (anticardinal)
- a1circle=RHO_id_group{9}; % model circle 1
- a2circle=RHO_id_group{10}; % model cicle 2
- %% delay 2
- %ori1 cued
- a1cued2{1}=RHO_id_group2{1}; % model model 1
- a1cued2{2}=RHO_id_group2{2}; % model model 2 (anticardinal)
- %ori1 uncued
- a1uncued2{1}=RHO_id_group2{3}; % model model 1
- a1uncued2{2}=RHO_id_group2{4}; % model model 2 (anticardinal)
- %ori2 cued
- a2cued2{1}=RHO_id_group2{5}; % model model 1
- a2cued2{2}=RHO_id_group2{6}; % model model 2 (anticardinal)
- %ori2 uncued
- a2uncued2{1}=RHO_id_group2{7}; % model model 1
- a2uncued2{2}=RHO_id_group2{8}; % model model 2 (anticardinal)
- a1circle2=RHO_id_group2{9}; % model circle 1
- a2circle2=RHO_id_group2{10}; % model cicle 2
- %% Uncomment to run the cluster perm tests
- % %% Cluster analysis of the difference (delay 1)
- %
- % %Setting times (from -100 stim onset until the end of the delay period)
- % t1=find(time==-100)
- % t2=find(time==5850)
- % t1_2=find(time==900)
- % [timesignclust cluspval] = cluster_dif(a1cued,a2cued,time,t1,t2,t1_2)
- %
- % % mean([timesignclust(1,1) timesignclust(2,1)]) %average of "starting" point;
- %
- % %% Cluster analysis of the difference within-between (delay 2)
- %
- % %Setting times (from -100 stim onset until the end of the delay period)
- % t1=find(time2==-100)
- % t2=find(time2==2850)
- % t1_2=find(time2==-100)
- % [timesignclust2 cluspval2] = cluster_dif(a1uncued2,a2uncued2,time2,t1,t2,t1_2)
- %
- % % mean([timesignclust(1,1) timesignclust(2,1)]) %average of "starting" point;
- %% Delay 1 fig
- %% mode 3
- coloresb=(colormap((parula(5))));
- coloresb(6,:)=[0 0 0];
- coloresb(1,:)=[1 0 0];
- coloresb(3,:)=[1 0 0];
- figure('Position',([200 800 750 700]))
- subplot(2,1,1)
- colores=coloresb([1 2 3 6 6],:)
- leng1='repulsion (B=1)'
- leng2='attraction (B=-1)'
- titu=''
- xl=[-500 5850];
- yl=[-0.02 0.15];
- pval=0.05
- spa=0.1
- toi=[2300 5000]
- plot3lines_models(time,a1cued,colores,xl,yl,leng1,leng2,titu,0,'time (ms)',1,timesignclust(1,:),colores(1,:),nanmean(a1circle,2),colores(4,:),'unbiased (B=0)',1)
- set(gca,'FontSize',20);
- subplot(2,1,2)
- titu=''
- plot3lines_models(time,a2cued,colores,xl,yl,leng1,leng2,titu,0,'time (ms)',1,timesignclust(2,:),colores(1,:),nanmean(a2circle,2),colores(4,:),'unbiased (B=0)',0)
- set(gca,'FontSize',20);
- %% Delay 2 fig
- figure('Position',([200 800 420 700]))
- subplot(2,1,1)
- leng1='repulsion (B=1)'
- leng2='attraction (B=-1)'
- titu=''
- xl=[-300 2850];
- yl=[-0.02 0.15];
- pval=0.05
- spa=0.1
- toi=[2500 5000]
- plot3lines_models2nd2(time2,a1uncued2,colores,xl,yl,leng1,leng2,titu,0,'time (ms) from Cue 2',1,timesignclust2(1,:),colores(1,:),nanmean(a1circle2,2),colores(4,:),'unbiased (B=0)',0)
- set(gca,'FontSize',20);
- subplot(2,1,2)
- titu=''
- plot3lines_models2nd2(time2,a2uncued2,colores,xl,yl,leng1,leng2,titu,0,'time (ms) from Cue 2',1,timesignclust2(2,:),colores(1,:),nanmean(a2circle2,2),colores(4,:),'unbiased (B=0)',0)
- set(gca,'FontSize',20);
- %% subfuction
- function [RHO_id_group,time]=loadingrsa(folder,partis)
- counter=1;
- for ppp=1:length(partis)
- counterf=1;
-
-
-
- for fff=1:size(folder,2)
- toload=[folder{fff}, partis{ppp,:},'.mat']
- load(toload)
-
- RHO_id_group{counterf}(:,counter)=squeeze(nanmean(RSA_obj_rot.rho(:,:,:),1));
- counterf=counterf+1;
- end
-
- counter=counter+1;
-
- end
- time=RSA_obj_rot.time;
- end
- function [timesignclust cluspv] = cluster_dif(a1_1,a2_1,time_1,t1,t2,t1_2)
- %ori1 cued
- wi1 =a1_1{1}(t1:t2,:); % with 1
- bet1 =a1_1{2}(t1:t2,:); % bet 1
- %ori2 cued
- wi2 =a2_1{1}(t1_2:t2,:); % w 2
- bet2 =a2_1{2}(t1_2:t2,:); % betwen 2
- RHOD_wi{1}=wi1();
- RHOD_wi{2}=wi2();
- RHOD_be{1}=bet1();
- RHOD_be{2}=bet2();
- pv_cluster=0.05; % p-vals for clust perm test
- % az=zeros(size(RHOD_diff{1})); % matrix to be compare (in this case against 0);
- timesall{1}=time_1(t1:t2);
- timesall{2}=time_1(t1_2:t2);
- [timesignclust cluspv]=allclustperm2(RHOD_wi,timesall,RHOD_be,pv_cluster) % output variable (rows -> lines; columns -> start and end (ms))
- end
- function [timesignclust cluspv]=allclustperm2(RHO_all,time,az,pv_cluster)
- timesignclust=nan(size(RHO_all,2),2); % output variable (rows -> lines; columns -> start and end (ms))
- for r=1:size(RHO_all,2);
- [clusters, p_values, t_sums, permutation_distribution] =permutest(RHO_all{r},az{r},1,0.05,20000)
- if p_values(1)<pv_cluster
-
- timesignclust(r,1)=time{r}(clusters{1}(1))
- timesignclust(r,2)=time{r}(clusters{1}(end))
-
- end
-
- cluspv(r)=p_values(1);
- end
- end
|