A reproducible Docker environment for chronobiology and actigraphy research, built on Python 3.11 + R 4.4 + JupyterLab + RStudio.
circadiaBase_Docker is a self-contained research computing environment for the Circadia Lab. It packages a fully pinned Python + R stack into two Docker services that share the same volume, ensuring reproducibility across machines and collaborators.
- JupyterLab β Python-based actigraphy, EEG/sleep staging, entropy, and circadian modelling
- RStudio Server β R-based sleep and circadian analyses with GGIR, ActCR, circacompare, brms, and lme4
- π Fully pinned dependencies β every package version is locked for reproducibility
- π JupyterLab β browser-based notebook interface at
localhost:8889 - π§ͺ RStudio Server β full IDE for R at
localhost:8787 - π Shared volume β both services read/write the same project files
- π‘ pyActigraphy β actigraphy analysis including REST-activity metrics, cosinor, and SSA
- π§ MNE + YASA β EEG processing and automatic sleep staging
- π Full scientific stack β numpy, scipy, pandas, matplotlib, scikit-learn, seaborn, statsmodels, plotly
- π EntropyHub β entropy methods for physiological time series
- π R stats β lme4, lmerTest, emmeans, ggplot2 extensions
- π°οΈ R circadian β GGIR, ActCR, circacompare, cosinor
- π¬ condor_pipeline β Circadia Lab actigraphy sleep analysis library, installed in editable mode
- π Apple Silicon native β RStudio service uses
jmgirard/rstudio2uwith full ARM64 support - π€ Auto-configured β
.envis generated automatically from the repo name via GitHub Actions - βοΈ Gated R profiles β choose build depth via
RSTUDIO_PROFILEin.env
circadiaBase_Docker/
βββ .github/
β βββ workflows/
β βββ setup-env.yml # Auto-generates .env from repo name on push
βββ condor_pipeline/ # Circadia Lab core actigraphy library (editable install)
β βββ algorithms/ # Sleep scoring algorithms (Cole-Kripke, vendor)
β βββ detection/ # Off-wrist, sleep period, WASO detection
β βββ io/ # Device readers (ActTrust, Actiwatch)
β βββ preprocessing/ # Data preparation and consistency checks
β βββ viz/ # Actogram and visualisation helpers
β βββ pipeline.py # High-level SleepPipeline orchestrator
βββ jupyter/
β βββ Dockerfile # Pinned Python 3.11 image
βββ notebooks/ # JupyterLab notebooks
βββ rstudio/
β βββ Dockerfile # Placeholder β do not use directly
β βββ Dockerfile.minimal # r2u + RStudio, no Stan, no lunaR (default)
β βββ Dockerfile.no-stan # r2u + RStudio, no Stan, with lunaR
β βββ Dockerfile.full # r2u + RStudio, Stan + lunaR
βββ docker-compose.yml # Two services: jupyter (8889) + rstudio (8787)
βββ pyproject.toml # condor_pipeline package definition
βββ .env # Auto-generated by GitHub Actions
βββ .env.example # Template with all configurable variables
βββ .gitignore
βββ LICENSE
For a full step-by-step walkthrough, see TUTORIAL.md.
git clone https://github.com/circadia-bio/circadiaBase_Docker.git
cd circadiaBase_Docker
cp .env.example .env
docker-compose up --build| Service | URL | Notes |
|---|---|---|
| JupyterLab | http://localhost:8889/lab | No token required |
| RStudio Server | http://localhost:8787 | No password required |
This repository includes a GitHub Actions workflow (.github/workflows/setup-env.yml) that runs automatically on every push to main. It does two things:
1. Generates .env from the repo name
When you fork or use this repo as a template, the workflow reads the repository name, converts it to a Docker-safe format (lowercase, underscores for special characters), and writes it as IMAGE_NAME in .env. This means collaborators never need to manually configure the image name β it's set correctly the first time they push.
For example, a repo named Per3_Study becomes IMAGE_NAME=per3_study.
2. Resets the README to a stub template (first push only)
On the first push to a new repo, if the README still contains placeholder text, the workflow replaces it with a minimal stub pre-filled with the repo name and Circadia Lab authorship. This only runs once β once you customise the README, the workflow detects it has been updated and skips the reset on all future pushes.
For the workflow to commit back to the repo, GitHub Actions needs write permissions. Enable this in your repo under:
Settings β Actions β General β Workflow permissions β Read and write permissions
If you are working locally without pushing to GitHub first, create .env manually:
cp .env.example .envThen edit IMAGE_NAME to match your project name if needed.
All configuration lives in .env:
IMAGE_NAME=circadia_base # Docker image name β set automatically from repo name
DISABLE_AUTH=true # Disable RStudio password (local dev only)
COMPOSE_PROFILES=both # Services to run: both | jupyter | rstudio
RSTUDIO_PROFILE=minimal # R build profile: minimal | no-stan | fullCOMPOSE_PROFILES |
Services started |
|---|---|
both (default) |
JupyterLab + RStudio |
jupyter |
JupyterLab only |
rstudio |
RStudio only |
| Profile | Stan | lunaR | Build time |
|---|---|---|---|
minimal (default) |
β | β | ~5β8 min |
no-stan |
β | β | ~10β15 min |
full |
β | β | ~30β40 min |
condor_pipeline is the Circadia Lab's core actigraphy sleep analysis library, included directly in this environment and installed in editable mode (pip install -e .). This means import condor_pipeline works out of the box in any notebook or script, and changes to the source are reflected immediately without rebuilding the image.
| Module | Purpose |
|---|---|
condor_pipeline.pipeline |
High-level SleepPipeline orchestrator β single file and batch modes |
condor_pipeline.io |
Device readers for ActTrust and Actiwatch formats |
condor_pipeline.preprocessing |
Data preparation, timestamp consistency checks |
condor_pipeline.detection |
Off-wrist detection, sleep period detection, WASO |
condor_pipeline.algorithms |
Cole-Kripke and vendor sleep scoring algorithms |
condor_pipeline.viz |
Actogram plotting |
from condor_pipeline.pipeline import SleepPipeline
# Single file
pipe = SleepPipeline("data/raw/subject_01.txt", device="acttrust")
result = pipe.run()
print(result.nights)
result.plot()
# Batch
results = SleepPipeline.batch("data/raw/", device="acttrust", pattern="*.txt")
for r in results:
print(r.subject_id, r.nights)To enable editable install, set INSTALL_PACKAGE=true in .env before building.
The vendor algorithms bundled in condor_pipeline/algorithms/vendor/ originate from Condor-Instruments/actigraphy-tutorials-sample and are copyright Β© Condor Instruments. Please refer to their repository for licensing terms before redistribution.
The remaining condor_pipeline wrapper code is copyright Β© Circadia Lab β Lucas FranΓ§a & Mario Leocadio-Miguel, released under the MIT Licence.
| Package | Version | Purpose |
|---|---|---|
| Python | 3.11 | Base interpreter |
| JupyterLab | 4.5.6 | Notebook interface |
| notebook | 7.5.5 | Classic notebook support |
| Package | Version | Purpose |
|---|---|---|
| numpy | 1.26.4 | Numerical computing |
| scipy | 1.14.1 | Scientific algorithms |
| pandas | 2.2.2 | Tabular data |
| matplotlib | 3.9.2 | Plotting |
| seaborn | 0.13.2 | Statistical visualisation |
| scikit-learn | 1.5.2 | Machine learning |
| statsmodels | 0.14.6 | Statistical modelling |
| plotly | 4.11.0 | Interactive plots |
| Package | Version | Purpose |
|---|---|---|
| pyActigraphy | GitHub (artvalencio) | Actigraphy analysis, REST-activity, cosinor, SSA |
| mne | 1.8.0 | EEG/MEG processing |
| yasa | 0.6.5 | Automatic sleep staging |
| EntropyHub | 2.0 | Entropy-based time series methods |
| Package | Version |
|---|---|
| joblib | 1.5.3 |
| lmfit | 1.3.4 |
| numba | 0.65.1 |
| pyexcel | 0.7.4 |
| pyexcel-ods3 | 0.6.1 |
| pyexcel-xlsx | 0.6.1 |
| spm1d | 0.4.53 |
| stochastic | 0.6.0 |
| lxml | 6.1.0 |
| Package | Purpose |
|---|---|
| jmgirard/rstudio2u | r2u + RStudio Server, ARM64-native, binary apt installs |
ggplot2 extensions β ggpubr, ggrepel, ggridges, patchwork, cowplot, scales, viridis, RColorBrewer
Stats β lme4, lmerTest, emmeans, MuMIn, effectsize, performance, parameters, see
Bayesian (no-stan / full profiles) β bayesplot, tidybayes, brms*, rstanarm*
Sleep & circadian β GGIR, ActCR, circacompare, cosinor, cosinor2, lunaR**
* full profile only β ** no-stan and full profiles only
| Role | Names |
|---|---|
| Principal Investigators | Lucas FranΓ§a, Mario Leocadio-Miguel |
| Development | Lucas FranΓ§a, Mario Leocadio-Miguel |
- π SleepDiaries β cross-platform sleep diary app built for research
- π sleep-questionnaires β validated sleep questionnaire instruments (PSQI, ESS, ISI, MEQ, and more)
- π¬ circadia-bio β the Circadia Lab GitHub organisation
Copyright Β© Circadia Lab β Lucas FranΓ§a & Mario Leocadio-Miguel
Released under the MIT License.
