Better Living Through Data

One running theme on this blog has been that of data-driven self study. A favorite source for data about myself is my laptop battery logs. Last summer I shared what an entire year of laptop battery usage looks like, in remarkable detail. Today I'm excited to show the follow up data!

Here is what two years of laptop battery use looks like, sampled every minute I've used my computer(s). This includes 293,952 data points, at time of writing. Since the "batlog" script runs every minute, that translates to over 204 days of computer use in the last ~2 years! Yowza

Update: Per several requests, I have added a more detailed install guide in the README file on github. 
This newer 2013 MacBook Air is holding up much better than the 2012 model, and I'm consistently still getting 6-8 hours of life out of the battery at least. The scatter on the battery capacity for the 2013 model is higher, which is mildly interesting. For reference, Time = 0 for the older model (blue) occurred at Tue Aug 14 10:41:46 PDT 2012, and for the newer model (red) at Sat Aug 24 12:16:00 PDT 2013.

Creature of Habit

The story of the battery is fascinating to me, from a technical perspective at least. I wonder if there is value in this sort of very well sampled data for engineering. However, this time I wanted to focus more on my own computer usage and behavior. For the past 2 years, here is when I am using my computer:
A fun thing to notice: my computer apparently wakes up a few times every night... I wonder what it's dreaming about? As I've pointed out before, the large gap last summer was my internship at MSR, where I didn't use my personal computer most days. You can also see some very long days, big streaks where I'm staying up most of the night. These are when I'm observing on a telescope usually.  The figure nicely shows I'm in bed by ~1230 or 1AM, and up (and working) by around 8 or 9AM.

Here are some round numbers:
Total computer use: 204 days
Longest day: 19 hours
Median day: 6.9 hours
Median week: 50.6 hours
Of course, these are averaging data from over 2 years, and only include the time I work on this computer specifically. All told, that's still a lot of use...

I was also curious to know what my day-of-week trends look like. Here is that data, also breaking it down between the 2 laptops:

With the newer computer (Year 2) I'm working considerably less in the evenings. I'd consider this better living! (also less blogging as a trade off, alas)

Combining both years (grey trend above) I actually do the most work on Tuesday. This surprised me, as I try to make Monday my power day. Monday/Tuesday are remarkably close. Here are the actual fractions:
Mon: 18.47 %
Tue: 18.68 %
Wed: 16.70 %
Thu: 17.43 %
Fri: 13.67 %
Sat:  7.01 %
Sun:  8.01 %
I wonder how this compares with other measures of productivity... emails? commits to repos? sentiment analysis of my social network posts?

Follow the Power

As the "batlog" script gathers time data, it also saves capacity and battery charge. If you compare subsequent data points you can tell if the computer was charging, plugged in, or discharging. This simple added bit of information tells volumes about what I'm doing every day. Here are the charging patterns of my laptop throughout the day:
I don't think I've ever seen a figure quite like this before. There's TONS of detail here, I love it! If the original time of day versus day figure is a silhouette of my computer usage (no details), then this version is getting to be a "fingerprint" for my life!

For clarification, here's the color scheme I've used (Spectral, the slightly less obnoxious rainbow!) based on the great implementation of the Brewer tables for IDL by Michael Galloy

The first feature that popped out to me: you can see I spend most mornings at a cafe. This shows up as these color streaks every morning, as I sip coffee and drain my battery slowly. The length of this rainbow stripe each AM is a really good measure of how long I'm in the cafe. 

I wonder if my total productivity, or pages or lines of code written per day, is correlated positively with  the time I spend in that first morning's stint of the cafe. I don't have the data to answer that (yet) but my gut tells me I'm happier when I spend that extra hour working in the solitude of a coffee house.

Then the laptop charges all day while I'm at work, staying plugged in at my desk. You electronics experts out there, is this very bad for my computer battery?

Too Much Computer?

All this data, and all this time "plugged in", drives me to pose a question: can we be modern scientists and not spend 7-10hrs a day staring at a computer? Too much media/computer use isn't good for your brain. The posture you adopt is bad for your health.

I worry computers are making people less creative in some ways, and too much time online is certainly bad for your soul. You need sunlight, air, dirt. You also need to talk with people to synthesis things and generate new ideas. You need to do this a lot as a scientist. A lot more than we do, I think.

Can we use data like this to learn about our habits, and then positively inform our actions? Could such monitoring aid interventions from the computer itself? Software that says "today's been a long slog, plugged in and running for 10 hours, try and go outside" or "lots of time off the charger today, maybe go visit the office?" Could this help make us happier and more productive? What other data could we passively collect that might help inform positive change?

Needing More Data

I think my dataset is unmatched for its personal detail and duration. One of the coolest things about the blog post from a year ago was that people started sending me their battery readings. A bunch of people also got excited about this project and checked out my github repo. If you did, I would *love* for you to send me your data!!! Also, please send me some metadata, such as:

  • What model/year is your computer?
  • Is this a work or home computer primarily? Or both?
  • Briefly describe a typical weekday, in relation to your computer (when you use it, where, etc)
  • Your age/gender

More examples of this kind of passively collected quantified-self data would make for an awesome study about modern computer usage, and is something I'd like to pursue in the next year! Reach out if you have thoughts!


  1. I find it ironic that you can make a blanket statement like

    "too much time online is certainly bad for your soul. You need sunlight, air, dirt. You also need to talk with people to synthesis things and generate new ideas. You need to do this a lot as a scientist."

    on a blog that's supposed to be datacentric.

    Juuuuuuust nosetweaking :)

    1. Ironic? Maybe, yeah. But I think it can be true also.

      Case & point: one shouldn't work 24/7/365, nor should they stare at a computer screen constantly... if for no other reason than you need to collaborate with people to be creative sometimes.

    2. It's the *most* appropriate place to make such a statement!

    3. Very true! And I submit that much (though admittedly not all) collaboration can be done virtually.


  2. Could you share the script you use to draw these graphs?

  3. This is great work, man! I'm both eager to try this out with my own computer and terrified of what the results are likely to be. I know that at the very least, there are few hours where I'm awake and not within 3 feet of my opened laptop.

  4. Stephen Wolfram has been collecting similar data about himself for a decade+.
    Makes nice eyecandy pictures, but haven't heard of much _utility_.

  5. Wolfram's personal data article -

  6. "Too much media/computer use isn't good for your brain. I worry computers are making people less creative in some ways, and too much time online is certainly bad for your soul. You need sunlight, air, dirt."
    Such statements abound but actually don't make much sense. It's just the progress our society is making and we should be proud and happy of it because it absolutely enhances our productivity. People just need to adapt to new things over time and overcome their resistance. I bet when pen and paper became popular similar statements were made of them! Which are of course quite nonsensical examine by time.


Inappropriate comments, advertisements, or spam will be removed.
Posts older than 2 weeks have moderated comments.
(Anonymous commenting disabled due to increasing spam)