OSCR

Neural encoding of pain is robust within but unstable between individuals.

Code ↔ Paper

12 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 12 matches
  1. [1] § Methods › Extracting EEG responses › Individual-level responses. ↔ statistical_analysis/plot_results_GAs.m, lines 47–65 · score 0.95 · 150–350 ms, 300–600 ms, 500–900 ms, 7–12 Hz, 14–30 Hz, 70–90 Hz
  2. [2] § Methods › Statistical analyses › Models of inter-individual variability. ↔ statistical_analysis/varPain_StatisticalAnalysis_INTER.R, lines 101–151 · score 0.70 · inter individual variability, Bayes factors, pain rating, regression, N2, N1
  3. [3] § Methods › Statistical analyses › Models of inter-individual variability. ↔ statistical_analysis/varPain_StatisticalAnalyses_INTRA_D2D.R, lines 91–140 · score 0.70 · inter individual variability, Bayes factors, pain rating, regression, N2, N1
  4. [4] § Methods › Extracting EEG responses › Individual-level responses. ↔ statistical_analysis/plot_results_GAs.m, lines 47–65 · score 0.68 · 14–30 Hz, 70–90 Hz, FieldTrip, 14 Hz, 70 Hz, beta
  5. [5] § Methods › Noxious stimulation ↔ paradigm/varPain_familiarization_laser.m, lines 120–156 · score 0.68 · spot diameter, pulse duration, stimulation intensities, laser, stimuli, Pain
  6. [6] § Methods › Noxious stimulation ↔ paradigm/varPain_Paradigm_IntensityRating.m, lines 298–349 · score 0.67 · spot diameter, stimulation intensities, pulse duration, laser, Pain
  7. [7] § Methods › Statistical analyses › Models of intra-individual variability. ↔ statistical_analysis/varPain_StatisticalAnalyses_INTRA_D2D.R, lines 91–140 · score 0.60 · bayesFactor, inter individual variability, pain rating, N2, N1, beta
  8. [8] § Methods › Statistical analyses › Models of intra-individual variability. ↔ statistical_analysis/varPain_StatisticalAnalyses_INTRA_M2M.R, lines 94–143 · score 0.60 · bayesFactor, inter individual variability, pain rating, N2, N1, beta
  9. [9] § Methods › Statistical analyses › Inference criteria. ↔ statistical_analysis/varPain_StatisticalAnalysis_INTER.R, lines 101–151 · score 0.57 · model fitting, inter individual variability, sex, age, posterior, BF
  10. [10] § Methods › Procedure and paradigm ↔ paradigm/varPain_Paradigm_IntensityRating.m, lines 434–546 · score 0.57 · pain paradigm, laser stimuli, prompted, sounds, intensities, EEG
  11. [11] § Methods › External replication data ↔ paradigm/varPain_familiarization_laser.m, lines 120–156 · score 0.56 · spot diameter, pulse duration, stimulation, laser, stimuli
  12. [12] § Methods › External replication data ↔ paradigm/varPain_Paradigm_IntensityRating.m, lines 298–349 · score 0.55 · spot diameter, pulse duration, stimulation, laser

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 · 546 lines · 20 KB · no license · 3 matches

  1. % before starting of this function:
  2. % 1. execute this line to open the serial port:
  3. % [spHandle, errmsg] = IOPort('OpenSerialPort', 'COM2');
  4. % 2. set laser from "panel" to "serial" on the laser's touchpad
  5. % establish handshake with laser by executing this line:
  6. % IOPort('Write', spHandle, uint8([204,080,000,000,000,185]));
  7. % in case you need to repeat the procedure, close serial port first by executing this line:
  8. % IOPort('Close', spHandle)
  9. function ME = varPain_Paradigm_IntensityRating()
  10. %% adjust parameters before each session %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  11. subject_ID = 'vp00';
  12. intens_1 = 2.5;
  13. intens_2 = 3.0;
  14. intens_3 = 3.5
  15. intens_4 = 4.0
  16. number_trials = 80;
  17. withTraining = true;
  18. number_test_trials = 3;
  19. % number_trials_block1 = 20;
  20. % number_trials_block2 = 20;
  21. % number_trials_block3 = 20;
  22. % number_trials_block4 = 20;
  23. % LASER parameters (fixed for experiment)
  24. Energy_1 = 4*(intens_1) - 1; % energy of the laser pulse in J (range: 1 - 59); E = 4*(energy in J) - 1
  25. Energy_2 = 4*(intens_2) - 1;
  26. Energy_3 = 4*(intens_3) - 1;
  27. Energy_4 = 4*(intens_4) - 1;
  28. pulseDuration = 3; % = 4ms; duration of the laser pulse in ms (range: 0 - 19); pulseDuration = pulse duration in ms - 1)
  29. spotDiameter = 3; % = 7mm; spot size of the laser pulse in mm (range: 0 - 11); spotDiameter = spot size in mm - 4
  30. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  31. close all
  32. % clear all
  33. % delete(instrfindall);
  34. % Screen('CloseAll');
  35. % clear ports
  36. % delete(instrfindall); % clear objects in ports
  37. % IOPort('CloseAll')
  38. % lptwrite(888,192); % set port with active 6th and 7th bit (response box)
  39. %% set isi
  40. isi = [1.0,5.0]; % random ISI between these two values (in seconds), specify as 7 seconds less as desired ISI because of the additional WaitSecs(3). to the beep, and additional WaitSecs(4). before applying the laser
  41. isi = isi(1) + (isi(2)-isi(1)).*rand(1,number_trials);
  42. isi = round(isi*10)/10;
  43. %% generate, randomize, and save matrix with stimulation intensities
  44. % save matrix with stimulation intensities
  45. max_num_same_intens = 2; % Number of identical elements who are allowed to follow after one another in the stim-sequence
  46. % for four stimulation intensities
  47. % block 1
  48. flag = 1;
  49. count = 0;
  50. while flag == 1
  51. % Randomisation
  52. stim_sequence1 = [repmat(intens_1,1,(number_trials/4)/4),repmat(intens_2,1,(number_trials/4)/4),repmat(intens_3,1,(number_trials/4)/4),repmat(intens_4,1,(number_trials/4)/4)];
  53. stim_sequence1 = stim_sequence1(randperm(numel(stim_sequence1)));
  54. % Create Matrix with 0 and 1 for 1, 2, 3, and 4_intens
  55. log_intens_1 = stim_sequence1 == intens_1;
  56. log_intens_2 = stim_sequence1 == intens_2;
  57. log_intens_3 = stim_sequence1 == intens_3;
  58. log_intens_4 = stim_sequence1 == intens_4;
  59. % sum consecutive elements in the 0/1 vector for 1, 2, 3, and 4_intens
  60. for i = 1:length(stim_sequence1)-max_num_same_intens
  61. sum_1_quad = sum(log_intens_1(1,i:i+max_num_same_intens));
  62. sum_2_quad = sum(log_intens_2(1,i:i+max_num_same_intens));
  63. sum_3_quad = sum(log_intens_3(1,i:i+max_num_same_intens));
  64. sum_4_quad = sum(log_intens_4(1,i:i+max_num_same_intens));
  65. % randomize until no sum is larger than max_num_same_intens
  66. if sum_1_quad == max_num_same_intens+1 || sum_2_quad == max_num_same_intens+1 || sum_3_quad == max_num_same_intens+1 || sum_4_quad == max_num_same_intens+1
  67. flag = 1;
  68. break
  69. else flag = 0;
  70. end
  71. end
  72. count = count + 1;
  73. end
  74. % block 2
  75. flag = 1;
  76. count = 0;
  77. while flag == 1
  78. % Randomisation
  79. stim_sequence2 = [repmat(intens_1,1,(number_trials/4)/4),repmat(intens_2,1,(number_trials/4)/4),repmat(intens_3,1,(number_trials/4)/4),repmat(intens_4,1,(number_trials/4)/4)];
  80. stim_sequence2 = stim_sequence2(randperm(numel(stim_sequence2)));
  81. % Create Matrix with 0 and 1 for 1, 2, 3, and 4_intens
  82. log_intens_1 = stim_sequence2 == intens_1;
  83. log_intens_2 = stim_sequence2 == intens_2;
  84. log_intens_3 = stim_sequence2 == intens_3;
  85. log_intens_4 = stim_sequence2 == intens_4;
  86. % sum consecutive elements in the 0/1 vector for 1, 2, 3, and 4_intens
  87. for i = 1:length(stim_sequence2)-max_num_same_intens
  88. sum_1_quad = sum(log_intens_1(1,i:i+max_num_same_intens));
  89. sum_2_quad = sum(log_intens_2(1,i:i+max_num_same_intens));
  90. sum_3_quad = sum(log_intens_3(1,i:i+max_num_same_intens));
  91. sum_4_quad = sum(log_intens_4(1,i:i+max_num_same_intens));
  92. % randomize until no sum is larger than max_num_same_intens
  93. if sum_1_quad == max_num_same_intens+1 || sum_2_quad == max_num_same_intens+1 || sum_3_quad == max_num_same_intens+1 || sum_4_quad == max_num_same_intens+1 || stim_sequence1(1,number_trials/4) == stim_sequence2(1,1)
  94. flag = 1;
  95. break
  96. else flag = 0;
  97. end
  98. end
  99. count = count + 1;
  100. end
  101. stim_sequence = [stim_sequence1, stim_sequence2];
  102. % block 3
  103. flag = 1;
  104. count = 0;
  105. while flag == 1
  106. % Randomisation
  107. stim_sequence3 = [repmat(intens_1,1,(number_trials/4)/4),repmat(intens_2,1,(number_trials/4)/4),repmat(intens_3,1,(number_trials/4)/4),repmat(intens_4,1,(number_trials/4)/4)];
  108. stim_sequence3 = stim_sequence3(randperm(numel(stim_sequence3)));
  109. % Create Matrix with 0 and 1 for 1, 2, 3, and 4_intens
  110. log_intens_1 = stim_sequence3 == intens_1;
  111. log_intens_2 = stim_sequence3 == intens_2;
  112. log_intens_3 = stim_sequence3 == intens_3;
  113. log_intens_4 = stim_sequence3 == intens_4;
  114. % sum consecutive elements in the 0/1 vector for 1, 2, 3, and 4_intens
  115. for i = 1:length(stim_sequence3)-max_num_same_intens
  116. sum_1_quad = sum(log_intens_1(1,i:i+max_num_same_intens));
  117. sum_2_quad = sum(log_intens_2(1,i:i+max_num_same_intens));
  118. sum_3_quad = sum(log_intens_3(1,i:i+max_num_same_intens));
  119. sum_4_quad = sum(log_intens_4(1,i:i+max_num_same_intens));
  120. % randomize until no sum is larger than max_num_same_intens
  121. if sum_1_quad == max_num_same_intens+1 || sum_2_quad == max_num_same_intens+1 || sum_3_quad == max_num_same_intens+1 || sum_4_quad == max_num_same_intens+1
  122. flag = 1;
  123. break
  124. else flag = 0;
  125. end
  126. end
  127. count = count + 1;
  128. end
  129. stim_sequence = [stim_sequence1, stim_sequence2, stim_sequence3];
  130. % block 4
  131. flag = 1;
  132. count = 0;
  133. while flag == 1
  134. % Randomisation
  135. stim_sequence4 = [repmat(intens_1,1,(number_trials/4)/4),repmat(intens_2,1,(number_trials/4)/4),repmat(intens_3,1,(number_trials/4)/4),repmat(intens_4,1,(number_trials/4)/4)];
  136. stim_sequence4 = stim_sequence4(randperm(numel(stim_sequence4)));
  137. % Create Matrix with 0 and 1 for 1, 2, 3, and 4_intens
  138. log_intens_1 = stim_sequence4 == intens_1;
  139. log_intens_2 = stim_sequence4 == intens_2;
  140. log_intens_3 = stim_sequence4 == intens_3;
  141. log_intens_4 = stim_sequence4 == intens_4;
  142. % sum consecutive elements in the 0/1 vector for 1, 2, 3, and 4_intens
  143. for i = 1:length(stim_sequence4)-max_num_same_intens
  144. sum_1_quad = sum(log_intens_1(1,i:i+max_num_same_intens));
  145. sum_2_quad = sum(log_intens_2(1,i:i+max_num_same_intens));
  146. sum_3_quad = sum(log_intens_3(1,i:i+max_num_same_intens));
  147. sum_4_quad = sum(log_intens_4(1,i:i+max_num_same_intens));
  148. % randomize until no sum is larger than max_num_same_intens
  149. if sum_1_quad == max_num_same_intens+1 || sum_2_quad == max_num_same_intens+1 || sum_3_quad == max_num_same_intens+1 || sum_4_quad == max_num_same_intens+1 || stim_sequence3(1,number_trials/4) == stim_sequence4(1,1)
  150. flag = 1;
  151. break
  152. else flag = 0;
  153. end
  154. end
  155. count = count + 1;
  156. end
  157. stim_sequence = [stim_sequence1, stim_sequence2, stim_sequence3, stim_sequence4];
  158. % mkdir(['C:\Users\PainLabPres\Documents\experiments\variability of pain responses\',subject_ID]);
  159. PATHOUT = ['C:\Users\PainLabPres\Desktop\VarPain\StimSequences\'];
  160. save([PATHOUT,subject_ID,'_stim_sequence.mat'],'stim_sequence');
  161. % load([PATHOUT,Subject_ID,'_stim_sequence.mat']);
  162. try % used for debugging with PTB (error message can be found in the structure ME)
  163. % initialization of keyboard
  164. KbName('UnifyKeyNames');
  165. esc = KbName('escape');
  166. enter = KbName('return');
  167. reaction_key = KbName('space');
  168. pause_key = KbName('shift'); % key to pause experiment
  169. [keyisdown, secs, keycode] = KbCheck; % initializing KbCheck
  170. oldenablekeys = RestrictKeysForKbCheck([esc,enter,reaction_key,pause_key]); % just the escape, return, reaction key and pause key are responsive
  171. % pausekey = 'shift'; % key to pause experiment
  172. % pausekeycode = KbName(pausekey);
  173. % %% set up TCPIP connection with EEG laptop
  174. % tcpip_obj = tcpip('141.39.145.129', 6700, 'NetworkRole', 'client');
  175. % tcpip_obj.ByteOrder = 'littleEndian';
  176. % fopen(tcpip_obj);
  177. %% window specifications
  178. w_size = [];
  179. backgr_color = [192,192,192];
  180. instr_textsize = 40;
  181. text_color = 0;
  182. screenNumber = Screen('Screens');
  183. [w rect]=Screen('OpenWindow',screenNumber,backgr_color,w_size);
  184. Screen('TextSize', w, instr_textsize);
  185. Screen('TextStyle', w, 1);
  186. Screen('TextFont', w, 'Arial');
  187. [X,Y] = RectCenter(rect);
  188. Screen('FillRect',w,backgr_color);
  189. Screen('Flip',w);
  190. WaitSecs(1);
  191. HideCursor(screenNumber);
  192. % %% start Brain Vision Recorder
  193. % start_remote_recorder_EEG(tcpip_obj,Subject_ID,'_Mediation_Paradigm1_Perception')
  194. %
  195. %% instruction
  196. DrawFormattedText(w ,['Wir werden Ihnen gleich Schmerzreize ganz'...
  197. '\n unterschiedlicher Intensit?t auf dem linken Handr?cken verabreichen.'...
  198. ' \n\n Ihre Aufgabe ist es, die Intensit?t jedes Schmerzreizes zu bewerten,'...
  199. '\n auf einer Skala von: \n\n '...
  200. '0 = >kein Schmerz<'...
  201. '\n bis \n '...
  202. '100 = >maximal tolerierbarer Schmerz<. \n\n'...
  203. '\n Bitte warten Sie mit Ihrer Bewertung, \n bis Sie den Piepton h?ren.'], 'center', 'center', text_color,[],[],[],1.7);
  204. Screen('Flip',w);
  205. KbWait;
  206. [keyIsDown,~,keyCode] = KbCheck;
  207. if keyIsDown && keyCode(esc)
  208. Screen('CloseAll');
  209. return
  210. end
  211. Screen('FillRect',w,backgr_color);
  212. Screen('Flip',w);
  213. WaitSecs(1);
  214. DrawFormattedText(w,['Bitte lassen Sie Ihre Augen \n die gesamte Zeit geschlossen.'...
  215. ' \n\n Bitte versuchen Sie auch, w?hrend der \n gesamten Zeit m?glichst entspannt zu bleiben.'...
  216. ' \n\n Die Intensit?t der Schmerzreize wird die Intensit?t'...
  217. ' \n w?hrend der Gew?hnung nicht ?berschreiten.'...
  218. ' \n\n Wenn Sie unterbrechen m?chten, \n lassen Sie es uns bitte wissen.'...
  219. ' \n Dann beenden wir das Experiment.'], 'center', 'center', text_color,[],[],[],1.7);
  220. Screen('Flip',w);
  221. KbWait;
  222. [keyIsDown,~,keyCode] = KbCheck;
  223. if keyIsDown && keyCode(esc)
  224. Screen('CloseAll');
  225. return
  226. end
  227. Screen('FillRect',w,backgr_color);
  228. Screen('Flip',w);
  229. WaitSecs(1);
  230. DrawFormattedText(w,'Haben Sie noch Fragen?', 'center', 'center', text_color,[],[],[],1.7);
  231. Screen('Flip',w);
  232. KbWait;
  233. [keyIsDown,~,keyCode] = KbCheck;
  234. if keyIsDown && keyCode(esc)
  235. Screen('CloseAll');
  236. return
  237. end
  238. Screen('FillRect',w,backgr_color);
  239. Screen('Flip',w);
  240. WaitSecs(1);
  241. DrawFormattedText(w,['Dann starten wir nun mit drei Probedurchg?ngen!'...
  242. ' \n\n Bitte schlie?en Sie die Augen \n und halten Sie sich bereit.'], 'center', 'center', text_color,[],[],[],1.7);
  243. Screen('Flip',w);
  244. KbWait;
  245. [keyIsDown,~,keyCode] = KbCheck;
  246. if keyIsDown && keyCode(esc)
  247. Screen('CloseAll');
  248. return
  249. end
  250. Screen('FillRect',w,backgr_color);
  251. Screen('Flip',w);
  252. WaitSecs(1);
  253. %% prepare laser
  254. % open Serialport (alternative)
  255. [spHandle, errmsg] = IOPort('OpenSerialPort', 'COM2');
  256. WaitSecs(2);
  257. % set LASER ON
  258. IOPort('Write', spHandle, uint8([204,076,049,049,049,185])); % L111
  259. WaitSecs(2);
  260. % set OPERATE ON
  261. IOPort('Write', spHandle, uint8([204,079,049,049,049,185])); % O111
  262. WaitSecs(2);
  263. % calibrate parameters for all stimulation intensities
  264. IOPort('Write', spHandle, uint8([204,067,pulseDuration,Energy_1,000,185])); % Cdef (f is empty)
  265. WaitSecs(8);
  266. IOPort('Write', spHandle, uint8([204,067,pulseDuration,Energy_2,000,185])); % Cdef (f is empty)
  267. WaitSecs(8);
  268. IOPort('Write', spHandle, uint8([204,067,pulseDuration,Energy_3,000,185])); % Cdef (f is empty)
  269. WaitSecs(8);
  270. IOPort('Write', spHandle, uint8([204,067,pulseDuration,Energy_4,000,185])); % Cdef (f is empty)
  271. WaitSecs(8);
  272. % set parameters for all stimulation intensities
  273. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_1,spotDiameter,185])); % Pdes
  274. WaitSecs(2);
  275. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_2,spotDiameter,185])); % Pdes
  276. WaitSecs(2);
  277. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_3,spotDiameter,185])); % Pdes
  278. WaitSecs(2);
  279. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_4,spotDiameter,185])); % Pdes
  280. WaitSecs(2);
  281. DrawFormattedText(w,['Footswitch pressed? \n Press >space< to start the test trials.'...
  282. ' \n\n >space<'], 'center', 'center', text_color,[],[],[],1.7);
  283. Screen('Flip',w);
  284. KbWait;
  285. [keyIsDown,~,keyCode] = KbCheck;
  286. if keyIsDown && keyCode(esc)
  287. Screen('CloseAll');
  288. return
  289. end
  290. Screen('FillRect',w,backgr_color);
  291. Screen('Flip',w);
  292. WaitSecs(1);
  293. % create beep or later use
  294. beep = MakeBeep(1000,0.2);
  295. Snd('Open');
  296. %% loop for test trials
  297. for i = 1:number_test_trials
  298. [keyisdown, secs, keycode] = KbCheck; % initializing KbCheck
  299. if keyisdown && keycode(esc)
  300. Screen('CloseAll');
  301. return
  302. end
  303. if keyisdown && keycode(pause_key)
  304. DrawFormattedText(w,['Pause requested.'...
  305. ' \n\n Press space to continue.'], 'center', 'center', text_color);
  306. Screen('Flip',w);
  307. KbPressWait;
  308. end
  309. % display trial number on screen
  310. DrawFormattedText(w,num2str(i), 'center', 'center', text_color);
  311. Screen('Flip',w);
  312. % LASER: set laser intensity
  313. LasEnerg = stim_sequence(i);
  314. LasEnerg_str = num2str(LasEnerg);
  315. if LasEnerg == intens_1
  316. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_1,spotDiameter,185])); % Pdes
  317. lptwrite(888,1); WaitSecs(0.004); lptwrite(888,0); % EEG marker laserpulse
  318. elseif LasEnerg == intens_2
  319. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_2,spotDiameter,185])); % Pdes
  320. lptwrite(888,2); WaitSecs(0.004); lptwrite(888,0); % EEG marker laserpulse
  321. elseif LasEnerg == intens_3
  322. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_3,spotDiameter,185])); % Pdes
  323. lptwrite(888,3); WaitSecs(0.004); lptwrite(888,0); % EEG marker laserpulse
  324. elseif LasEnerg == intens_4
  325. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_4,spotDiameter,185])); % Pdes
  326. lptwrite(888,4); WaitSecs(0.004); lptwrite(888,0); % EEG marker laserpulse
  327. end
  328. WaitSecs(4);
  329. % LASER: apply laser stimulus
  330. IOPort('Write', spHandle, uint8([204,071,049,049,049,185])); % G11
  331. % Wait for specified time (3 sec until beep)
  332. WaitSecs(3);
  333. % play sound which prompts rating
  334. lptwrite(888,7); WaitSecs(0.004); lptwrite(888,0); % EEG marker beep
  335. Snd('Play',beep);
  336. % Wait for specified time (ISI)
  337. WaitSecs(isi(i));
  338. end
  339. %% Instructions before start of main experiment
  340. DrawFormattedText(w,['Alles klar? Dann geht es jetzt los!'], 'center', 'center', text_color,[],[],[],1.7);
  341. Screen('Flip',w);
  342. KbWait;
  343. [keyIsDown,~,keyCode] = KbCheck;
  344. if keyIsDown && keyCode(esc)
  345. Screen('CloseAll');
  346. return
  347. end
  348. Screen('FillRect',w,backgr_color);
  349. Screen('Flip',w);
  350. WaitSecs(1);
  351. DrawFormattedText(w,['Footswitch pressed? EEG saved? \n Press >space< to start the experiment.'...
  352. ' \n\n >space<'], 'center', 'center', text_color,[],[],[],1.7);
  353. Screen('Flip',w);
  354. KbWait;
  355. [keyIsDown,~,keyCode] = KbCheck;
  356. if keyIsDown && keyCode(esc)
  357. Screen('CloseAll');
  358. return
  359. end
  360. Screen('FillRect',w,backgr_color);
  361. Screen('Flip',w);
  362. % fprintf(tcpip_obj, '%s','S');
  363. WaitSecs(10);
  364. lptwrite(888,8); WaitSecs(0.004); lptwrite(888,0); % start the experiment / start block 1
  365. %% loop for main experiment
  366. for i = 1:number_trials
  367. [keyisdown, secs, keycode] = KbCheck; % initializing KbCheck
  368. if keyisdown && keycode(esc)
  369. Screen('CloseAll');
  370. return
  371. end
  372. if keyisdown && keycode(pause_key)
  373. DrawFormattedText(w,['Pause requested.'...
  374. ' \n \n Press space to continue.'], 'center', 'center', text_color);
  375. Screen('Flip',w);
  376. KbPressWait;
  377. end
  378. % display trial number on screen
  379. DrawFormattedText(w,num2str(i), 'center', 'center', text_color);
  380. Screen('Flip',w);
  381. % send marker end / start blocks and pause after 40 trials
  382. if i == 20
  383. lptwrite(888,9); WaitSecs(0.004); lptwrite(888,0); % end block 1
  384. elseif i == 21
  385. lptwrite(888,10); WaitSecs(0.004); lptwrite(888,0); % start block 2
  386. elseif i == 40
  387. lptwrite(888,11); WaitSecs(0.004); lptwrite(888,0); % end block 2
  388. WaitSecs(0.5);
  389. DrawFormattedText(w,'Kurze Pause. \n \n Alles klar? Dann geht es jetzt weiter! \n \n >space<', 'center', 'center', text_color);
  390. Screen('Flip',w);
  391. KbWait;
  392. [keyIsDown,~,keyCode] = KbCheck;
  393. if keyIsDown && keyCode(esc)
  394. Screen('CloseAll');
  395. return
  396. end
  397. Screen('FillRect',w,backgr_color);
  398. Screen('Flip',w);
  399. % fprintf(tcpip_obj, '%s','S');
  400. WaitSecs(3);
  401. end
  402. % LASER: set laser intensity
  403. LasEnerg = stim_sequence(i);
  404. LasEnerg_str = num2str(LasEnerg);
  405. if LasEnerg == intens_1
  406. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_1,spotDiameter,185])); % Pdes
  407. lptwrite(888,1); WaitSecs(0.004); lptwrite(888,0); % EEG marker laserpulse
  408. elseif LasEnerg == intens_2
  409. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_2,spotDiameter,185])); % Pdes
  410. lptwrite(888,2); WaitSecs(0.004); lptwrite(888,0); % EEG marker laserpulse
  411. elseif LasEnerg == intens_3
  412. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_3,spotDiameter,185])); % Pdes
  413. lptwrite(888,3); WaitSecs(0.004); lptwrite(888,0); % EEG marker laserpulse
  414. elseif LasEnerg == intens_4
  415. IOPort('Write', spHandle, uint8([204,080,pulseDuration,Energy_4,spotDiameter,185])); % Pdes
  416. lptwrite(888,4); WaitSecs(0.004); lptwrite(888,0); % EEG marker laserpulse
  417. end
  418. WaitSecs(4);
  419. % LASER: apply laser stimulus
  420. IOPort('Write', spHandle, uint8([204,071,049,049,049,185])); % G111
  421. % Wait for specified time (3 sec until beep)
  422. WaitSecs(3);
  423. % play sound which prompts rating
  424. lptwrite(888,7); WaitSecs(0.004); lptwrite(888,0); % EEG marker beep
  425. beep = MakeBeep(1000,0.2);
  426. Snd('Open');
  427. Snd('Play',beep);
  428. Snd('Quiet');
  429. % Wait for specified time (ISI)
  430. WaitSecs(isi(i));
  431. end
  432. catch ME
  433. Screen('CloseAll');
  434. rethrow(ME);
  435. end
  436. WaitSecs(5);
  437. lptwrite(888,15); WaitSecs(0.004); lptwrite(888,0); % end of the experiment / end block 4
  438. WaitSecs(1);
  439. % fprintf(tcpip_obj, '%s','Q'); % stop the recording
  440. % fprintf(tcpip_obj, '%s','X'); % quit the recorder
  441. % fclose(tcpip_obj); delete(tcpip_obj); clear tcpip_obj; % clear and delete the object
  442. % fclose(s); delete(s); clear s; % clear and delete the object
  443. DrawFormattedText(w,['The experiment is completed.'], 'center', 'center', text_color);
  444. Screen('Flip',w);
  445. WaitSecs(5);
  446. Screen('CloseAll');
  447. %close object used or beep
  448. Snd('Quiet');
  449. % %% function starting EEG recording
  450. % function start_remote_recorder_EEG(tcpip_obj,Subject_ID,file_extension)
  451. % fprintf(tcpip_obj, '%s','1f:\WorkFiles\Pain64ch_1kHz_mediation.rwksp'); % workspace (numbers 1-4 necessary for remote recorder)
  452. % WaitSecs(1); fprintf(tcpip_obj, '%s',['2',file_extension]); % experiment name
  453. % WaitSecs(1); fprintf(tcpip_obj, '%s',['3',Subject_ID]); % vp number
  454. % WaitSecs(1); fprintf(tcpip_obj, '%s','4'); % start recorder
  455. % WaitSecs(1); fprintf(tcpip_obj, '%s','M'); % Monitor Mode
  456. % WaitSecs(1);

varPain_Paradigm_IntensityRating.m, no license · at the source

Overview

Authors: Laura Tiemann1, Felix S Bott1, Elisabeth S May1, Moritz M Nickel1, Vanessa D Hohn1, Cristina Gil Ávila1, Nicolò Bruna1, Paul Theo Zebhauser1, Markus Ploner1
  1. Center for Interdisciplinary Pain Medicine, Department of Neurology and TUM-Neuroimaging Center, TUM School of Medicine and Health, Technical University of Munich (TUM), Munich, Germany
Institutions: TUM Klinikum (Germany); Technical University of Munich (Germany)
Journal: PLoS biology, volume 24, issue 8, article e3003948
Dates: received 28 April 2026; accepted 29 July 2026; published online 10 August 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1371/journal.pbio.3003948 · PMID 42574470 · PMCID PMC13475984 · OpenAlex W7202151556
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism), pain (population), cognitive (subfield)
Methods: Spectral & time-frequency, Smoothing, state filtering, decompositions, Statistics, Preprocessing, Evoked potentials, Connectivity
MeSH: Brain*, Pain*, Pain Perception*, Adult, Bayes Theorem, Electroencephalography, Female, Humans, Male, Pain Measurement, Young Adult (* major topic)
Topic: Pain Mechanisms and Treatments (Physiology, Medicine), according to OpenAlex
Funding: Deutsche Forschungsgemeinschaft (PL321/14-1, PL321/16-1, SFB 1158); Technische Universität München (TUM Innovation Network Neurotechnology in Mental Health)
Citations: not cited yet (Europe PMC); 63 references in the paper

Abstract

The perception of pain varies both within and between individuals, even when sensory input remains constant. Understanding how the brain encodes these intra- and inter-individual variations is central to elucidating the neural mechanisms of pain and to developing reliable brain-based markers for clinical use. Yet, previous findings have been inconsistent, and their robustness across time and populations remains unclear. Here, we used electroencephalography (EEG) in 161 healthy participants to re-investigate the neural patterns explaining intra- and inter-individual variations in the perception of brief painful stimuli independent of stimulus intensity. Using Bayesian multivariate multi-model regression, we related pain ratings to canonical EEG responses. To directly assess robustness, the experiment was repeated after 4 weeks in the same participants and replicated in an independent cohort (n = 111). Neural patterns associated with inter-individual differences in pain perception were repeatable over time but not replicable across cohorts. In contrast, neural patterns underlying intra-individual fluctuations were robust both over time and across cohorts. These findings indicate that within-person and between-person variability in pain perception is encoded by distinct neural patterns that differ fundamentally in their robustness. Furthermore, they show that brain-based markers are particularly suited for tracking intra-individual fluctuations of pain, while being less sensitive to inter-individual differences. More broadly, they highlight the importance of within-person approaches for advancing both mechanistic models of pain and the development of clinically useful biomarkers.

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 12 matches between paragraphs and lines of code.

OSF bs3yj

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: MATLAB (5), R (4)
Size: 60 files, 9 scripts
Software Heritage: not checked
Found in: “Data Availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: BayesFactor (3 files), data.table (3 files), easystats (3 files), ggplot2 (3 files), lme4 (3 files), lmerTest (3 files), tidyverse (3 files), Psychtoolbox (2 files), FieldTrip (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
9 files

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;
  • 9 scripts, each with its path and the digest of its content;
  • 12 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

Data Availability

All data in standardized EEG-BIDS format [44] are available at https://osf.io/z2h86. Code used for the current manuscript and data underlying the figures are publicly available at https://doi.org/10.17605/OSF.IO/BS3YJ.

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 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 9 authors, 11 MeSH terms, 2 funders, 57 references.

Cite

This paper

Tiemann, L., Bott, F. S., May, E. S., Nickel, M. M., Hohn, V. D., Gil Ávila, C., Bruna, N., Zebhauser, P. T., & Ploner, M. (2026). Neural encoding of pain is robust within but unstable between individuals. PLoS biology, 24(8), e3003948. https://doi.org/10.1371/journal.pbio.3003948

BibTeX

@article{tiemann2026neural,
author = {Tiemann, Laura and Bott, Felix S and May, Elisabeth S and Nickel, Moritz M and Hohn, Vanessa D and Gil Ávila, Cristina and Bruna, Nicolò and Zebhauser, Paul Theo and Ploner, Markus},
title = {{Neural encoding of pain is robust within but unstable between individuals}},
journal = {PLoS biology},
year = {2026},
month = aug,
volume = {24},
number = {8},
pages = {e3003948},
publisher = {PLOS},
issn = {1544-9173},
doi = {10.1371/journal.pbio.3003948},
url = {https://doi.org/10.1371/journal.pbio.3003948},
pmid = {42574470},
pmcid = {PMC13475984}
}

RIS

TY - JOUR
AU - Tiemann, Laura
AU - Bott, Felix S
AU - May, Elisabeth S
AU - Nickel, Moritz M
AU - Hohn, Vanessa D
AU - Gil Ávila, Cristina
AU - Bruna, Nicolò
AU - Zebhauser, Paul Theo
AU - Ploner, Markus
TI - Neural encoding of pain is robust within but unstable between individuals
T2 - PLoS biology
J2 - PLoS Biol
PY - 2026
DA - 2026/08/10
VL - 24
IS - 8
SP - e3003948
SN - 1544-9173
PB - PLOS
DO - 10.1371/journal.pbio.3003948
UR - https://doi.org/10.1371/journal.pbio.3003948
LA - en
ER -

CSL-JSON

{
"id": "10.1371/journal.pbio.3003948",
"type": "article-journal",
"title": "Neural encoding of pain is robust within but unstable between individuals",
"container-title": "PLoS biology",
"author": [
{
"family": "Tiemann",
"given": "Laura"
},
{
"family": "Bott",
"given": "Felix S"
},
{
"family": "May",
"given": "Elisabeth S"
},
{
"family": "Nickel",
"given": "Moritz M"
},
{
"family": "Hohn",
"given": "Vanessa D"
},
{
"family": "Gil Ávila",
"given": "Cristina"
},
{
"family": "Bruna",
"given": "Nicolò"
},
{
"family": "Zebhauser",
"given": "Paul Theo"
},
{
"family": "Ploner",
"given": "Markus"
}
],
"container-title-short": "PLoS Biol",
"volume": "24",
"issue": "8",
"page": "e3003948",
"DOI": "10.1371/journal.pbio.3003948",
"PMID": "42574470",
"PMCID": "PMC13475984",
"ISSN": "1544-9173",
"publisher": "PLOS",
"URL": "https://doi.org/10.1371/journal.pbio.3003948",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
10
]
]
}
}

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.1097/j.pain.0000000000004044 [code]
No effect of rhythmic visual stimulation on experimental pain perception.
Journal: Pain
In common: pain, EEG, cognitive, 10 references
[2] doi:10.1371/journal.pbio.3003979 [code]
Impaired midfrontal‑motor theta phase synchronization characterizes maladaptive motivational behavior in people with obsessive‑compulsive disorder.
Journal: PLoS biology
In common: BayesFactor, FieldTrip, lmerTest, 4 other tools, EEG, 2 references
[3] doi:10.1016/j.neuroimage.2026.122002
EEG-based clustering shows distinct separation of chronic pain patients before spinal cord stimulation surgery.
Journal: NeuroImage
In common: pain, EEG, 7 references
[4] doi:10.1038/s44271-026-00431-w [code]
Alpha power increases spontaneously during a neurofeedback session.
Journal: Communications psychology
In common: BayesFactor, Psychtoolbox, easystats, 2 other tools, EEG, cognitive, 2 references
[5] doi:10.1038/s41467-026-74565-0 [code]
The functional neurobiology of dispositions towards negative emotions.
Journal: Nature communications
In common: BayesFactor, easystats, FieldTrip, 3 other tools, cognitive, 1 reference
[6] doi:10.1038/s41467-026-71600-y [code]
Temporal predictions shape somatosensory perception.
Journal: Nature communications
In common: Psychtoolbox, FieldTrip, pain, EEG, cognitive, 4 references
[7] doi:10.1371/journal.pone.0355165 [code]
Pupillary dynamics during hands-off L2 driving and transitions of control under high cognitive load.
Journal: PloS one
In common: BayesFactor, easystats, lmerTest, 4 other tools, cognitive
[8] doi:10.1038/s41467-026-73865-9 [code]
Histamine shapes the neurocomputational dynamics of human learning.
Journal: Nature communications
In common: BayesFactor, easystats, lmerTest, 4 other tools, cognitive
[9] doi:10.1038/s41598-026-53424-4 [code]
Cognitive control networks causally support implicit emotion regulation: evidence from dlPFC stimulation and directed functional connectivity.
Journal: Scientific reports
In common: BayesFactor, FieldTrip, lmerTest, 3 other tools, EEG, cognitive, 1 reference
[10] doi:10.1162/imag.a.1258 [code]
Non-specific increase in alpha power during a neurofeedback session targeting its downregulation.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: BayesFactor, Psychtoolbox, easystats, 2 other tools, EEG, 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.