Sign language narrative reveals universal and modality-specific features of cortical timescale hierarchy.
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
Jupyter notebook · 342 lines · 10 KB · no license
- # %%
- import os
- import glob
- import numpy as np
- import pandas as pd
- import matplotlib.pyplot as plt
- import seaborn as sns
- from nltools.stats import regress, zscore
- from nltools.data import Brain_Data, Design_Matrix
- from nltools.stats import find_spikes
- from nltools.mask import expand_mask
- # %%
- from nilearn import datasets
- from nilearn import image
- dataset_ho = datasets.fetch_atlas_harvard_oxford("cort-maxprob-thr25-2mm", data_dir=None, symmetric_split=True, resume=True, verbose=1)
- dataset_ju = datasets.fetch_atlas_juelich("maxprob-thr0-2mm")
- dataset_ju=datasets.fetch_atlas_juelich("maxprob-thr0-2mm", data_dir=None, symmetric_split=True, resume=True, verbose=1)
- atlas_ho_filename = dataset_ho.filename
- atlas_ju_filename = dataset_ju.filename
- labels = dataset_ho["labels"]
- print(f"Atlas ROIs are located at: {atlas_ho_filename}")
- print(f"Atlas ROIs are located at: {atlas_ju_filename}")
- from nilearn import plotting
- plotting.plot_roi(
- atlas_ho_filename, view_type="contours", title="Juelich atlas in contours"
- )
- plotting.show()
- # %%
- atlas_filename =dataset_ho["maps"]
- print(atlas_filename.shape)
- # Loading atlas dadataset_juta stored in 'labels'
- labels = dataset_ho["labels"]
- print(len(labels))
- print(labels)
- # %%
- from nilearn.datasets import fetch_atlas_harvard_oxford
- from nilearn.maskers import NiftiLabelsMasker
- from nilearn.image import load_img, index_img, resample_to_img
- ho = dataset_ju
- ho_img = ho.maps
- ho_img_resampled = resample_to_img(ho_img, nii_img, interpolation='nearest')
- ho_data = ho_img_resampled.get_fdata()
- ho_labels = ho.labels
- data_dictionary = {}
- for index,label in enumerate(ho_labels):
- print(index,label)
- if index == 0: # Skip background
- continue
- ho_region = (ho_data==index)
- nii_data_in_region = nii_data[ho_region,:]
- data_dictionary[label] = nii_data_in_region
- # %%
- # Load Image
- from nilearn import image
- #bilateral_mask_path = '/path/to/mask.nii.gz'
- bilateral_mask = image.load_img(atlas_ju_filename)
- mask_data = bilateral_mask.get_fdata()
- affine = bilateral_mask.affine
- # %%
- # Get center X-coord
- import os
- x_dim = mask_data.shape[0]
- x_center = int(x_dim/2)
- plotting.plot_img(bilateral_mask, title='Bilateral Mask')
- plotting.show()
- # Get left mask
- mask_data_left = mask_data.copy()
- mask_data_left[0:x_center,:,:] = 0
- mask_left = image.new_img_like(bilateral_mask, mask_data_left, affine=affine, copy_header=True)
- plotting.plot_img(mask_left, title='Left Mask')
- plotting.show()
- os.chdir('/Users/marysia/dropbox/PJM/masks')
- mask_left.to_filename('left_mask.nii.gz')
- # Get right mask
- mask_data_right = mask_data.copy()
- mask_data_right[x_center:,:,:] = 0
- mask_right = image.new_img_like(bilateral_mask, mask_data_right, affine=affine, copy_header=True)
- plotting.plot_img(mask_right, title='Right Mask')
- plotting.show()
- bilateral_mask.to_filename('mask_J.nii.gz')
- # %%
- def get_file_names1(data_dir_, task_name_, verbose = False):
- """
- Get all the participant file names
- Parameters
- ----------
- data_dir_ [str]: the data root dir
- task_name_ [str]: the name of the task
- Return
- ----------
- fnames_ [list]: file names for all subjs
- """
- upper_limit_n_subjs=22
- c_ = 0
- fnames_ = []
- # Collect all file names
- #these are natives
- #for subj in [1,2,5,6,7,8,9,10,11,13,14,15,16,23,24,25,26,27,29,30]:
- for subj in [1,2,3,4,5,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21]:
- #late signers
- #
- #for subj in [2,3,4,6,5,6,8,9,12,13,14,15,16,17,18,20,21]:
- #
- #for subj in range(1, n_subjs_total):
- #fname = os.path.join(
- #data_dir_, 'sub-%.2d/func/sub-%.2d_run-6_denoise_smooth6mm_task-%s_desc-preproc_bold.nii.gz' % (subj, subj, task_name_))
- fname = os.path.join(
- #data_dir_, 'sub-deaf%.2d/func/sub-deaf%.2d_denoise_smooth6mm_task-%s_MNI152NLin2009cAsym_desc-preproc_bold.nii.gz' % (subj, subj, task_name_))
- data_dir_, 'sub-deaf%.2d/func/sub-deaf%.2d_denoise_smooth6mm_task-%s_MNI152NLin2009cAsym_desc-preproc_bold.nii.gz' % (subj, subj, task_name_))
- #data_dir_, 'sub-%.3d/sub-%.3d-task-%s.nii.gz' % (subj, subj, task_name_))
- print(fname)
- # If the file exists
- if os.path.exists(fname):
- # Add to the list of file names
- fnames_.append(fname)
- if verbose:
- print(fname)
- c_+= 1
- if c_ >= upper_limit_n_subjs:
- break
- return fnames_
- # %%
- my_list=[]
- from nilearn import plotting
- from brainiak import io
- from nilearn.image import resample_to_img
- dir_mask='/Users/marysia/dropbox/PJM/masks'
- mask_name = os.path.join(dir_mask, 'MNI152_T1_3mm_Brain_mask.nii')
- import nibabel.processing
- isrsa_nn2=np.load('/Users/marysia/dropbox/PJM/results/whole_brain_isc/isc/Correlations/rs_pseudo.npy')
- brain_mask = nib.load(mask_name)
- brain_mask = io.load_boolean_mask(mask_name)
- # Get the list of nonzero voxel coordinates
- coords = np.where(brain_mask)
- # Load the brain nii image
- brain_nii = nib.load(mask_name)
- print(brain_nii.shape)
- import os
- base_dir='/Users/marysia/dropbox/PJM/fmriprep/'
- #datad = image.load_img(atlas_ho_filename)
- import nibabel as nib
- datad= nib.load(os.path.join('/Users/marysia/dropbox/PJM/masks/','FFA2.nii.gz'))
- print(datad.shape)
- datad= resample_to_img(datad, brain_nii)
- mask=Brain_Data(datad)
- file_list = glob.glob(os.path.join(base_dir, '*', 'func', f'*denoise_smooth6mm_task-intact22_MNI152NLin2009cAsym_desc-preproc_bold.nii.gz'))
- print(file_list)
- for f in file_list:
- sub = os.path.basename(f).split('_')[0]
- data = Brain_Data(f)
- roi = data.extract_roi(mask)
- pd.DataFrame(roi.T).to_csv(os.path.join(os.path.dirname(f),'ffa2_intact2.csv'), index=False)
- # %%
- my_list=[]
- import os
- base_dir='/Users/marysia/dropbox/PJM/fmriprep/'
- datad = image.load_img(atlas_ho_filename)
- datad= nib.load(FFA1.nii.gz)
- mask=Brain_Data(datad)
- print(mask)
- mask_x = expand_mask(mask)
- file_list = glob.glob(os.path.join(base_dir, '*', 'func', f'*denoise_smooth6mm_task-intact22_MNI152NLin2009cAsym_desc-preproc_bold.nii.gz'))
- print(file_list)
- for f in file_list:
- sub = os.path.basename(f).split('_')[0]
- data = Brain_Data(f)
- roi = data.extract_roi(mask)
- pd.DataFrame(roi.T).to_csv(os.path.join(os.path.dirname(f),'harvard_intact2.csv'), index=False)
- # %%
- my_list=[]
- import os
- base_dir='/Users/marysia/dropbox/PJM/fmriprep/'
- datad = image.load_img(atlas_ho_filename)
- mask=Brain_Data(datad)
- mask_x = expand_mask(mask)
- file_list = glob.glob(os.path.join(base_dir, '*', 'func', f'*denoise_smooth6mm_task-sentences2_MNI152NLin2009cAsym_desc-preproc_bold.nii.gz'))
- print(file_list)
- for f in file_list:
- sub = os.path.basename(f).split('_')[0]
- data = Brain_Data(f)
- roi = data.extract_roi(mask)
- pd.DataFrame(roi.T).to_csv(os.path.join(os.path.dirname(f),'harvard_sentences2.csv'), index=False)
- # %%
- my_list=[]
- import os
- base_dir='/Users/marysia/dropbox/PJM/fmriprep/'
- datad = image.load_img(atlas_ho_filename)
- mask=Brain_Data(datad)
- mask_x = expand_mask(mask)
- file_list = glob.glob(os.path.join(base_dir, '*', 'func', f'*denoise_smooth6mm_task-words2_MNI152NLin2009cAsym_desc-preproc_bold.nii.gz'))
- print(file_list)
- for f in file_list:
- sub = os.path.basename(f).split('_')[0]
- data = Brain_Data(f)
- roi = data.extract_roi(mask)
- pd.DataFrame(roi.T).to_csv(os.path.join(os.path.dirname(f),'harvard_words2.csv'), index=False)
- # %%
- my_list=[]
- import os
- base_dir='/Users/marysia/dropbox/PJM/fmriprep/'
- datad = image.load_img(atlas_ho_filename)
- mask=Brain_Data(datad)
- mask_x = expand_mask(mask)
- file_list = glob.glob(os.path.join(base_dir, '*', 'func', f'*denoise_smooth6mm_task-pseudo2_MNI152NLin2009cAsym_desc-preproc_bold.nii.gz'))
- print(file_list)
- for f in file_list:
- sub = os.path.basename(f).split('_')[0]
- data = Brain_Data(f)
- roi = data.extract_roi(mask)
- pd.DataFrame(roi.T).to_csv(os.path.join(os.path.dirname(f),'harvard_pseudo2.csv'), index=False)
- # %%
- from brainiak import isc
- time_series={}
- aa=[]
- file_list = glob.glob(os.path.join(base_dir, '*', 'func', f'*denoise_smooth6mm_task-pseudo_MNI152NLin2009cAsym_desc-preproc_bold.nii.gz'))
- print(file_list)
- for f in file_list:
- sub = os.path.basename(f).split('_')[0]
- part4 = pd.read_csv(os.path.join(base_dir, sub ,'func', 'ffa1_intact2.csv' ))
- part4.reset_index(inplace=True, drop=True)
- aa.append(part4)
- time_series[sub] = part4
- print(len(aa))
- np.stack((aa))
- print(np.shape(aa))
- roi_new=np.transpose(aa, (1, 2, 0))
- print(np.shape(roi_new))
- isc1 = isc.isc(roi_new, summary_statistic=None, pairwise=False)
- os.chdir('/Users/marysia/dropbox/PJM/')
- np.save('ffa1_ISC_pseudo2',isc1)
- df = pd.DataFrame(isc1)
- #labels = dataset_ho["labels"]
- #print(labels)
- ##df.columns = labels[1:97]
- #df.insert(loc=0, column='SUB', value=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])
- df.to_csv('ISC_ffa1.csv', index=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])
- # %%
- import numpy as np
- import pandas as pd
- import os
- os.chdir('/Users/marysia/dropbox/PJM/')
- a=pd.read_csv('ISC_harvard_words2.csv')
- b=pd.read_csv('ISC_harvard_sentences2.csv')
- c=pd.read_csv('ISC_harvard_pseudo2.csv')
- d=pd.read_csv('ISC_harvard_intact2.csv')
- cond= ['intact'] * 20
- cond1= ['sentences'] * 20
- cond2= ['words'] * 20
- cond3= ['pseudo'] * 20
- cond4=cond+cond1+cond2+cond3
- print(cond4)
- df.to_csv('ISC_ho_words.csv', index=None)
- df= pd.concat([d,b,a,c])
- new_labels = list(range(1, 97))
- new_labels1=[]
- for i in new_labels:
- new_labels1.append(str(i))
- df.insert(loc=0, column='cond', value=cond4)
- #new_labels=['cond','no','SUB']+new_labels
- #df.columns = new_labels
- print(df)
- df.to_csv('ISC_ho_all_rois123.csv', index=None)
- # %%
- print(labels[1:97])
- print(df)
- # %%
- new_labels = list(range(1, 97))
- new_labels1=[]
- for i in new_labels:
- new_labels1.append(str(i))
- print(labels)
- print(new_labels1[1:97])
- df=pd.melt(df, id_vars=['SUB','cond'], value_vars=labels[1:97])
- #df = pd.melt(df, id_vars='SUB')
- df.to_csv('ISC_ho_all_long.csv', index=None)
- # %%
- #view updated DataFrame
- df
- cond= ['words'] * 1920
- df.insert(loc=0, column='cond', value=cond)
- df.to_csv('ISC_ho_words.csv', index=None)
- # %%
- import os
- import pandas as pd
- os.chdir('/Users/marysia/dropbox/PJM/ROI')
- df = pd.read_csv("ISC_lang.csv", sep=';')
- print(df)
- df1 = df[df["ROI"] == "Mask07"]
- print(df1)
- df2=df1.pivot(index='Subject', columns='Condition', values='ISC')
- print(df2)
- df2.to_csv('ISC_lang_06.csv', index=None)
ROI_analysis.ipynb, no license · at the source
Overview
- Department of Psychology, University of Warsaw,Warsaw, Poland
- Department of Psychological and Brain Sciences, Johns Hopkins University,Baltimore, US
- Laboratory of Brain Imaging, Nencki Institute for Experimental Biology,Warsaw, Poland
- Institute of Psychology, Jagiellonian University,Kraków, Poland
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.
Repository
Its files are read in the Code ↔ Paper reader above.
OSF n8sv3
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
2 files
- code/
ROI_analysis.ipynb , Jupyter, 342 lines - code/
lateralization_analysis. , Jupyter, 802 linesipynb
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: OSF n8sv3
Read it in the paper: doi.org/10.1038/s41467-026-73895-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:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 2 scripts, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- 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
No dataset and no data link were found in the paper.
Data availability statement
The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- no repository, dataset or request procedure was recognized in it
Read it in the paper: doi.org/10.1038/s41467-026-73895-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, 2 keywords, 14 MeSH terms, 1 funder, 71 references.
Cite
This paper
Zimmermann, M., Tomaszewski, P., Marchewka, A., Szwed, M., & Bedny, M. (2026). Sign language narrative reveals universal and modality-specific features of cortical timescale hierarchy. Nature communications, 17(1), 7126. https://
BibTeX
@article{zimmermann2026s
author = {Zimmermann, Maria and Tomaszewski, Piotr and Marchewka, Artur and Szwed, Marcin and Bedny, Marina},
title = {{Sign language narrative reveals universal and modality-specific features of cortical timescale hierarchy}},
journal = {Nature communications},
year = {2026},
month = jun,
volume = {17},
number = {1},
pages = {7126},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/
url = {https://
pmid = {42236497},
pmcid = {PMC13396480}
}
RIS
TY - JOUR
AU - Zimmermann, Maria
AU - Tomaszewski, Piotr
AU - Marchewka, Artur
AU - Szwed, Marcin
AU - Bedny, Marina
TI - Sign language narrative reveals universal and modality-specific features of cortical timescale hierarchy
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/
VL - 17
IS - 1
SP - 7126
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Sign language narrative reveals universal and modality-specific features of cortical timescale hierarchy",
"container-title": "Nature communications",
"author": [
{
"family": "Zimmermann",
"given": "Maria"
},
{
"family": "Tomaszewski",
"given": "Piotr"
},
{
"family": "Marchewka",
"given": "Artur"
},
{
"family": "Szwed",
"given": "Marcin"
},
{
"family": "Bedny",
"given": "Marina"
}
],
"container-title-short":
"volume": "17",
"issue": "1",
"page": "7126",
"DOI": "10.1038/
"PMID": "42236497",
"PMCID": "PMC13396480",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
3
]
]
}
}
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.1093/cercor/bhad106 [code]
- Individual differences in neural event segmentation of continuous experiences.Journal: Cerebral cortex (New York, N.Y. : 1991)In common: BrainIAK, nltools, Nilearn, 7 other tools, fMRI, 6 references
- [2] 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, NiBabel, 5 other tools, 9 references
- [3] doi:10.1038/s41467-023-39862-y [code]
- The default network dominates neural responses to evolving movie stories.Journal: Nature communicationsIn common: Nilearn, NiBabel, seaborn, 4 other tools, cognitive, 9 references
- [4] doi:10.1101/2024.12.03.626542 [code]
- Inter-subject correlations and their behavioral associations vary across movies: Implications for generalizabilityJournal: bioRxiv (preprint)In common: nltools, Nilearn, statsmodels, 6 other tools, fMRI, 6 references
- [5] doi:10.1162/imag.a.1116 [code]
- Context modulates brain state dynamics and behavioral responses during narrative comprehension.Journal: Imaging neuroscience (Cambridge, Mass.)In common: Nilearn, statsmodels, NiBabel, 5 other tools, fMRI, 8 references
- [6] doi:10.1016/j.isci.2024.109844 [code]
- Reward-related regions play a role in natural story comprehension.Journal: iScienceIn common: BrainIAK, nltools, Nilearn, 7 other tools, 3 references
- [7] 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: Nilearn, statsmodels, NiBabel, 5 other tools, fMRI, cognitive, 7 references
- [8] doi:10.7554/elife.101944 [code]
- Animacy semantic network supports causal inferences about illness.Journal: eLifeIn common: NiBabel, pandas, SciPy, 2 other tools, fMRI, cognitive, 9 references
- [9] doi:10.1073/pnas.2420105122 [code]
- Emergence of a temporal processing gradient from naturalistic inputs and network connectivity.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: BrainIAK, seaborn, pandas, 3 other tools, fMRI, 7 references
- [10] doi:10.1038/s41467-026-71151-2 [code]
- Common and distinct neural correlates of social interaction processing and theory of mind in narratives.Journal: Nature communicationsIn common: nltools, Nilearn, statsmodels, 6 other tools, cognitive, 5 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: 1 repository of the authors' code, each at its verified commit and with its license, 2 scripts, and 0 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:da8ec54792dda139…
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-73895-3)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1038/s41467-026-73895-3.svg
:target: https://openscicode.org/badge/doi/10.1038/s41467-026-73895-3
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41467-026-73895-3"><img src="https://openscicode.org/badge/doi/10.1038/s41467-026-73895-3.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->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)
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
