Spec-RWKV: A Spectrum-Guided Multi-Scale Recurrent Modeling Framework for Multi-Center Resting-State fMRI-Assisted Diagnosis.
The 8 matches · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
- [1] § 2. Materials and Methods › 2.1. Datasets › 2.1.1. ABIDE-I ↔ Dataset/Prep/prep_abide.py, lines 107–179 · score 0.92 · global signal regression, band pass filtering, CPAC pipeline, fMRI, PCP, quality
- [2] § 2. Materials and Methods › 2.3. Spec-RWKV Framework › 2.3.4. Training Objectives and Optimization Strategy ↔ Models/spec_rwkv/model.py, lines 49–143 · score 0.74 · Asymmetric Focal Loss, learning rate scheduling, Adam, Optimization, classification, training
- [3] § 2. Materials and Methods › 2.3. Spec-RWKV Framework › 2.3.2. Temporal Backbone: RWKV Recurrent Attention and PrismTimeMix ↔ Models/spec_rwkv/rwkv_block.py, lines 141–267 · score 0.66 · step decay rates, physical half, PrismTimeMix, heads, RWKV, TR
- [4] § 2. Materials and Methods › 2.3. Spec-RWKV Framework › 2.3.4. Training Objectives and Optimization Strategy ↔ Models/spec_rwkv/hyperparams.py, the whole file · a weak match · score 0.65 · Asymmetric Focal Loss, diversity, auxiliary, Optimization, resampling, classification
- [5] § 3. Results › 3.1. Experimental Settings and Evaluation Metrics › 3.1.2. Evaluation Metrics ↔ Models/spec_rwkv/model.py, lines 613–666 · score 0.59 · binary classification, ACC, TN, TP, FN, FP
- [6] § 2. Materials and Methods › 2.3. Spec-RWKV Framework › 2.3.3. Spectral Branch and Spectrum-Guided Temporal Aggregation ↔ Models/spec_rwkv/hyperparams.py, the whole file · a weak match · score 0.57 · Gated Fusion, spectral contributions, GFU, dimension, weight, Branch
- [7] § 2. Materials and Methods › 2.1. Datasets › 2.1.2. ADHD-200 ↔ Dataset/Prep/prep_abide.py, lines 107–179 · score 0.56 · phenotypic information, fMRI, quality, Global
- [8] § 3. Results › 3.1. Experimental Settings and Evaluation Metrics › 3.1.1. Experimental Settings ↔ Models/spec_rwkv/rwkv_block.py, lines 141–267 · score 0.55 · physical half lives, PrismTimeMix, learnable, modulation, zero, heads
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 · 181 lines · 6.7 KB · no license · 2 matches
- import os
- from concurrent.futures import ProcessPoolExecutor
- from functools import partial
- import nilearn as nil
- import nilearn.datasets
- import nilearn.image
- from glob import glob
- import pandas
- import torch
- from tqdm import tqdm
- try:
- from .prep_atlas import prep_atlas
- except ImportError:
- from prep_atlas import prep_atlas
- from nilearn.input_data import NiftiLabelsMasker
- datadir = "./Dataset/Data"
- def parse_schaefer_labels_to_roi2net(labels, merge_7net=True):
- """
- labels: list of strings length N (1-based or 0-based names)
- returns: roi2net list of ints length N, mapping dict network->id, network_names list
- """
- if labels is None:
- raise ValueError("labels is None; cannot parse roi->network mapping")
- # ensure list of str
- lab_list = [str(l) for l in labels]
- canonical7 = ['Vis', 'SomMot', 'DorsAttn', 'SalVentAttn', 'Limbic', 'Cont', 'Default']
- mapping = {}
- roi2net = []
- for lab in lab_list:
- # typical label like "7Networks_LH_Vis_1" or "17Networks_LH_ContA_1"
- parts = lab.split('_')
- token = parts[2] if len(parts) >= 3 else lab
- if merge_7net and parts[0].startswith('7Networks'):
- matched = None
- for name in canonical7:
- if token.startswith(name):
- matched = name
- break
- token = matched if matched is not None else token
- # assign id
- if token not in mapping:
- mapping[token] = len(mapping)
- roi2net.append(mapping[token])
- network_names = [k for k, v in sorted(mapping.items(), key=lambda kv: kv[1])]
- # If atlas labels included a 'Background' token (common: labels length == n_rois + 1),
- # normalize by removing the background entry so roi2net length matches expected ROI count.
- if len(roi2net) > 0 and (network_names and network_names[0].lower().startswith("background") or (len(roi2net) % (len(network_names) if len(network_names)>0 else 1) == 1)):
- # heuristic: if first label is Background, drop it
- if lab_list[0].lower().startswith("background") or lab_list[0].lower().startswith("bg"):
- roi2net = roi2net[1:]
- # no change to mapping ids, but ensure network_names reflect mapping keys order
- network_names = [k for k, v in sorted(mapping.items(), key=lambda kv: kv[1])]
- return roi2net, mapping, network_names
- def _extract_subject(scan_path, atlas_map_path, phenoInfos):
- """
- Extract ROI time series and phenotypic information for one subject.
- This helper is designed for parallel preprocessing.
- """
- if ".gz" not in scan_path:
- return None
- try:
- # 1. Load the image and extract ROI signals.
- scanImage = nil.image.load_img(scan_path)
- masker = NiftiLabelsMasker(atlas_map_path)
- roiTimeseries = masker.fit_transform(scanImage)
- # 2. Extract acquisition metadata.
- header_zooms = scanImage.header.get_zooms()
- # TR is usually stored in the 4th zoom entry (index 3).
- tr = float(header_zooms[3]) if len(header_zooms) > 3 else None
- n_volumes = scanImage.shape[-1]
- # Compute total scan duration: Duration = TR × N.
- duration = tr * n_volumes if tr is not None else None
- # 3. Match phenotypic information.
- subjectId = scan_path.split("_")[-3][2:]
- pheno = phenoInfos.get(subjectId, {})
- return {
- "roiTimeseries": roiTimeseries,
- "pheno": {
- "subjectId": subjectId,
- "tr": tr,
- "n_volumes": n_volumes,
- "duration": duration,
- **pheno,
- },
- }
- except Exception as e:
- import traceback
- error_msg = f"Error processing {scan_path}: {type(e).__name__}: {e}"
- print(error_msg)
- # Print a short traceback for debugging.
- print(f" Traceback: {traceback.format_exc().splitlines()[-1]}")
- return None
- def prep_abide(atlas, num_workers=None):
- """
- Prepare the ABIDE-I dataset.
- Steps:
- 1) Download or load the requested atlas and build the ROI mask.
- 2) Download ABIDE PCP functional images if they are not already cached
- locally (CPAC pipeline, no filtering, no global signal regression).
- 3) Traverse 4D fMRI scans, extract ROI time series with the atlas, and
- save them together with phenotypic information.
- Args:
- atlas (str): Atlas identifier. Currently supports "schaefer7_400".
- Returns:
- None. Processed data files are written under Dataset/Data.
- """
- bulkDataDir = "{}/Bulk/ABIDE".format(datadir)
- atlasImage, atlas_map_path, labels = prep_atlas(atlas)
- # Always call fetch_abide_pcp: nilearn uses its cache and downloads only
- # missing files, so interrupted downloads can resume cleanly.
- nil.datasets.fetch_abide_pcp(
- data_dir=bulkDataDir,
- pipeline="cpac",
- band_pass_filtering=False,
- global_signal_regression=False,
- derivatives="func_preproc",
- quality_checked=True,
- )
- dataset = []
- temp = pandas.read_csv(bulkDataDir + "/ABIDE_pcp/Phenotypic_V1_0b_preprocessed1.csv").to_numpy()
- phenoInfos = {}
- for row in temp:
- phenoInfos[str(row[2])] = {"site": row[5], "age" : row[9], "disease" : row[7], "gender" : row[10]}
- print("\n\nStarting Parallel ROI Extraction...\n\n")
- scan_files = sorted(glob(bulkDataDir + "/ABIDE_pcp/cpac/nofilt_noglobal/*"))
- # Choose the number of worker processes: prefer the user-provided value,
- # otherwise use a fraction of the available CPU cores.
- workers = num_workers if num_workers is not None else max(1, (os.cpu_count() or 1) // 8)
- if workers == 1:
- # Single-process mode is easier to debug.
- iterator = map(lambda f: _extract_subject(f, atlas_map_path, phenoInfos), scan_files)
- for sample in tqdm(iterator, total=len(scan_files), ncols=60):
- if sample is not None:
- dataset.append(sample)
- else:
- # Multi-process mode speeds up preprocessing substantially.
- print(f"Using {workers} workers for parallel processing")
- from functools import partial
- process_fn = partial(_extract_subject, atlas_map_path=atlas_map_path, phenoInfos=phenoInfos)
- with ProcessPoolExecutor(max_workers=workers) as executor:
- # Distribute jobs with map.
- iterator = executor.map(process_fn, scan_files)
- for sample in tqdm(iterator, total=len(scan_files), ncols=60):
- if sample is not None:
- dataset.append(sample)
- # Save the fully processed dataset.
- save_path = datadir + "/dataset_abide_{}.save".format(atlas)
- torch.save(dataset, save_path)
- print(f"\nSuccessfully saved preprocessed dataset to: {save_path}")
prep_abide.py at commit 8e371b4, no license · at the source
Overview
Abstract
Highlights: What are the main findings? Spec-RWKV showed competitive diagnostic performance on ABIDE-I and ADHD-200, with relatively consistent results under leave-one-site-out evaluation and simulated TR perturbations. Model-derived importance maps were concentrated in the default mode and frontoparietal networks, and ASD-related spectral differences were more evident in slower frequency bands.
What are the implications of the main findings? Defining temporal dynamics in physical time may help make multi-site rs-fMRI modeling less sensitive to acquisition differences in TR. Joint temporal–spectral modeling could provide cross-site analyses with intermediate patterns that remain easier to inspect and interpret.
Abstract: Background: Multi-center resting-state functional magnetic resonance imaging (rs-fMRI) is important for neurodevelopmental disorder diagnosis, but cross-site differences in repetition time (TR) can cause temporal feature misalignment. In addition, blood-oxygenlevel-depend
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 8 matches between paragraphs and lines of code.
arisaris28/spec-rwkv
8e371b4551de922973e99c66f7280c2833cedaaa, 26 March 2026Availability: 1 check, the latest on 29 September 2026: the link answers
- 29 September 2026: the link answers
28 files
- Dataset/
DataLoaders/ , Python, 1 line__init__.py - Dataset/
DataLoaders/ , Python, 87 linesabide1Loader.py - Dataset/
DataLoaders/ , Python, 85 linesadhd200Loader.py - Dataset/
Prep/ , Python, 1 line__init__.py - Dataset/
Prep/ , Python, 181 lines, 2 matchesprep_abide.py - Dataset/
Prep/ , Python, 556 linesprep_adhd200.py - Dataset/
Prep/ , Python, 50 linesprep_atlas.py - Dataset/
__init__.py , Python, 1 line - Dataset/
dataset.py , Python, 304 lines - Dataset/
datasetDetails.py , Python, 114 lines - Models/
__init__.py , Python, 1 line - Models/
spec_rwkv/ , Python, 16 linesgated_fusion.py - Models/
spec_rwkv/ , Python, 130 lines, 2 matcheshyperparams.py - Models/
spec_rwkv/ , Python, 277 lineslosses.py - Models/
spec_rwkv/ , Python, 710 lines, 2 matchesmodel.py - Models/
spec_rwkv/ , Python, 171 linesmulti_gtu.py - Models/
spec_rwkv/ , Python, 680 linesrun.py - Models/
spec_rwkv/ , Python, 347 lines, 2 matchesrwkv_block.py - Models/
spec_rwkv/ , Python, 109 linesrwkv_kernel/ birwkv_x060.py - Models/
spec_rwkv/ , CUDA, 278 linesrwkv_kernel/ cuda/ wkv6_cuda.cu - Models/
spec_rwkv/ , C++, 18 linesrwkv_kernel/ cuda/ wkv6_op.cpp - Models/
spec_rwkv/ , Python, 395 linesrwkv_kernel/ rwkv_x060.py - Models/
spec_rwkv/ , Python, 1,739 linesspec_rwkv.py - Models/
spec_rwkv/ , Python, 29 linesutil.py - prep.py, Python, 24 lines
- tester.py, Python, 159 lines
- utils.py, Python, 232 lines
- README.md, Text, 3 lines
The paper's code and data availability statement is in the Data section.
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;
- 27 scripts, each with its path and the digest of its content;
- 8 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
No dataset and no data link were found in the paper.
Data Availability Statement
The data presented in this study are openly available in ABIDE Preprocessed Connectomes Project at http://
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 1, 29 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 2 authors, 6 keywords, 37 references.
Cite
This paper
Peng, S., & Xu, Q. (2026). Spec-RWKV: A Spectrum-Guided Multi-Scale Recurrent Modeling Framework for Multi-Center Resting-State fMRI-Assisted Diagnosis. Brain sciences, 16(5), 455. https://
BibTeX
@article{peng2026spec,
author = {Peng, Sihang and Xu, Qi},
title = {{Spec-RWKV: A Spectrum-Guided Multi-Scale Recurrent Modeling Framework for Multi-Center Resting-State fMRI-Assisted Diagnosis}},
journal = {Brain sciences},
year = {2026},
month = apr,
volume = {16},
number = {5},
pages = {455},
publisher = {Multidisciplinary Digital Publishing Institute (MDPI)},
issn = {2076-3425},
doi = {10.3390/
url = {https://
pmid = {42192768},
pmcid = {PMC13204946}
}
RIS
TY - JOUR
AU - Peng, Sihang
AU - Xu, Qi
TI - Spec-RWKV: A Spectrum-Guided Multi-Scale Recurrent Modeling Framework for Multi-Center Resting-State fMRI-Assisted Diagnosis
T2 - Brain sciences
J2 - Brain Sci
PY - 2026
DA - 2026/
VL - 16
IS - 5
SP - 455
SN - 2076-3425
PB - Multidisciplinary Digital Publishing Institute (MDPI)
DO - 10.3390/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.3390/
"type": "article-journal",
"title": "Spec-RWKV: A Spectrum-Guided Multi-Scale Recurrent Modeling Framework for Multi-Center Resting-State fMRI-Assisted Diagnosis",
"container-title": "Brain sciences",
"author": [
{
"family": "Peng",
"given": "Sihang"
},
{
"family": "Xu",
"given": "Qi"
}
],
"container-title-short":
"volume": "16",
"issue": "5",
"page": "455",
"DOI": "10.3390/
"PMID": "42192768",
"PMCID": "PMC13204946",
"ISSN": "2076-3425",
"publisher": "Multidisciplinary Digital Publishing Institute (MDPI)",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
24
]
]
}
}
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.1038/s42003-026-10011-7 [code]
- Learning brain dynamics across distinct scaling regimes reveals psychiatric signatures.Journal: Communications biologyIn common: PyWavelets, Nilearn, PyTorch, 4 other tools, ADHD, autism, 4 references
- [2] doi:10.1186/s40708-026-00312-2 [code]
- Synergistic and redundant information dynamics exhibit dissociable alterations across schizophrenia and neurodevelopmental conditions.Journal: Brain informaticsIn common: seaborn, scikit-learn, pandas, 2 other tools, ADHD, autism, fMRI, 5 references
- [3] doi:10.1016/j.patter.2026.101560 [code]
- Automating region selection with genetic algorithms for energy landscape analyses of brain dynamics.Journal: Patterns (New York, N.Y.)In common: Nilearn, PyTorch, seaborn, 3 other tools, autism, fMRI, 4 references
- [4] doi:10.1038/s41467-026-75745-8 [code]
- A language network in the individualized functional connectomes of 1199 human brains doing arbitrary tasks.Journal: Nature communicationsIn common: Nilearn, seaborn, scikit-learn, 3 other tools, 4 references
- [5] doi:10.1016/j.isci.2026.116173 [code]
- Hierarchical sparse spatiotemporal graph neural network for brain graph classification.Journal: iScienceIn common: Nilearn, PyTorch, seaborn, 4 other tools, fMRI, 1 reference
- [6] doi:10.1038/s41467-026-73668-y [code]
- Convergent and divergent brain-cognition development in early adolescence.Journal: Nature communicationsIn common: Nilearn, PyTorch, seaborn, 4 other tools, fMRI, 2 references
- [7] doi:10.1038/s41598-026-68186-2 [code]
- NeuroStream: spectral-spatio-temporal
deep learning for visual stimulus classification from EEG. Journal: Scientific reportsIn common: PyWavelets, PyTorch, seaborn, 4 other tools, 1 reference - [8] doi:10.1038/s41398-026-04025-2 [code]
- Brain energetic landscapes shape state dysregulation in major depressive disorder: a morphological network controllability perspective.Journal: Translational psychiatryIn common: Nilearn, PyTorch, seaborn, 4 other tools, 2 references
- [9] doi:10.1162/netn.a.571 [code]
- Regional activity and interregional functional connectivity uniquely contribute to social cognitive judgments during movie-watching.Journal: Network neuroscience (Cambridge, Mass.)In common: Nilearn, seaborn, pandas, 2 other tools, fMRI, 3 references
- [10] doi:10.3390/brainsci16070680 [code]
- ION-Sim: A Novel Open-Source Simulation Framework for Intraoperative Neurophysiological Monitoring.Journal: Brain sciencesIn common: PyWavelets, Nilearn, PyTorch, 4 other tools
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, 27 scripts, and 8 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:3c51f855a0da8fa6…
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.
