Skip to content

jacopofar/sleep-anki-correlation

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

Sleep and Anki performance

This repo implements a rough calculation of the correlation between sleep hours and daily Anki review performance.

Sleep is estimated using Google activities (assuming that the clock app is the last and first to be used when sleeping).

Anki card reviews performance are calculated using the complete revlog.

The result are two heatmaps and a Pearson coefficient. In my case, no correlation exists between the two metrics.

The activities heatmap, a vertical dark column represent the sleep The sleep/Anki heatmap, it shows high values around a point, with no distinctive linear correlation

How to run

You will have to adapt the scripts to parse the Google Activity file in your language anbd timezone, and maybe adapt to your sleep habits. Currently it assumes one sleeps only at night and never outside 21-9 in local time

The instructions below are for macOS/Linux and require Python 3. On Windows it should work but the first 3 commands will be different. Check the virtualenv documentation about it.

# create the virtualenv
python3 -m venv .venv
# activate it
source .venv/bin/activate
# install the requirements
python3 -m pip install -r requirements.txt
# read Google takeout HTML export and creates activities.jsonl
python3 activities_takeout_to_json.py
# shows a the day of the week/hour activities heatmap, can be skipped
python3 activities_weekly_heatmap.py
# reads Anki's collection.anki2 SQLLite file and creates anki_daily_performance.jsonl
python3 anki_daily_performance.py
# calculate correlation between sleep and Anki results, and show it
python3 anki_sleep_correlation.py

About

Script to estimate sleeping hours and correlate them with Anki performance

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages