OSCR

Cortical reinstatement of causally related events sparks narrative insights by updating neural representation patterns.

Code ↔ Paper

4 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 4 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 › FMRI image preprocessing ↔ code/code_extractbold.py, lines 32–82 · score 0.81 · head motion, brain mask, fMRI, BIDS, movie, EPI
  2. [2] § Methods › Neural reinstatement of causally related past events ↔ code/code_ahahmmreinst_stats.R, the whole file · a weak match · score 0.80 · behavioral retrieval neural, lme4, neural pattern shift, neural reinstatement, binomial, glmer
  3. [3] § Methods › Parcellation ↔ code/code_extractbold.py, lines 32–82 · score 0.69 · brain mask, subcortical parcels, fMRI, EPI, voxels
  4. [4] § Results › Neural reinstatement of causally related past events drives neural pattern shifts at insight moments ↔ code/code_ahahmmreinst_stats.R, the whole file · a weak match · score 0.55 · neural pattern shift, behavioral retrieval, Neural reinstatement, mediation

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

Python · 87 lines · 4.5 KB · MIT · 2 matches

  1. # extracting voxel time series after applying a parcel mask to preprocessed EPIs
  2. # Nov 24, 2024, Hayoung Song
  3. # preprocessed fMRI data can be downloaded from: https://openneuro.org/datasets/ds005658
  4. import numpy as np
  5. from nilearn.image import load_img
  6. import matplotlib.pyplot as plt
  7. import scipy.stats
  8. import pandas as pd
  9. def niftimask(nroi_cor, nroi_sub, directory):
  10. cortical = directory+'/template/tpl-MNI152NLin2009cAsym/tpl-MNI152NLin2009cAsym_res-02_atlas-Schaefer2018_desc-'+str(nroi_cor)+'Parcels17Networks_dseg.nii.gz'
  11. if nroi_sub==16: subcortical = directory+'/template/Tian2020MSA_v1.1_3T_Subcortex-Only/Tian_Subcortex_S1_3T_2009cAsym.nii.gz'
  12. elif nroi_sub==32: subcortical = directory+'/template/Tian2020MSA_v1.1_3T_Subcortex-Only/Tian_Subcortex_S2_3T_2009cAsym.nii.gz'
  13. elif nroi_sub == 50: subcortical = directory + '/template/Tian2020MSA_v1.1_3T_Subcortex-Only/Tian_Subcortex_S3_3T_2009cAsym.nii.gz'
  14. elif nroi_sub == 54: subcortical = directory + '/template/Tian2020MSA_v1.1_3T_Subcortex-Only/Tian_Subcortex_S4_3T_2009cAsym.nii.gz'
  15. mask_cor = load_img(cortical).dataobj[:]
  16. mask_sub = load_img(subcortical).dataobj[:]
  17. for i1 in range(mask_sub.shape[0]):
  18. for i2 in range(mask_sub.shape[1]):
  19. for i3 in range(mask_sub.shape[2]):
  20. if mask_sub[i1,i2,i3]>0:
  21. mask_sub[i1,i2,i3] = mask_sub[i1,i2,i3] + nroi_cor
  22. id = np.where(np.multiply(mask_cor, mask_sub)>0)
  23. mask = mask_cor + mask_sub
  24. mask[id[0],id[1],id[2]] = 0
  25. return mask
  26. ''' setting '''
  27. flist = {}
  28. flist[1] = ['sub-1001', 'sub-1005', 'sub-1008', 'sub-1011', 'sub-1014', 'sub-1017', 'sub-1020', 'sub-1023', 'sub-1026', 'sub-1029', 'sub-1033', 'sub-1039']
  29. flist[2] = ['sub-2006', 'sub-2009', 'sub-2012', 'sub-2015', 'sub-2018', 'sub-2021', 'sub-2024', 'sub-2027', 'sub-2034', 'sub-2038', 'sub-2040'] # 'sub-2030'
  30. flist[3] = ['sub-3004', 'sub-3007', 'sub-3013', 'sub-3016', 'sub-3019', 'sub-3022', 'sub-3025', 'sub-3031', 'sub-3037', 'sub-3041'] # 'sub-3010', 'sub-3028'
  31. tasklist = ['01','02','03','04','05','06','07','08','09','10']
  32. # sub-2030, sub-3010, sub-3028: large head motion participants
  33. # sub-1023 task-03: only movie watching portion was recorded
  34. nsubj = len(flist[1])+len(flist[2])+len(flist[3])
  35. directory = '/foldername'
  36. nroi_cor, nroi_sub = 100, 16
  37. hrf = 4 # 4TR = 4.8s
  38. mask = niftimask(nroi_cor, nroi_sub, directory)
  39. for groupid in range(1, 3+1):
  40. run = np.array(pd.read_csv(directory+'/socialaha-fMRI/socialaha_groupscene.csv')['run'])
  41. scene = np.array(pd.read_csv(directory+'/socialaha-fMRI/socialaha_groupscene.csv')['g'+str(groupid)+'.sceneid'])
  42. for si, subname in enumerate(flist[groupid]):
  43. # parcel mask is multiplied by each participant's brain mask applied during preprocessing
  44. submask = load_img(directory+'/masks/'+subname+'/'+subname+'_combined.nii.gz').dataobj[:]
  45. submask = np.multiply(submask, mask)
  46. for ti, task in enumerate(tasklist):
  47. print(subname+' task-'+task)
  48. # time stamps
  49. tst = pd.read_csv(directory+'/bids/'+subname+'/func/'+subname+'_task-'+task+'_events.tsv', sep='\t')
  50. tst['offset'] = tst['onset'] + tst['duration']
  51. tst['onset'] = tst['onset'] + hrf
  52. tst['offset'] = tst['offset'] + hrf
  53. # normalized BOLD time series of all voxels corresponding to each of the cortical & subcortical parcels
  54. epi = load_img(directory + '/derivatives/'+subname+'/'+subname+'_task-'+task+'_smoothed.nii.gz').dataobj[:]
  55. roi_ts = {}
  56. for roi in range(1, nroi_cor+nroi_sub+1):
  57. mask_id = np.where(submask == roi)
  58. ts = np.array([])
  59. ts = epi[mask_id[0], mask_id[1], mask_id[2], :]
  60. # remove time steps that were censored due to motion
  61. for tr in range(ts.shape[1]):
  62. if np.all(ts[:,tr]==0):
  63. ts[:,tr] = np.nan
  64. # normalize each voxel time series
  65. ts = scipy.stats.zscore(ts, axis=1, ddof=1, nan_policy='omit')
  66. roi_ts[roi] = ts
  67. # example
  68. # roi_ts[1][:,int(tst['onset'][0]):int(tst['offset'][0])] # time series of roi=1 during first-event movie watching
  69. # roi_ts[50][:,int(tst['onset'][5]):int(tst['offset'][5])].shape # time series of roi=50 during first-event aha explanation
  70. # roi_ts[50][:,int(tst['onset'][10]):int(tst['offset'][10])].shape # time series of roi=50 during first-character impression

code_extractbold.py at commit b910bab, under MIT · at the source

Overview

  1. Department of Psychology, University of Chicago,Chicago, IL USA
  2. Center for Theoretical and Computational Neuroscience, Washington University in St. Louis,St. Louis, MO USA
  3. Department of Psychology, Yale University,New Haven, CT USA
  4. Neuroscience Institute, University of Chicago,Chicago, IL USA
  5. Institute for Mind and Biology, University of Chicago,Chicago, IL USA
Institutions: University of Chicago (United States); Washington University in St. Louis (United States); Yale University (United States)
Journal: Nature communications, volume 17, issue 1, article 7362
Dates: received 7 April 2025; accepted 22 May 2026; published online 10 June 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41467-026-73914-3 · PMID 42270596 · PMCID PMC13402326 · OpenAlex W4408413088
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: human (organism), cognitive (subfield)
Methods: Statistics, Smoothing, state filtering, decompositions, Connectivity, fMRI & imaging, Machine learning
Keywords: Problem solving, Long-term memory, Human behaviour
MeSH: Brain*, Cerebral Cortex*, Comprehension*, Adult, Brain Mapping, Cognition, Female, Humans, Magnetic Resonance Imaging, Male, Young Adult (* major topic)
Topic: Functional Brain Connectivity Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: cited by 3 papers (Europe PMC); 41 references in the paper

Abstract

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

Repositories

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

Zenodo 19389961

License: CC-BY-4.0
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: “Code availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Matplotlib (5 files), NumPy (5 files), pandas (5 files), SciPy (4 files), seaborn (2 files), BrainIAK (1 file), lme4 (1 file), lmerTest (1 file), Nilearn (1 file), statsmodels (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
7 files
At the source:

hyssong/memoryaha

License: MIT
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: b910bab1d86e24bdeab0af69e0f8f52f2e2689f0, 13 May 2026
Languages: Python (5), R (1)
Size: 21 files, 6 scripts
Software Heritage: not archived
Found in: the Zenodo archive record
Holds: README, license file, environment (environment.yml)
Not found: CITATION.cff, tests, continuous integration, documentation
Tools: Matplotlib (5 files), NumPy (5 files), pandas (5 files), SciPy (4 files), seaborn (2 files), BrainIAK (1 file), lme4 (1 file), lmerTest (1 file), Nilearn (1 file), statsmodels (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
8 files

Code availability statement

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

  • it points to the authors' code: Zenodo 19389961

Read it in the paper: doi.org/10.1038/s41467-026-73914-3.

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:

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

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

Data

Datasets cited

Code and data availability statement

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

Read it in the paper: doi.org/10.1038/s41467-026-73914-3.

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, 5 authors, 3 keywords, 11 MeSH terms, 3 funders, 38 references.

Cite

This paper

Song, H., Ke, J., Madhogarhia, R., Leong, Y. C., & Rosenberg, M. D. (2026). Cortical reinstatement of causally related events sparks narrative insights by updating neural representation patterns. Nature communications, 17(1), 7362. https://doi.org/10.1038/s41467-026-73914-3

BibTeX

@article{song2026cortical,
author = {Song, Hayoung and Ke, Jin and Madhogarhia, Rhea and Leong, Yuan Chang and Rosenberg, Monica D.},
title = {{Cortical reinstatement of causally related events sparks narrative insights by updating neural representation patterns}},
journal = {Nature communications},
year = {2026},
month = jun,
volume = {17},
number = {1},
pages = {7362},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/s41467-026-73914-3},
url = {https://doi.org/10.1038/s41467-026-73914-3},
pmid = {42270596},
pmcid = {PMC13402326}
}

RIS

TY - JOUR
AU - Song, Hayoung
AU - Ke, Jin
AU - Madhogarhia, Rhea
AU - Leong, Yuan Chang
AU - Rosenberg, Monica D.
TI - Cortical reinstatement of causally related events sparks narrative insights by updating neural representation patterns
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/06/10
VL - 17
IS - 1
SP - 7362
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/s41467-026-73914-3
UR - https://doi.org/10.1038/s41467-026-73914-3
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-73914-3",
"type": "article-journal",
"title": "Cortical reinstatement of causally related events sparks narrative insights by updating neural representation patterns",
"container-title": "Nature communications",
"author": [
{
"family": "Song",
"given": "Hayoung"
},
{
"family": "Ke",
"given": "Jin"
},
{
"family": "Madhogarhia",
"given": "Rhea"
},
{
"family": "Leong",
"given": "Yuan Chang"
},
{
"family": "Rosenberg",
"given": "Monica D."
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "7362",
"DOI": "10.1038/s41467-026-73914-3",
"PMID": "42270596",
"PMCID": "PMC13402326",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41467-026-73914-3",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
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.1073/pnas.2512071123 [code]
Narrative "twist" shifts within-individual neural representations of dissociable story features.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: lmerTest, Nilearn, lme4, 6 other tools, cognitive, 7 references
[2] doi:10.1038/s41467-026-73895-3 [code]
Sign language narrative reveals universal and modality-specific features of cortical timescale hierarchy.
Journal: Nature communications
In common: BrainIAK, Nilearn, statsmodels, 5 other tools, cognitive, 5 references
[3] doi:10.1038/s41467-026-71428-6 [code]
Binding items to contexts through conjunctive neural representations with the method of loci.
Journal: Nature communications
In common: lmerTest, Nilearn, lme4, 6 other tools, 3 references
[4] doi:10.1371/journal.pbio.3003684 [code]
The retrieval of previously learned motor memories is facilitated by the reinstatement of default mode network manifold structures.
Journal: PLoS biology
In common: Nilearn, seaborn, pandas, 3 other tools, cognitive, 5 references
[5] doi:10.1371/journal.pbio.3003666 [code]
Emotion regulation success involves systematic gradient-based reconfigurations of large-scale activation patterns in the human brain.
Journal: PLoS biology
In common: lmerTest, Nilearn, lme4, 6 other tools, cognitive
[6] doi:10.1162/imag.a.105 [code]
Right posterior theta reflects human parahippocampal phase resetting by salient cues during goal-directed navigation
Journal: n/a
In common: lmerTest, Nilearn, lme4, 6 other tools, cognitive
[7] doi:10.1038/s41467-026-76452-0 [code]
Music evokes shared neural representations of imagined narratives across sensory modalities.
Journal: Nature communications
In common: Nilearn, statsmodels, seaborn, 4 other tools, cognitive, 3 references
[8] doi:10.1162/imag.a.1278 [code]
Young and old adult brains experience opposite effects of acute sleep restriction on the functional connectivity network.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: Nilearn, lme4, statsmodels, 5 other tools, 2 references
[9] doi:10.1038/s41467-026-74357-6 [code]
Hippocampo-neocortical interaction as compressive retrieval-augmented generation.
Journal: Nature communications
In common: statsmodels, seaborn, pandas, 3 other tools, 3 references
[10] doi:10.1038/s42003-026-09794-6 [code]
The role of dorsal anterior cingulate cortex in dynamic attitude changes in naturalistic settings.
Journal: Communications biology
In common: Nilearn, statsmodels, seaborn, 4 other tools, 3 references

Contribute

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

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

Request its removal

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

Discussion, reproductions, activity

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

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

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