Sleep


07/17/23 343 words

I wrote a little program to visualize my sleeping habits. The data is held in a Google Sheet, and the program is written in Python3. The graph is generated with matplotlib.

You can view the code here.

Motivation

Back in 2021, I read a few articles on the quantified self. The quantified self is to treat one's lifestyle as a numbers game, usually supplemented by analysis or optimization. This isn't exactly how I wanted to direct my life, but I was interested in tracking something, just to see how it would develop long-term.

I knew I liked staring at the sleep tracker on my phone, but it wasn't very accurate as it assumed I would fall asleep before a set bedtime. So, I started tabulating my sleep and wake times on September 21, 2021.

Results

Here's my chart for 2021, starting on September 21: Nice, only one day where I slept before midnight. But as a student, what can I say?

I also calculated some bonus statistics on the side. The shortest sleep during this time period was 5 hours and 45 minutes, on December 30. The longest sleep was 10 hours and 40 minutes, which actually occurred three times in December.

On average, I fell asleep at 2:21 AM and woke up at 10:38 AM. But, I got about 8 hours and 17 minutes of sleep per day, which is healthy, I think. If I ever move to California, I would adjust very easily.

Now here's my chart for 2022, up to July 16 (can you guess when I started my 9 to 5?): My shortest sleep was 3 hours, on June 18, and the longest sleep was 10 hours and 25 minutes, once in March and the other in April. On average, I slept 8 hours and 4 minutes per day. I'm pretty satisfied with that length.

One interesting observation was that my sleeping habits appeared periodic. For a few weeks I would sleep super late, then ease back into earlier hours. I'm not sure why this happens.



back