This page contains source code for most of the in-house software we use in the lab. There are two main languages represented (at the moment): Arduino (which is really C++), and Python. We also build a lot of things in the lab and I may post schematics for the things that the Arduino code controls soon. The files below are organized not by what language they are in but by what they do. Sorry if that's confusing.
A lot of our experiments involve tracking animals moving around in videos. We use automated tracking software to do this. Mostly we use our own software, which you can download below. However, there is a lot of great FREE tracking software out there that is a lot more sophisticated than ours. We particularly recommend IDTracker. Our tracker is written in Python and depends on OpenCV. The ZIP file contains the Python code, a user's manual, and a default parameter file (explained in the manual). The software is free to use and redistribute.
Automated fish tank.
Recently, for a number of reasons, I've designed and built a completely automated fish tank. The tank has a hacked automated feeder, a string of LED lights, a temperature sensor and heaters, a water-depth detector, and two peristaltic pumps that can add or remove water, all connected to an Arduino which is connected to a laptop. I will post the schematics for it soon, along with some pictures. In the meantime, below is the code that runs it. There is an Arduino script that controls the actual tank and a Python script that controls the Arduino script. At the top of the chain, ideally, is a human that controls the Python script.
social network measures.
In our experiments on Japanese quail, we often calculate the dominance hierarchy in a given group. We pair the birds up and have them 'fight' over right-of-way to see who wins in each contest. The first Python script below ("dominance_pairing_v1.0") gives the algorithm we use to pair up the birds so that everyone meets everyone else and no-one runs more than once a day. This may seem trivial but it isn't. The other Python script, "elo_ranks_v2.0", takes as input a list of the 'contests' between pairs of individuals. The script generates a set of ELO scores which define the dominance hierarchy (higher score = more dominant). It also calculates a randomized Elo score and confidence intervals, and also returns two common measures of transitivity (Kendall's K and Landau's h), which measure how strict the hierarchy is by counting closed triangles (e.g., if A beats B, B beats C, and C beats A, then the hierarchy is not very linear). A sample data-set from our quail is included. The scripts are both free to use and redistribute.