Glitter: App to manually track lab animal behavior

Glitter is a app I developed in Python, using Kivy and FFPyPlayer, that enables users to efficiently code animal behaviors (e.g. eating) using video recording of experiments. It also allows users to track the position of the animal using touch or with a mouse. Data is saved in the HDF5 format and can be exported and analyzed using Python scripts.


Glitter is a Python app I developed to meet the requirements below.


Following is a overview of the typical workflow to code behavior. A user:

  • Loads an experiment video file and creates a data file for it.
  • Creates a data channels for the desired behavior to be tracked. E.g.
    • A channel that is controlled by the g key, which when pressed indicates the animal is grooming.
    • Two channels that track the animals head and tail, respectively.
    • A area of interest such as a reward cup.
  • Start coding the video
    • Video playback is controlled using the
      • Space key for pausing/playing.
      • Right/left arrow keys for seeking.
      • Up/down arrow keys for logarithmic control over the play speed.
    • Behavior data is visually shown on a timeline to indicate where behavior occurred, and animal position is similarly displayed.


Most behavior experiments with animals that are not live-scored, are video recorded, manually scored by multiple human scores, and then statistically analyzed. Although there is commercial software to track animal position, it is often inaccurate, especially for experiments under difficult or uneven backgrounds. No software currently commercially exists that can automatically score higher level behavior, such as eating, accurately.

We needed software that can:

  • Replay experimental video,
  • Support manual coding of higher level behavior by having a user press a button or a keyboard key when a behavior occurs,
  • Support user tracing of animal position using touch screen or a mouse. Either placing new traces, or correcting the automatic traces of commercial software.
  • Support drawing of areas of interest so we can compute when the animal traces intersect those zones.
  • Data file management of the resulting coded data.
  • Export and analysis of the GUI coded data.


After coding, data is accessible in Python using a object oriented interface. We can export information such as the duration of behavior events or the speed of the animal in a particular zone.

Glitter Glitter Glitter Glitter Glitter
Glitter gallery