Download from NSRR¶
Download files from a dataset on the National Sleep Research Resource (NSRR).
Synopsis¶
See CLI for the full reference.
Before you start¶
Get an NSRR token¶
- Create an account at sleepdata.org.
- Request access to the dataset (e.g. SOF, SHHS, MESA).
- After approval, copy your auth token from the dataset page or account profile.
- Pass it with
--tokenor set theNSRR_TOKENenvironment variable (e.g. in.env).
Output layout¶
Files are placed under OUTPUT_DIR/SLUG/. If you use --path, only that subpath is created. For example:
somnio download-nsrr sof ./data ...→./data/sof/...somnio download-nsrr shhs ./data --path polysomnography ...→./data/shhs/polysomnography/...
Examples¶
Full dataset¶
Download the full SOF dataset into ./data:
Single subpath¶
Download only the polysomnography folder from SHHS:
Using the environment for the token¶
Avoid putting the token on the command line by setting NSRR_TOKEN (e.g. in .env or your shell):
Longer timeout and file logging¶
Use a 10-minute timeout and write logs to the default logs/ file:
Custom log file¶
Send debug logs to a specific file for later inspection:
Retries and timeouts¶
For flaky connections or slow networks, use --timeout-seconds to increase the per-request timeout. You can also tune --download-retries (retries per file on connection/read timeout) and --http-retries (retries for API requests). See the CLI reference for defaults and details.