Cortical reinstatement of causally related events sparks narrative insights by updating neural representation patterns.
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] § Methods › FMRI image preprocessing ↔ code/code_extractbold.py, lines 32–82 · score 0.81 · head motion, brain mask, fMRI, BIDS, movie, EPI
- [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] § Methods › Parcellation ↔ code/code_extractbold.py, lines 32–82 · score 0.69 · brain mask, subcortical parcels, fMRI, EPI, voxels
- [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
- # extracting voxel time series after applying a parcel mask to preprocessed EPIs
- # Nov 24, 2024, Hayoung Song
- # preprocessed fMRI data can be downloaded from: https://openneuro.org/datasets/ds005658
- import numpy as np
- from nilearn.image import load_img
- import matplotlib.pyplot as plt
- import scipy.stats
- import pandas as pd
- def niftimask(nroi_cor, nroi_sub, directory):
- cortical = directory+'/template/tpl-MNI152NLin2009cAsym/tpl-MNI152NLin2009cAsym_res-02_atlas-Schaefer2018_desc-'+str(nroi_cor)+'Parcels17Networks_dseg.nii.gz'
- if nroi_sub==16: subcortical = directory+'/template/Tian2020MSA_v1.1_3T_Subcortex-Only/Tian_Subcortex_S1_3T_2009cAsym.nii.gz'
- elif nroi_sub==32: subcortical = directory+'/template/Tian2020MSA_v1.1_3T_Subcortex-Only/Tian_Subcortex_S2_3T_2009cAsym.nii.gz'
- elif nroi_sub == 50: subcortical = directory + '/template/Tian2020MSA_v1.1_3T_Subcortex-Only/Tian_Subcortex_S3_3T_2009cAsym.nii.gz'
- elif nroi_sub == 54: subcortical = directory + '/template/Tian2020MSA_v1.1_3T_Subcortex-Only/Tian_Subcortex_S4_3T_2009cAsym.nii.gz'
- mask_cor = load_img(cortical).dataobj[:]
- mask_sub = load_img(subcortical).dataobj[:]
- for i1 in range(mask_sub.shape[0]):
- for i2 in range(mask_sub.shape[1]):
- for i3 in range(mask_sub.shape[2]):
- if mask_sub[i1,i2,i3]>0:
- mask_sub[i1,i2,i3] = mask_sub[i1,i2,i3] + nroi_cor
- id = np.where(np.multiply(mask_cor, mask_sub)>0)
- mask = mask_cor + mask_sub
- mask[id[0],id[1],id[2]] = 0
- return mask
- ''' setting '''
- flist = {}
- 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']
- 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'
- 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'
- tasklist = ['01','02','03','04','05','06','07','08','09','10']
- # sub-2030, sub-3010, sub-3028: large head motion participants
- # sub-1023 task-03: only movie watching portion was recorded
- nsubj = len(flist[1])+len(flist[2])+len(flist[3])
- directory = '/foldername'
- nroi_cor, nroi_sub = 100, 16
- hrf = 4 # 4TR = 4.8s
- mask = niftimask(nroi_cor, nroi_sub, directory)
- for groupid in range(1, 3+1):
- run = np.array(pd.read_csv(directory+'/socialaha-fMRI/socialaha_groupscene.csv')['run'])
- scene = np.array(pd.read_csv(directory+'/socialaha-fMRI/socialaha_groupscene.csv')['g'+str(groupid)+'.sceneid'])
- for si, subname in enumerate(flist[groupid]):
- # parcel mask is multiplied by each participant's brain mask applied during preprocessing
- submask = load_img(directory+'/masks/'+subname+'/'+subname+'_combined.nii.gz').dataobj[:]
- submask = np.multiply(submask, mask)
- for ti, task in enumerate(tasklist):
- print(subname+' task-'+task)
- # time stamps
- tst = pd.read_csv(directory+'/bids/'+subname+'/func/'+subname+'_task-'+task+'_events.tsv', sep='\t')
- tst['offset'] = tst['onset'] + tst['duration']
- tst['onset'] = tst['onset'] + hrf
- tst['offset'] = tst['offset'] + hrf
- # normalized BOLD time series of all voxels corresponding to each of the cortical & subcortical parcels
- epi = load_img(directory + '/derivatives/'+subname+'/'+subname+'_task-'+task+'_smoothed.nii.gz').dataobj[:]
- roi_ts = {}
- for roi in range(1, nroi_cor+nroi_sub+1):
- mask_id = np.where(submask == roi)
- ts = np.array([])
- ts = epi[mask_id[0], mask_id[1], mask_id[2], :]
- # remove time steps that were censored due to motion
- for tr in range(ts.shape[1]):
- if np.all(ts[:,tr]==0):
- ts[:,tr] = np.nan
- # normalize each voxel time series
- ts = scipy.stats.zscore(ts, axis=1, ddof=1, nan_policy='omit')
- roi_ts[roi] = ts
- # example
- # roi_ts[1][:,int(tst['onset'][0]):int(tst['offset'][0])] # time series of roi=1 during first-event movie watching
- # roi_ts[50][:,int(tst['onset'][5]):int(tst['offset'][5])].shape # time series of roi=50 during first-event aha explanation
- # 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
- Department of Psychology, University of Chicago,Chicago, IL USA
- Center for Theoretical and Computational Neuroscience, Washington University in St. Louis,St. Louis, MO USA
- Department of Psychology, Yale University,New Haven, CT USA
- Neuroscience Institute, University of Chicago,Chicago, IL USA
- Institute for Mind and Biology, University of Chicago,Chicago, IL USA
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
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
7 files
- code/
code_ahahmmreinst.py , Python, 104 lines - code/
code_ahahmmreinst_stats. , R, 51 linesR - code/
code_ahasynchrony.py , Python, 119 lines - code/
code_causalitymemory.py , Python, 76 lines - code/
code_extractbold.py , Python, 87 lines - code/
code_hmm.py , Python, 175 lines - README.md, Text, 52 lines
hyssong/memoryaha
b910bab1d86e24bdeab0af69e0f8f52f2e2689f0, 13 May 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
8 files
- code/
code_ahahmmreinst.py , Python, 104 lines - code/
code_ahahmmreinst_stats. , R, 51 lines, 2 matchesR - code/
code_ahasynchrony.py , Python, 119 lines - code/
code_causalitymemory.py , Python, 76 lines - code/
code_extractbold.py , Python, 87 lines, 2 matches - code/
code_hmm.py , Python, 175 lines - LICENSE, License, 21 lines
- README.md, Text, 52 lines
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
- openneuro:ds005658, at OpenNeuro; found in “Data availability”
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:
- it points to a dataset: OpenNeuro ds005658
- it points to the authors' code: Zenodo 19389961
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://
BibTeX
@article{song2026cortica
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/
url = {https://
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/
VL - 17
IS - 1
SP - 7362
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"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":
"volume": "17",
"issue": "1",
"page": "7362",
"DOI": "10.1038/
"PMID": "42270596",
"PMCID": "PMC13402326",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://
"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 AmericaIn 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 communicationsIn 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 communicationsIn 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 biologyIn 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 biologyIn 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 navigationJournal: n/aIn 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 communicationsIn 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 communicationsIn 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 biologyIn 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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 12 scripts, and 4 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:e123c63c41132246…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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.
