OSCR

Brain-wide properties of slow waves across vigilance states.

Code ↔ Paper

1 match between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

One block of code here has 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 1 match
  1. [1] § Materials and methods › Identification of SWs ↔ iDetectSlowWave.m, lines 4 to 29 · score 0.51 · SW detection, candidate, zero crossings, 0.25 s, waves, 0.5 Hz · block oscr:b:1W6ZGKV0XG1F5-X · 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

MATLAB · 180 lines · 7.8 KB · MIT · 1 match

  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. % Slow wave detector
  3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  4. % Detection of slow waves based on criteria defined in Frauscher et al.
  5. % (2015) Brain and Riedner et al. (2007) Sleep.
  6. % If used, thank you for citing:
  7. % Sheybani et al. (2023) Nat Comm (in revision)
  8. % Sheybani et al. (2023) Brain Communications
  9. % Given their substantial theorical inputs, it would be fair to cite
  10. % Frauscher et al. (2015) Brain and Riedner et al. (2007) Sleep as well
  11. % The code is shared without any warranty
  12. % Laurent Sheybani, laboratory of Prof. Matthew C Walker, University
  13. % College London (UCL), London, UK
  14. rawdata = ; % lines are electrodes, columns are timeframes
  15. n = ; % filter order
  16. sf = ; % sampling frequency
  17. fc_low = 0.5; % high-pass for SW detection
  18. fc_high = 4; % low-pass for SW detection
  19. min_duration_ZeroCrossing_sec = 0.25; % minimal duration of a half-wave, in s
  20. max_duration_ZeroCrossing_sec = 1; % maximal duration of a half-wave, in s
  21. keep_above_prctle = []; % threshold above which candidate waves are saved
  22. % For simplicity, we remove the condition "no_IED_before", and assume that
  23. % the post-processing pruning controls for that
  24. %% Filter the data for SW detection
  25. [b_low a_low] = butter(n, 2*fc_low/sf,'high'); % coefficients of the high pass-filter
  26. [b_high a_high] = butter(n, 2*fc_high/sf,'low'); % coefficients of the low pass-filter
  27. min_duration_ZeroCrossing = min_duration_ZeroCrossing_sec * sf;
  28. max_duration_ZeroCrossing = max_duration_ZeroCrossing_sec * sf;
  29. thedata = filtfilt(b_low, a_low, rawdata'); % filtering (high-pass)
  30. thedata = filtfilt(b_high, a_high, thedata)'; % filtering (low-pass)
  31. %% Look for SW of default polarity
  32. idx_ZeroCrossing = iFindZeroCrossing(thedata);
  33. clear PosToNeg_ZeroCrossing
  34. for k = 1 : length(idx_ZeroCrossing)
  35. if thedata(k,idx_ZeroCrossing{k}(1) + 1) > thedata(k,idx_ZeroCrossing{k}(1))
  36. PosToNeg_ZeroCrossing{k} = idx_ZeroCrossing{k}(2 : 2 : end);
  37. else
  38. PosToNeg_ZeroCrossing{k} = idx_ZeroCrossing{k}(1 : 2 : end);
  39. end
  40. end
  41. % Initiate variables
  42. onset_SWA = cell(1,length(PosToNeg_ZeroCrossing));
  43. offset_SWA = cell(1,length(PosToNeg_ZeroCrossing));
  44. SWA = cell(1, length(PosToNeg_ZeroCrossing));
  45. SWA_onset = cell(1, length(PosToNeg_ZeroCrossing));
  46. SWA_offset = cell(1, length(PosToNeg_ZeroCrossing));
  47. SWA_middle = cell(1, length(PosToNeg_ZeroCrossing));
  48. % Across electrodes
  49. disp('Negative waves...')
  50. clear diff_ZeroCrossing
  51. for k = 1 : length(PosToNeg_ZeroCrossing)
  52. if isempty(PosToNeg_ZeroCrossing{k})
  53. SWA_onset{k} = [];
  54. SWA_offset{k} = [];
  55. SWA_middle{k} = [];
  56. SWA{k} = [];
  57. else
  58. diff_ZeroCrossing = diff(idx_ZeroCrossing{k});
  59. if thedata(k,idx_ZeroCrossing{k}(1) + 1) > thedata(k,idx_ZeroCrossing{k}(1))
  60. PosToNeg_diff_ZeroCrossing = diff_ZeroCrossing(2 : 2 : end);
  61. else
  62. PosToNeg_diff_ZeroCrossing = diff_ZeroCrossing(1 : 2 : end);
  63. end
  64. onset_SWA{k} = PosToNeg_ZeroCrossing{k}(PosToNeg_diff_ZeroCrossing > min_duration_ZeroCrossing...
  65. & PosToNeg_diff_ZeroCrossing < max_duration_ZeroCrossing);
  66. for m = 1 : length(onset_SWA{k})
  67. offset_SWA{k} = [offset_SWA{k} idx_ZeroCrossing{k}(find(onset_SWA{k}(m) == idx_ZeroCrossing{k}) + 1)];
  68. end
  69. for m = 1 : length(onset_SWA{k})
  70. amp_temp(m) = max(abs(thedata(k,onset_SWA{k}(m) : offset_SWA{k}(m))));
  71. end
  72. threshold_amp = prctile(amp_temp, keep_above_prctle);
  73. clear amp_temp
  74. m_trace = 1;
  75. for m = 1 : length(onset_SWA{k})
  76. if max(abs(thedata(k, onset_SWA{k}(m) : offset_SWA{k}(m)))) >= max(abs(threshold_amp))
  77. [maxi idx] = max(abs(thedata(k, onset_SWA{k}(m) : offset_SWA{k}(m))));
  78. if onset_SWA{k}(m) + idx - (3*sf) > 0 && onset_SWA{k}(m) + idx + (3*sf) < length(thedata(k,:))
  79. SWA{k}(m_trace,:) = rawdata(k, onset_SWA{k}(m) + idx + [(-3*sf) : (3*sf)]);
  80. SWA_onset{k}(m_trace) = onset_SWA{k}(m);
  81. SWA_offset{k}(m_trace) = offset_SWA{k}(m);
  82. SWA_middle{k}(m_trace) = onset_SWA{k}(m) + idx;
  83. m_trace = m_trace + 1;
  84. end
  85. end
  86. end
  87. clear threshold_amp
  88. end
  89. end
  90. %% Look for SW of opposite polarity
  91. clear rawdata_inv
  92. for k = 1 : size(rawdata,1)
  93. rawdata_inv(k,:) = rawdata(k,:);
  94. end
  95. thedata_inv = filtfilt(b_low, a_low, rawdata_inv'); % filtering (high-pass)
  96. thedata_inv = filtfilt(b_high, a_high, thedata_inv)'; % filtering (low-pass)
  97. idx_ZeroCrossing_inv = iFindZeroCrossing(thedata_inv);
  98. clear NegToPos_ZeroCrossing_inv
  99. for k = 1 : length(idx_ZeroCrossing_inv)
  100. if thedata_inv(k,idx_ZeroCrossing_inv{k}(1) + 1) < thedata_inv(k,idx_ZeroCrossing_inv{k}(1))
  101. NegToPos_ZeroCrossing_inv{k} = idx_ZeroCrossing_inv{k}(2 : 2 : end);
  102. else
  103. NegToPos_ZeroCrossing_inv{k} = idx_ZeroCrossing_inv{k}(1 : 2 : end);
  104. end
  105. end
  106. % Initiate variables
  107. onset_SWA_inv = cell(1,length(NegToPos_ZeroCrossing_inv));
  108. offset_SWA_inv = cell(1,length(NegToPos_ZeroCrossing_inv));
  109. SWA_inv = cell(1, length(NegToPos_ZeroCrossing_inv));
  110. SWA_inv_onset = cell(1, length(NegToPos_ZeroCrossing_inv));
  111. SWA_inv_offset = cell(1, length(NegToPos_ZeroCrossing_inv));
  112. SWA_inv_middle = cell(1, length(NegToPos_ZeroCrossing_inv));
  113. % Across electrodes
  114. disp('Positive waves...')
  115. clear diff_ZeroCrossing_inv
  116. for k = 1 : length(NegToPos_ZeroCrossing_inv)
  117. if isempty(NegToPos_ZeroCrossing_inv{k})
  118. SWA_inv_onset{k} = [];
  119. SWA_inv_offset{k} = [];
  120. SWA_inv_middle{k} = [];
  121. SWA_inv{k} = [];
  122. else
  123. diff_ZeroCrossing_inv = diff(idx_ZeroCrossing_inv{k});
  124. if thedata_inv(k,idx_ZeroCrossing_inv{k}(1) + 1) < thedata_inv(k,idx_ZeroCrossing_inv{k}(1))
  125. NegToPos_diff_ZeroCrossing_inv = diff_ZeroCrossing_inv(2 : 2 : end);
  126. else
  127. NegToPos_diff_ZeroCrossing_inv = diff_ZeroCrossing_inv(1 : 2 : end);
  128. end
  129. onset_SWA_inv{k} = NegToPos_ZeroCrossing_inv{k}(NegToPos_diff_ZeroCrossing_inv > min_duration_ZeroCrossing...
  130. & NegToPos_diff_ZeroCrossing_inv < max_duration_ZeroCrossing);
  131. for m = 1 : length(onset_SWA_inv{k})
  132. offset_SWA_inv{k} = [offset_SWA_inv{k} idx_ZeroCrossing_inv{k}(find(onset_SWA_inv{k}(m) == idx_ZeroCrossing_inv{k}) + 1)];
  133. end
  134. for m = 1 : length(onset_SWA_inv{k})
  135. amp_temp_inv(m) = max(abs(thedata_inv(k,onset_SWA_inv{k}(m) : offset_SWA_inv{k}(m))));
  136. end
  137. threshold_amp_inv = prctile(amp_temp_inv, current_threshold);
  138. clear amp_temp_inv
  139. m_trace = 1;
  140. for m = 1 : length(onset_SWA_inv{k})
  141. if max(abs(thedata_inv(k, onset_SWA_inv{k}(m) : offset_SWA_inv{k}(m)))) >= max(abs(threshold_amp_inv))
  142. [maxi idx] = max(abs(thedata_inv(k, onset_SWA_inv{k}(m) : offset_SWA_inv{k}(m))));
  143. if onset_SWA_inv{k}(m) + idx - (3*sf) > 0 && onset_SWA_inv{k}(m) + idx + (3*sf) < length(thedata_inv(k,:))
  144. SWA_inv{k}(m_trace,:) = rawdata_inv(k, onset_SWA_inv{k}(m) + idx + [(-3*sf) : (3*sf)]);
  145. SWA_inv_onset{k}(m_trace) = onset_SWA_inv{k}(m);
  146. SWA_inv_offset{k}(m_trace) = offset_SWA_inv{k}(m);
  147. SWA_inv_middle{k}(m_trace) = onset_SWA_inv{k}(m) + idx;
  148. m_trace = m_trace + 1;
  149. end
  150. end
  151. end
  152. clear threshold_amp_inv
  153. end
  154. end

iDetectSlowWave.m at commit dd32d80, under MIT · at the source

Overview

Authors: Senyu Yang1, Olivia Poole2, Matthew C Walker1,3,4, Laurent Sheybani1,3,4
  1. Research Department of Epilepsy, UCL Queen Square Institute of Neurology, University College London, London, United Kingdom
  2. Department of Epilepsy, National Hospital for Neurology and Neurosurgery, London, United Kingdom
  3. National Hospital for Neurology and Neurosurgery, University College London Hospitals NHS Foundation Trust, London, United Kingdom
  4. NIHR University College London Hospitals Biomedical Research Centre, London, United Kingdom
Journal: Sleep advances : a journal of the Sleep Research Society, volume 7, issue 3, article zpag065
Dates: received 10 March 2026; accepted 6 June 2026; published online 22 June 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1093/sleepadvances/zpag065 · PMID 42494975 · PMCID PMC13395241 · OpenAlex W7165538059
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: intracranial EEG (iEEG / ECoG / SEEG) (modality), epilepsy (population), systems (subfield)
Methods: Spectral & time-frequency, Connectivity, Statistics, Machine learning, Preprocessing
Keywords: slow waves (SWs), intracranial EEG, sleep–wake cycle, high-gamma (HG) amplitude, neuronal synchrony, epilepsy
Topic: Sleep and Wakefulness Research (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Swiss National Science Foundation (233452)
Citations: not cited yet (Europe PMC); 45 references in the paper

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

License: MIT
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: dd32d8034421413342b7b195c6e60880b6270e1b, 30 November 2023
Languages: MATLAB (3)
Size: 5 files, 3 scripts
Software Heritage: not archived
Found in: the text, “Identification of SWs”
Holds: README, license file
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Signal Processing Toolbox (2 files)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
5 files

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://mni-open-ieegatlas.research.mcgill.ca/

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://doi.org/10.1093/sleepadvances/zpag065

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/sleepadvances/zpag065},
url = {https://doi.org/10.1093/sleepadvances/zpag065},
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/06/22
VL - 7
IS - 3
SP - zpag065
SN - 2632-5012
PB - Oxford University Press
DO - 10.1093/sleepadvances/zpag065
UR - https://doi.org/10.1093/sleepadvances/zpag065
LA - en
ER -

CSL-JSON

{
"id": "10.1093/sleepadvances/zpag065",
"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": "Sleep Adv",
"volume": "7",
"issue": "3",
"page": "zpag065",
"DOI": "10.1093/sleepadvances/zpag065",
"PMID": "42494975",
"PMCID": "PMC13395241",
"ISSN": "2632-5012",
"publisher": "Oxford University Press",
"URL": "https://doi.org/10.1093/sleepadvances/zpag065",
"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.1212/wnl.0000000000214001
Dynamic Interplay Between Wake Slow Waves and Epileptiform Discharges in the Epileptogenic Zone.
Journal: Neurology
In common: intracranial EEG (iEEG / ECoG / SEEG), epilepsy, 8 references, 2 authors
[2] doi:10.1038/s41593-026-02318-9 [code]
Induction of cortical on/off periods in awake mice fulfills sleep functions.
Journal: Nature neuroscience
In common: 9 references
[3] 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 America
In common: 8 references
[4] doi:10.1093/braincomms/fcae354 [code]
Non-rapid eye movement sleep slow-wave activity features are associated with amyloid accumulation in older adults with obstructive sleep apnoea.
Journal: Brain communications
In common: 8 references
[5] doi:10.1371/journal.pbio.3003060 [code]
Hemispherotomy leads to persistent sleep-like slow waves in the isolated cortex of awake humans.
Journal: PLoS biology
In common: Signal Processing Toolbox, epilepsy, 6 references
[6] doi:10.1093/braincomms/fcaf391
Evoked slow oscillations and dynamic network reorganization after stroke.
Journal: Brain communications
In common: 7 references
[7] doi:10.1016/j.isci.2023.107138 [code]
How and when EEG reflects changes in neuronal connectivity due to time awake.
Journal: iScience
In common: Signal Processing Toolbox, 6 references
[8] doi:10.1038/s42003-024-06941-9 [code]
Coordinated NREM sleep oscillations among hippocampal subfields modulate synaptic plasticity in humans.
Journal: Communications biology
In common: epilepsy, 6 references
[9] doi:10.1016/j.isci.2025.113213
Global and local nature of cortical slow waves.
Journal: iScience
In common: 6 references
[10] doi:10.1016/j.cub.2025.06.064 [code]
Cortical activity upon awakening from sleep reveals consistent spatio-temporal gradients across sleep stages in human EEG.
Journal: Current biology : CB
In common: Signal Processing Toolbox, 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.

Add the badge to the code's README

OSCR: the badge of this paper

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 -->
[![OSCR](https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag065.svg)](https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag065)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag065.svg
   :target: https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag065
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag065"><img src="https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag065.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.