OSCR

Phasic modulation of attentional rhythmic sampling according to task demands.

Code ↔ Paper

3 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 3 matches
  1. [1] § Methods › Spectrum analysis of the envelope of SSVEP ↔ fuse.m, lines 188–270 · score 0.68 · 41.5–42.5 Hz, 43.5–44.5 Hz, 41.5 Hz, 43.5 Hz, filtered, peak
  2. [2] § Methods › Spectrum analysis of the envelope of SSVEP ↔ sep.m, lines 188–270 · score 0.68 · 41.5–42.5 Hz, 43.5–44.5 Hz, 41.5 Hz, 43.5 Hz, filtered, peak
  3. [3] § Methods › Statistical tests ↔ fuse.m, lines 434–473 · score 0.53 · circ_htest, CircStat, uniformity, phase

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

MATLAB · 881 lines · 34 KB · no license · 2 matches

  1. %% 0. fuse条件
  2. % 42 hz总是在左边,44 hz总是在右边。
  3. % trigger:10代表左边先开始闪,20代表右边先开始闪。
  4. % PO3:45; PO4:46
  5. %% 1. SSVEP topography,左右半球各选一个电极,先计算ERP,再做fft
  6. load("E:\Data\Kongqing\Exp1\fuse\fuse.mat");
  7. cfg = [];
  8. cfg.demean = 'yes';
  9. cfg.baselinewindow = [-0.2, 0];
  10. for i=1:length(eegdata)
  11. eegdata{1,i} = ft_preprocessing(cfg, eegdata{1,i});
  12. end
  13. % 分开左边先闪和右边先闪,各自计算erp
  14. subj=1:21; % 被试
  15. cfg = [];
  16. for i = 1:length(subj)
  17. cfg.trials = find(eegdata{1, subj(i)}.trialinfo == 10);
  18. erp_l{1, i} = ft_timelockanalysis(cfg,eegdata{1, subj(i)});
  19. cfg.trials = find(eegdata{1, subj(i)}.trialinfo == 20);
  20. erp_r{1, i} = ft_timelockanalysis(cfg,eegdata{1, subj(i)});
  21. i
  22. end
  23. % grandaverage
  24. cfg = [];
  25. erp_l_ave = ft_timelockgrandaverage(cfg,erp_l{1,1},erp_l{1,2},erp_l{1,3},erp_l{1,4},erp_l{1,5},erp_l{1,6},...
  26. erp_l{1,7},erp_l{1,8},erp_l{1,9},erp_l{1,10},erp_l{1,11},erp_l{1,12},erp_l{1,13},erp_l{1,14},erp_l{1,15},...
  27. erp_l{1,16},erp_l{1,17},erp_l{1,18},erp_l{1,19},erp_l{1,20},erp_l{1,21});
  28. erp_r_ave = ft_timelockgrandaverage(cfg,erp_r{1,1},erp_r{1,2},erp_r{1,3},erp_r{1,4},erp_r{1,5},erp_r{1,6},...
  29. erp_r{1,7},erp_r{1,8},erp_r{1,9},erp_r{1,10},erp_r{1,11},erp_r{1,12},erp_r{1,13},erp_r{1,14},erp_r{1,15},...
  30. erp_r{1,16},erp_r{1,17},erp_r{1,18},erp_r{1,19},erp_r{1,20},erp_r{1,21});
  31. % plot
  32. cfg = [];
  33. cfg.showlabels = 'yes';
  34. cfg.fontsize = 6;
  35. cfg.layout = 'easycapM1.mat';
  36. % cfg.ylim = [-3e-13 3e-13];
  37. ft_multiplotER(cfg, erp_l{1, 2}, erp_r{1, 2});
  38. % ft_multiplotER(cfg, erp_l_ave, erp_r_ave);
  39. cfg = [];
  40. cfg.xlim = [-0.2 1.7];
  41. % cfg.ylim = [-1e-13 3e-13];
  42. cfg.channel = 'PO3';
  43. ft_singleplotER(cfg, erp_l_ave, erp_r_ave);
  44. cfg = [];
  45. cfg.xlim = [-0.2 1.7];
  46. % cfg.ylim = [-1e-13 3e-13];
  47. cfg.channel = 'PO4';
  48. ft_singleplotER(cfg, erp_l_ave, erp_r_ave);
  49. % 导出原始数据
  50. po3_erp_l=erp_l_ave.avg(45,:);
  51. po3_erp_r=erp_r_ave.avg(45,:);
  52. po4_erp_l=erp_l_ave.avg(46,:);
  53. po4_erp_r=erp_r_ave.avg(46,:);
  54. t=erp_l_ave.time;
  55. save('erp_fuse.mat','po3_erp_l','po3_erp_r','po4_erp_l','po4_erp_r','t');
  56. % 分开基线前和基线后
  57. cfg = [];
  58. cfg.toilim = [-0.2, 0];
  59. for i=1:length(eegdata)
  60. eegdata_bs{1,i} = ft_redefinetrial(cfg, eegdata{1,i});
  61. end
  62. cfg = [];
  63. cfg.toilim = [0, 1.7];
  64. for i=1:length(eegdata)
  65. eegdata_er{1,i} = ft_redefinetrial(cfg, eegdata{1,i});
  66. end
  67. % 分开左边先闪和右边先闪,各自计算erp
  68. subj=1:21;
  69. cfg = [];
  70. for i = 1:length(subj)
  71. cfg.trials = find(eegdata_bs{1, subj(i)}.trialinfo == 10);
  72. erp_bs_l{1, i} = ft_timelockanalysis(cfg,eegdata_bs{1, subj(i)});
  73. cfg.trials = find(eegdata_bs{1, subj(i)}.trialinfo == 20);
  74. erp_bs_r{1, i} = ft_timelockanalysis(cfg,eegdata_bs{1, subj(i)});
  75. cfg.trials = find(eegdata_er{1, subj(i)}.trialinfo == 10);
  76. erp_er_l{1, i} = ft_timelockanalysis(cfg,eegdata_er{1, subj(i)});
  77. cfg.trials = find(eegdata_er{1, subj(i)}.trialinfo == 20);
  78. erp_er_r{1, i} = ft_timelockanalysis(cfg,eegdata_er{1, subj(i)});
  79. i
  80. end
  81. % FFT analysis
  82. cfg = [];
  83. cfg.output = 'pow';
  84. cfg.channel = 'all';
  85. cfg.method = 'mtmfft';
  86. cfg.pad = 10;
  87. cfg.foi = 36:1:48;
  88. cfg.taper = 'hanning';
  89. for i=1:length(subj)
  90. erp_bs_l_fft{1, i} = ft_freqanalysis(cfg, erp_bs_l{1, i});
  91. erp_bs_r_fft{1, i} = ft_freqanalysis(cfg, erp_bs_r{1, i});
  92. erp_er_l_fft{1, i} = ft_freqanalysis(cfg, erp_er_l{1, i});
  93. erp_er_r_fft{1, i} = ft_freqanalysis(cfg, erp_er_r{1, i});
  94. i
  95. end
  96. % convert to zscore
  97. erp_er_l_fft_z=erp_er_l_fft;
  98. erp_er_r_fft_z=erp_er_r_fft;
  99. for i = 1:length(subj)
  100. erp_er_l_fft_z{1, i}.powspctrm = zscore(erp_er_l_fft{1, i}.powspctrm,0,2);
  101. erp_er_r_fft_z{1, i}.powspctrm = zscore(erp_er_r_fft{1, i}.powspctrm,0,2);
  102. end
  103. erp_er_l_fft_z_ave = erp_er_l_fft_z{1, 1};
  104. erp_er_r_fft_z_ave = erp_er_r_fft_z{1, 1};
  105. spct_er_l = 0;
  106. spct_er_r = 0;
  107. for i = 1:length(subj)
  108. spct_er_l = spct_er_l + erp_er_l_fft_z{1, i}.powspctrm;
  109. spct_er_r = spct_er_r + erp_er_r_fft_z{1, i}.powspctrm;
  110. end
  111. erp_er_l_fft_z_ave.powspctrm = spct_er_l/length(subj);
  112. erp_er_r_fft_z_ave.powspctrm = spct_er_r/length(subj);
  113. % plot
  114. cfg = [];
  115. cfg.parameter = 'powspctrm';
  116. cfg.showlabels = 'yes';
  117. cfg.layout = 'easycapM1.mat';
  118. figure;
  119. ft_multiplotER(cfg, erp_er_l_fft_z_ave);
  120. figure;
  121. ft_multiplotER(cfg, erp_er_r_fft_z_ave);
  122. % topo plot
  123. cfg = [];
  124. cfg.parameter = 'powspctrm';
  125. cfg.xlim = [42, 42];
  126. cfg.zlim = [-0.4, 2.4];
  127. cfg.colormap = brewermap([],'*RdBu');
  128. cfg.colorbar = 'yes';
  129. cfg.layout = 'easycapM1.mat';
  130. figure;
  131. ft_topoplotER(cfg, erp_er_l_fft_z_ave);
  132. figure;
  133. ft_topoplotER(cfg, erp_er_r_fft_z_ave);
  134. cfg.xlim = [44, 44];
  135. cfg.zlim = [-0.4, 2];
  136. figure;
  137. ft_topoplotER(cfg, erp_er_l_fft_z_ave);
  138. figure;
  139. ft_topoplotER(cfg, erp_er_r_fft_z_ave);
  140. % 导出频谱
  141. for i = 1:length(subj)
  142. spec_po3_l(i,:)=erp_er_l_fft_z{1, i}.powspctrm(45,:);
  143. spec_po3_r(i,:)=erp_er_r_fft_z{1, i}.powspctrm(45,:);
  144. spec_po4_l(i,:)=erp_er_l_fft_z{1, i}.powspctrm(46,:);
  145. spec_po4_r(i,:)=erp_er_r_fft_z{1, i}.powspctrm(46,:);
  146. end
  147. f=erp_er_l_fft_z_ave.freq;
  148. save('spect_fuse.mat','spec_po3_l','spec_po3_r','spec_po4_l','spec_po4_r','f');
  149. % 提取PO3和PO4的数值来统计
  150. % 44 hz
  151. for i = 1:length(subj)
  152. fft_po3_bs_l(i)=erp_bs_l_fft{1, i}.powspctrm(45,9);
  153. fft_po3_bs_r(i)=erp_bs_r_fft{1, i}.powspctrm(45,9);
  154. fft_po3_er_l(i)=erp_er_l_fft{1, i}.powspctrm(45,9);
  155. fft_po3_er_r(i)=erp_er_r_fft{1, i}.powspctrm(45,9);
  156. end
  157. fft_po3_44_bs=(fft_po3_bs_l+fft_po3_bs_r)/2;
  158. fft_po3_44_er=(fft_po3_er_l+fft_po3_er_r)/2;
  159. % 42 hz
  160. for i = 1:length(subj)
  161. fft_po4_bs_l(i)=erp_bs_l_fft{1, i}.powspctrm(46,7);
  162. fft_po4_bs_r(i)=erp_bs_r_fft{1, i}.powspctrm(46,7);
  163. fft_po4_er_l(i)=erp_er_l_fft{1, i}.powspctrm(46,7);
  164. fft_po4_er_r(i)=erp_er_r_fft{1, i}.powspctrm(46,7);
  165. end
  166. fft_po4_42_bs=(fft_po4_bs_l+fft_po4_bs_r)/2;
  167. fft_po4_42_er=(fft_po4_er_l+fft_po4_er_r)/2;
  168. save('spect_value_fuse.mat','fft_po3_44_bs','fft_po3_44_er','fft_po4_42_bs','fft_po4_42_er');
  169. %% 2. 抽取选择的电极上SSVEP的amplitude envelop
  170. subj=1:21;
  171. % filter
  172. cfg = [];
  173. cfg.bpfilter = 'yes';
  174. for i = 1:length(subj)
  175. cfg.bpfreq = [41.5, 42.5];
  176. cfg.trials = find(eegdata_er{1, subj(i)}.trialinfo == 10);
  177. eeg_42_l{1, i} = ft_preprocessing(cfg,eegdata_er{1, subj(i)});
  178. cfg.trials = find(eegdata_er{1, subj(i)}.trialinfo == 20);
  179. eeg_42_r{1, i} = ft_preprocessing(cfg,eegdata_er{1, subj(i)});
  180. i
  181. end
  182. for i = 1:length(subj)
  183. cfg.bpfreq = [43.5, 44.5];
  184. cfg.trials = find(eegdata_er{1, subj(i)}.trialinfo == 10);
  185. eeg_44_l{1, i} = ft_preprocessing(cfg,eegdata_er{1, subj(i)});
  186. cfg.trials = find(eegdata_er{1, subj(i)}.trialinfo == 20);
  187. eeg_44_r{1, i} = ft_preprocessing(cfg,eegdata_er{1, subj(i)});
  188. i
  189. end
  190. % envelope
  191. for i = 1:length(subj)
  192. for j = 1:160
  193. for m = 1:65
  194. [u1,l1]=envelope(eeg_42_l{1, i}.trial{1, j}(m,:),13,'peak');
  195. eeg_42_l{1, i}.trial{1, j}(m,:)=u1;
  196. [u2,l2]=envelope(eeg_42_r{1, i}.trial{1, j}(m,:),13,'peak');
  197. eeg_42_r{1, i}.trial{1, j}(m,:)=u2;
  198. [u3,l3]=envelope(eeg_44_l{1, i}.trial{1, j}(m,:),13,'peak');
  199. eeg_44_l{1, i}.trial{1, j}(m,:)=u3;
  200. [u4,l4]=envelope(eeg_44_r{1, i}.trial{1, j}(m,:),13,'peak');
  201. eeg_44_r{1, i}.trial{1, j}(m,:)=u4;
  202. end
  203. end
  204. i
  205. end
  206. % time-lock analysis
  207. cfg = [];
  208. for i = 1:length(subj)
  209. hilbert_42_l{1, i} = ft_timelockanalysis(cfg,eeg_42_l{1, i});
  210. hilbert_42_r{1, i} = ft_timelockanalysis(cfg,eeg_42_r{1, i});
  211. hilbert_44_l{1, i} = ft_timelockanalysis(cfg,eeg_44_l{1, i});
  212. hilbert_44_r{1, i} = ft_timelockanalysis(cfg,eeg_44_r{1, i});
  213. i
  214. end
  215. % grandaverage
  216. cfg = [];
  217. hilbert_42_l_ave = ft_timelockgrandaverage(cfg,hilbert_42_l{1,1},hilbert_42_l{1,2},hilbert_42_l{1,3},hilbert_42_l{1,4},hilbert_42_l{1,5},hilbert_42_l{1,6},...
  218. hilbert_42_l{1,7},hilbert_42_l{1,8},hilbert_42_l{1,9},hilbert_42_l{1,10},hilbert_42_l{1,11},hilbert_42_l{1,12},hilbert_42_l{1,13},hilbert_42_l{1,14},hilbert_42_l{1,15},...
  219. hilbert_42_l{1,16},hilbert_42_l{1,17},hilbert_42_l{1,18},hilbert_42_l{1,19},hilbert_42_l{1,20},hilbert_42_l{1,21});
  220. hilbert_42_r_ave = ft_timelockgrandaverage(cfg,hilbert_42_r{1,1},hilbert_42_r{1,2},hilbert_42_r{1,3},hilbert_42_r{1,4},hilbert_42_r{1,5},hilbert_42_r{1,6},...
  221. hilbert_42_r{1,7},hilbert_42_r{1,8},hilbert_42_r{1,9},hilbert_42_r{1,10},hilbert_42_r{1,11},hilbert_42_r{1,12},hilbert_42_r{1,13},hilbert_42_r{1,14},hilbert_42_r{1,15},...
  222. hilbert_42_r{1,16},hilbert_42_r{1,17},hilbert_42_r{1,18},hilbert_42_r{1,19},hilbert_42_r{1,20},hilbert_42_r{1,21});
  223. hilbert_44_l_ave = ft_timelockgrandaverage(cfg,hilbert_44_l{1,1},hilbert_44_l{1,2},hilbert_44_l{1,3},hilbert_44_l{1,4},hilbert_44_l{1,5},hilbert_44_l{1,6},...
  224. hilbert_44_l{1,7},hilbert_44_l{1,8},hilbert_44_l{1,9},hilbert_44_l{1,10},hilbert_44_l{1,11},hilbert_44_l{1,12},hilbert_44_l{1,13},hilbert_44_l{1,14},hilbert_44_l{1,15},...
  225. hilbert_44_l{1,16},hilbert_44_l{1,17},hilbert_44_l{1,18},hilbert_44_l{1,19},hilbert_44_l{1,20},hilbert_44_l{1,21});
  226. hilbert_44_r_ave = ft_timelockgrandaverage(cfg,hilbert_44_r{1,1},hilbert_44_r{1,2},hilbert_44_r{1,3},hilbert_44_r{1,4},hilbert_44_r{1,5},hilbert_44_r{1,6},...
  227. hilbert_44_r{1,7},hilbert_44_r{1,8},hilbert_44_r{1,9},hilbert_44_r{1,10},hilbert_44_r{1,11},hilbert_44_r{1,12},hilbert_44_r{1,13},hilbert_44_r{1,14},hilbert_44_r{1,15},...
  228. hilbert_44_r{1,16},hilbert_44_r{1,17},hilbert_44_r{1,18},hilbert_44_r{1,19},hilbert_44_r{1,20},hilbert_44_r{1,21});
  229. % plot
  230. cfg = [];
  231. cfg.showlabels = 'yes';
  232. cfg.fontsize = 6;
  233. cfg.layout = 'easycapM1.mat';
  234. % cfg.ylim = [-3e-13 3e-13];
  235. ft_multiplotER(cfg, hilbert_42_l{1, 1}, hilbert_42_r{1, 1});
  236. cfg = [];
  237. cfg.xlim = [0 1.7];
  238. % cfg.ylim = [-1e-13 3e-13];
  239. cfg.channel = 'PO3';
  240. ft_singleplotER(cfg, hilbert_42_l_ave, hilbert_42_r_ave);
  241. cfg = [];
  242. cfg.xlim = [0 1.7];
  243. % cfg.ylim = [-1e-13 3e-13];
  244. cfg.channel = 'PO4';
  245. ft_singleplotER(cfg, hilbert_42_l_ave, hilbert_42_r_ave);
  246. %% 3. 两个条件的envelop之间的关系,考察它们之间的相位差
  247. % FFT analysis
  248. cfg = [];
  249. cfg.output = 'fooof_peaks';
  250. cfg.channel = 'all';
  251. cfg.method = 'mtmfft';
  252. cfg.pad = 10;
  253. cfg.foi = 2:0.2:10;
  254. cfg.taper = 'hanning';
  255. for i=1:length(subj)
  256. eeg_42_l_fft{1, i} = ft_freqanalysis(cfg, eeg_42_l{1, i});
  257. eeg_42_r_fft{1, i} = ft_freqanalysis(cfg, eeg_42_r{1, i});
  258. eeg_44_l_fft{1, i} = ft_freqanalysis(cfg, eeg_44_l{1, i});
  259. eeg_44_r_fft{1, i} = ft_freqanalysis(cfg, eeg_44_r{1, i});
  260. i
  261. end
  262. freq=2:0.2:10;
  263. % grand average
  264. eeg_42_l_fft_ave = eeg_42_l_fft{1, 1};
  265. eeg_42_r_fft_ave = eeg_42_r_fft{1, 1};
  266. eeg_44_l_fft_ave = eeg_44_l_fft{1, 1};
  267. eeg_44_r_fft_ave = eeg_44_r_fft{1, 1};
  268. for i = 1:length(subj)
  269. spct_42_l(i,:,:) = eeg_42_l_fft{1, i}.powspctrm;
  270. spct_42_r(i,:,:) = eeg_42_r_fft{1, i}.powspctrm;
  271. spct_44_l(i,:,:) = eeg_44_l_fft{1, i}.powspctrm;
  272. spct_44_r(i,:,:) = eeg_44_r_fft{1, i}.powspctrm;
  273. end
  274. eeg_42_l_fft_ave.powspctrm = squeeze(mean(spct_42_l));
  275. eeg_42_r_fft_ave.powspctrm = squeeze(mean(spct_42_r));
  276. eeg_44_l_fft_ave.powspctrm = squeeze(mean(spct_44_l));
  277. eeg_44_r_fft_ave.powspctrm = squeeze(mean(spct_44_r));
  278. % plot
  279. cfg = [];
  280. cfg.parameter = 'powspctrm';
  281. cfg.showlabels = 'yes';
  282. cfg.layout = 'easycapM1.mat';
  283. figure;
  284. ft_multiplotER(cfg, eeg_42_l_fft_ave, eeg_42_r_fft_ave);
  285. figure;
  286. ft_multiplotER(cfg, eeg_44_l_fft_ave, eeg_44_r_fft_ave);
  287. % topo plot
  288. eeg_42_l_fft_temp=eeg_42_l_fft_ave;
  289. eeg_42_l_fft_temp.powspctrm=(eeg_42_l_fft_ave.powspctrm+eeg_42_r_fft_ave.powspctrm)/2;
  290. a=eeg_42_l_fft_temp.powspctrm(47, :);
  291. eeg_42_l_fft_temp.powspctrm(47, :)=eeg_42_l_fft_temp.powspctrm(6, :);
  292. eeg_42_l_fft_temp.powspctrm(6, :)=a;
  293. eeg_44_l_fft_temp=eeg_44_l_fft_ave;
  294. eeg_44_l_fft_temp.powspctrm=(eeg_44_l_fft_ave.powspctrm+eeg_44_r_fft_ave.powspctrm)/2;
  295. b=eeg_44_l_fft_temp.powspctrm(12, :);
  296. eeg_44_l_fft_temp.powspctrm(12, :)=eeg_44_l_fft_temp.powspctrm(9, :);
  297. eeg_44_l_fft_temp.powspctrm(9, :)=b;
  298. c=eeg_44_l_fft_temp.powspctrm(48, :);
  299. eeg_44_l_fft_temp.powspctrm(48, :)=eeg_44_l_fft_temp.powspctrm(45, :);
  300. eeg_44_l_fft_temp.powspctrm(45, :)=c;
  301. cfg = [];
  302. cfg.parameter = 'powspctrm';
  303. cfg.xlim = [4.4, 4.4];
  304. cfg.zlim = [6.4, 7.4];
  305. cfg.colormap = brewermap([],'Reds');
  306. cfg.colorbar = 'yes';
  307. cfg.layout = 'easycapM1.mat';
  308. ft_topoplotER(cfg, eeg_42_l_fft_temp);
  309. cfg.xlim = [6.2, 6.2];
  310. cfg.zlim = [12.5, 14];
  311. ft_topoplotER(cfg, eeg_44_l_fft_temp);
  312. % permutation test
  313. % FFT analysis
  314. cfg = [];
  315. cfg.output = 'fooof_peaks';
  316. cfg.channel = 'all';
  317. cfg.method = 'mtmfft';
  318. cfg.pad = 10;
  319. cfg.foi = 2:0.2:10;
  320. cfg.taper = 'hanning';
  321. eeg_42_l_temp=eeg_42_l;
  322. eeg_42_r_temp=eeg_42_r;
  323. eeg_44_l_temp=eeg_44_l;
  324. eeg_44_r_temp=eeg_44_r;
  325. parob=parpool;
  326. for n=1:1000
  327. % shuffle
  328. parfor i=1:length(subj)
  329. for j=1:160
  330. for m=1:65
  331. eeg_42_l_temp{1, i}.trial{1, j}(m,:)=eeg_42_l{1, i}.trial{1, j}(m,randperm(850));
  332. eeg_42_r_temp{1, i}.trial{1, j}(m,:)=eeg_42_r{1, i}.trial{1, j}(m,randperm(850));
  333. eeg_44_l_temp{1, i}.trial{1, j}(m,:)=eeg_44_l{1, i}.trial{1, j}(m,randperm(850));
  334. eeg_44_r_temp{1, i}.trial{1, j}(m,:)=eeg_44_r{1, i}.trial{1, j}(m,randperm(850));
  335. end
  336. end
  337. eeg_42_l_fft_temp{1, i} = ft_freqanalysis(cfg, eeg_42_l_temp{1, i});
  338. eeg_42_r_fft_temp{1, i} = ft_freqanalysis(cfg, eeg_42_r_temp{1, i});
  339. eeg_44_l_fft_temp{1, i} = ft_freqanalysis(cfg, eeg_44_l_temp{1, i});
  340. eeg_44_r_fft_temp{1, i} = ft_freqanalysis(cfg, eeg_44_r_temp{1, i});
  341. end
  342. % grand average
  343. spct_42_l = 0;
  344. spct_42_r = 0;
  345. spct_44_l = 0;
  346. spct_44_r = 0;
  347. for i = 1:length(subj)
  348. spct_42_l = spct_42_l + eeg_42_l_fft_temp{1, i}.powspctrm;
  349. spct_42_r = spct_42_r + eeg_42_r_fft_temp{1, i}.powspctrm;
  350. spct_44_l = spct_44_l + eeg_44_l_fft_temp{1, i}.powspctrm;
  351. spct_44_r = spct_44_r + eeg_44_r_fft_temp{1, i}.powspctrm;
  352. end
  353. eeg_42_l_shuf(n,:,:) = spct_42_l/length(subj);
  354. eeg_42_r_shuf(n,:,:) = spct_42_r/length(subj);
  355. eeg_44_l_shuf(n,:,:) = spct_44_l/length(subj);
  356. eeg_44_r_shuf(n,:,:) = spct_44_r/length(subj);
  357. n
  358. end
  359. delete(parob);
  360. save('env_fft_shuf_fuse.mat','eeg_42_l_shuf','eeg_42_r_shuf','eeg_44_l_shuf','eeg_44_r_shuf');
  361. % 取95%的阈限
  362. load('env_fft_shuf_fuse.mat');
  363. eeg_42_l_thre = squeeze(prctile(eeg_42_l_shuf,95,1));
  364. eeg_42_r_thre = squeeze(prctile(eeg_42_r_shuf,95,1));
  365. eeg_44_l_thre = squeeze(prctile(eeg_44_l_shuf,95,1));
  366. eeg_44_r_thre = squeeze(prctile(eeg_44_r_shuf,95,1));
  367. % phase analysis
  368. cfg = [];
  369. cfg.output = 'fourier';
  370. cfg.channel = 'all';
  371. cfg.method = 'mtmfft';
  372. cfg.pad = 10;
  373. cfg.foi = 2:0.2:10;
  374. cfg.taper = 'hanning';
  375. for i=1:length(subj)
  376. eeg_42_l_phase{1, i} = ft_freqanalysis(cfg, eeg_42_l{1, i});
  377. eeg_42_r_phase{1, i} = ft_freqanalysis(cfg, eeg_42_r{1, i});
  378. eeg_44_l_phase{1, i} = ft_freqanalysis(cfg, eeg_44_l{1, i});
  379. eeg_44_r_phase{1, i} = ft_freqanalysis(cfg, eeg_44_r{1, i});
  380. i
  381. end
  382. for i=1:length(subj)
  383. po4_42_l_phase(i) = circ_mean(angle(eeg_42_l_phase{1, i}.fourierspctrm(:,46,17)));
  384. po4_42_r_phase(i) = circ_mean(angle(eeg_42_r_phase{1, i}.fourierspctrm(:,46,17)));
  385. po3_44_l_phase(i) = circ_mean(angle(eeg_44_l_phase{1, i}.fourierspctrm(:,45,17)));
  386. po3_44_r_phase(i) = circ_mean(angle(eeg_44_r_phase{1, i}.fourierspctrm(:,45,17)));
  387. i
  388. end
  389. phase_l_diff = circ_dist(po4_42_l_phase, po3_44_l_phase);
  390. phase_r_diff = circ_dist(po3_44_r_phase, po4_42_r_phase);
  391. % plot
  392. figure;
  393. subplot(131);
  394. circ_plot(po4_42_l_phase','hist',[],12,false,true,'linewidth',2,'color','r');
  395. subplot(132);
  396. circ_plot(po3_44_l_phase','hist',[],12,false,true,'linewidth',2,'color','r');
  397. subplot(133);
  398. circ_plot(phase_l_diff','hist',[],12,false,true,'linewidth',2,'color','r');
  399. circ_rad2ang(circ_mean(po4_42_l_phase,[],2));
  400. [pval z] = circ_rtest(po4_42_l_phase); % non-uniform
  401. circ_rad2ang(circ_mean(po3_44_l_phase,[],2));
  402. [pval z] = circ_rtest(po3_44_l_phase); % non-uniform
  403. circ_rad2ang(circ_mean(phase_l_diff,[],2));
  404. [pval z] = circ_rtest(phase_l_diff); % non-uniform
  405. figure;
  406. subplot(131);
  407. circ_plot(po3_44_r_phase','hist',[],12,false,true,'linewidth',2,'color','r');
  408. subplot(132);
  409. circ_plot(po4_42_r_phase','hist',[],12,false,true,'linewidth',2,'color','r');
  410. subplot(133);
  411. circ_plot(phase_r_diff','hist',[],12,false,true,'linewidth',2,'color','r');
  412. circ_rad2ang(circ_mean(po3_44_r_phase,[],2));
  413. [pval z] = circ_rtest(po3_44_r_phase); % non-uniform
  414. circ_rad2ang(circ_mean(po4_42_r_phase,[],2));
  415. [pval z] = circ_rtest(po4_42_r_phase); % non-uniform
  416. circ_rad2ang(circ_mean(phase_r_diff,[],2));
  417. [pval z] = circ_rtest(phase_r_diff); % non-uniform
  418. [pval z] = circ_vtest(phase_l_diff,circ_ang2rad(0)); % difference to 0
  419. [pval z] = circ_vtest(phase_r_diff,circ_ang2rad(0)); % difference to 0
  420. phase_diff_fuse=circ_mean([phase_l_diff; phase_r_diff],[],1);
  421. save('phase_diff_fuse.mat','phase_diff_fuse');
  422. circ_rad2ang(circ_mean(circ_dist(phase_diff_single, phase_diff_fuse),[],2));
  423. [pval, F] = circ_htest(phase_diff_single, phase_diff_fuse);
  424. circ_plot(circ_dist(phase_diff_single, phase_diff_fuse)','hist',[],12,false,true,'linewidth',2,'color','r');
  425. %% 4. Phase-amplitude coupling, SSVEP的amplitude与某个地方脑电的phase有coupling。表现为SSVEP envelope与脑电phase的coherence
  426. % 将提取EEG的频谱,然后跟ssvep的envelope计算coherence
  427. % FFT on eeg
  428. cfg = [];
  429. cfg.output = 'fourier';
  430. cfg.channel = 'all';
  431. cfg.method = 'mtmfft';
  432. cfg.pad = 10;
  433. cfg.foi = 2:0.2:10;
  434. cfg.taper = 'hanning';
  435. for i=1:length(subj)
  436. cfg.trials = find(eegdata_er{1, subj(i)}.trialinfo == 10);
  437. eeg_fft_l{1, i} = ft_freqanalysis(cfg, eegdata_er{1, subj(i)});
  438. cfg.trials = find(eegdata_er{1, subj(i)}.trialinfo == 20);
  439. eeg_fft_r{1, i} = ft_freqanalysis(cfg, eegdata_er{1, subj(i)});
  440. i
  441. end
  442. % 选择电极,替换IO。计算IO与其他电极的coherence
  443. % 左边先开始闪,PO4(46)替换
  444. for i=1:length(subj)
  445. eeg_fft_l{1, i}.fourierspctrm(:,20,:)=eeg_42_l_phase{1, i}.fourierspctrm(:,46,:);
  446. end
  447. cfg = [];
  448. cfg.method = 'coh';
  449. cfg.channelcmb = {'IO' 'Fp1'; 'IO' 'Fp2'; 'IO' 'F3'; 'IO' 'F4'; 'IO' 'C3'; 'IO' 'C4';...
  450. 'IO' 'P3'; 'IO' 'P4'; 'IO' 'O1'; 'IO' 'O2'; 'IO' 'F7'; 'IO' 'F8'; 'IO' 'T7';...
  451. 'IO' 'T8'; 'IO' 'P7'; 'IO' 'P8'; 'IO' 'Fz'; 'IO' 'Cz'; 'IO' 'Pz'; 'IO' 'FC1';...
  452. 'IO' 'FC2'; 'IO' 'CP1'; 'IO' 'CP2'; 'IO' 'FC5'; 'IO' 'FC6'; 'IO' 'CP5'; 'IO' 'CP6';...
  453. 'IO' 'FT9'; 'IO' 'FT10'; 'IO' 'TP9';'IO' 'TP10';'IO' 'F1';'IO' 'F2';'IO' 'C1';...
  454. 'IO' 'C2';'IO' 'P1';'IO' 'P2';'IO' 'AF3';'IO' 'AF4';'IO' 'FC3';'IO' 'FC4';...
  455. 'IO' 'CP3';'IO' 'CP4';'IO' 'PO3';'IO' 'PO4';'IO' 'F5';'IO' 'F6';'IO' 'C5';...
  456. 'IO' 'C6';'IO' 'P5';'IO' 'P6';'IO' 'AF7';'IO' 'AF8';'IO' 'FT7';'IO' 'FT8';...
  457. 'IO' 'TP7';'IO' 'TP8';'IO' 'PO7';'IO' 'PO8';'IO' 'Fpz';'IO' 'CPz';'IO' 'POz';...
  458. 'IO' 'Oz';'IO' 'FCz'};
  459. for i=1:length(subj)
  460. coh_l_po4{1, i}= ft_connectivityanalysis(cfg, eeg_fft_l{1, i});
  461. end
  462. % 左边先开始闪,PO3(45)
  463. for i=1:length(subj)
  464. eeg_fft_l{1, i}.fourierspctrm(:,20,:)=eeg_44_l_phase{1, i}.fourierspctrm(:,45,:);
  465. end
  466. cfg = [];
  467. cfg.method = 'coh';
  468. cfg.channelcmb = {'IO' 'Fp1'; 'IO' 'Fp2'; 'IO' 'F3'; 'IO' 'F4'; 'IO' 'C3'; 'IO' 'C4';...
  469. 'IO' 'P3'; 'IO' 'P4'; 'IO' 'O1'; 'IO' 'O2'; 'IO' 'F7'; 'IO' 'F8'; 'IO' 'T7';...
  470. 'IO' 'T8'; 'IO' 'P7'; 'IO' 'P8'; 'IO' 'Fz'; 'IO' 'Cz'; 'IO' 'Pz'; 'IO' 'FC1';...
  471. 'IO' 'FC2'; 'IO' 'CP1'; 'IO' 'CP2'; 'IO' 'FC5'; 'IO' 'FC6'; 'IO' 'CP5'; 'IO' 'CP6';...
  472. 'IO' 'FT9'; 'IO' 'FT10'; 'IO' 'TP9';'IO' 'TP10';'IO' 'F1';'IO' 'F2';'IO' 'C1';...
  473. 'IO' 'C2';'IO' 'P1';'IO' 'P2';'IO' 'AF3';'IO' 'AF4';'IO' 'FC3';'IO' 'FC4';...
  474. 'IO' 'CP3';'IO' 'CP4';'IO' 'PO3';'IO' 'PO4';'IO' 'F5';'IO' 'F6';'IO' 'C5';...
  475. 'IO' 'C6';'IO' 'P5';'IO' 'P6';'IO' 'AF7';'IO' 'AF8';'IO' 'FT7';'IO' 'FT8';...
  476. 'IO' 'TP7';'IO' 'TP8';'IO' 'PO7';'IO' 'PO8';'IO' 'Fpz';'IO' 'CPz';'IO' 'POz';...
  477. 'IO' 'Oz';'IO' 'FCz'};
  478. for i=1:length(subj)
  479. coh_l_po3{1, i}= ft_connectivityanalysis(cfg, eeg_fft_l{1, i});
  480. end
  481. % 右边先开始闪,PO3(45)
  482. for i=1:length(subj)
  483. eeg_fft_r{1, i}.fourierspctrm(:,20,:)=eeg_44_r_phase{1, i}.fourierspctrm(:,45,:);
  484. end
  485. cfg = [];
  486. cfg.method = 'coh';
  487. cfg.channelcmb = {'IO' 'Fp1'; 'IO' 'Fp2'; 'IO' 'F3'; 'IO' 'F4'; 'IO' 'C3'; 'IO' 'C4';...
  488. 'IO' 'P3'; 'IO' 'P4'; 'IO' 'O1'; 'IO' 'O2'; 'IO' 'F7'; 'IO' 'F8'; 'IO' 'T7';...
  489. 'IO' 'T8'; 'IO' 'P7'; 'IO' 'P8'; 'IO' 'Fz'; 'IO' 'Cz'; 'IO' 'Pz'; 'IO' 'FC1';...
  490. 'IO' 'FC2'; 'IO' 'CP1'; 'IO' 'CP2'; 'IO' 'FC5'; 'IO' 'FC6'; 'IO' 'CP5'; 'IO' 'CP6';...
  491. 'IO' 'FT9'; 'IO' 'FT10'; 'IO' 'TP9';'IO' 'TP10';'IO' 'F1';'IO' 'F2';'IO' 'C1';...
  492. 'IO' 'C2';'IO' 'P1';'IO' 'P2';'IO' 'AF3';'IO' 'AF4';'IO' 'FC3';'IO' 'FC4';...
  493. 'IO' 'CP3';'IO' 'CP4';'IO' 'PO3';'IO' 'PO4';'IO' 'F5';'IO' 'F6';'IO' 'C5';...
  494. 'IO' 'C6';'IO' 'P5';'IO' 'P6';'IO' 'AF7';'IO' 'AF8';'IO' 'FT7';'IO' 'FT8';...
  495. 'IO' 'TP7';'IO' 'TP8';'IO' 'PO7';'IO' 'PO8';'IO' 'Fpz';'IO' 'CPz';'IO' 'POz';...
  496. 'IO' 'Oz';'IO' 'FCz'};
  497. for i=1:length(subj)
  498. coh_r_po3{1, i}= ft_connectivityanalysis(cfg, eeg_fft_r{1, i});
  499. end
  500. % 右边先开始闪,PO4(46)
  501. for i=1:length(subj)
  502. eeg_fft_r{1, i}.fourierspctrm(:,20,:)=eeg_42_r_phase{1, i}.fourierspctrm(:,46,:);
  503. end
  504. cfg = [];
  505. cfg.method = 'coh';
  506. cfg.channelcmb = {'IO' 'Fp1'; 'IO' 'Fp2'; 'IO' 'F3'; 'IO' 'F4'; 'IO' 'C3'; 'IO' 'C4';...
  507. 'IO' 'P3'; 'IO' 'P4'; 'IO' 'O1'; 'IO' 'O2'; 'IO' 'F7'; 'IO' 'F8'; 'IO' 'T7';...
  508. 'IO' 'T8'; 'IO' 'P7'; 'IO' 'P8'; 'IO' 'Fz'; 'IO' 'Cz'; 'IO' 'Pz'; 'IO' 'FC1';...
  509. 'IO' 'FC2'; 'IO' 'CP1'; 'IO' 'CP2'; 'IO' 'FC5'; 'IO' 'FC6'; 'IO' 'CP5'; 'IO' 'CP6';...
  510. 'IO' 'FT9'; 'IO' 'FT10'; 'IO' 'TP9';'IO' 'TP10';'IO' 'F1';'IO' 'F2';'IO' 'C1';...
  511. 'IO' 'C2';'IO' 'P1';'IO' 'P2';'IO' 'AF3';'IO' 'AF4';'IO' 'FC3';'IO' 'FC4';...
  512. 'IO' 'CP3';'IO' 'CP4';'IO' 'PO3';'IO' 'PO4';'IO' 'F5';'IO' 'F6';'IO' 'C5';...
  513. 'IO' 'C6';'IO' 'P5';'IO' 'P6';'IO' 'AF7';'IO' 'AF8';'IO' 'FT7';'IO' 'FT8';...
  514. 'IO' 'TP7';'IO' 'TP8';'IO' 'PO7';'IO' 'PO8';'IO' 'Fpz';'IO' 'CPz';'IO' 'POz';...
  515. 'IO' 'Oz';'IO' 'FCz'};
  516. for i=1:length(subj)
  517. coh_r_po4{1, i}= ft_connectivityanalysis(cfg, eeg_fft_r{1, i});
  518. end
  519. % the coh value of 4 hz
  520. for i=1:length(subj)
  521. coh_l_po4_val(:,i)=coh_l_po4{1, i}.cohspctrm(:,13);
  522. coh_l_po3_val(:,i)=coh_l_po3{1, i}.cohspctrm(:,22);
  523. coh_r_po4_val(:,i)=coh_r_po4{1, i}.cohspctrm(:,13);
  524. coh_r_po3_val(:,i)=coh_r_po3{1, i}.cohspctrm(:,22);
  525. end
  526. % topo plot
  527. chann_label=eegdata{1, 1}.label;
  528. chann_label(20)=[];
  529. cfg = [];
  530. cfg.layout = 'easycapM1.mat';
  531. cfg.xlim = 'maxmin'; % time limitation
  532. % cfg.zlim = [0.5 1];
  533. % cfg.style = 'straight';
  534. cfg.colorbar = 'yes';
  535. cfg.marker = 'on';
  536. cfg.comment = 'xlim';
  537. cfg.commentpos = 'lefttop';
  538. coh_l_po4_plot = {};
  539. coh_l_po4_plot.avg = mean(coh_l_po4_val,2); % data definition, channel * time
  540. coh_l_po4_plot.time = 1; % time definition
  541. coh_l_po4_plot.dimord = 'chan_time';
  542. coh_l_po4_plot.label = chann_label;
  543. figure;
  544. ft_topoplotER(cfg, coh_l_po4_plot);
  545. title('coh_l_po4');
  546. axis tight;
  547. coh_l_po3_plot = {};
  548. coh_l_po3_plot.avg = mean(coh_l_po3_val,2); % data definition, channel * time
  549. coh_l_po3_plot.time = 1; % time definition
  550. coh_l_po3_plot.dimord = 'chan_time';
  551. coh_l_po3_plot.label = chann_label;
  552. figure;
  553. ft_topoplotER(cfg, coh_l_po3_plot);
  554. title('coh_l_po3');
  555. axis tight;
  556. coh_r_po3_plot = {};
  557. coh_r_po3_plot.avg = mean(coh_r_po3_val,2); % data definition, channel * time
  558. coh_r_po3_plot.time = 1; % time definition
  559. coh_r_po3_plot.dimord = 'chan_time';
  560. coh_r_po3_plot.label = chann_label;
  561. figure;
  562. ft_topoplotER(cfg, coh_r_po3_plot);
  563. title('coh_r_po3');
  564. axis tight;
  565. coh_r_po4_plot = {};
  566. coh_r_po4_plot.avg = mean(coh_r_po4_val,2); % data definition, channel * time
  567. coh_r_po4_plot.time = 1; % time definition
  568. coh_r_po4_plot.dimord = 'chan_time';
  569. coh_r_po4_plot.label = chann_label;
  570. figure;
  571. ft_topoplotER(cfg, coh_r_po4_plot);
  572. title('coh_r_po3');
  573. axis tight;
  574. % permutation test
  575. eegdata_er_sel=eegdata_er(subj);
  576. parob=parpool;
  577. for n=1:1000
  578. % shuffle
  579. eegdata_er_temp=eegdata_er_sel;
  580. parfor i=1:length(subj)
  581. for j=1:320
  582. for m=1:65
  583. eegdata_er_temp{1, i}.trial{1, j}(m,:)=eegdata_er_sel{1, i}.trial{1, j}(m,randperm(850));
  584. end
  585. end
  586. end
  587. % FFT on eeg
  588. cfg = [];
  589. cfg.output = 'fourier';
  590. cfg.channel = 'all';
  591. cfg.method = 'mtmfft';
  592. cfg.pad = 10;
  593. cfg.foi = 2:0.2:10;
  594. cfg.taper = 'hanning';
  595. for i=1:length(subj)
  596. cfg.trials = find(eegdata_er_temp{1, i}.trialinfo == 10);
  597. eeg_fft_l_temp{1, i} = ft_freqanalysis(cfg, eegdata_er_temp{1, i});
  598. cfg.trials = find(eegdata_er_temp{1, i}.trialinfo == 20);
  599. eeg_fft_r_temp{1, i} = ft_freqanalysis(cfg, eegdata_er_temp{1, i});
  600. end
  601. % 选择电极,替换IO。计算IO与其他电极的coherence
  602. % 左边先开始闪,PO4(46)替换
  603. for i=1:length(subj)
  604. eeg_fft_l_temp{1, i}.fourierspctrm(:,20,:)=eeg_42_l_phase{1, i}.fourierspctrm(:,46,:);
  605. end
  606. cfg = [];
  607. cfg.method = 'coh';
  608. cfg.channelcmb = {'IO' 'Fp1'; 'IO' 'Fp2'; 'IO' 'F3'; 'IO' 'F4'; 'IO' 'C3'; 'IO' 'C4';...
  609. 'IO' 'P3'; 'IO' 'P4'; 'IO' 'O1'; 'IO' 'O2'; 'IO' 'F7'; 'IO' 'F8'; 'IO' 'T7';...
  610. 'IO' 'T8'; 'IO' 'P7'; 'IO' 'P8'; 'IO' 'Fz'; 'IO' 'Cz'; 'IO' 'Pz'; 'IO' 'FC1';...
  611. 'IO' 'FC2'; 'IO' 'CP1'; 'IO' 'CP2'; 'IO' 'FC5'; 'IO' 'FC6'; 'IO' 'CP5'; 'IO' 'CP6';...
  612. 'IO' 'FT9'; 'IO' 'FT10'; 'IO' 'TP9';'IO' 'TP10';'IO' 'F1';'IO' 'F2';'IO' 'C1';...
  613. 'IO' 'C2';'IO' 'P1';'IO' 'P2';'IO' 'AF3';'IO' 'AF4';'IO' 'FC3';'IO' 'FC4';...
  614. 'IO' 'CP3';'IO' 'CP4';'IO' 'PO3';'IO' 'PO4';'IO' 'F5';'IO' 'F6';'IO' 'C5';...
  615. 'IO' 'C6';'IO' 'P5';'IO' 'P6';'IO' 'AF7';'IO' 'AF8';'IO' 'FT7';'IO' 'FT8';...
  616. 'IO' 'TP7';'IO' 'TP8';'IO' 'PO7';'IO' 'PO8';'IO' 'Fpz';'IO' 'CPz';'IO' 'POz';...
  617. 'IO' 'Oz';'IO' 'FCz'};
  618. for i=1:length(subj)
  619. coh_l_po4_temp{1, i}= ft_connectivityanalysis(cfg, eeg_fft_l_temp{1, i});
  620. coh_l_po4_temp_val(i,:,:)=coh_l_po4_temp{1, i}.cohspctrm;
  621. end
  622. % 左边先开始闪,PO3(45)
  623. for i=1:length(subj)
  624. eeg_fft_l_temp{1, i}.fourierspctrm(:,20,:)=eeg_44_l_phase{1, i}.fourierspctrm(:,45,:);
  625. end
  626. cfg = [];
  627. cfg.method = 'coh';
  628. cfg.channelcmb = {'IO' 'Fp1'; 'IO' 'Fp2'; 'IO' 'F3'; 'IO' 'F4'; 'IO' 'C3'; 'IO' 'C4';...
  629. 'IO' 'P3'; 'IO' 'P4'; 'IO' 'O1'; 'IO' 'O2'; 'IO' 'F7'; 'IO' 'F8'; 'IO' 'T7';...
  630. 'IO' 'T8'; 'IO' 'P7'; 'IO' 'P8'; 'IO' 'Fz'; 'IO' 'Cz'; 'IO' 'Pz'; 'IO' 'FC1';...
  631. 'IO' 'FC2'; 'IO' 'CP1'; 'IO' 'CP2'; 'IO' 'FC5'; 'IO' 'FC6'; 'IO' 'CP5'; 'IO' 'CP6';...
  632. 'IO' 'FT9'; 'IO' 'FT10'; 'IO' 'TP9';'IO' 'TP10';'IO' 'F1';'IO' 'F2';'IO' 'C1';...
  633. 'IO' 'C2';'IO' 'P1';'IO' 'P2';'IO' 'AF3';'IO' 'AF4';'IO' 'FC3';'IO' 'FC4';...
  634. 'IO' 'CP3';'IO' 'CP4';'IO' 'PO3';'IO' 'PO4';'IO' 'F5';'IO' 'F6';'IO' 'C5';...
  635. 'IO' 'C6';'IO' 'P5';'IO' 'P6';'IO' 'AF7';'IO' 'AF8';'IO' 'FT7';'IO' 'FT8';...
  636. 'IO' 'TP7';'IO' 'TP8';'IO' 'PO7';'IO' 'PO8';'IO' 'Fpz';'IO' 'CPz';'IO' 'POz';...
  637. 'IO' 'Oz';'IO' 'FCz'};
  638. for i=1:length(subj)
  639. coh_l_po3_temp{1, i}= ft_connectivityanalysis(cfg, eeg_fft_l_temp{1, i});
  640. coh_l_po3_temp_val(i,:,:)=coh_l_po3_temp{1, i}.cohspctrm;
  641. end
  642. % 右边先开始闪,PO3(45)
  643. for i=1:length(subj)
  644. eeg_fft_r_temp{1, i}.fourierspctrm(:,20,:)=eeg_44_r_phase{1, i}.fourierspctrm(:,45,:);
  645. end
  646. cfg = [];
  647. cfg.method = 'coh';
  648. cfg.channelcmb = {'IO' 'Fp1'; 'IO' 'Fp2'; 'IO' 'F3'; 'IO' 'F4'; 'IO' 'C3'; 'IO' 'C4';...
  649. 'IO' 'P3'; 'IO' 'P4'; 'IO' 'O1'; 'IO' 'O2'; 'IO' 'F7'; 'IO' 'F8'; 'IO' 'T7';...
  650. 'IO' 'T8'; 'IO' 'P7'; 'IO' 'P8'; 'IO' 'Fz'; 'IO' 'Cz'; 'IO' 'Pz'; 'IO' 'FC1';...
  651. 'IO' 'FC2'; 'IO' 'CP1'; 'IO' 'CP2'; 'IO' 'FC5'; 'IO' 'FC6'; 'IO' 'CP5'; 'IO' 'CP6';...
  652. 'IO' 'FT9'; 'IO' 'FT10'; 'IO' 'TP9';'IO' 'TP10';'IO' 'F1';'IO' 'F2';'IO' 'C1';...
  653. 'IO' 'C2';'IO' 'P1';'IO' 'P2';'IO' 'AF3';'IO' 'AF4';'IO' 'FC3';'IO' 'FC4';...
  654. 'IO' 'CP3';'IO' 'CP4';'IO' 'PO3';'IO' 'PO4';'IO' 'F5';'IO' 'F6';'IO' 'C5';...
  655. 'IO' 'C6';'IO' 'P5';'IO' 'P6';'IO' 'AF7';'IO' 'AF8';'IO' 'FT7';'IO' 'FT8';...
  656. 'IO' 'TP7';'IO' 'TP8';'IO' 'PO7';'IO' 'PO8';'IO' 'Fpz';'IO' 'CPz';'IO' 'POz';...
  657. 'IO' 'Oz';'IO' 'FCz'};
  658. for i=1:length(subj)
  659. coh_r_po3_temp{1, i}= ft_connectivityanalysis(cfg, eeg_fft_r_temp{1, i});
  660. coh_r_po3_temp_val(i,:,:)=coh_r_po3_temp{1, i}.cohspctrm;
  661. end
  662. % 右边先开始闪,PO4(46)
  663. for i=1:length(subj)
  664. eeg_fft_r_temp{1, i}.fourierspctrm(:,20,:)=eeg_42_r_phase{1, i}.fourierspctrm(:,46,:);
  665. end
  666. cfg = [];
  667. cfg.method = 'coh';
  668. cfg.channelcmb = {'IO' 'Fp1'; 'IO' 'Fp2'; 'IO' 'F3'; 'IO' 'F4'; 'IO' 'C3'; 'IO' 'C4';...
  669. 'IO' 'P3'; 'IO' 'P4'; 'IO' 'O1'; 'IO' 'O2'; 'IO' 'F7'; 'IO' 'F8'; 'IO' 'T7';...
  670. 'IO' 'T8'; 'IO' 'P7'; 'IO' 'P8'; 'IO' 'Fz'; 'IO' 'Cz'; 'IO' 'Pz'; 'IO' 'FC1';...
  671. 'IO' 'FC2'; 'IO' 'CP1'; 'IO' 'CP2'; 'IO' 'FC5'; 'IO' 'FC6'; 'IO' 'CP5'; 'IO' 'CP6';...
  672. 'IO' 'FT9'; 'IO' 'FT10'; 'IO' 'TP9';'IO' 'TP10';'IO' 'F1';'IO' 'F2';'IO' 'C1';...
  673. 'IO' 'C2';'IO' 'P1';'IO' 'P2';'IO' 'AF3';'IO' 'AF4';'IO' 'FC3';'IO' 'FC4';...
  674. 'IO' 'CP3';'IO' 'CP4';'IO' 'PO3';'IO' 'PO4';'IO' 'F5';'IO' 'F6';'IO' 'C5';...
  675. 'IO' 'C6';'IO' 'P5';'IO' 'P6';'IO' 'AF7';'IO' 'AF8';'IO' 'FT7';'IO' 'FT8';...
  676. 'IO' 'TP7';'IO' 'TP8';'IO' 'PO7';'IO' 'PO8';'IO' 'Fpz';'IO' 'CPz';'IO' 'POz';...
  677. 'IO' 'Oz';'IO' 'FCz'};
  678. for i=1:length(subj)
  679. coh_r_po4_temp{1, i}= ft_connectivityanalysis(cfg, eeg_fft_r_temp{1, i});
  680. coh_r_po4_temp_val(i,:,:)=coh_r_po4_temp{1, i}.cohspctrm;
  681. end
  682. coh_l_po4_shuf(n,:,:)=mean(coh_l_po4_temp_val,1);
  683. coh_l_po3_shuf(n,:,:)=mean(coh_l_po3_temp_val,1);
  684. coh_r_po3_shuf(n,:,:)=mean(coh_r_po3_temp_val,1);
  685. coh_r_po4_shuf(n,:,:)=mean(coh_r_po4_temp_val,1);
  686. n
  687. end
  688. delete(parob);
  689. save('coh_shuf_fuse.mat','coh_l_po4_shuf','coh_l_po3_shuf','coh_r_po3_shuf','coh_r_po4_shuf');
  690. % 取百分位数
  691. load('coh_shuf_fuse.mat');
  692. coh_l_po3_shuf_temp=squeeze(coh_l_po3_shuf(:,:,22));
  693. coh_l_po4_shuf_temp=squeeze(coh_l_po4_shuf(:,:,13));
  694. coh_r_po3_shuf_temp=squeeze(coh_r_po3_shuf(:,:,22));
  695. coh_r_po4_shuf_temp=squeeze(coh_r_po4_shuf(:,:,13));
  696. coh_l_po3_val_m=mean(coh_l_po3_val,2);
  697. coh_l_po4_val_m=mean(coh_l_po4_val,2);
  698. coh_r_po3_val_m=mean(coh_r_po3_val,2);
  699. coh_r_po4_val_m=mean(coh_r_po4_val,2);
  700. for i=1:64
  701. coh_l_po3_p(i) = invprctile(coh_l_po3_shuf_temp(:,i),coh_l_po3_val_m(i));
  702. coh_l_po4_p(i) = invprctile(coh_l_po4_shuf_temp(:,i),coh_l_po4_val_m(i));
  703. coh_r_po3_p(i) = invprctile(coh_r_po3_shuf_temp(:,i),coh_r_po3_val_m(i));
  704. coh_r_po4_p(i) = invprctile(coh_r_po4_shuf_temp(:,i),coh_r_po4_val_m(i));
  705. end
  706. coh_l_p=(coh_l_po3_p+coh_l_po4_p)/2;
  707. coh_r_p=(coh_r_po3_p+coh_r_po4_p)/2;
  708. % topo plot
  709. chann_label=eegdata{1, 1}.label;
  710. chann_label(20)=[];
  711. cfg = [];
  712. cfg.layout = 'easycapM1.mat';
  713. cfg.xlim = 'maxmin'; % time limitation
  714. cfg.zlim = [50 100];
  715. cfg.style = 'straight';
  716. cfg.colormap = brewermap([],'Reds');
  717. cfg.colorbar = 'yes';
  718. % cfg.marker = 'on';
  719. % cfg.comment = 'xlim';
  720. % cfg.commentpos = 'lefttop';
  721. coh_l_plot = {};
  722. coh_l_plot.avg = coh_l_p'; % data definition, channel * time
  723. coh_l_plot.time = 1; % time definition
  724. coh_l_plot.dimord = 'chan_time';
  725. coh_l_plot.label = chann_label;
  726. cfg.highlight = 'on';
  727. cfg.highlightchannel = find(coh_l_p'>95);
  728. cfg.highlightsymbol = '*';
  729. cfg.highlightcolor = [1 1 0];
  730. % cfg.highlightsize = 6;
  731. ft_topoplotER(cfg, coh_l_plot);
  732. title('coh_l');
  733. axis tight;
  734. cfg = [];
  735. cfg.layout = 'easycapM1.mat';
  736. cfg.xlim = 'maxmin'; % time limitation
  737. cfg.zlim = [50 100];
  738. cfg.style = 'straight';
  739. cfg.colormap = brewermap([],'Reds');
  740. cfg.colorbar = 'yes';
  741. % cfg.marker = 'on';
  742. % cfg.comment = 'xlim';
  743. % cfg.commentpos = 'lefttop';
  744. coh_r_plot = {};
  745. coh_r_plot.avg = coh_r_p'; % data definition, channel * time
  746. coh_r_plot.time = 1; % time definition
  747. coh_r_plot.dimord = 'chan_time';
  748. coh_r_plot.label = chann_label;
  749. cfg.highlight = 'on';
  750. cfg.highlightchannel = find(coh_r_p'>95);
  751. cfg.highlightsymbol = '+';
  752. cfg.highlightcolor = [1 1 0];
  753. ft_topoplotER(cfg, coh_r_plot);
  754. title('coh_r');
  755. axis tight;
  756. save('coh_fuse.mat','coh_l_p','coh_r_p');
  757. %% 5. behaviral correlates,两个SSVEP的相位差异与行为之间的相关。circular-linear相关
  758. phase_diff=circ_mean([phase_l_diff; phase_r_diff]);
  759. load('D:\OneDrive - hznu.edu.cn\Matlab_workspace\Attention and oscillation\kongqing\Data\beha\exp1\dual_acc.mat');
  760. load('D:\OneDrive - hznu.edu.cn\Matlab_workspace\Attention and oscillation\kongqing\Data\beha\exp1\dual_rt.mat');
  761. % acc
  762. for i=1:length(subj)
  763. acc_sub(i)=mean(dual_acc{1, subj(i)});
  764. end
  765. % RT
  766. for i=1:length(subj)
  767. for j=1:320
  768. if dual_acc{1, subj(i)}(1,j) == 0
  769. dual_rt{1, subj(i)}(1,j) = NaN;
  770. end
  771. end
  772. rt_sub(i)=mean(dual_rt{1, subj(i)},"omitnan");
  773. end
  774. % correlation
  775. [rho pval] = circ_corrcl(phase_diff', rt_sub');
  776. [rho pval] = circ_corrcl(abs(phase_diff'), rt_sub');
  777. % plot
  778. scatter(phase_diff,rt_sub);
  779. scatter(abs(phase_diff),rt_sub);
  780. save('beha_fuse.mat','phase_diff','rt_sub');

fuse.m at commit 7d710bf, no license · at the source

Overview

Authors: Qing Kong1,2, Tong Wang1,2, Jianrong Jia1,2
  1. Department of Psychology, Hangzhou Normal University,Hangzhou, Zhejiang 311121 China
  2. Zhejiang Philosophy and Social Science Laboratory for Research in Early Development and Childcare, Hangzhou Normal University,Hangzhou, Zhejiang 311121 China
Institutions: Hangzhou Normal University (China)
Journal: BMC biology, volume 24, issue 1, article 154
Dates: received 6 January 2026; accepted 8 May 2026; published online 15 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1186/s12915-026-02630-7 · PMID 42141460 · PMCID PMC13349037 · OpenAlex W7161305590
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism), cognitive (subfield)
Methods: Spectral & time-frequency, Connectivity, Statistics, Smoothing, state filtering, decompositions, Preprocessing, Evoked potentials
Keywords: Visual attention, Rhythmic sampling, Task modulation, Phase modulation
MeSH: Attention*, Evoked Potentials, Visual*, Visual Perception*, Adult, Female, Humans, Male, Photic Stimulation, Young Adult (* major topic)
Topic: Flow Experience in Various Fields (Developmental and Educational Psychology, Psychology), according to OpenAlex
Citations: not cited yet (Europe PMC); 47 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above, with 3 matches between paragraphs and lines of code.

perevo/attentiondynamicsKQ

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 7d710bfb81aa1aa2d384c0850e1263d189c83270, 13 July 2024
Languages: MATLAB (2)
Size: 2 files, 2 scripts
Software Heritage: not archived
Found in: “Data availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
2 files
  • fuse.m, MATLAB, 881 lines, 2 matches
  • sep.m, MATLAB, 879 lines, 1 match

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 2 scripts, each with its path and the digest of its content;
  • 3 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1186/s12915-026-02630-7.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 4 keywords, 9 MeSH terms, 45 references.

Cite

This paper

Kong, Q., Wang, T., & Jia, J. (2026). Phasic modulation of attentional rhythmic sampling according to task demands. BMC biology, 24(1), 154. https://doi.org/10.1186/s12915-026-02630-7

BibTeX

@article{kong2026phasic,
author = {Kong, Qing and Wang, Tong and Jia, Jianrong},
title = {{Phasic modulation of attentional rhythmic sampling according to task demands}},
journal = {BMC biology},
year = {2026},
month = may,
volume = {24},
number = {1},
pages = {154},
publisher = {BMC},
issn = {1741-7007},
doi = {10.1186/s12915-026-02630-7},
url = {https://doi.org/10.1186/s12915-026-02630-7},
pmid = {42141460},
pmcid = {PMC13349037}
}

RIS

TY - JOUR
AU - Kong, Qing
AU - Wang, Tong
AU - Jia, Jianrong
TI - Phasic modulation of attentional rhythmic sampling according to task demands
T2 - BMC biology
J2 - BMC Biol
PY - 2026
DA - 2026/05/15
VL - 24
IS - 1
SP - 154
SN - 1741-7007
PB - BMC
DO - 10.1186/s12915-026-02630-7
UR - https://doi.org/10.1186/s12915-026-02630-7
LA - en
ER -

CSL-JSON

{
"id": "10.1186/s12915-026-02630-7",
"type": "article-journal",
"title": "Phasic modulation of attentional rhythmic sampling according to task demands",
"container-title": "BMC biology",
"author": [
{
"family": "Kong",
"given": "Qing"
},
{
"family": "Wang",
"given": "Tong"
},
{
"family": "Jia",
"given": "Jianrong"
}
],
"container-title-short": "BMC Biol",
"volume": "24",
"issue": "1",
"page": "154",
"DOI": "10.1186/s12915-026-02630-7",
"PMID": "42141460",
"PMCID": "PMC13349037",
"ISSN": "1741-7007",
"publisher": "BMC",
"URL": "https://doi.org/10.1186/s12915-026-02630-7",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
15
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1016/j.isci.2026.116240 [code]
Physical activity enhances theta-periodicity of visual attentional allocation.
Journal: iScience
In common: CircStat, Statistics and Machine Learning Toolbox, cognitive, 8 references
[2] doi:10.1038/s41598-026-50726-5
Rhythmic alternate prioritization in auditory feature-based attention.
Journal: Scientific reports
In common: cognitive, 9 references
[3] doi:10.7554/elife.108017 [code]
Visual working memory guides attention rhythmically in humans.
Journal: eLife
In common: Statistics and Machine Learning Toolbox, cognitive, 8 references
[4] doi:10.1038/s41598-026-49900-6 [code]
Global neural oscillations underlie performance variability and attentional state fluctuations in humans.
Journal: Scientific reports
In common: CircStat, FieldTrip, Statistics and Machine Learning Toolbox, cognitive, 4 references
[5] doi:10.1162/imag.a.1229 [code]
40 Hz audiovisual stimulation improves sustained attention and related brain oscillations.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: CircStat, FieldTrip, Parallel Computing Toolbox, 1 other tool, EEG, 2 references
[6] doi:10.1523/eneuro.0346-25.2026 [code]
Effects of TMS on the Decoding and Electrophysiology of Priority in Working Memory.
Journal: eNeuro
In common: CircStat, FieldTrip, Statistics and Machine Learning Toolbox, EEG, cognitive, 3 references
[7] doi:10.1038/s41467-026-70124-9 [code]
Alpha frequency shapes perceptual sensitivity by modulating optimal phase likelihood.
Journal: Nature communications
In common: CircStat, Statistics and Machine Learning Toolbox, EEG, cognitive, 3 references
[8] doi:10.1162/imag.a.1199 [code]
Sustained alpha oscillations serve attentional prioritization in working memory, not maintenance.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: CircStat, FieldTrip, Parallel Computing Toolbox, 1 other tool, EEG, cognitive, 1 reference
[9] doi:10.1371/journal.pbio.3003938 [code]
Theta oscillations tag episodic memories for sleep-dependent consolidation.
Journal: PLoS biology
In common: CircStat, FieldTrip, Statistics and Machine Learning Toolbox, EEG, cognitive, 2 references
[10] doi:10.1523/eneuro.0076-26.2026 [code]
Exogenously Driven Neural Reactivation of Spatially Matching Visual Working-Memory Contents.
Journal: eNeuro
In common: FieldTrip, Statistics and Machine Learning Toolbox, EEG, cognitive, 3 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.