Spec-RWKV: A Spectrum-Guided Multi-Scale Recurrent Modeling Framework for Multi-Center Resting-State fMRI-Assisted Diagnosis.
5 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 8 matches · 2 of them tie a paragraph to a whole file without 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 to 179 · score 0.92 · global signal regression, band pass filtering, CPAC pipeline, fMRI, PCP, quality · block
oscr:b:R6D7K1B2JZCJB-3· Report a mismatch - [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 to 143 · score 0.74 · Asymmetric Focal Loss, learning rate scheduling, Adam, Optimization, classification, training · block
oscr:b:HH6HWZTZ3TEV6-1· Report a mismatch - [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 to 267 · score 0.66 · step decay rates, physical half, PrismTimeMix, heads, RWKV, TR · block
oscr:b:KRAKX1Q3BMWD2-K· Report a mismatch - [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 · block
oscr:b:X212QJCGTT7Y3-L· Report a mismatch - [5] § 3. Results › 3.1. Experimental Settings and Evaluation Metrics › 3.1.2. Evaluation Metrics ↔ Models/spec_rwkv/model.py, lines 613 to 666 · score 0.59 · binary classification, ACC, TN, TP, FN, FP · block
oscr:b:1PSX2HGWAHS9A-G· Report a mismatch - [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 · block
oscr:b:X212QJCGTT7Y3-L· Report a mismatch - [7] § 2. Materials and Methods › 2.1. Datasets › 2.1.2. ADHD-200 ↔ Dataset/Prep/prep_abide.py, lines 107 to 179 · score 0.56 · phenotypic information, fMRI, quality, Global · block
oscr:b:R6D7K1B2JZCJB-3· Report a mismatch - [8] § 3. Results › 3.1. Experimental Settings and Evaluation Metrics › 3.1.1. Experimental Settings ↔ Models/spec_rwkv/rwkv_block.py, lines 141 to 267 · score 0.55 · physical half lives, PrismTimeMix, learnable, modulation, zero, heads · block
oscr:b:KRAKX1Q3BMWD2-K· 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 · 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.1007/s10278-025-01399-5 [code]
- MHNet: Multi-view High-Order Network for Diagnosing Neurodevelopmental Disorders Using Resting-State fMRI.Journal: Journal of imaging informatics in medicineIn common: Nilearn, PyTorch, scikit-learn, 3 other tools, fMRI, 4 references
- [3] doi:10.1016/j.neuroimage.2024.120909 [code]
- A simple but tough-to-beat baseline for fMRI time-series classification.Journal: NeuroImageIn common: PyTorch, seaborn, scikit-learn, 3 other tools, fMRI, 5 references
- [4] doi:10.1002/hbm.70469 [code]
- VarCoNet: A Variability-Aware Self-Supervised Framework for Functional Connectome Extraction From Resting-State fMRI.Journal: Human brain mappingIn common: Nilearn, PyTorch, seaborn, 4 other tools, autism, fMRI, 3 references
- [5] doi:10.1016/j.isci.2023.108244 [code]
- A common spectrum underlying brain disorders across lifespan revealed by deep learning on brain networks.Journal: iScienceIn common: Nilearn, PyTorch, scikit-learn, 3 other tools, 5 references
- [6] 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
- [7] doi:10.1038/s41467-023-38972-x [code]
- Hierarchical fluctuation shapes a dynamic flow linked to states of consciousness.Journal: Nature communicationsIn common: Nilearn, PyTorch, seaborn, 4 other tools, fMRI, 4 references
- [8] doi:10.1016/j.cell.2025.11.039 [code]
- Stimulant medications affect arousal and reward, not attention networks.Journal: CellIn common: Nilearn, seaborn, scikit-learn, 3 other tools, ADHD, fMRI, 3 references
- [9] doi:10.1093/gigascience/giaf091 [code]
- High-precision machine learning identifies a reproducible functional connectivity signature of autism spectrum diagnosis in a subset of individuals.Journal: GigaScienceIn common: Nilearn, seaborn, scikit-learn, 3 other tools, autism, fMRI, clinical / translational, 2 references
- [10] doi:10.1016/j.isci.2025.114100 [code]
- Toward neuroimaging-based diagnostic support: a deep learning approach with a closed-loop system for psychiatric classification.Journal: iScienceIn common: PyWavelets, PyTorch, seaborn, 4 other tools, clinical / translational, 2 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, 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:bb8e042aafda085d…
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.3390/brainsci16050455)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.3390/brainsci16050455.svg
:target: https://openscicode.org/badge/doi/10.3390/brainsci16050455
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.3390/brainsci16050455"><img src="https://openscicode.org/badge/doi/10.3390/brainsci16050455.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.
