Learning the bistable cortical dynamics of the sleep-onset period.
The 9 matches · 4 of them tie a paragraph to a whole file without given lines: weak matches, whose lines are not tinted
- [1] § Materials and methods › EEG recordings ↔ code/step1_embedding.m, the whole file · a weak match · score 0.70 · pass filter, alpha band, transform, cmor1, bins, wavelet · Report a mismatch
- [2] § Materials and methods › EEG recordings ↔ plots/fig2_embedding.m, lines 1 to 41 · score 0.63 · alpha band, embedding extraction, cmor1, bins, wavelet, EEG · Report a mismatch
- [3] § Materials and methods › Dataset ↔ plots/fig8_corr.py, lines 1 to 26 · score 0.62 · Sleepiness Scale, sleep scales, Karolinska, KSS, Stanford, nap · Report a mismatch
- [4] § Materials and methods › SOP window definition ↔ plots/fig10_comp_mode.m, the whole file · a weak match · score 0.61 · delta band, alpha band, window, ratio, wavelet, amplitudes · Report a mismatch
- [5] § Materials and methods › SOP window definition ↔ code/step1_embedding.m, the whole file · a weak match · score 0.60 · delta band, alpha band, ratio, wavelet, amplitudes, spectrograms · Report a mismatch
- [6] § Results › The bistable characteristics of the SOP are preserved in a low-rank embedding of the EEG spectrogram ↔ plots/fig2_embedding.m, lines 104 to 181 · score 0.58 · SOP spectrogram, low dimensional, sleep mode, embedding, EEG, wake · Report a mismatch
- [7] § Materials and methods › Embedding extraction ↔ plots/fig2_embedding.m, lines 104 to 181 · score 0.54 · SOP spectrogram, low dimensional, gaussian, embedding, wake, EEG · Report a mismatch
- [8] § Materials and methods › Model evaluation › Per-timepoint likelihood. ↔ code/step2_param_est.py, lines 37 to 74 · score 0.52 · Euler Maruyama, cubic SDE, Gaussian · Report a mismatch
- [9] § Results › The bistable characteristics of the SOP are preserved in a low-rank embedding of the EEG spectrogram ↔ plots/fig10_comp_mode.m, the whole file · a weak match · score 0.51 · alpha band, transitional period, dominant, window, amplitude, 100 s · 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 · 201 lines · 6.1 KB · MIT · 3 matches
- %% Embedding extraction (sub 9)
- clc,clear all;close all;
- embed_folder = ['..\data\EEG\'];
- ls = dir([embed_folder,'ds*mat']);
- % Focus on first 30 minutes
- fs = 100;
- t_start = 1*fs;
- t_end = 1800*fs;
- t = linspace(t_start,t_end,(t_end - t_start + 1)) / fs;
- % Wavelet parameter
- wavelet_name = 'cmor1-1.5';
- central_freq = centfrq(wavelet_name);
- freq_start = 0.5;
- freq_end = 20;
- num_bin = 200;
- w = linspace(freq_start,freq_end,num_bin)';
- scales = (central_freq/(1/fs))./w;
- % Define frequency band of interests
- delta_band = find( 0.5 < w & w < 4);
- alpha_band = find( 8 < w & w < 12);
- % Plot settings
- figure('Position',1.0e+03*[ 0.1106 0.1778 1.2712 0.4842]);
- fig = figure('Position',[441.0000 125.0000 586.4000 503.2000]);
- for k = 1:3
- axe{k} = axes('Position',[0.15,0.1+0.27*(k-1),0.7,0.18]);
- end
- axe{4} = axes('Position',[0.03,0.1+0.27*(2-1),0.05,0.18]);
- axe{5} = axes('Position',[0.92,0.1+0.27*(2-1),0.05,0.18]);
- % Load sample subject
- s_idx = 9;
- data_file = [embed_folder,ls(s_idx).name];
- load(data_file);
- data = squeeze(data(:,1,:,:,:,t_start:t_end));
- % Take the Wavelt representation
- amp_wav = abs(cwt(data',scales,wavelet_name));
- % Decide the transition window
- amp_ratio = sum(amp_wav(delta_band,:),1) ./ sum(amp_wav(alpha_band,:),1);
- sm_ratio= smoothdata(amp_ratio,"gaussian",300);
- % 3 min larger than 1
- thres_start = 1;
- dur_tran_start = 60*fs;
- cond = sm_ratio > thres_start;
- % Find the start and end indices of consecutive true sequences
- d = diff([0, cond, 0]);
- % This finds the start and the end of transition period
- run_starts = find(d == 1);
- run_ends = find(d == -1);
- % Calculate the durations of the runs
- run_dur = run_ends - run_starts + 1; % Length in samples
- req_run_idx = find(run_dur >= dur_tran_start);
- t_transtart = run_starts(req_run_idx(1));
- thres_end = 1;
- dur_tran_end = 120*fs;
- cond = sm_ratio > thres_end;
- % Find the start and end indices of consecutive true sequences
- d = diff([0, cond, 0]);
- % This finds the start and the end of transition period
- run_starts = find(d == 1);
- run_ends = find(d == -1);
- % Calculate the durations of the runs
- run_dur = run_ends - run_starts + 1; % Length in samples
- req_run_idx = find(run_dur >= dur_tran_end);
- t_tranend = run_starts(req_run_idx(1));
- t_ana = [t_transtart-200*fs, t_tranend+200*fs];
- % Extract dominant mode in wake and sleep state
- if t_ana(1) < 0
- wav_ana = amp_wav(:,[1:t_ana(2)]);
- t_ana_win = [1:t_ana(2)]/fs;
- else
- wav_ana = amp_wav(:,[t_ana(1):t_ana(2)]);
- t_ana_win = [t_ana(1):t_ana(2)]/fs;
- end
- % Dominant mode in wake state
- wav_wake = wav_ana(:,1:60*fs);
- [Uw,Sw,Vw] = svd(wav_wake,'econ');
- wav_sleep = wav_ana(:,(end-60*fs):end);
- [Us,Ss,Vs] = svd(wav_sleep,'econ');
- if Uw(:,1) < 0
- mode_wake = -1*Uw(:,1);
- else
- mode_wake = Uw(:,1);
- end
- if Us(:,1) < 0
- mode_sleep = -1*Us(:,1);
- else
- mode_sleep = Us(:,1);
- end
- % Extract the low_dimensional dynamics
- wav_norm = wav_ana ./ vecnorm(wav_ana, 2, 1);
- mu = (wav_norm-mode_sleep)'*(mode_wake-mode_sleep) / norm(mode_wake - mode_sleep,2).^2;
- mu = smoothdata(mu,"gaussian",100);
- gca = axe{3};
- sm_wav = smoothdata(abs(wav_ana),2,"gaussian",300);
- hdl = imagesc(gca,t_ana_win,w, sm_wav);hold(gca,"on");
- hdl.Parent.YDir = 'normal';
- colormap turbo;
- set(gca,'clim',[-8,30]);
- set(gca,'ylim',[1,15]);
- ylabel('Frequency [Hz]');
- set(gca,'xlim',[t_ana_win(1),t_ana_win(end)]);
- hold(gca,'on');
- ylim = get(gca,'ylim');
- t_end = t(run_starts(req_run_idx(1)))+ 2*60;
- wake_time = [t_ana_win(1),t_ana_win(1)+60];
- sleep_time = [t_ana_win(end)-60,t_ana_win(end)];
- area(gca,wake_time, [15, 15], 'FaceColor', 'blue', 'FaceAlpha', 0.3);
- area(gca,sleep_time, [15, 15], 'FaceColor', 'blue', 'FaceAlpha', 0.3);
- set(gca, 'XTick', []);
- title(gca,'EEG SOP Spectrogram','FontSize',10);
- ylabel(gca,'Frequency [Hz]','FontSize',10);
- text(gca,0.06, 0.3, ["Wake"], 'Units', 'normalized',...
- 'FontSize', 11, 'Color', 'k', 'HorizontalAlignment', 'center');
- text(gca,0.94, 0.8, ["Sleep"], 'Units', 'normalized',...
- 'FontSize', 11, 'Color', 'k', 'HorizontalAlignment', 'center');
- gca = axe{1}
- mu_scale = (mu - min(mu)) ./ (max(mu) - min(mu));
- recon_spec = mode_wake*mu_scale'+ mode_sleep*(1-mu_scale)';
- sm_recon = smoothdata(recon_spec,2,'gaussian',300);
- hdl = imagesc(gca,t_ana_win,w,recon_spec); %
- hdl.Parent.YDir = 'normal';
- colormap turbo;
- set(gca,'ylim',[1,15]);
- set(gca,'fontsize',10);
- title(gca,'Reconstruction (\mu(t)U_w^{1}+(1-\mu(t))U_s^{1})','FontSize',10);
- xlabel(gca,'Time [s]');
- set(gca,'clim',[0,0.15]);
- ylabel(gca,'Frequency [Hz]','FontSize',10);
- gca = axe{2};
- plot(gca,t_ana_win,mu);
- set(gca,'xlim',[t_ana_win(1),t_ana_win(end)]);
- set(gca, 'XTick', []);
- title(gca,'\mu(t) (projection on U_w^{1}-U_s^{1})','FontSize',10);
- set(gca,'fontsize',10);
- % Plot two patches for the wake and sleep mode
- dummy_width = 5;
- mode_wake_patch = repmat(mode_wake, 1, dummy_width);
- mode_sleep_patch = repmat(mode_sleep, 1, dummy_width);
- % 3) Create a new axis for the wake mode patch
- gca = axe{4};
- imagesc(gca, 1:dummy_width, w, mode_wake_patch);
- set(gca, 'YDir','normal', 'XTick',[], 'YTick',[]);
- title(gca, 'U_w^{1}', 'FontSize', 9);
- colormap(gca, turbo); % Use the same colormap as your main spectrogram
- clim(gca, [0, 0.16]); % Match color limits if you want
- set(gca,'ylim',[1,15]);
- ylabel(gca,'Frequency [Hz]','FontSize',10);
- gca = axe{5};
- imagesc(gca, 1:dummy_width, w, mode_sleep_patch);
- set(gca, 'YDir','normal', 'XTick',[], 'YTick',[]);
- title(gca, 'U_s^{1}', 'FontSize', 9);
- colormap(gca, turbo); % Use the same colormap as your main spectrogram
- clim(gca, [0, 0.16]); % Match color limits if you want
- set(gca,'ylim',[1,15]);
- set(gca,'xlim',[1,5]);
- ylabel(gca,'Frequency [Hz]','FontSize',10);
- saveas(gcf,'..\figures\fig2a_sample_embedding.png');
- %% Plot all embeddings
- clc,clear all;close all;
- folder = ['../embedding/'];
- figure('Position', 1.0e+03 * [0.1146 0.1074 1.2304 0.5408]);
- ls = dir([folder,'*.mat']);
- fs = 10;
- for f_idx = 1:length(ls)
- filename = [folder,ls(f_idx).name];
- load(filename);
- subplot(4,5,f_idx);
- t = [1:length(ds_mu)]/fs;
- plot(t,ds_mu);
- tit = ['sub',num2str(f_idx)];
- title(tit);
- set(gca,'xlim',[t(1),t(end)]);
- set(gca,'fontsize',10)
- end
- saveas(gcf,'..\figures\fig2b_all_embeddings.png');
fig2_embedding.m at commit 68d7750, under MIT · at the source
Overview
- Department of Robotics and Control, Université Marie et Louis Pasteur, SUPMICROTECH, CNRS, institut FEMTO-ST, Besançon, France
- Faculty of Psychology, Sleep and Neuroimaging Center, Southwest University, Chongqing, China
- Department of Applied Mathematics and Electrical and Computer Engineering, University of Washington, Seattle, Washington, United States of America
Abstract
Humans just don’t fall asleep like a log – or step-function. Rather, the sleep-onset period (SOP) exhibits dynamic and non-monotonous changes of electroencephalogram (EEG) with high, and so far poorly understood, intra- and inter-individual variability. Computational models of the sleep regulation network have suggested that the transition to sleep can be viewed as a noisy bifurcation at a saddle node which is determined by an underlying control signal or “sleep drive”. However, such models do not describe how internal control signals in the SOP can produce rapid switches between stable wake and sleep states, nor how these state-space changes are translated in the macroscopic EEG. Here, we propose a minimally-parameterized stochastic dynamical model, in which one slowly-varying control parameter drives the wake-to-sleep transition while exhibiting noise-driven bistability. We provide a procedure for estimating the parameters of the model given single observations of experimental sleep EEG data, and show that it can reproduce a wide variety of SOP phenomenology. Using the model to analyze a pre-existing sleep EEG dataset, we find that the estimated model parameters correlate with subjective sleepiness reports. These results suggest that the bistable characteristics of the SOP can serve as biomarkers for tracking intra- and inter-individual variability of sleep-onset disorders.
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 9 matches between paragraphs and lines of code.
neuro-team-femto/cubic_sleep
68d7750e35d2574894d579e2471a270b6da45daf, 20 January 2026Availability: 1 check, the latest on 30 September 2026: the link answers
- 30 September 2026: the link answers
14 files
- code/
step1_embedding.m , MATLAB, 117 lines, 2 matches - code/
step2_param_est.py , Python, 74 lines, 1 match - code/
tvEM.py , Python, 199 lines - plots/
fig10_comp_mode.m , MATLAB, 135 lines, 2 matches - plots/
fig2_embedding.m , MATLAB, 201 lines, 3 matches - plots/
fig4_synth_wavelet.m , MATLAB, 102 lines - plots/
fig5_sim_fixed_landscape , Python, 104 lines.py - plots/
fig6_sim_tv_landscape.py , Python, 211 lines - plots/
fig7_real_validation.m , MATLAB, 201 lines - plots/
fig8_corr.py , Python, 258 lines, 1 match - plots/
fig9_sop_win.m , MATLAB, 100 lines - plots/
fig_11_12_MCMC.m , MATLAB, 91 lines - LICENSE, License, 21 lines
- README.md, Text, 18 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;
- 12 scripts, each with its path and the digest of its content;
- 9 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
Data availability preprocessed EEG data of 19 subjects are available at 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, 30 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 5 authors, 10 MeSH terms, 6 funders, 28 references.
Cite
This paper
Hu, Z., Aravind, M., Lei, X., Kutz, J. N., & Aucouturier, J.-J. (2026). Learning the bistable cortical dynamics of the sleep-onset period. PLoS computational biology, 22(4), e1014246. https://
BibTeX
@article{hu2026learning,
author = {Hu, Zhenxing and Aravind, Manaoj and Lei, Xu and Kutz, J. Nathan and Aucouturier, Jean-Julien},
title = {{Learning the bistable cortical dynamics of the sleep-onset period}},
journal = {PLoS computational biology},
year = {2026},
month = apr,
volume = {22},
number = {4},
pages = {e1014246},
publisher = {PLOS},
issn = {1553-734X},
doi = {10.1371/
url = {https://
pmid = {42060699},
pmcid = {PMC13152216}
}
RIS
TY - JOUR
AU - Hu, Zhenxing
AU - Aravind, Manaoj
AU - Lei, Xu
AU - Kutz, J. Nathan
AU - Aucouturier, Jean-Julien
TI - Learning the bistable cortical dynamics of the sleep-onset period
T2 - PLoS computational biology
J2 - PLoS Comput Biol
PY - 2026
DA - 2026/
VL - 22
IS - 4
SP - e1014246
SN - 1553-734X
PB - PLOS
DO - 10.1371/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1371/
"type": "article-journal",
"title": "Learning the bistable cortical dynamics of the sleep-onset period",
"container-title": "PLoS computational biology",
"author": [
{
"family": "Hu",
"given": "Zhenxing"
},
{
"family": "Aravind",
"given": "Manaoj"
},
{
"family": "Lei",
"given": "Xu"
},
{
"family": "Kutz",
"given": "J. Nathan"
},
{
"family": "Aucouturier",
"given": "Jean-Julien"
}
],
"container-title-short":
"volume": "22",
"issue": "4",
"page": "e1014246",
"DOI": "10.1371/
"PMID": "42060699",
"PMCID": "PMC13152216",
"ISSN": "1553-734X",
"publisher": "PLOS",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
30
]
]
}
}
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-025-02091-1 [code]
- Falling asleep follows a predictable bifurcation dynamic.Journal: Nature neuroscienceIn common: Statistics and Machine Learning Toolbox, SciPy, Matplotlib, 1 other tool, EEG, 5 references
- [2] doi:10.1098/rsif.2024.0880 [code]
- Dynamic causal modelling in probabilistic programming languages.Journal: Journal of the Royal Society, InterfaceIn common: PyMC, ArviZ, seaborn, 4 other tools, computational, 1 reference
- [3] doi:10.1016/j.bpsgos.2025.100541 [code]
- Predicting Mental and Neurological Illnesses Based on Cerebellar Normative Features.Journal: Biological psychiatry global open scienceIn common: PyMC, ArviZ, seaborn, 5 other tools, computational
- [4] doi:10.1016/j.xpro.2024.103496 [code]
- Protocol for artificial intelligence-guided neural control using deep reinforcement learning and infrared neural stimulation.Journal: STAR protocolsIn common: PyMC, ArviZ, seaborn, 5 other tools, computational
- [5] doi:10.1162/imag.a.1269 [code]
- From early to contemporary normative modeling: Mapping individual differences in neurophysiological signals.Journal: Imaging neuroscience (Cambridge, Mass.)In common: PyMC, ArviZ, seaborn, 4 other tools, computational, EEG
- [6] doi:10.1371/journal.pcbi.1011406 [code]
- Simulation-based inference for efficient identification of generative models in computational connectomics.Journal: PLoS computational biologyIn common: PyMC, ArviZ, pandas, 3 other tools, computational, 1 reference
- [7] doi:10.1038/s42003-026-10957-8 [code]
- Brain defence by the extracellular matrix protein Cochlin.Journal: Communications biologyIn common: PyMC, ArviZ, seaborn, 5 other tools
- [8] doi:10.1038/s41380-026-03457-y [code]
- Connectome-based growth models reveal individual heterogeneity and neurophysiological subtypes of subthreshold depression.Journal: Molecular psychiatryIn common: PyMC, ArviZ, seaborn, 5 other tools
- [9] doi:10.1038/s41540-026-00727-x [code]
- Association-sensory spatiotemporal hierarchy and functional gradient-regularised recurrent neural network with implications for schizophrenia.Journal: NPJ systems biology and applicationsIn common: PyMC, ArviZ, seaborn, 4 other tools, computational
- [10] doi:10.1038/s42003-026-09825-2 [code]
- Normative modeling of MEG brain oscillations across the human lifespan.Journal: Communications biologyIn common: PyMC, ArviZ, seaborn, 4 other tools, computational
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, 12 scripts, and 9 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:157b75f31b7b8254…
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.1371/journal.pcbi.1014246)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1371/journal.pcbi.1014246.svg
:target: https://openscicode.org/badge/doi/10.1371/journal.pcbi.1014246
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1371/journal.pcbi.1014246"><img src="https://openscicode.org/badge/doi/10.1371/journal.pcbi.1014246.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.
