OSCR

Human hippocampal ripples tune cortical responses based on predicted uncertainty.

Code ↔ Paper

7 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 7 matches · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
  1. [1] § Methods › SWR analyses ↔ code/detectripples_iedreject_df.m, the whole file · a weak match · score 0.76 · 80–120 Hz, artifact rejection, gradient, IEDs, score, Hilbert
  2. [2] § Methods › TF analyses ↔ code/TF_calculation.m, the whole file · a weak match · score 0.70 · 2.5–32.5 Hz, frequency smoothing, taper, 160 Hz, windows, spectral
  3. [3] § Results › Prestimulus ripples increase with entropy ↔ code/pipeline_ripples.m, lines 184–266 · score 0.69 · random noise, uniform distribution, entropy bins, Spearman, ripple peak, permutation
  4. [4] § Methods › SWR analyses ↔ code/ripple_detection.m, lines 1–56 · score 0.69 · 80–120 Hz, ripple detection, body, Hilbert, head, axis
  5. [5] § Methods › TF analyses ↔ code/pipeline.m, lines 175–257 · score 0.61 · 2.5–32.5 Hz, 35–160 Hz, 0–1 s, GLM, 35 Hz, TF
  6. [6] § Methods › SWR analyses ↔ code/mixed_eff_models.R, lines 47–85 · score 0.60 · emmeans, lme4, pairwise, ripple peak, family, mixed
  7. [7] § Methods › SWR analyses ↔ code/pipeline_ripples.m, lines 184–266 · score 0.55 · uniform distribution, surprise bin, ripple peak, subI, entropy

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 · 360 lines · 15 KB · no license · 2 matches

  1. clearvars
  2. rng(111)
  3. region = 'anterior'; baseline = 0; resp_lock = 0;
  4. nsubs = [3,6,8,9,13,15,16,22,25,31,32,36,37,6,8,10,11,12];
  5. iszurich = logical([zeros(1,13),ones(1,5)]);
  6. % nsubs = [3,6,8,9,13,15,16,22,25,31,32,36,37,6,8,10];
  7. % iszurich = logical([zeros(1,13),ones(1,3)]);
  8. % create stp and patient_data structs
  9. [~,stp] = setup(nsubs,iszurich,baseline,resp_lock,region);
  10. patient_data = getMontage(nsubs,stp,0);
  11. hpfilt = 200;
  12. ripdur = 25;
  13. % fname = sprintf('HPCRipples/HPCAnterior_vaz_hpf%d_%dms_%dsubjs_Jan22_reclean.mat',hpfilt, ripdur, numel(nsubs));
  14. fname = 'HPCAnterior_vaz_hpf200_25ms_18subjs_zurich_12zlen.mat'
  15. res = 300;
  16. load(fname)
  17. ent = zeros(numel(nsubs),1);
  18. start = zeros(numel(nsubs),1);
  19. trial_block = zeros(numel(nsubs),1);
  20. times = [-1:0.002:1]';
  21. surp = zeros(1,1);
  22. peak=zeros(numel(nsubs),1);
  23. g=1; j=0.8:0.1:2;x=1; y=1; all_trls = []; all_rips = [];
  24. ytick={'0.8-0.9', '0.9-1','1-1.1','1.1-1.2','1.2-1.3','1.3-1.4' '1.4-1.5',...
  25. '1.5-1.6','1.6-1.7','1.7-1.8','1.8-1.9','1.9-2'};
  26. xtick={'-1 to -0.8','-0.8 to -0.6', '-0.6 to -0.4', '-0.4 to-0.2',...
  27. '-0.2 to 0', '0 to 0.2', '0.2 to 0.4','0.4 to 0.6', '0.6 to 0.8','0.8 to 1'};
  28. surp_tick = {'0.5-1','1-1.5','1.5-2','2-2.5','2.5-3','3-3.5','3.5-4','4-4.5','4.5-5'};
  29. for subI = 1:numel(nsubs)
  30. if nsubs(subI) == 22 % no ripples for sub 22 (and excluded anyways) - position 8
  31. continue
  32. end
  33. k=1;
  34. fprintf(['Getting clean trials for Patient ',num2str(nsubs(subI)), '\n'])
  35. if stp.zurich(subI) == 1
  36. foldn = sprintf('Information/P%dz',nsubs(subI));
  37. else
  38. foldn = sprintf('Information/Patient%d+',nsubs(subI));
  39. end
  40. cd(foldn)
  41. if strcmp(stp.region,'anterior')||strcmp(stp.region,'head')||strcmp(stp.region,'body')
  42. cd(sprintf('hpc_%s',patient_data(subI).hpc_axis))
  43. else
  44. cd(sprintf('%s',patient_data(subI).region))
  45. end
  46. load('clean_trials_bipolar.mat','clean')
  47. clean_trials(subI) = clean;
  48. cd ../../../
  49. ent_tot(g:g+size(clean_trials(subI).info(:,1),1)-1) = clean_trials(subI).info(:,1);
  50. % find same ripple in different channels
  51. sub(subI).unique_rips(:,13) = 1:size(sub(subI).unique_rips,1);
  52. rips_sorted_by_chan_start{subI} = sortrows(sub(subI).unique_rips,[2,3]);
  53. dif=diff(rips_sorted_by_chan_start{subI}(:,2:3));
  54. same_rip =find(abs(dif(:,2))<10 & dif(:,1)==0);
  55. rips_sorted_by_chan_start{subI}(same_rip,12) = 1;
  56. % return to original order to remove rip
  57. rips_sorted_by_chan_start{subI} = sortrows(rips_sorted_by_chan_start{subI},13);
  58. sub(subI).same_rip=sum(rips_sorted_by_chan_start{subI}(:,12));
  59. % remove rip
  60. same_rip_rmv = find(sub(subI).unique_rips(:,12));
  61. sub(subI).unique_rips(same_rip_rmv,:) = [];
  62. sub(subI).unique_rips(:,12:13) = [];
  63. for ripI = 1:size(sub(subI).unique_rips,1)
  64. t_idx = sub(subI).unique_rips(ripI,2);
  65. t = clean_trials(subI).trl(t_idx); % trial # insead of index
  66. ent(subI,ripI) = clean_trials(subI).info(t_idx,1);
  67. surp(subI,ripI) = clean_trials(subI).info(t_idx,2);
  68. start(subI,ripI)=times(sub(subI).unique_rips(ripI,3));
  69. peak(subI,ripI)=times(sub(subI).unique_rips(ripI,5));
  70. if t < 40
  71. trial_block(subI,ripI) = t;
  72. else
  73. new_t = mod(t,40);
  74. if new_t == 0
  75. new_t = 40;
  76. end
  77. trial_block(subI,ripI) = new_t;
  78. end
  79. end
  80. g=g+size(clean_trials(subI).info(:,1));
  81. rip_rate(subI,1:2) = [size(clean_trials(subI).info(:,1),1), size(sub(subI).unique_rips,1)];
  82. rip_rate(subI,3) = rip_rate(subI,2)/rip_rate(subI,1); %rip per trial
  83. rip_rate(subI,4) = rip_rate(subI,2)/(rip_rate(subI,1)*2.2); %rip per sec (each trial is 2.2s)
  84. % ripple frequency as a function of time-bin
  85. c = histogram(times(sub(subI).unique_rips(:,3)),'BinEdges',[-1:0.2:1]);
  86. rip_times_prob(subI,1:10) = c.Values ./ sum(c.Values);
  87. % floats for hist
  88. ent_rounded = 10*round(sub(subI).unique_rips(:,7),1);
  89. surp_rounded = 10*round(sub(subI).unique_rips(:,8),1);
  90. e1d= histogram(ent_rounded, 'BinEdges',[8:1:20]);
  91. subj_count_ent_rips(subI,1:12) = e1d.Values;
  92. s1d=histogram(surp_rounded, 'BinEdges',[5:5:50]);
  93. subj_count_surp_rips(subI,1:9) = s1d.Values;
  94. if nsubs(subI) == 22
  95. subj_ent_bins(subI,:) = zeros(1,12);
  96. subj_surp_bins(subI,:) = zeros(1,9);
  97. end
  98. ent_trls = 10*round(clean_trials(subI).info(:,1),1);
  99. surp_trls = 10*round(clean_trials(subI).info(:,2),1);
  100. c1d = histogram(ent_trls, 'BinEdges', [8:1:20]);
  101. count_ent_trls = c1d.Values;
  102. cs1d =histogram(surp_trls, 'BinEdges', [5:5:50]);
  103. count_surp_trls = cs1d.Values;
  104. subj_tot_ent(subI,:) = count_ent_trls;
  105. subj_tot_surp(subI,:) = count_surp_trls;
  106. % can be >1 because of multiple ripples per trial
  107. % y=1 for each entropy trial there was a correposnding ripple
  108. subj_ent_bins(subI,:) = subj_count_ent_rips(subI,:) ./ count_ent_trls;
  109. subj_surp_bins(subI,:) = subj_count_surp_rips(subI,:) ./ count_surp_trls;
  110. marks = find(isnan(subj_ent_bins(subI,:)));
  111. figure(2);subplot(5,4,subI);
  112. bar([0.9:0.1:2],subj_ent_bins(subI,:));
  113. xlabel('Entropy');
  114. title(sprintf('patient %d',nsubs(subI)));
  115. ylabel({'ripple conut/entropy trials','>1 because of mult. ripples per trl'});
  116. if ~isempty(marks); hold on; plot(j(marks),1,'r*'); hold off; end
  117. clear ent_trls surp_trls count_ent_trls count_surp_trls marks
  118. rip_time = 1000*round(times(sub(subI).unique_rips(:,5)),2);
  119. ent_rounded = 10*round(sub(subI).unique_rips(:,7),1);
  120. surp_rounded = 10*round(sub(subI).unique_rips(:,8),1);
  121. freq_norm_ent = subj_ent_bins(subI,:);
  122. freq_norm_surp = subj_surp_bins(subI,:);
  123. cr=histogram(rip_time,'BinEdges',[-1000:200:1000])
  124. time_dist(subI,:) = cr.Values;
  125. ce = histogram(ent_rounded,'BinEdges',[8:1:20])
  126. ent_dist(subI,:) = ce.Values;
  127. figure(3);sgtitle({sprintf('Patient %d',nsubs(subI)),'Ripple peak time/entropy distribution'});
  128. subplot(121);
  129. c=histogram2(rip_time,ent_rounded,'XBinEdges',[-1000:200:1000],'YBinEdges',[8:1:20]); % if want prob add 'Normalization','Probability', otherwise it's normalized count
  130. xlabel('Ripple peak time'); ylabel('Entropy'); zlabel('Count');title('Raw count')
  131. ent_time_hist = c.Values;
  132. cs=histogram2(rip_time,surp_rounded,'XBinEdges',[-1000:200:1000],'YBinEdges',[5:5:50]); % if want prob add 'Normalization','Probability', otherwise it's normalized count
  133. xlabel('Ripple peak time'); ylabel('Surprise'); zlabel('Count');title('Raw count')
  134. surp_time_hist = cs.Values;
  135. % prop_ent_time_hist = ent_time_hist ./ sum(sum(ent_time_hist)); % convert to prob to avoid issues with different numbers of trials
  136. sub(subI).ent_prop_time = ent_time_hist .* freq_norm_ent;
  137. sub(subI).surp_prop_time = surp_time_hist .* freq_norm_surp;
  138. sub(subI).ent_time = ent_time_hist;
  139. sub(subI).surp_time = surp_time_hist;
  140. subplot(122); h=heatmap(sub(subI).ent_prop_time');
  141. ylabel('Entropy'); xlabel('Ripple peak time');
  142. h.XDisplayLabels = xtick; h.YDisplayLabels = ytick;
  143. h.CellLabelColor='none'; h.NodeChildren(3).YDir='normal';
  144. title('Normalised by proportion per entropy bin')
  145. ent_rip_prop_3d(:,:,subI) = sub(subI).ent_prop_time;
  146. ent_rip_3d(:,:,subI) = sub(subI).ent_time;
  147. surp_rip_prop_3d(:,:,subI) = sub(subI).surp_prop_time;
  148. surp_rip_3d(:,:,subI) = sub(subI).surp_time;
  149. clear rip_time rip_ent rip_surp freq_norm_ent freq_norm_surp ent_time_hist surp_time_hist
  150. % data for R - LME (get trials without ripples)
  151. t_indices = sub(subI).unique_rips(:,2);
  152. no_rips = setdiff(1:size(clean_trials(subI).info,1),t_indices);
  153. no_rips_mat = clean_trials(subI).info(no_rips,1:5);
  154. no_rips_mat = [nan(size(no_rips,2),6), no_rips_mat];
  155. no_rips_mat(:,2) = no_rips';
  156. all_rips(x:x+size(sub(subI).unique_rips,1)-1,:) = [sub(subI).unique_rips,...
  157. repmat(subI,[size(sub(subI).unique_rips,1),1])];
  158. all_len = size(sub(subI).unique_rips,1)+size(no_rips_mat,1);
  159. all_trls(y:y+all_len-1,:) = [[no_rips_mat;sub(subI).unique_rips],...
  160. repmat(subI,all_len,1)];
  161. x = x+size(sub(subI).unique_rips,1);
  162. y = y+all_len;
  163. clear no_rips_mat
  164. end
  165. %% time-ent heatmap
  166. if numel(nsubs) > 7
  167. ent_rip_prop_3d(:,:,8) = [];
  168. surp_rip_prop_3d(:,:,8) = [];
  169. end
  170. %normalised
  171. group_avg_ent_time = nanmean(ent_rip_prop_3d,3);
  172. group_sum_ent_time = nansum(ent_rip_prop_3d,3);
  173. figure( 'position',[10 10 500 400]); h1=heatmap(group_avg_ent_time'); %title({'Group average','Normalised by entropy bin'})
  174. ylabel('Entropy'); xlabel('Ripple peak time');
  175. h1.XDisplayLabels = xtick; h1.YDisplayLabels = ytick; h1.FontSize = 20;
  176. h1.CellLabelColor='none'; h1.NodeChildren(3).YDir='normal';h1.Colormap = parula;
  177. % print('-dsvg',fullfile('Manuscript/Figures/','normalised_rip_ent_time'),['-r' num2str(res)])
  178. % raw
  179. group_avg_ent_time_r = nanmean(ent_rip_3d,3);
  180. figure( 'position',[10 10 900 700]); h1=heatmap(group_avg_ent_time_r'); %title({'Group average'})
  181. ylabel('Entropy'); xlabel('Ripple peak time');
  182. h1.XDisplayLabels = xtick; h1.YDisplayLabels = ytick; h1.FontSize = 20;
  183. h1.CellLabelColor='none'; h1.NodeChildren(3).YDir='normal';h1.Colormap = parula;
  184. % print('-dtiff',fullfile('Manuscript/Figures/','raw_rip_ent_time'),['-r' num2str(res)])
  185. group_avg_surp_time = nanmean(surp_rip_prop_3d,3);
  186. group_sum_surp_time = nansum(surp_rip_prop_3d,3);
  187. figure( 'position',[10 10 900 700]); h1=heatmap(group_avg_surp_time'); %title({'Group average','Normalised by surprise bin'})
  188. ylabel('Surprise'); xlabel('Ripple peak time');
  189. h1.XDisplayLabels = xtick; h1.YDisplayLabels = surp_tick; h1.FontSize = 20;
  190. h1.CellLabelColor='none'; h1.NodeChildren(3).YDir='normal';h1.Colormap = parula;
  191. % print('-dtiff',fullfile('Manuscript/Figures/','normalised_rip_surp_time'),['-r' num2str(res)])
  192. group_avg_surp_time_r = nanmean(surp_rip_3d,3);
  193. figure( 'position',[10 10 900 700]); h1=heatmap(group_avg_surp_time_r'); %title({'Group average'})
  194. ylabel('Surprise'); xlabel('Ripple peak time');
  195. h1.XDisplayLabels = xtick; h1.YDisplayLabels = surp_tick; h1.FontSize = 20;
  196. h1.CellLabelColor='none'; h1.NodeChildren(3).YDir='normal';h1.Colormap = parula;
  197. % print('-dtiff',fullfile('Manuscript/Figures/','raw_rip_surp_time'),['-r' num2str(res)])
  198. % perm test
  199. if numel(nsubs) > 7
  200. nperm = numel(nsubs)-1;
  201. else
  202. nperm = numel(nsubs);
  203. end
  204. for subI = 1:nperm
  205. sub_mat=ent_rip_prop_3d(:,:,subI);
  206. sub_mat = sub_mat(~isnan(sub_mat));
  207. nrand = 1000;
  208. for i = 1:nrand
  209. shuff_mat(:,i) = sub_mat(randperm(size(sub_mat,1)));
  210. corrs(subI,i) = corr(sub_mat,shuff_mat(:,i),'Type','Spearman');
  211. corrs_kend(subI,i) = corr(sub_mat,shuff_mat(:,i),'Type','Kendall');
  212. end
  213. clear sub_mat shuff_mat
  214. end
  215. % not sig meaning does not correlate with random noise.
  216. avg_corr = mean(corrs,2);
  217. [h_cor,p_cor,ci,stats_cor]=ttest(avg_corr);
  218. % kendall - same result as spearman
  219. avg_corr_kend = mean(corrs_kend,2);
  220. [h_cor_k,p_cor_k,ci_k,stats_cor_k]=ttest(avg_corr_kend);
  221. % % or x2 on the vectorised avg matrix
  222. % [h_x2,p_x2,stats_x2]=chi2gof(group_avg_ent_time(:));
  223. % ks on the avg matrix - sig --> not normally distributed
  224. [h_ks,p_ks,ksstat,cv]=kstest(group_avg_ent_time);
  225. %uniform distribution - sig --> not uniformly distributed
  226. % https://math.stackexchange.com/questions/2435/is-there-a-simple-test-for-uniform-distributions
  227. % dist=makedist('uniform',0,4);
  228. % [h_ks_uni,p_ks_uni,ksstat_uni,cv_uni]=kstest(group_avg_ent_time,dist);
  229. Xent = unifrnd(min(group_avg_ent_time(:)),max(group_avg_ent_time(:)),10,12);
  230. [~,ent_p_ks_unif,ent_ksstat_uni]=kstest2(group_avg_ent_time(:),Xent(:));
  231. Xsurp = unifrnd(min(group_avg_surp_time(:)),max(group_avg_surp_time(:)),10,12);
  232. [~,surp_p_ks_unif,surp_ksstat_uni]=kstest2(group_avg_surp_time(:),Xsurp(:));
  233. %% trial in block
  234. idx=find(trial_block);
  235. rips_trial_block = trial_block(find(trial_block));
  236. rips_ent = ent(find(ent));
  237. rips_surp = surp(idx);
  238. rips_peak = peak(idx);
  239. ytick={'< 0.8','0.8-1', '1-1.2','1.2-1.4','1.4-1.6','1.6-1.8','1.8-2'};
  240. xtick={'-1 to -0.8','-0.8 to -0.6', '-0.6 to -0.4', '-0.4 to-0.2',...
  241. '-0.2 to 0', '0 to 0.2', '0.2 to 0.4','0.4 to 0.6', '0.6 to 0.8','0.8 to 1'};
  242. % three way heatmap
  243. x=discretize(rips_peak,10);
  244. y=discretize(rips_ent,7);
  245. tbl=array2table([x,y,rips_trial_block]);
  246. figure(8);h=heatmap(tbl,'Var1','Var2','ColorVariable','Var3','ColorMethod','mean');
  247. xlabel('Time'); ylabel('Entropy');title('Distribution of HPC ripples as a function of entropy, peri-stimulus time and trial # in block');
  248. set(gca, 'FontSize', 20);
  249. h.XDisplayLabels = xtick;
  250. h.YDisplayLabels = ytick;
  251. h.CellLabelColor='none'; h.NodeChildren(3).YDir='normal';
  252. % distribution over trials in block
  253. for subI = 1:numel(nsubs)
  254. if nsubs(subI)==22
  255. continue
  256. end
  257. trlIdx= find(trial_block(subI,:));
  258. blkI = trial_block(subI,trlIdx);
  259. c1d = histogram(blkI, 'BinEdges', [1:41],'Normalization', 'Probability');%,
  260. count_ent_trls(subI,:) = c1d.Values;
  261. clean_trials(subI).info(:,6)=mod(clean_trials(subI).info(:,5),40);
  262. clean_trials(subI).info((clean_trials(subI).info(:,6)==0),6) = 40;
  263. trl_idx=clean_trials(subI).info(:,6)==1;%missing first trial
  264. if sum(trl_idx) ==0
  265. count_ent_trls(subI,1)=NaN;
  266. end
  267. c1d = histogram(blkI, 'BinEdges', [1:41]);%,
  268. count_trls(subI,:) = c1d.Values;
  269. % to get this in rip rate - divide by the duration of trial * number of
  270. % trials that were used (post-cleaning)
  271. for i = 1:40
  272. tot_trls = sum(clean_trials(subI).info(:,6) == i);
  273. tot_trls_time = tot_trls * 2; %2s trl
  274. trl_rate(subI,i) = ( count_trls(subI,i) / tot_trls_time); %events/s
  275. rip_per_trls(subI,i) = count_trls(subI,i) / tot_trls;
  276. end
  277. end
  278. % fit exponential learning curve
  279. % https://people.richland.edu/james/lecture/m116/logs/models.html
  280. x = [1:40]';
  281. g = fittype('b*(1-exp(-c*x))');
  282. [f_exp, gof]=fit(x,nanmean(count_ent_trls)',g,'StartPoint',[1,0]);
  283. figure( 'position',[10 10 900 700]);plot(f_exp,x,nanmean(count_ent_trls)');
  284. xlabel('Trial # of block'); ylabel('p(ripple)');text(31,0.03,sprintf('adjusted R^2 = %.2f',gof.adjrsquare))
  285. set(gca, 'FontSize', 20,'LineWidth',2);
  286. err = nanstd(trl_rate) / sqrt(numel(nsubs) - 2);
  287. n_trials = size(trl_rate, 2);
  288. trial_mean = nanmean(trl_rate);
  289. % Mean + error bars on top
  290. scatter(1:n_trials, trial_mean);
  291. hold on;
  292. errorbar(1:n_trials, trial_mean, err);
  293. hold off;
  294. [f_lin, gof_lin] = fit(x,nanmean(count_ent_trls)','poly2');
  295. figure(10);plot(f_lin,x,nanmean(count_ent_trls)');
  296. xlabel('Trial # of block'); ylabel('p(ripple)');
  297. text(31,0.03,sprintf('adjusted R^2 = %.2f',gof_lin.adjrsquare))
  298. set(gca, 'FontSize', 20);
  299. err = nanstd(count_ent_trls)/sqrt(numel(nsubs)-1);
  300. figure('position',[10 10 500 400]);bar(nanmean(count_ent_trls));
  301. hold on;
  302. er = errorbar([1:40],nanmean(count_ent_trls),err);
  303. er.Color = [0 0 0];
  304. er.LineStyle = 'none';
  305. p=plot(f_exp,'-r');xlabel('Trial # in block');ylabel('Ripple probability'); ylim([0 0.045]);
  306. p.LineWidth=2;hold off
  307. set(gca, 'FontSize', 20);
  308. print('-dtiff',fullfile('Manuscript/Figures/','rip_trl_in_blk'),['-r' num2str(res)])
  309. % text(1,0.042,sprintf('adjusted R^2 = %.2f',gof.adjrsquare))hold off;

pipeline_ripples.m at commit ce37ac8, no license · at the source

Overview

  1. Laboratory for Clinical Neuroscience, Centre for Biomedical Technology, Universidad Politécnica de Madrid, IdISSC,Madrid, Spain
  2. Andrew Mayes Centre for Cognitive Neuroscience, University of Manchester,Manchester, UK
  3. Department of Experimental Psychology, Complutense University of Madrid,Madrid, Spain
  4. Department of Neurosurgery, University Hospital and University of Zurich,Zurich, Switzerland
  5. Neuroscience Center Zurich, University of Zurich and ETH Zurich,Zurich, Switzerland
  6. Movement Disorders and Neuromodulation Unit, Department of Neurology, Charité—Universitätsmedizin Berlin, corporate member of Freie Universität Berlin and Humboldt-Universität zu Berlin,Berlin, Germany
  7. Department of Neurosurgery, Harvard Medical School, Massachusetts General Hospital,Boston, MA USA
  8. Brigham & Women’s Hospital, Center for Brain Circuit Therapeutics,Boston, MA USA
  9. Swiss Epilepsy Center, Klinik Lengg,Zurich, Switzerland
  10. Epilepsy Unit, Department of Neurology, Hospital Ruber Internacional,Madrid, Spain
  11. Wellcome Trust Centre for Neuroimaging, Institute of Neurology, University College London,London, UK
  12. IDG/McGovern Institute for Brain Research, Peking University,Beijing, China
Journal: Nature neuroscience, volume 29, issue 8, pages 1987-1998
Dates: received 11 February 2026; accepted 20 May 2026; published online 25 June 2026; in print 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1038/s41593-026-02345-6 · PMID 42350816 · PMCID PMC13433285 · OpenAlex W7165923216
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: human (organism), cognitive (subfield)
Methods: Spectral & time-frequency, Connectivity, Statistics, Preprocessing, fMRI & imaging, Physiology & signal measures
Keywords: Neuroscience, Cognitive neuroscience, Perception, Visual system, Hippocampus
MeSH: Hippocampus*, Visual Cortex*, Visual Perception*, Adult, Female, Humans, Male, Photic Stimulation, Uncertainty, Young Adult (* major topic)
Topic: Neural dynamics and brain function (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: cited by 1 paper (Europe PMC); 77 references in the paper

Abstract

To encode information efficiently, our perceptual system should detect when situations are unpredictable (that is, informative) and modulate brain dynamics to prepare for encoding. Under uncertainty, there is an increased need to generate predictions about upcoming information, a process that has been proposed to require coordinated activity between the hippocampus and neocortex. Here we show, with direct recordings from the human hippocampus and visual cortex, that after exposure to unpredictable visual stimulus streams, hippocampal ripple activity increases in frequency and duration before stimulus presentation. Prestimulus hippocampal ripples suppress changes in visual cortex gamma activity associated with uncertainty and modulate poststimulus prediction error gamma responses in higher-level visual cortex to surprising stimuli. We reveal a function of hippocampal ripples in facilitating the propagation of visual stimuli based on the expected information gain. These results, therefore, link hippocampal ripples with predictive coding accounts of neuronal message passing and precision-weighted prediction errors, revealing a mechanism relevant for perceptual synthesis and subsequent memory encoding.

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

frdarya/GenerativeRipples

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: ce37ac8416614da9d490e09b4eeed23f5b4ca161, 7 May 2026
Languages: MATLAB (17), R (1)
Size: 34 files, 18 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: FieldTrip (13 files), Statistics and Machine Learning Toolbox (11 files), boundedline (5 files), car (1 file), emmeans (1 file), ggpubr (1 file), lme4 (1 file), Curve Fitting Toolbox (1 file), Image Processing Toolbox (1 file), Signal Processing Toolbox (1 file), Wavelet Toolbox (1 file), tidyverse (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
19 files

Code availability

Analysis codes are available in the following GitHub repository: https://github.com/frdarya/GenerativeRipples.

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

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

Preprocessed data needed to generate the figures, and over which statistics were computed, are available in the following GitHub repository: https://github.com/frdarya/GenerativeRipples.

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 → Nature Portfolio

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 12 authors, 5 keywords, 10 MeSH terms, 6 funders, 76 references.

Cite

This paper

Frank, D., Moratti, S., Hellerstedt, R., Sarnthein, J., Li, N., Horn, A., Imbach, L., Stieglitz, L., Gil-Nagel, A., Toledano, R., Friston, K. J., & Strange, B. A. (2026). Human hippocampal ripples tune cortical responses based on predicted uncertainty. Nature neuroscience, 29(8), 1987-1998. https://doi.org/10.1038/s41593-026-02345-6

BibTeX

@article{frank2026human,
author = {Frank, Darya and Moratti, Stephan and Hellerstedt, Robin and Sarnthein, Johannes and Li, Ningfei and Horn, Andreas and Imbach, Lukas and Stieglitz, Lennart and Gil-Nagel, Antonio and Toledano, Rafael and Friston, Karl J. and Strange, Bryan A.},
title = {{Human hippocampal ripples tune cortical responses based on predicted uncertainty}},
journal = {Nature neuroscience},
year = {2026},
month = jun,
volume = {29},
number = {8},
pages = {1987--1998},
publisher = {Nature Portfolio},
issn = {1097-6256},
doi = {10.1038/s41593-026-02345-6},
url = {https://doi.org/10.1038/s41593-026-02345-6},
pmid = {42350816},
pmcid = {PMC13433285}
}

RIS

TY - JOUR
AU - Frank, Darya
AU - Moratti, Stephan
AU - Hellerstedt, Robin
AU - Sarnthein, Johannes
AU - Li, Ningfei
AU - Horn, Andreas
AU - Imbach, Lukas
AU - Stieglitz, Lennart
AU - Gil-Nagel, Antonio
AU - Toledano, Rafael
AU - Friston, Karl J.
AU - Strange, Bryan A.
TI - Human hippocampal ripples tune cortical responses based on predicted uncertainty
T2 - Nature neuroscience
J2 - Nat Neurosci
PY - 2026
DA - 2026/06/25
VL - 29
IS - 8
SP - 1987
EP - 1998
SN - 1097-6256
PB - Nature Portfolio
DO - 10.1038/s41593-026-02345-6
UR - https://doi.org/10.1038/s41593-026-02345-6
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41593-026-02345-6",
"type": "article-journal",
"title": "Human hippocampal ripples tune cortical responses based on predicted uncertainty",
"container-title": "Nature neuroscience",
"author": [
{
"family": "Frank",
"given": "Darya"
},
{
"family": "Moratti",
"given": "Stephan"
},
{
"family": "Hellerstedt",
"given": "Robin"
},
{
"family": "Sarnthein",
"given": "Johannes"
},
{
"family": "Li",
"given": "Ningfei"
},
{
"family": "Horn",
"given": "Andreas"
},
{
"family": "Imbach",
"given": "Lukas"
},
{
"family": "Stieglitz",
"given": "Lennart"
},
{
"family": "Gil-Nagel",
"given": "Antonio"
},
{
"family": "Toledano",
"given": "Rafael"
},
{
"family": "Friston",
"given": "Karl J."
},
{
"family": "Strange",
"given": "Bryan A."
}
],
"container-title-short": "Nat Neurosci",
"volume": "29",
"issue": "8",
"page": "1987-1998",
"DOI": "10.1038/s41593-026-02345-6",
"PMID": "42350816",
"PMCID": "PMC13433285",
"ISSN": "1097-6256",
"publisher": "Nature Portfolio",
"URL": "https://doi.org/10.1038/s41593-026-02345-6",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
25
]
]
}
}

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.1002/ana.78206 [code]
Multimodal Image Guidance in Subthalamic Deep Brain Stimulation for Parkinson's Disease.
Journal: Annals of neurology
In common: Curve Fitting Toolbox, FieldTrip, Image Processing Toolbox, 2 other tools, 2 references, 2 authors
[2] doi:10.1038/s41467-026-75345-6 [code]
Hippocampal ripples initiate cortical dimensionality expansion for memory retrieval.
Journal: Nature communications
In common: boundedline, FieldTrip, Image Processing Toolbox, 2 other tools, cognitive, 9 references
[3] doi:10.1016/j.celrep.2026.117646 [code]
Medial entorhinal-hippocampal desynchronization parallels the emergence of memory impairment in a mouse model of Alzheimer's disease pathology.
Journal: Cell reports
In common: boundedline, Curve Fitting Toolbox, car, 7 other tools
[4] doi:10.7554/elife.107088 [code]
Development of auditory and spontaneous movement responses to music over the first postnatal year.
Journal: eLife
In common: Wavelet Toolbox, car, FieldTrip, 6 other tools, 1 reference
[5] doi:10.1002/advs.77857 [code]
Brain Network Dynamics of Local and Global Predictive Processing in Aging.
Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)
In common: FieldTrip, Image Processing Toolbox, Signal Processing Toolbox, 1 other tool, cognitive, 7 references
[6] doi:10.1093/sleep/zsag168 [code]
Deltas' and spindles' cross-area synchronization and ripple subtypes.
Journal: Sleep
In common: boundedline, FieldTrip, Image Processing Toolbox, 2 other tools, 5 references
[7] 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: Wavelet Toolbox, FieldTrip, lme4, 3 other tools, cognitive, 3 references
[8] doi:10.1016/j.isci.2026.116458 [code]
Neural tracking of prosodic and statistical rhythms jointly supports artificial language learning.
Journal: iScience
In common: FieldTrip, emmeans, lme4, 2 other tools, cognitive, 5 references
[9] doi:10.1038/s41467-026-75359-0 [code]
Neural mechanisms of time-forward predictions for naturalistic auditory tone sequences.
Journal: Nature communications
In common: FieldTrip, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, cognitive, 7 references
[10] doi:10.1111/ejn.70481 [code]
Neural and Behavioral Tracking of Musical Phrases Occurs Without Temporal Regularity.
Journal: The European journal of neuroscience
In common: boundedline, FieldTrip, lme4, 4 other tools, cognitive, 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.