A couple of weeks back I was thinking about monitors and sensors and had a crazy idea: it ought to be possible to gather stats on how well my plonk is fermenting by attaching a mic to the airlock and counting the bubbles. So in a moment of enthusiasm I ordered a cheap lapel microphone from eBay and forgot all about it… until Saturday morning when it finally arrived in the post.
Time for some fun!
While messing with Python to output some better graphs for my Facebook group scraper I stumbled upon an interesting problem. What happens if you have missing samples, or want to change the sampling frequency half way through your log? Well, you could use a proper math library and have extra dependencies or generate the missing data manually, but the simplest answer I could think of was to write a list class which interpolates between missing values, so you can do something like this:
>>> a = InterpoList()
>>> a = 0
>>> a = 200
>>> a = 0
And then store the time values as seconds past the epoch. Now I can inject data from multiple sources taken at different frequencies and retrieve an interpolated value for any time, which means more nice graphs like this:
As usual I also decided to share it with the Internet, because I’m nice like that! You can get a copy of the InterpoList module here.
I’ve stopped using Google Analytics and have now moved over to Piwik. I don’t have that many visitors, but there are still lots of good reasons to use Piwik. It’s better for everyone if I keep hold of my own stats instead of giving it all to Google and I may even do some Piwik hacking in the future.
Getting it working in Gallery2 was a bit of a pain, so I updated their wiki for them, but other than that it’s about the same as installing Google Analytics.
Subscribers are welcome to see my laughable stats