Brain-wide properties of slow waves across vigilance states.
The 1 match
- [1] § Materials and methods › Identification of SWs ↔ iDetectSlowWave.m, lines 4–29 · score 0.51 · SW detection, candidate, zero crossings, 0.25 s, waves, 0.5 Hz
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
MATLAB · 180 lines · 7.8 KB · MIT · 1 match
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Slow wave detector
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Detection of slow waves based on criteria defined in Frauscher et al.
- % (2015) Brain and Riedner et al. (2007) Sleep.
- % If used, thank you for citing:
- % Sheybani et al. (2023) Nat Comm (in revision)
- % Sheybani et al. (2023) Brain Communications
- % Given their substantial theorical inputs, it would be fair to cite
- % Frauscher et al. (2015) Brain and Riedner et al. (2007) Sleep as well
- % The code is shared without any warranty
- % Laurent Sheybani, laboratory of Prof. Matthew C Walker, University
- % College London (UCL), London, UK
- rawdata = ; % lines are electrodes, columns are timeframes
- n = ; % filter order
- sf = ; % sampling frequency
- fc_low = 0.5; % high-pass for SW detection
- fc_high = 4; % low-pass for SW detection
- min_duration_ZeroCrossing_sec = 0.25; % minimal duration of a half-wave, in s
- max_duration_ZeroCrossing_sec = 1; % maximal duration of a half-wave, in s
- keep_above_prctle = []; % threshold above which candidate waves are saved
- % For simplicity, we remove the condition "no_IED_before", and assume that
- % the post-processing pruning controls for that
- %% Filter the data for SW detection
- [b_low a_low] = butter(n, 2*fc_low/sf,'high'); % coefficients of the high pass-filter
- [b_high a_high] = butter(n, 2*fc_high/sf,'low'); % coefficients of the low pass-filter
- min_duration_ZeroCrossing = min_duration_ZeroCrossing_sec * sf;
- max_duration_ZeroCrossing = max_duration_ZeroCrossing_sec * sf;
- thedata = filtfilt(b_low, a_low, rawdata'); % filtering (high-pass)
- thedata = filtfilt(b_high, a_high, thedata)'; % filtering (low-pass)
- %% Look for SW of default polarity
- idx_ZeroCrossing = iFindZeroCrossing(thedata);
- clear PosToNeg_ZeroCrossing
- for k = 1 : length(idx_ZeroCrossing)
- if thedata(k,idx_ZeroCrossing{k}(1) + 1) > thedata(k,idx_ZeroCrossing{k}(1))
- PosToNeg_ZeroCrossing{k} = idx_ZeroCrossing{k}(2 : 2 : end);
- else
- PosToNeg_ZeroCrossing{k} = idx_ZeroCrossing{k}(1 : 2 : end);
- end
- end
- % Initiate variables
- onset_SWA = cell(1,length(PosToNeg_ZeroCrossing));
- offset_SWA = cell(1,length(PosToNeg_ZeroCrossing));
- SWA = cell(1, length(PosToNeg_ZeroCrossing));
- SWA_onset = cell(1, length(PosToNeg_ZeroCrossing));
- SWA_offset = cell(1, length(PosToNeg_ZeroCrossing));
- SWA_middle = cell(1, length(PosToNeg_ZeroCrossing));
- % Across electrodes
- disp('Negative waves...')
- clear diff_ZeroCrossing
- for k = 1 : length(PosToNeg_ZeroCrossing)
- if isempty(PosToNeg_ZeroCrossing{k})
- SWA_onset{k} = [];
- SWA_offset{k} = [];
- SWA_middle{k} = [];
- SWA{k} = [];
- else
- diff_ZeroCrossing = diff(idx_ZeroCrossing{k});
- if thedata(k,idx_ZeroCrossing{k}(1) + 1) > thedata(k,idx_ZeroCrossing{k}(1))
- PosToNeg_diff_ZeroCrossing = diff_ZeroCrossing(2 : 2 : end);
- else
- PosToNeg_diff_ZeroCrossing = diff_ZeroCrossing(1 : 2 : end);
- end
- onset_SWA{k} = PosToNeg_ZeroCrossing{k}(PosToNeg_diff_ZeroCrossing > min_duration_ZeroCrossing...
- & PosToNeg_diff_ZeroCrossing < max_duration_ZeroCrossing);
- for m = 1 : length(onset_SWA{k})
- offset_SWA{k} = [offset_SWA{k} idx_ZeroCrossing{k}(find(onset_SWA{k}(m) == idx_ZeroCrossing{k}) + 1)];
- end
- for m = 1 : length(onset_SWA{k})
- amp_temp(m) = max(abs(thedata(k,onset_SWA{k}(m) : offset_SWA{k}(m))));
- end
- threshold_amp = prctile(amp_temp, keep_above_prctle);
- clear amp_temp
- m_trace = 1;
- for m = 1 : length(onset_SWA{k})
- if max(abs(thedata(k, onset_SWA{k}(m) : offset_SWA{k}(m)))) >= max(abs(threshold_amp))
- [maxi idx] = max(abs(thedata(k, onset_SWA{k}(m) : offset_SWA{k}(m))));
- if onset_SWA{k}(m) + idx - (3*sf) > 0 && onset_SWA{k}(m) + idx + (3*sf) < length(thedata(k,:))
- SWA{k}(m_trace,:) = rawdata(k, onset_SWA{k}(m) + idx + [(-3*sf) : (3*sf)]);
- SWA_onset{k}(m_trace) = onset_SWA{k}(m);
- SWA_offset{k}(m_trace) = offset_SWA{k}(m);
- SWA_middle{k}(m_trace) = onset_SWA{k}(m) + idx;
- m_trace = m_trace + 1;
- end
- end
- end
- clear threshold_amp
- end
- end
- %% Look for SW of opposite polarity
- clear rawdata_inv
- for k = 1 : size(rawdata,1)
- rawdata_inv(k,:) = rawdata(k,:);
- end
- thedata_inv = filtfilt(b_low, a_low, rawdata_inv'); % filtering (high-pass)
- thedata_inv = filtfilt(b_high, a_high, thedata_inv)'; % filtering (low-pass)
- idx_ZeroCrossing_inv = iFindZeroCrossing(thedata_inv);
- clear NegToPos_ZeroCrossing_inv
- for k = 1 : length(idx_ZeroCrossing_inv)
- if thedata_inv(k,idx_ZeroCrossing_inv{k}(1) + 1) < thedata_inv(k,idx_ZeroCrossing_inv{k}(1))
- NegToPos_ZeroCrossing_inv{k} = idx_ZeroCrossing_inv{k}(2 : 2 : end);
- else
- NegToPos_ZeroCrossing_inv{k} = idx_ZeroCrossing_inv{k}(1 : 2 : end);
- end
- end
- % Initiate variables
- onset_SWA_inv = cell(1,length(NegToPos_ZeroCrossing_inv));
- offset_SWA_inv = cell(1,length(NegToPos_ZeroCrossing_inv));
- SWA_inv = cell(1, length(NegToPos_ZeroCrossing_inv));
- SWA_inv_onset = cell(1, length(NegToPos_ZeroCrossing_inv));
- SWA_inv_offset = cell(1, length(NegToPos_ZeroCrossing_inv));
- SWA_inv_middle = cell(1, length(NegToPos_ZeroCrossing_inv));
- % Across electrodes
- disp('Positive waves...')
- clear diff_ZeroCrossing_inv
- for k = 1 : length(NegToPos_ZeroCrossing_inv)
- if isempty(NegToPos_ZeroCrossing_inv{k})
- SWA_inv_onset{k} = [];
- SWA_inv_offset{k} = [];
- SWA_inv_middle{k} = [];
- SWA_inv{k} = [];
- else
- diff_ZeroCrossing_inv = diff(idx_ZeroCrossing_inv{k});
- if thedata_inv(k,idx_ZeroCrossing_inv{k}(1) + 1) < thedata_inv(k,idx_ZeroCrossing_inv{k}(1))
- NegToPos_diff_ZeroCrossing_inv = diff_ZeroCrossing_inv(2 : 2 : end);
- else
- NegToPos_diff_ZeroCrossing_inv = diff_ZeroCrossing_inv(1 : 2 : end);
- end
- onset_SWA_inv{k} = NegToPos_ZeroCrossing_inv{k}(NegToPos_diff_ZeroCrossing_inv > min_duration_ZeroCrossing...
- & NegToPos_diff_ZeroCrossing_inv < max_duration_ZeroCrossing);
- for m = 1 : length(onset_SWA_inv{k})
- offset_SWA_inv{k} = [offset_SWA_inv{k} idx_ZeroCrossing_inv{k}(find(onset_SWA_inv{k}(m) == idx_ZeroCrossing_inv{k}) + 1)];
- end
- for m = 1 : length(onset_SWA_inv{k})
- amp_temp_inv(m) = max(abs(thedata_inv(k,onset_SWA_inv{k}(m) : offset_SWA_inv{k}(m))));
- end
- threshold_amp_inv = prctile(amp_temp_inv, current_threshold);
- clear amp_temp_inv
- m_trace = 1;
- for m = 1 : length(onset_SWA_inv{k})
- if max(abs(thedata_inv(k, onset_SWA_inv{k}(m) : offset_SWA_inv{k}(m)))) >= max(abs(threshold_amp_inv))
- [maxi idx] = max(abs(thedata_inv(k, onset_SWA_inv{k}(m) : offset_SWA_inv{k}(m))));
- if onset_SWA_inv{k}(m) + idx - (3*sf) > 0 && onset_SWA_inv{k}(m) + idx + (3*sf) < length(thedata_inv(k,:))
- SWA_inv{k}(m_trace,:) = rawdata_inv(k, onset_SWA_inv{k}(m) + idx + [(-3*sf) : (3*sf)]);
- SWA_inv_onset{k}(m_trace) = onset_SWA_inv{k}(m);
- SWA_inv_offset{k}(m_trace) = offset_SWA_inv{k}(m);
- SWA_inv_middle{k}(m_trace) = onset_SWA_inv{k}(m) + idx;
- m_trace = m_trace + 1;
- end
- end
- end
- clear threshold_amp_inv
- end
- end
iDetectSlowWave.m at commit dd32d80, under MIT · at the source
Overview
- Research Department of Epilepsy, UCL Queen Square Institute of Neurology, University College London, London, United Kingdom
- Department of Epilepsy, National Hospital for Neurology and Neurosurgery, London, United Kingdom
- National Hospital for Neurology and Neurosurgery, University College London Hospitals NHS Foundation Trust, London, United Kingdom
- NIHR University College London Hospitals Biomedical Research Centre, London, United Kingdom
Abstract
Until recently, slow waves (SWs) were considered to be highly specific, if not exclusive, to sleep and non-rapid eye movement (NREM) sleep in particular. During NREM sleep, they are proposed to track and contribute to normalization of homeostatic sleep pressure. However, recent evidence has identified typical SWs during wakefulness and rapid-eye movement (REM) sleep. SWs during wakefulness have been regarded as intrusions of sleep, supported by the finding of an associated down-state of neural activity. Although this suggests that the underlying neurobiology of SWs might be shared across vigilance states, i.e. the activity of neurons is comparable, it does not address the question as to whether SWs display state-dependent differences that could reflect a homeostatic regulation. To address this question, we utilized an intracranial dataset of 106 adult patients with drug-resistant epilepsy and computed specific features of SWs—their incidence, slope, transition frequency, associated high gamma activity, multipeak morphology and overlap across brain regions. Overall, we found that changes in these features reflect a state-dependent modulation, potentially in line with expected changes in homeostatic pressure. The multipeak morphology displayed the greatest changes across states. SW differences were sufficiently specific to vigilance state that we could successfully classify these states using SW properties. Our work provides further evidence that SWs during wakefulness and REM sleep are consistent with intrusion of NREM-SW and establish normative values for future studies on SWs across vigilance states and brain regions.
Statement of Significance: Using a large dataset of intracranial recordings in 106 patients with drug-resistant epilepsy, we show that key morphological features of SWs change across vigilance states. Furthermore, we were able to successfully classify vigilance states based on these morphological properties, establishing their specificity for wakefulness, non-rapid eye movement (NREM) and rapid eye movement (REM) sleep respectively. Our work contributes to the hypothesis that SWs outsides NREM can be regarded as intrusions of NREM-SW and provides normative scaling laws for future studies on this neurophysiological entity.
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 1 match between paragraphs and lines of code.
bushlab-ucl/slowWaveDetection
dd32d8034421413342b7b195c6e60880b6270e1b, 30 November 2023Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
5 files
- iDetectSlowWave.m, MATLAB, 180 lines, 1 match
- iFindIED_semiautomatic.m
, MATLAB, 180 lines - iFindZeroCrossing.m, MATLAB, 24 lines
- LICENSE, License, 21 lines
- README.md, Text, 6 lines
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;
- 3 scripts, each with its path and the digest of its content;
- 1 match 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
Data are available on the Loris repository: https://
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, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 6 keywords, 1 funder, 40 references.
Cite
This paper
Yang, S., Poole, O., Walker, M. C., & Sheybani, L. (2026). Brain-wide properties of slow waves across vigilance states. Sleep advances : a journal of the Sleep Research Society, 7(3), zpag065. https://
BibTeX
@article{yang2026brain,
author = {Yang, Senyu and Poole, Olivia and Walker, Matthew C and Sheybani, Laurent},
title = {{Brain-wide properties of slow waves across vigilance states}},
journal = {Sleep advances : a journal of the Sleep Research Society},
year = {2026},
month = jun,
volume = {7},
number = {3},
pages = {zpag065},
publisher = {Oxford University Press},
issn = {2632-5012},
doi = {10.1093/
url = {https://
pmid = {42494975},
pmcid = {PMC13395241}
}
RIS
TY - JOUR
AU - Yang, Senyu
AU - Poole, Olivia
AU - Walker, Matthew C
AU - Sheybani, Laurent
TI - Brain-wide properties of slow waves across vigilance states
T2 - Sleep advances : a journal of the Sleep Research Society
J2 - Sleep Adv
PY - 2026
DA - 2026/
VL - 7
IS - 3
SP - zpag065
SN - 2632-5012
PB - Oxford University Press
DO - 10.1093/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1093/
"type": "article-journal",
"title": "Brain-wide properties of slow waves across vigilance states",
"container-title": "Sleep advances : a journal of the Sleep Research Society",
"author": [
{
"family": "Yang",
"given": "Senyu"
},
{
"family": "Poole",
"given": "Olivia"
},
{
"family": "Walker",
"given": "Matthew C"
},
{
"family": "Sheybani",
"given": "Laurent"
}
],
"container-title-short":
"volume": "7",
"issue": "3",
"page": "zpag065",
"DOI": "10.1093/
"PMID": "42494975",
"PMCID": "PMC13395241",
"ISSN": "2632-5012",
"publisher": "Oxford University Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
22
]
]
}
}
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/s41593-026-02318-9 [code]
- Induction of cortical on/
off periods in awake mice fulfills sleep functions. Journal: Nature neuroscienceIn common: 9 references - [2] doi:10.1073/pnas.2532072123 [code]
- Spatially structured heterogeneity shapes large-scale cortical dynamics in a model of the human cortex.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: 8 references
- [3] doi:10.1038/s42003-026-09988-y
- Thalamic involvement defines distinct slow-wave subtypes in NREM sleep.Journal: Communications biologyIn common: 5 references
- [4] doi:10.1038/s41598-026-57532-z
- Predictability of sleep slow oscillation emergence and spatial extent from pre-onset neural dynamics.Journal: Scientific reportsIn common: systems, 4 references
- [5] doi:10.1093/braincomms/fcag120 [code]
- The heartbeat evoked potential and the prediction of functional seizure semiology.Journal: Brain communicationsIn common: epilepsy, author Matthew C Walker
- [6] doi:10.1093/pnasnexus/pgag108
- Aging disrupts the temporal organization of slow oscillations beyond density reduction.Journal: PNAS nexusIn common: systems, 3 references
- [7] doi:10.1007/s44470-026-00131-6
- Sleep homeostasis impairment across obstructive sleep apnea severity: findings from a population-based cohort study.Journal: Journal of clinical sleep medicine : JCSM : official publication of the American Academy of Sleep MedicineIn common: 3 references
- [8] doi:10.1016/j.ebiom.2026.106287 [code]
- Thalamic interictal epileptic and non-epileptic events during NREM sleep in patients with focal epilepsy: a Stereo-EEG study.Journal: EBioMedicineIn common: Signal Processing Toolbox, intracranial EEG (iEEG / ECoG / SEEG), epilepsy, 1 reference
- [9] doi:10.1016/j.isci.2026.116601 [code]
- Random auditory stimulation during sleep disturbs traveling slow waves and declarative memory.Journal: iScienceIn common: Signal Processing Toolbox, 2 references
- [10] doi:10.1093/braincomms/fcaf170 [code]
- Noninvasive classification of physiological and pathological high frequency oscillations in childrenJournal: n/aIn common: Signal Processing Toolbox, epilepsy, 1 reference
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, 3 scripts, and 1 match 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:4ed18ae013e45440…
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.
