Real-time sleep scoring and analysis visualizer.
Project description
NAPVIEW - An autoscoring visualizer for real-time sleep experiments.
Read the manual here: napview.netlify.app
NAPVIEW is a user-friendly software for automatic real-time sleep stage classification in the sleep lab. It provides a real-time interface to deep learning machine learning algorithm output. It connects to live EEG data, runs automated sleep stage classification using powerful machine learning tools, and displays stage probabilities and signal features. NAPVIEW runs independently of existing lab setups and is intended to make the lives of researchers easier during live monitoring at night.
At present NAPVIEW directly supports BrainVision and OpenBCI EEG hardware, but any EEG system that allows real-time signal streaming can be connected through a labstreaminglayer (LSL) connector.
Installation
Option 1: Download NAPVIEW installer (Windows)
The easiest way to use napview on Windows is to download the portable self-extracting installer.
Note: due to the restrictive environment of Windows, you may see a "Search on app store" popup window. Click "No". You may also see the blue Smartscreen warning. In that case click "More info" and then "run anyway". You can also right-click NAPVIEW.exe, go to Properties and tick the box "Unblock". Should this fail, try installing via the standalone archive or pip (see below).
Option 2: Download NAPVIEW standalone (Windows)
Download the zip archive, extract it to your preferred location, then double click run_napview.bat to start NAPVIEW. This installation method can be useful on systems without admin priviledges.
Option 3: Install as Python package
First install e.g. Miniconda.
Windows:
conda create -n napview-env python=3.11 -y
conda activate napview-env
pip install napview
macOS/Linux:
conda create -n napview-env python=3.11 -y
conda activate napview-env
pip install napview
Launch NAPVIEW:
conda activate napview-env
napview
Note: on first run, NAPVIEW may download model weights via the NIDRA backend.
GUI Guide
Graphical user interface (GUI)
NAPVIEW launches a local control panel in your browser and opens a second tab for the real-time visualizer. The default control URL is http://127.0.0.1:8145. If that port is unavailable, NAPVIEW will pick the next free port. The browser window should open automatically.
Walkthrough
Step 1: Start NAPVIEW
Start NAPVIEW.exe or run napview in a terminal or command prompt. A browser window opens with the control panel.
Step 2: Set data directory and record name
Use the Data directory selector to choose where session files and outputs are stored. The default location is your user data directory under napview/data.
Step 3: Select data source
- Playback recording (simulator): use the integrated example recording or select a local EDF file to simulate a live stream. The file is copied into the session data directory.
- BrainVision: enter the IP and RDA port of the EEG acquisition PC. On Windows you can find the IP by opening a command prompt (
CTRL+R, then typecmd, press Enter. Next, typeipconfig, press Enter, and look for an entry under "Ethernet adapter" or "Wireless LAN adapter Wi-Fi" if using Wi-Fi labeled "IPv4 Address"). The number shown next to IPv4 Address is the IP address of the EEG acquisition PC. The port is typically51234. - OpenBCI: choose a board type and port (if required). Use Synthetic to test without hardware.
- Custom LSL stream: provide the LSL stream name (default in config is
napview_EEG_stream). - ZMax: currently not implemented.
Step 4: Select the sleep staging model
Choose the sleep staging model. Currently only U-Sleep is available, which is a reliable state-of-the-art autoscorer.
Step 5: Optional settings
- Analysis parameters: e.g. adjust epoch length. This is currently not implemented and 30s epochs will always be used.
- Channel configuration: select EEG channels to use. This is optional, as NAPVIEW will automatically detect channel type and will skip noisy or empty channels. During scoring all combinations between valid EEG and EOG channels are being used and scored individually. The final score is then determined by majority vote.
Step 6: Start streaming
Click START napview. A new tab opens with the real-time visualizer, typically at http://127.0.0.1:8245. Sleep stage probabilities stabilize after several minutes of data. Less than 5 minutes of data will likely not result in reliable estimates. A maximum of 15 minutes of past data will be used.
Step 7: Shutdown and save
Once the experiment session is finished, click SHUTDOWN and save to stop the session and write outputs.
Notes
- NAPVIEW expects a continuous EEG stream with channel names available from the stream metadata.
- Use the Simulator to test the systemwith a static EDF file.
- For BrainVision, make sure the RDA plugin is enabled and configured correctly.
- For custom LSL streams, make sure the stream type is EEG and the name matches the value in the GUI.
- It is recommended that you test the system first with the Simulator, then with an EEG amp connected without a participant, and finally with an awake participant. If everything works as expected you are now prepared to use NAPVIEW during an overnight session.
Model Validation
NAPVIEW uses the NIDRA backend for real-time scoring. The default staging model is U-Sleep, which has been validated in large multi-center datasets. For detailed performance metrics, refer to the original U-Sleep publication:
U-Sleep: resilient high-frequency sleep staging (Perslev et al., 2021)
FAQ & Troubleshooting
GUI issues
Q: The GUI did not open.
A: Check the terminal output for the correct URL, normally http://127.0.0.1:8145, and enter it manually in the browser. Otherwise check the logs, which should be in your user directory, e.g. C:\Users\<your-username>\AppData\Local\napview\data.
Q: The visualizer tab is empty or only shows a text message.
A: This usually means the data stream has not started or there is no incoming data. Confirm the data source and check the status panel for red warnings. Otherwise check the logs.
Q: My BrainVision EEG amp does not connect.
A: Verify the RDA plugin is enabled and the IP/port are correct.
Q: Custom LSL stream not found.
A: Ensure the stream is running, the stream name matches exactly, and the stream type is EEG.
How to Cite NAPVIEW
If you use NAPVIEW in your research, please cite the NAPVIEW repository and the underlying models.
1. Citing NAPVIEW
Zerr, P. (2025). napview: real-time sleep scoring and analysis visualizer. GitHub. https://github.com/paulzerr/napview
2. Citing U-Sleep
Perslev, M., et al. (2021). U-Sleep: resilient high-frequency sleep staging. NPJ Digital Medicine.
License
This project is released under the BSD-3 Clause License.
Contact
For questions, bug reports, or feedback, please contact Paul Zerr at paul.zerr@donders.ru.nl.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file napview-0.1.1.tar.gz.
File metadata
- Download URL: napview-0.1.1.tar.gz
- Upload date:
- Size: 7.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d335dda0ec5cd786d444b58132504fae7a5a510e669bd3cfb733b8582cad27c
|
|
| MD5 |
b12e965d032463ed72184076a12894da
|
|
| BLAKE2b-256 |
4e51a092188b813290a349a1948da34e8280dc1222e46dfee04a36b630df5d37
|
Provenance
The following attestation bundles were made for napview-0.1.1.tar.gz:
Publisher:
release_build.yml on paulzerr/napview
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
napview-0.1.1.tar.gz -
Subject digest:
3d335dda0ec5cd786d444b58132504fae7a5a510e669bd3cfb733b8582cad27c - Sigstore transparency entry: 1003814509
- Sigstore integration time:
-
Permalink:
paulzerr/napview@eb5e78d1f33be5cc2ab624e7111d296dfb7d431f -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/paulzerr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release_build.yml@eb5e78d1f33be5cc2ab624e7111d296dfb7d431f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file napview-0.1.1-py3-none-any.whl.
File metadata
- Download URL: napview-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3858f58c98e3436321c29e0d8b5d874a272c0a511960f0b05c6ab8f4af806fff
|
|
| MD5 |
a5db7db4fad5eb5f19418e8bc9532766
|
|
| BLAKE2b-256 |
fad29bf00ea47f071dc76614b2d1603d635e3d8638664d835473624e437ff15b
|
Provenance
The following attestation bundles were made for napview-0.1.1-py3-none-any.whl:
Publisher:
release_build.yml on paulzerr/napview
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
napview-0.1.1-py3-none-any.whl -
Subject digest:
3858f58c98e3436321c29e0d8b5d874a272c0a511960f0b05c6ab8f4af806fff - Sigstore transparency entry: 1003814514
- Sigstore integration time:
-
Permalink:
paulzerr/napview@eb5e78d1f33be5cc2ab624e7111d296dfb7d431f -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/paulzerr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release_build.yml@eb5e78d1f33be5cc2ab624e7111d296dfb7d431f -
Trigger Event:
workflow_dispatch
-
Statement type: