OSCR

Partially Different Mechanisms of Social and Nonsocial Attention: Evidence From Changes in Cueing Effects and Underlying Frontal Cortex Processing Over Time.

Code ↔ Paper

2 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 2 matches
  1. [1] § Methods › fNIRS Data Preprocessing ↔ SOT_fnirs.m, lines 382–424 · score 0.79 · distribution repair, signal improvement, Hz, component, global, shift
  2. [2] § Methods › fNIRS Data Preprocessing ↔ SOT_fnirs.m, lines 467–540 · score 0.59 · optical density changes, Inc, rejected, fNIRS, channels, SD

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 · 621 lines · 28 KB · no license · 2 matches

  1. clear; clc
  2. % Selects and reads in the data file.
  3. Drive = 'E:\';
  4. offset = 'y'; %delete the 2nd stimuli
  5. subj_list = [19:45 47:59 61]; %subj46-SOT1 marker problem
  6. rep_list = 1;
  7. task_selection = 1; %1:SOT
  8. for task_num = task_selection;
  9. switch task_num
  10. case 1
  11. Task = 'SOT';
  12. trial_tp = 240;
  13. trial_amp = 1;
  14. nCond = 6;
  15. end
  16. %Path setup
  17. posfilename = '0001.pos';
  18. dir_file = [Drive 'From SD Card\Project_C_test_retest\'];
  19. output_dir = [Drive 'From SD Card\Matlab_C\' Task '_fNIRS_output\'];
  20. pospath = [Drive 'From SD Card\Matlab_C\PosForHomerConversion\'];
  21. % Load subject information
  22. [~,~,c] = xlsread([Drive 'From SD Card\Matlab_C\fNIRS_subj_info.xlsx']);
  23. SubjINFO_header = c(1,:);
  24. SubjINFO_data = c(2:end,:);
  25. %Transform csv to nirs
  26. for subj = subj_list
  27. Age = cell2mat(SubjINFO_data(subj,find(cellfun(@(x)isequal(x,'Age'),SubjINFO_header)==1)));
  28. CapSize = cell2mat(SubjINFO_data(subj,find(cellfun(@(x)isequal(x,'cap_size'),SubjINFO_header)==1)));
  29. Folder_name = char(SubjINFO_data(subj,find(cellfun(@(x)isequal(x,'Folder_name'),SubjINFO_header)==1)));
  30. for rep = rep_list;
  31. for probe = 1:2;
  32. Probe_num = num2str(probe);
  33. %correction for 2nd test-retest batch
  34. if subj<=43 & rep==1
  35. filename = [Task '_MES_Probe' Probe_num '.csv'];
  36. else
  37. filename = [Task num2str(rep) '_MES_Probe' Probe_num '.csv'];
  38. end
  39. if rep==2
  40. filename = [Task num2str(rep) '_MES_Probe' Probe_num '.csv'];
  41. end
  42. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  43. % Open raw data file
  44. fid = fopen([dir_file Folder_name '\' filename]);
  45. disp('Loading data...');
  46. while 1
  47. tline = fgetl(fid);
  48. if isempty(strfind(tline, 'Mode')) == 0
  49. rindex = find(tline == ',');
  50. tline(rindex) = ' ';
  51. text_array = tline(rindex(1)+1:end);
  52. end
  53. if isempty(strfind(tline, 'Wave[nm]')) == 0
  54. windex = find(tline == ',');
  55. tline(windex) = ' ';
  56. text_lambda = tline(windex(1)+1:end);
  57. wavelengths = str2num(text_lambda);
  58. end
  59. if isempty(strfind(tline, 'Sampling Period[s]')) == 0
  60. nindex = find(tline == ',');
  61. tline(nindex) = ' ';
  62. txt_fs = tline(nindex(1)+1:end);
  63. fs = 1./mean(str2num(txt_fs));
  64. end
  65. if isempty(strfind(tline, 'Data')) == 0
  66. tline = fgetl(fid);
  67. nch = length(strfind(tline, 'CH'));
  68. nindex = find(tline == ',');
  69. try
  70. col_mark = strfind(tline, 'Mark');
  71. col_mark = col_mark(1);
  72. col_mark = find(nindex == col_mark - 1) + 1;
  73. end
  74. try
  75. col_prescan = strfind(tline, 'PreScan');
  76. col_prescan = col_prescan(1);
  77. col_prescan = find(nindex == col_prescan - 1)+1;
  78. end
  79. while 1
  80. tline = fgetl(fid);
  81. if ischar(tline) == 0, break, end,
  82. nindex = find(tline == ',');
  83. tline_data = tline(nindex(1)+1:nindex(nch+1)-1);
  84. nindex_d = find(tline_data == ',');
  85. tline_data(nindex_d) = ' ';
  86. tline_data = str2num(tline_data);
  87. count = str2num(tline(1:nindex(1)-1));
  88. nirs_data.rawData(count, :) = tline_data;
  89. try
  90. vector_onset(count) = str2num(tline(nindex(col_mark-1)+1:nindex(col_mark)-1));
  91. end
  92. try
  93. baseline(count) = str2num(tline(nindex(col_prescan-1)+1:nindex(col_prescan)-1));
  94. end
  95. end
  96. break;
  97. end
  98. end
  99. disp('Data loaded... Getting more information...');
  100. % Asks if you want to remove the marker at the end of the stimulus (i.e. if you
  101. % have a block design and your stimuli are marked at both beginning and end (as
  102. % is required by the ETG4000) rather than just at the beginning (as is required
  103. % by HomER2. To hard-code this, replace the next line with offset = 'y' or 'n'.
  104. % offset = input('Do you want to remove the marker at the end of each stimulus? y/n: ','s');
  105. % Constructs the arrays that are required in the .nirs file
  106. t = transpose((0:count-1)*(1/fs));
  107. d = nirs_data.rawData;
  108. switch probe
  109. case 1
  110. d1 = d;
  111. case 2
  112. d2 = d(:,[43:48 35:42 29:34 21:28 15:20 7:14 1:6]); %Homologous channels of probe 1
  113. end
  114. SD.Lambda = transpose(wavelengths);
  115. SD.MeasList = [];
  116. end % probe end
  117. d = [d1 d2]; %Combine Probe 1 and Probe 2
  118. channel_pos = importdata(strcat(pospath,posfilename));
  119. channel_pos_tmp = char(channel_pos);
  120. text_array = '4x4';
  121. % Calculation of MeasList for two 4x4 optode arrays
  122. if strcmp('4x4', text_array)
  123. names = {'[LeftEar]','[RightEar]','[Nasion]','[Back]','[Top]',...
  124. '[Probe1-ch1]','[Probe1-ch2]','[Probe1-ch3]','[Probe1-ch4]',...
  125. '[Probe1-ch5]','[Probe1-ch6]','[Probe1-ch7]','[Probe1-ch8]',...
  126. '[Probe1-ch9]','[Probe1-ch10]','[Probe1-ch11]','[Probe1-ch12]',...
  127. '[Probe1-ch13]','[Probe1-ch14]','[Probe1-ch15]','[Probe1-ch16]',...
  128. '[Probe2-ch13]','[Probe2-ch14]','[Probe2-ch15]','[Probe2-ch16]',...
  129. '[Probe2-ch9]','[Probe2-ch10]','[Probe2-ch11]','[Probe2-ch12]',...
  130. '[Probe2-ch5]','[Probe2-ch6]','[Probe2-ch7]','[Probe2-ch8]',...
  131. '[Probe2-ch1]','[Probe2-ch2]','[Probe2-ch3]','[Probe2-ch4]'};
  132. optodes = 32;
  133. x = zeros(optodes,1);
  134. y = zeros(optodes,1);
  135. z = zeros(optodes,1);
  136. for i=1:optodes
  137. ind = find(strcmp(channel_pos,names{i+5}));
  138. x(i) = str2num(channel_pos_tmp(ind+1,3:end));
  139. y(i) = str2num(channel_pos_tmp(ind+2,3:end));
  140. z(i) = str2num(channel_pos_tmp(ind+3,3:end));
  141. end
  142. SD.SpatialUnit = 'mm';
  143. SD.nSrcs = 16;
  144. SD.nDets = 16;
  145. SD.SrcPos = [x(1), y(1), z(1); x(3), y(3), z(3); x(6), y(6), z(6); x(8), y(8), z(8);...
  146. x(9), y(9), z(9); x(11), y(11), z(11); x(14), y(14), z(14); x(16), y(16), z(16);...
  147. x(1+16), y(1+16), z(1+16); x(3+16), y(3+16), z(3+16); x(6+16), y(6+16), z(6+16); x(8+16), y(8+16), z(8+16);...
  148. x(9+16), y(9+16), z(9+16); x(11+16), y(11+16), z(11+16); x(14+16), y(14+16), z(14+16); x(16+16), y(16+16), z(16+16)];
  149. SD.DetPos = [x(2), y(2), z(2); x(4), y(4), z(4); x(5), y(5), z(5); x(7), y(7), z(7);...
  150. x(10), y(10), z(10); x(12), y(12), z(12); x(13), y(13), z(13); x(15), y(15), z(15);...
  151. x(2+16), y(2+16), z(2+16); x(4+16), y(4+16), z(4+16); x(5+16), y(5+16), z(5+16); x(7+16), y(7+16), z(7+16);...
  152. x(10+16), y(10+16), z(10+16); x(12+16), y(12+16), z(12+16); x(13+16), y(13+16), z(13+16); x(15+16), y(15+16), z(15+16)];
  153. SD.MeasList(1,:) = [1 1 1 1];
  154. SD.MeasList(2,:) = [1 1 1 2];
  155. SD.MeasList(3,:) = [2 1 1 1];
  156. SD.MeasList(4,:) = [2 1 1 2];
  157. SD.MeasList(5,:) = [2 2 1 1];
  158. SD.MeasList(6,:) = [2 2 1 2];
  159. SD.MeasList(7,:) = [1 3 1 1];
  160. SD.MeasList(8,:) = [1 3 1 2];
  161. SD.MeasList(9,:) = [3 1 1 1];
  162. SD.MeasList(10,:) = [3 1 1 2];
  163. SD.MeasList(11,:) = [2 4 1 1];
  164. SD.MeasList(12,:) = [2 4 1 2];
  165. SD.MeasList(13,:) = [4 2 1 1];
  166. SD.MeasList(14,:) = [4 2 1 2];
  167. SD.MeasList(15,:) = [3 3 1 1];
  168. SD.MeasList(16,:) = [3 3 1 2];
  169. SD.MeasList(17,:) = [3 4 1 1];
  170. SD.MeasList(18,:) = [3 4 1 2];
  171. SD.MeasList(19,:) = [4 4 1 1];
  172. SD.MeasList(20,:) = [4 4 1 2];
  173. SD.MeasList(21,:) = [5 3 1 1];
  174. SD.MeasList(22,:) = [5 3 1 2];
  175. SD.MeasList(23,:) = [3 5 1 1];
  176. SD.MeasList(24,:) = [3 5 1 2];
  177. SD.MeasList(25,:) = [6 4 1 1];
  178. SD.MeasList(26,:) = [6 4 1 2];
  179. SD.MeasList(27,:) = [4 6 1 1];
  180. SD.MeasList(28,:) = [4 6 1 2];
  181. SD.MeasList(29,:) = [5 5 1 1];
  182. SD.MeasList(30,:) = [5 5 1 2];
  183. SD.MeasList(31,:) = [6 5 1 1];
  184. SD.MeasList(32,:) = [6 5 1 2];
  185. SD.MeasList(33,:) = [6 6 1 1];
  186. SD.MeasList(34,:) = [6 6 1 2];
  187. SD.MeasList(35,:) = [5 7 1 1];
  188. SD.MeasList(36,:) = [5 7 1 2];
  189. SD.MeasList(37,:) = [7 5 1 1];
  190. SD.MeasList(38,:) = [7 5 1 2];
  191. SD.MeasList(39,:) = [6 8 1 1];
  192. SD.MeasList(40,:) = [6 8 1 2];
  193. SD.MeasList(41,:) = [8 6 1 1];
  194. SD.MeasList(42,:) = [8 6 1 2];
  195. SD.MeasList(43,:) = [7 7 1 1];
  196. SD.MeasList(44,:) = [7 7 1 2];
  197. SD.MeasList(45,:) = [7 8 1 1];
  198. SD.MeasList(46,:) = [7 8 1 2];
  199. SD.MeasList(47,:) = [8 8 1 1];
  200. SD.MeasList(48,:) = [8 8 1 2];
  201. SD.MeasList(1+48,:) = [1+8 1+8 1 1];
  202. SD.MeasList(2+48,:) = [1+8 1+8 1 2];
  203. SD.MeasList(3+48,:) = [2+8 1+8 1 1];
  204. SD.MeasList(4+48,:) = [2+8 1+8 1 2];
  205. SD.MeasList(5+48,:) = [2+8 2+8 1 1];
  206. SD.MeasList(6+48,:) = [2+8 2+8 1 2];
  207. SD.MeasList(7+48,:) = [1+8 3+8 1 1];
  208. SD.MeasList(8+48,:) = [1+8 3+8 1 2];
  209. SD.MeasList(9+48,:) = [3+8 1+8 1 1];
  210. SD.MeasList(10+48,:) = [3+8 1+8 1 2];
  211. SD.MeasList(11+48,:) = [2+8 4+8 1 1];
  212. SD.MeasList(12+48,:) = [2+8 4+8 1 2];
  213. SD.MeasList(13+48,:) = [4+8 2+8 1 1];
  214. SD.MeasList(14+48,:) = [4+8 2+8 1 2];
  215. SD.MeasList(15+48,:) = [3+8 3+8 1 1];
  216. SD.MeasList(16+48,:) = [3+8 3+8 1 2];
  217. SD.MeasList(17+48,:) = [3+8 4+8 1 1];
  218. SD.MeasList(18+48,:) = [3+8 4+8 1 2];
  219. SD.MeasList(19+48,:) = [4+8 4+8 1 1];
  220. SD.MeasList(20+48,:) = [4+8 4+8 1 2];
  221. SD.MeasList(21+48,:) = [5+8 3+8 1 1];
  222. SD.MeasList(22+48,:) = [5+8 3+8 1 2];
  223. SD.MeasList(23+48,:) = [3+8 5+8 1 1];
  224. SD.MeasList(24+48,:) = [3+8 5+8 1 2];
  225. SD.MeasList(25+48,:) = [6+8 4+8 1 1];
  226. SD.MeasList(26+48,:) = [6+8 4+8 1 2];
  227. SD.MeasList(27+48,:) = [4+8 6+8 1 1];
  228. SD.MeasList(28+48,:) = [4+8 6+8 1 2];
  229. SD.MeasList(29+48,:) = [5+8 5+8 1 1];
  230. SD.MeasList(30+48,:) = [5+8 5+8 1 2];
  231. SD.MeasList(31+48,:) = [6+8 5+8 1 1];
  232. SD.MeasList(32+48,:) = [6+8 5+8 1 2];
  233. SD.MeasList(33+48,:) = [6+8 6+8 1 1];
  234. SD.MeasList(34+48,:) = [6+8 6+8 1 2];
  235. SD.MeasList(35+48,:) = [5+8 7+8 1 1];
  236. SD.MeasList(36+48,:) = [5+8 7+8 1 2];
  237. SD.MeasList(37+48,:) = [7+8 5+8 1 1];
  238. SD.MeasList(38+48,:) = [7+8 5+8 1 2];
  239. SD.MeasList(39+48,:) = [6+8 8+8 1 1];
  240. SD.MeasList(40+48,:) = [6+8 8+8 1 2];
  241. SD.MeasList(41+48,:) = [8+8 6+8 1 1];
  242. SD.MeasList(42+48,:) = [8+8 6+8 1 2];
  243. SD.MeasList(43+48,:) = [7+8 7+8 1 1];
  244. SD.MeasList(44+48,:) = [7+8 7+8 1 2];
  245. SD.MeasList(45+48,:) = [7+8 8+8 1 1];
  246. SD.MeasList(46+48,:) = [7+8 8+8 1 2];
  247. SD.MeasList(47+48,:) = [8+8 8+8 1 1];
  248. SD.MeasList(48+48,:) = [8+8 8+8 1 2];
  249. end
  250. % Sort SD.MeasList by lambda
  251. [SD.MeasList, I] = sortrows(SD.MeasList,4); % Version 3
  252. % Re-arrange the measurement signals in the data matrix accordingly
  253. d = d(:,I); % Version 3
  254. % Trim irrelevant time points
  255. Exp_timestamp = find(vector_onset==10);
  256. t = t(Exp_timestamp(1):Exp_timestamp(2)) - t(Exp_timestamp(1));
  257. d = d(Exp_timestamp(1):Exp_timestamp(2),:);
  258. vector_onset = vector_onset(Exp_timestamp(1):Exp_timestamp(2));
  259. count = length(t);
  260. % Reading vector of stimulus markers and arranging this into the format
  261. % required by Homer2 and storing in the variable "aux"
  262. markertimes = [find(vector_onset>0) find(vector_onset<0)];
  263. markers = vector_onset(markertimes);
  264. unique_markers = unique(markers);
  265. aux = zeros(count, length(unique_markers));
  266. for stimuli=1:length(unique_markers)
  267. if offset == 'y' || offset == 'Y' % Version 3
  268. stim_on_off = find(vector_onset==(unique_markers(stimuli))); % Version 3
  269. stim_markers = stim_on_off(1:2:length(stim_on_off)-1); % Version 3
  270. aux(stim_markers,stimuli) = 1; % Version 3
  271. else % Version 3
  272. stim_markers = find(vector_onset==(unique_markers(stimuli)));
  273. aux(stim_markers,stimuli) = 1;
  274. end % Version 3
  275. end
  276. ml = SD.MeasList;
  277. % As the stimulus markers are stored in "aux", the stimulus matrix "s" still
  278. % needs to be created. This is set to zeroes for now.
  279. s = zeros(size(t));
  280. % Add all task conditions
  281. switch Task
  282. case 'SOT'
  283. [row col] = find(aux(:,1:6)==1);
  284. case 'NBT'
  285. [row col] = find(aux(:,1:4)==1);
  286. case 'FMT'
  287. [row col] = find(aux(:,1:3)==1);
  288. end
  289. aux(row,end+1)=1;
  290. % Finished rearranging information...
  291. disp('I have all the information I need... Saving...');
  292. save(strcat(output_dir,['C' num2str(subj,'%03d')],'_',Task,'_run',num2str(rep),'.nirs')...
  293. ,'t', 'd', 'SD', 's', 'ml', 'aux');
  294. disp('Done!');
  295. save(strcat(output_dir,['C' num2str(subj,'%03d')],'_',Task,'_run',num2str(rep),'.mat')...
  296. ,'t', 'd', 'SD', 's', 'ml', 'aux','vector_onset','Age','CapSize','output_dir');
  297. %Condition setup
  298. snirf = SnirfClass(load(strcat(output_dir,['C' num2str(subj,'%03d')],'_',Task,'_run',num2str(rep),'.nirs'),'-mat'));
  299. %Create StimClass from aux
  300. for i = 1:nCond
  301. Cond{i}.idx = find(snirf.aux(i).dataTimeSeries==1);
  302. Cond{i}.tp =zeros(length(snirf.data.dataTimeSeries),1);
  303. Cond{i}.tp(Cond{i}.idx)=1;
  304. Cond{i}.dur = repmat(round(trial_tp/fs),length(Cond{i}.idx),1);
  305. Cond{i}.amp = repmat(trial_amp,length(Cond{i}.idx),1);
  306. % stim{i} = Cond{i}.idx;
  307. obj = StimClass();
  308. obj.data = [find(Cond{i}.tp>0)/fs repmat(trial_tp,length(find(Cond{i}.tp>0)),1)/fs repmat(1,length(find(Cond{i}.tp>0)),1)];
  309. obj.states = [find(Cond{i}.tp>0)/fs repmat(1,length(find(Cond{i}.tp>0)),1)];
  310. obj.name =['Cond' num2str(i)];
  311. snirf.stim(i) = obj;
  312. % stimRuns(:,i) = Cond{i}.tp
  313. end
  314. if strcmp(Task,'SOT')
  315. for i = 4:6
  316. snirf.stim(i).data(:,2)= 1/fs;
  317. end
  318. blk_markers_pre = markers(markers>1 & markers<4);
  319. blk_markers= blk_markers_pre(1:2:end);
  320. Nonsoc_valid = [];
  321. Nonsoc_invalid = [];
  322. Soc_valid = [];
  323. Soc_invalid = [];
  324. aaa = find(blk_markers==2);
  325. for i = aaa
  326. Nonsoc_valid = [Nonsoc_valid;snirf.stim(5).data((i-1)*6+1:(i-1)*6+6,:)];
  327. Nonsoc_invalid = [Nonsoc_invalid;snirf.stim(6).data((i-1)*6+1:(i-1)*6+6,:)];
  328. end
  329. bbb = find(blk_markers==3);
  330. for i = bbb
  331. Soc_valid = [Soc_valid;snirf.stim(5).data((i-1)*6+1:(i-1)*6+6,:)];
  332. Soc_invalid = [Soc_invalid;snirf.stim(6).data((i-1)*6+1:(i-1)*6+6,:)];
  333. end
  334. snirf.stim(7).data = Nonsoc_valid; snirf.stim(7).states = Nonsoc_valid(:,[1 3]); snirf.stim(7).name = 'Nonsoc_valid';
  335. snirf.stim(8).data = Nonsoc_invalid; snirf.stim(8).states = Nonsoc_invalid(:,[1 3]); snirf.stim(8).name = 'Nonsoc_invalid';
  336. snirf.stim(9).data = Soc_valid; snirf.stim(9).states = Soc_valid(:,[1 3]); snirf.stim(9).name = 'Soc_valid';
  337. snirf.stim(10).data = Soc_invalid; snirf.stim(10).states = Soc_valid(:,[1 3]); snirf.stim(10).name = 'Soc_invalid';
  338. end
  339. %convert from .nirs to .snirf
  340. snirf.Save(strcat(output_dir,['C' num2str(subj,'%03d')],'_',Task,'_run',num2str(rep),'.snirf'));
  341. end %rep end
  342. ['Subj ' num2str(subj) ' - completed']
  343. end %subj end
  344. %Channel locations corrected for Probe 2; d:ch1-24(695nm); ch25-48(830nm)
  345. end %task end
  346. %% Preprocessing
  347. clear; clc;
  348. % Selects and reads in the data file.
  349. Drive = 'E:\';
  350. fs = 10; % sampling rate (Hz)
  351. age_correction = 1; %Correct DPF for the subject's age
  352. MAmp_criterion = [0 4.9];%OD
  353. SNR_criterion = [20 65]; %db
  354. glm = 1;
  355. TDDR = 1; %Temporal Deriative Distribution Repair
  356. PCA = 1;nSV_option= 1; %PCA to remove the global spatial covariance. nSV = no. of components to remove
  357. Freqfilt = 1;Freqfilt_freq = [0.005 0.5];
  358. CBSI = 0; %Correlation-Based Signal Improvement
  359. fNIRS_idx = 1; %1:HbO; 2:HbR: 3:HbT
  360. plot_OD = 0;
  361. task_num = 1; %1:SOT
  362. subj_list = [1:17 19:45 47:59 61];
  363. rep_list = 1;
  364. for task_num = task_num;
  365. switch task_num
  366. case 1
  367. Task = 'SOT';
  368. er_flag = 1; %1: event-related (use stim 7-10)
  369. target_flag = 1; %1: shift from cue onset to target onset
  370. max_rep = 1;
  371. Task_duration = 24;
  372. Pretask_bsline = 2;
  373. Posttask_plot = 10;
  374. Pretask_lag = 0;
  375. Posttask_lag = 0;
  376. linearfit = 0; %0:no; 1:yes;
  377. TaskBlk_marker = [1];%1-3)Congruent and no,Center,SpatualCue; 4-6)Incongruent and no,Center,SpatualCue
  378. c_vector = [1/3 1/3 1/3];
  379. end
  380. %Path setup
  381. posfilename = '0001.pos';
  382. dir_file = [Drive 'From SD Card\'];
  383. output_dir = [Drive 'From SD Card\Matlab_C\' Task '_fNIRS_output\'];
  384. pospath = [Drive 'From SD Card\Matlab_C\PosForHomerConversion\'];
  385. % Load subject information
  386. [~,~,c] = xlsread([Drive 'From SD Card\Matlab_C\fNIRS_subj_info.xlsx']);
  387. SubjINFO_header = c(1,:);
  388. SubjINFO_data = c(2:end,:);
  389. %Transform csv to nirs
  390. for subj = subj_list
  391. Age = cell2mat(SubjINFO_data(subj,find(cellfun(@(x)isequal(x,'Age'),SubjINFO_header)==1)));
  392. CapSize = cell2mat(SubjINFO_data(subj,find(cellfun(@(x)isequal(x,'cap_size'),SubjINFO_header)==1)));
  393. Folder_name = char(SubjINFO_data(subj,find(cellfun(@(x)isequal(x,'Folder_name'),SubjINFO_header)==1)));
  394. for rep = rep_list;
  395. output_dir = [Drive 'From SD Card\Matlab_C\' Task '_fNIRS_output\'];
  396. snirf = SnirfClass(strcat(output_dir,['C' num2str(subj,'%03d')],'_',Task,'_run' ,num2str(rep) ,'.snirf'));
  397. data_d = snirf.data;
  398. probe = snirf.probe;
  399. %Channel rejection
  400. mlActAuto = hmrR_PruneChannels_MKY(data_d, probe, [], [], MAmp_criterion, SNR_criterion, [0 99]); %function modified to use SNR in decibels
  401. SD.MeasListAct = mlActAuto{1}(:,3); %for TDDR
  402. %Convert d to dod
  403. d = hmrR_PreprocessIntensity_Negative_MKY(data_d, 'OPTION1: Add a dc offset'); %Automatic selection of Option 1
  404. data_dod = hmrR_Intensity2OD(data_d);
  405. %TDDR motion correction
  406. if TDDR==1
  407. dod = hmrMotionCorrectTDDR(data_dod.GetDataTimeSeries,SD,fs);
  408. data_dod.SetDataTimeSeries(dod);
  409. end
  410. %PCA systemic correction
  411. if PCA==1
  412. [data_dod, svs, nSV] = hmrR_PCAFilter(data_dod, mlActAuto, [],nSV_option);
  413. end
  414. % frequency filtering
  415. if Freqfilt ==1
  416. data_dod = hmrR_BandpassFilt(data_dod, Freqfilt_freq(1) , Freqfilt_freq(2))
  417. end
  418. % From optical density changes to [oxy-Hb] and [deoxy-Hb] changes
  419. %NaN for rejected channels
  420. data_dod.dataTimeSeries(:,find(cell2mat(mlActAuto)==0))=NaN;
  421. %Conversion from dod to dc
  422. switch CapSize
  423. case 54, rho = 29;
  424. case 56, rho = 30;
  425. case 58, rho = 31;
  426. end
  427. % General equation from Scholkmann and Wolf (2013) in the Journal of Biomedical Optics
  428. %recommended for the age of 0-70 years and for the wavelength of 690-832 nm
  429. if age_correction ==1
  430. lambda=probe.wavelengths;
  431. for i = 1:length(lambda)
  432. DPF(i) = 223.3 + 0.05624*(Age^0.8493)-(5.723*10^-7)*(lambda(i)^3)+0.001245*(lambda(i)^2)-0.9025*lambda(i);
  433. end
  434. else
  435. DPF(1:length(lambda)) = 1;
  436. end
  437. ppf = DPF;
  438. data_dc = hmrR_OD2Conc_Hitachi_EASYCAP(data_dod, probe, ppf, rho);
  439. % CBSI
  440. if CBSI ==1;
  441. data_dc = hmrR_MotionCorrectCbsi(data_dc,mlActAuto);
  442. end
  443. %glm
  444. if glm ==1;
  445. data_y = data_dc;
  446. stim = snirf.stim;
  447. if task_num==1
  448. if er_flag
  449. stim = snirf.stim([4 7:10]);
  450. for i = 1:length(stim)
  451. stim(i).data(:,1) = stim(i).data(:,1)+0.3; stim(i).states(:,1) = stim(i).data(:,1)+0.3;% 300ms SOA
  452. end
  453. else
  454. stim = snirf.stim(1:3);
  455. end
  456. end
  457. switch task_num
  458. case {1}
  459. trange = [0, 32];
  460. end
  461. Aaux = [];
  462. tIncAuto =[];
  463. mlActAuto = mlActAuto;
  464. rcMap =[];
  465. glmSolveMethod= 1;
  466. idxBasis= 5; %1: consecutive sequence of guassian functions; 2: modified gamma; 5: canonical hrf from spm
  467. paramsBasis= []; %idxBasis2_default:[0.1 3.0 1.8 3.0]
  468. rhoSD_ssThresh= 0;
  469. flagNuisanceRMethod= 0;
  470. driftOrder= 0;
  471. [data_yavg, data_yavgstd, nTrials, data_ynew, data_yresid, data_ysum2, beta_blks, yR_blks, hmrstats] = ...
  472. hmrR_GLM_MKY(data_y, stim, probe, mlActAuto, Aaux, tIncAuto, rcMap, trange, glmSolveMethod, ...
  473. idxBasis, paramsBasis, rhoSD_ssThresh, flagNuisanceRMethod, driftOrder, c_vector, fs);
  474. if idxBasis ==1
  475. beta_master(:,:,:,rep,subj) = squeeze(mean(cell2mat(beta_blks),1));%idx, ch, cond, rep, subj
  476. else
  477. beta_master(:,:,:,rep,subj) = squeeze(cell2mat(beta_blks)); %idx, ch, cond, rep, subj
  478. end
  479. % set bad channels to NaN
  480. beta_master(:,mlActAuto{1}(1:48,3)==0,:,rep,subj) = NaN;
  481. beta_master(:,mlActAuto{1}(49:96,3)==0,:,rep,subj) = NaN;
  482. bad_ch_list = mlActAuto{1}(1:48,3)==0 |mlActAuto{1}(49:96,3)==0;
  483. BadChannel_N(:,subj) = sum(bad_ch_list);
  484. end% end GLM
  485. %Homer block averaging
  486. stim = snirf.stim;
  487. if task_num==1
  488. if er_flag
  489. stim = snirf.stim([4 7:10]);
  490. for i = 1:length(stim)
  491. stim(i).data(:,1) = stim(i).data(:,1)+0.3; stim(i).states(:,1) = stim(i).states(:,1)+0.3;% 300ms SOA
  492. end
  493. else
  494. stim = snirf.stim(1:3);
  495. end
  496. end
  497. % set bad channels to NaN
  498. fNIRS_master(:,bad_ch_list,:,:,:,subj) = NaN;
  499. clearvars dc
  500. end % rep end
  501. ['Preprocessing for ' num2str(subj) ' completed']
  502. end % subj end
  503. %correct output_dir
  504. output_dir = [Drive 'From SD Card\Matlab_C\' Task '_fNIRS_output\'];
  505. end % task end
  506. fNIRS_master_M = squeeze(mean(nanmean(fNIRS_master((Pretask_bsline+Pretask_lag)*fs+1:...
  507. (Pretask_bsline+Task_duration+Posttask_lag)*fs+1,:,:,fNIRS_idx,:,:),5))); %tp ch cond idx rep subj
  508. %BA Tal
  509. %unilateral
  510. ROI_config = {[1 4 8 11] [2 3 6 7 9 10 13] [5 12 15 16 20] [18 19 22 23] [14 17 21 24]...
  511. [25 28 32 35] [26 27 30 31 33 34 37] [29 36 39 40 44] [42 43 46 47] [38 41 45 48]};
  512. for i = 1:length(ROI_config)
  513. fNIRS_master_M_cluster(i,:,:) = squeeze(nanmean(fNIRS_master_M(ROI_config{i},:,:),1));
  514. end
  515. if glm==1
  516. Master_glm_beta = squeeze(nanmean(beta_master(fNIRS_idx,:,:,rep,:),4));
  517. for i = 1:length(ROI_config)
  518. fNIRS_master_M_beta_cluster(i,:,:) = squeeze(nanmean(Master_glm_beta(ROI_config{i},:,:),1));
  519. end
  520. end
  521. fNIRS_master_plot = squeeze(mean(nanmean(fNIRS_master(:,:,TaskBlk_marker,fNIRS_idx,:,:),4),3));
  522. ['Preprocessing for ' Task ' completed']
  523. %% SOT GLM - Export cluster-level beta values
  524. LR_combine =0;
  525. NROI = 5;
  526. filename = [output_dir 'SOT_output7.xlsx'];
  527. delete(filename)
  528. clear beta_export
  529. beta_export_pre = reshape(fNIRS_master_M_beta_cluster,[size(fNIRS_master_M_beta_cluster,1)*size(fNIRS_master_M_beta_cluster,2) ...
  530. size(fNIRS_master_M_beta_cluster,3)])'*10^6;
  531. %left and right combined
  532. if LR_combine==1
  533. for m = 1:3 %number of conditions
  534. for n = 1:NROI %no. of ROIs in each hemisphere
  535. beta_export(:,n+(m-1)*NROI) = mean(beta_export_pre(:,[n n+NROI]+(m-1)*(NROI*2)),2);
  536. end
  537. end
  538. else
  539. beta_export = beta_export_pre;
  540. end
  541. for i = 1:size(beta_export,1)
  542. for j = 1:size(beta_export,2)
  543. if beta_export(i,j)==0
  544. beta_export(i,j)= NaN;
  545. end
  546. end
  547. end
  548. writematrix([[1:subj]' beta_export BadChannel_N'], filename);
  549. winopen(filename)

SOT_fnirs.m, no license · at the source

Overview

  1. Department of Psychology The Education University of Hong Kong Hong Kong SAR China
  2. University Research Facility of Human Behavioral Neuroscience The Education University of Hong Kong Hong Kong SAR China
  3. Centre for Psychosocial Health The Education University of Hong Kong Hong Kong SAR China
  4. Department of Rehabilitation Sciences The Hong Kong Polytechnic University Hung Hom Hong Kong SAR China
  5. University Research Facility in Behavioral and Systems Neuroscience The Hong Kong Polytechnic University Hung Hom Hong Kong SAR China
Institutions: Education University of Hong Kong (Hong Kong SAR China); Hong Kong Polytechnic University (Hong Kong SAR China)
Journal: Psychophysiology, volume 63, issue 4, article e70286
Dates: received 11 October 2025; accepted 16 March 2026; published online 25 March 2026; in print April 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1111/psyp.70286 · PMID 41882980 · PMCID PMC13018724 · OpenAlex W7140368631
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: fNIRS (modality), human (organism), cognitive (subfield)
Methods: Spectral & time-frequency, Statistics, Smoothing, state filtering, decompositions, fMRI & imaging
Keywords: alerting, fNIRS, gaze, orienting, prefrontal cortex, social attention
MeSH: Attention*, Cues*, Frontal Lobe*, Psychomotor Performance*, Adult, Female, Fixation, Ocular, Humans, Male, Reaction Time, Spectroscopy, Near-Infrared, Young Adult (* major topic)
Topic: Face Recognition and Perception (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 56 references in the paper

Abstract

Gaze conveys important information about one's intentions and likely object of reference. Because processes of attention may change over time, for reasons including fatigue or experience, this study aimed to compare mechanisms of gaze and arrow cueing effects by measuring across sessions. On two separate occasions, 39 young adults underwent a cueing paradigm with valid or invalid gaze or arrow cues, as well as neutral cues. Activation in frontal cortex regions implicated in the dorsal and ventral attention networks was examined during task performance using functional near‐infrared spectroscopy. Behavioral results showed comparable orienting (valid vs. neutral) and reorienting (invalid vs. valid) responses following gaze and arrow cues, which did not significantly change over sessions. However, the gaze cue elicited a significantly greater alerting effect (i.e., more benefits from the presence of the cue on reaction time) than the arrow cue in Session 2. Parallel to these behavioral findings, neuroimaging results indicated robust (de‐)activation during orienting and reorienting. Aligning with the greater alerting effect, target detection elicited significantly greater activation in the left posterior dorsomedial frontal cortex following gaze cues as opposed to arrow cues in Session 2. Therefore, insofar as changes over time are concerned, our findings offer converging evidence that gaze and arrow cues follow partially different attentional and neural mechanisms.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

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

OSF p7cx4

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Languages: MATLAB (2)
Size: 106 files, 2 scripts
Software Heritage: not checked
Found in: “Data Availability Statement”
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 (HTTP 200)
  • 28 September 2026: the link answers (HTTP 200)
2 files
At the source: osf.io/p7cx4

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;
  • 2 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

No dataset and no data link were found in the paper.

Data Availability Statement

The dataset and data processing scripts that form the basis of the results are available on OSF (https://osf.io/p7cx4).

Reproduced under the paper's license (CC BY), from the paper cited above.

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 2, 28 September 2026

  • Publisher: n/a → Wiley

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 2 authors, 6 keywords, 12 MeSH terms, 55 references.

Cite

This paper

Yeung, M. K., & Han, Y. M. Y. (2026). Partially Different Mechanisms of Social and Nonsocial Attention: Evidence From Changes in Cueing Effects and Underlying Frontal Cortex Processing Over Time. Psychophysiology, 63(4), e70286. https://doi.org/10.1111/psyp.70286

BibTeX

@article{yeung2026partially,
author = {Yeung, Michael K. and Han, Yvonne M. Y.},
title = {{Partially Different Mechanisms of Social and Nonsocial Attention: Evidence From Changes in Cueing Effects and Underlying Frontal Cortex Processing Over Time}},
journal = {Psychophysiology},
year = {2026},
month = apr,
volume = {63},
number = {4},
pages = {e70286},
publisher = {Wiley},
issn = {0048-5772},
doi = {10.1111/psyp.70286},
url = {https://doi.org/10.1111/psyp.70286},
pmid = {41882980},
pmcid = {PMC13018724}
}

RIS

TY - JOUR
AU - Yeung, Michael K.
AU - Han, Yvonne M. Y.
TI - Partially Different Mechanisms of Social and Nonsocial Attention: Evidence From Changes in Cueing Effects and Underlying Frontal Cortex Processing Over Time
T2 - Psychophysiology
J2 - Psychophysiology
PY - 2026
DA - 2026/04/01
VL - 63
IS - 4
SP - e70286
SN - 0048-5772
PB - Wiley
DO - 10.1111/psyp.70286
UR - https://doi.org/10.1111/psyp.70286
LA - en
ER -

CSL-JSON

{
"id": "10.1111/psyp.70286",
"type": "article-journal",
"title": "Partially Different Mechanisms of Social and Nonsocial Attention: Evidence From Changes in Cueing Effects and Underlying Frontal Cortex Processing Over Time",
"container-title": "Psychophysiology",
"author": [
{
"family": "Yeung",
"given": "Michael K."
},
{
"family": "Han",
"given": "Yvonne M. Y."
}
],
"container-title-short": "Psychophysiology",
"volume": "63",
"issue": "4",
"page": "e70286",
"DOI": "10.1111/psyp.70286",
"PMID": "41882980",
"PMCID": "PMC13018724",
"ISSN": "0048-5772",
"publisher": "Wiley",
"URL": "https://doi.org/10.1111/psyp.70286",
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
1
]
]
}
}

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.1117/1.nph.12.2.025011 [code]
NIRSTORM: a Brainstorm extension dedicated to functional near-infrared spectroscopy data analysis, advanced 3D reconstructions, and optimal probe design
Journal: n/a
In common: Statistics and Machine Learning Toolbox, fNIRS, 4 references
[2] doi:10.1117/1.nph.13.3.035009
Single-subject detection of speech network activation using functional near-infrared spectroscopy.
Journal: Neurophotonics
In common: fNIRS, cognitive, 4 references
[3] doi:10.1038/s41598-026-50540-z [code]
Addressing arbitrary choices of frequency band of interest in fNIRS hyperscanning.
Journal: Scientific reports
In common: Statistics and Machine Learning Toolbox, fNIRS, 3 references
[4] doi:10.1111/desc.70188
Contextual Transparency Supports Cognitive Control by Reducing Prefrontal Activation and Enhancing Cue Prioritization in Children.
Journal: Developmental science
In common: fNIRS, cognitive, 3 references
[5] doi:10.1016/j.nicl.2026.104019 [code]
Stress-related hypofrontality in depression and its relation to altered activation prior to the stress response.
Journal: NeuroImage. Clinical
In common: Statistics and Machine Learning Toolbox, 3 references
[6] doi:10.1016/j.isci.2026.116287 [code]
Neural selectivity for social interactions in the infant brain.
Journal: iScience
In common: 4 references
[7] doi:10.1117/1.nph.13.3.035006 [code]
Characterizing developmental changes in infant habituation using functional change point detection.
Journal: Neurophotonics
In common: fNIRS, 3 references
[8] doi:10.1364/boe.604286
Computational validation of optical adaptive depth steering for continuous-wave fNIRS.
Journal: Biomedical optics express
In common: fNIRS, 3 references
[9] doi:10.1117/1.nph.13.s3.s32602 [code]
Cedalion tutorial: a Python-based framework for comprehensive analysis of multimodal fNIRS and DOT from the lab to the everyday world.
Journal: Neurophotonics
In common: fNIRS, 3 references
[10] doi:10.1162/imag.a.1208 [code]
Brain network analysis in Alzheimer's disease and mild cognitive impairment using high-density diffuse optical tomography.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: Statistics and Machine Learning Toolbox, fNIRS, 2 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.