Cortical reinstatement of causally related events sparks narrative insights by updating neural representation patterns.
2 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.
The 4 matches · 2 of them tie a paragraph to a whole file without given lines: weak matches, whose lines are not tinted
- [1] § Methods › FMRI image preprocessing ↔ code/code_extractbold.py, lines 32 to 82 · score 0.81 · head motion, brain mask, fMRI, BIDS, movie, EPI · block
oscr:b:NR5F2BZEJP63D-2· Report a mismatch - [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 · block
oscr:b:4768APFQZGQH8-6· Report a mismatch - [3] § Methods › Parcellation ↔ code/code_extractbold.py, lines 32 to 82 · score 0.69 · brain mask, subcortical parcels, fMRI, EPI, voxels · block
oscr:b:NR5F2BZEJP63D-2· Report a mismatch - [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 · block
oscr:b:4768APFQZGQH8-6· Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: 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 Portfolio},
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 Portfolio
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 Portfolio",
"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.7554/elife.85487 [code]
- Large-scale neural dynamics in a shared low-dimensional state space reflect cognitive and attentional dynamics.Journal: eLifeIn common: Nilearn, statsmodels, seaborn, 4 other tools, cognitive, 6 references, 2 authors
- [2] doi:10.1093/cercor/bhad106 [code]
- Individual differences in neural event segmentation of continuous experiences.Journal: Cerebral cortex (New York, N.Y. : 1991)In common: BrainIAK, lmerTest, Nilearn, 7 other tools, 6 references
- [3] 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
- [4] doi:10.1038/s42003-025-08377-1 [code]
- Hippocampal systems for event encoding and sequencing during ongoing narrative comprehension.Journal: Communications biologyIn common: statsmodels, seaborn, pandas, 3 other tools, 6 references, author Hayoung Song
- [5] doi:10.1371/journal.pcbi.1012994 [code]
- Dynamic brain connectivity predicts emotional arousal during naturalistic movie-watching.Journal: PLoS computational biologyIn common: seaborn, pandas, SciPy, 2 other tools, cognitive, 1 reference, 2 authors
- [6] 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
- [7] doi:10.7554/elife.69430 [code]
- Developmental changes in story-evoked responses in the neocortex and hippocampus.Journal: eLifeIn common: BrainIAK, Nilearn, statsmodels, 5 other tools, 5 references
- [8] doi:10.1093/cercor/bhad015 [code]
- Neural unscrambling of temporal information during a nonlinear narrative.Journal: Cerebral cortex (New York, N.Y. : 1991)In common: BrainIAK, Nilearn, statsmodels, 5 other tools, 4 references
- [9] doi:10.1371/journal.pbio.3003268 [code]
- Transfer of motor learning is associated with patterns of activity in the default mode network.Journal: PLoS biologyIn common: Nilearn, statsmodels, seaborn, 4 other tools, 7 references
- [10] doi:10.1038/s41467-024-49173-5 [code]
- Shared functional specialization in transformer-based language models and the human brain.Journal: Nature communicationsIn common: Nilearn, statsmodels, seaborn, 4 other tools, 6 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:ce82fe8f03273433…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.1038/s41467-026-73914-3)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1038/s41467-026-73914-3.svg
:target: https://openscicode.org/badge/doi/10.1038/s41467-026-73914-3
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41467-026-73914-3"><img src="https://openscicode.org/badge/doi/10.1038/s41467-026-73914-3.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".
If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge 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: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
