Category: Software

Open source modules for tracking animal behavior and closed-loop stimulation based on Open Ephys and Bonsai

June 15, 2018

In a recent preprint on BioRxiv, Alessio Buccino and colleagues from the University of Oslo provide a step-by-step guide for setting up an open source, low cost, and adaptable system for combined behavioral tracking, electrophysiology, and closed-loop stimulation. Their setup integrates Bonsai and Open Ephys with multiple modules they have developed for robust real-time tracking and behavior-based closed-loop stimulation. In the preprint, they describe using the system to record place cell activity in the hippocampus and medial entorhinal cortex, and present a case where they used the system for closed-loop optogenetic stimulation of grid cells in the entorhinal cortex as examples of what the system is capable of. Expanding the Open Ephys system to include animal tracking and behavior-based closed-loop stimulation extends the availability of high-quality, low-cost experimental setup within standardized data formats.

Read more on BioRxiv, or on GitHub!

Buccino A, Lepperød M, Dragly S, Häfliger P, Fyhn M, Hafting T (2018). Open Source Modules for Tracking Animal Behavior and Closed-loop Stimulation Based on Open Ephys and Bonsai. BioRxiv.

ToxTrac: A fast and robust software for tracking organisms

June 8, 2018

OpenBehavior has shared a variety of popular open-source tracking software, and there’s another to add to the list: ToxTrac!

Alvaro Rodriguez and colleagues from Umeå University in Umeå, Sweden, have developed ToxTrac, an open-source Windows program optimized for high-speed tracking of animals. It uses an advanced tracking algorithm that requires no specific knowledge of the geometry of tracked bodies and can therefore be used for a variety of species. ToxTrac can also track multiple bodies in multiple arenas simultaneously, while maintaining individual identification. The software is fast, operating at a rate >25 frames per second, and robust against false positives. ToxTrac generates useful statistics and heat maps in real scale that can be exported in image, text and excel formats to provide useful information about locomotor activity in rodents, insects, fish, etc.

Learn more about ToxTrac here:

Or Download ToxTrac software here:

Rodriguez A, Zhang H, Klaminder J, Brodin T, Andersson PL, Andersson M. ToxTrac: A fast and robust software for tracking organisms. Methods Ecol Evol. 2018;9:460–464.


June 6, 2018

This post is relevant for MedPC users who also use MatLab or Python for data analysis.

We recently became aware that many MedPC users are not saving precise times for behavioral events from their experiments. A method called time-event codes was worked out around 2000 by Russ Church and his group at Brown, working with MedAssociates. Marcelo Caetano, a former postdoc in the Laubach Lab at Yale, incorporated this approach into an existing MatLab function (MedParse, written by Kumar Narayanan during his PhD training in the Laubach Lab at Yale). More recently, the code was ported to Python by Kyra Swanson, a Phd student in the Laubach Lab at American University. It is available at MedPC code for saving precise times of behavioral events (example in MedPC Template) and MatLab and Python functions are provided that convert MedPC data (see the template) into “time-event codes,” i.e., a two-column matrix with times (column 1) and events (column 2).


FaceMap: Unsupervised analysis of rodent behaviors

May 15, 2018

We developed a toolbox for videographic processing of head-fixed rodent behaviors. It extracts the principal components of the animal’s behavior, either in a single movie, or across movies recorded simultaneously. Several regions of interest in the movie can be processed simultaneously (such as the whisker pad or the nose). We found that the behavioral components from the full face of the mouse predicted up to half of the explainable neural activity across the brain (see

In addition to extracting movement components, it can compute the pupil area of the rodent using a center-of-mass estimation. Also, in experiments in which the mouse sits on a surface with texture, the software can estimate the running speed of the mouse. The software is available here (

MAPLE: a Modular Automated Platform for Large-Scale Experiments

January 8th, 2018 
The de Bivort lab and FlySorter, LLC are happy to share on OpenBehavior their open-source Drosophila handling platform, called MAPLE: Modular Automated Platform for Large-Scale Experiments.

Drosophila Melanogaster has proven a valuable genetic model organism due to the species’ rapid reproduction, low-maintenance, and extensive genetic documentation. However, the tedious chore of handling and manually phenotyping remains a limitation with regards to data collection. MAPLE: a Modular Automated Platform for Large-Scale Experiments provides a solution to this limitation.

MAPLE is a Drosophila-handing robot that boasts a modular design, allowing the platform to both automate diverse phenotyping assays and aid with lab chores (e.g., collecting virgin female flies). MAPLE permits a small-part manipulator, a USB digital camera, and a fly manipulator to work simultaneously over a platform of flies. Failsafe mechanisms allow users to leave MAPLE unattended without risking damage to MAPLE or the modules.

The physical platform integrates phenotyping and animal husbandry to allow end-to-end experimental protocols. MAPLE features a large, physically-open workspace for user convenience. The sides, top, and bottom are made of clear acrylic to allow optical phenotyping at all time points other than when the end-effector carriages are above the modules. Finally, the low cost and scalability allow large-scale experiments ($3500 vs hundreds of thousands for a “fly-flipping” robot).

MAPLE’s utility and versatility were demonstrated through the execution of two tasks: collection of virgin female flies, and a large-scale longitudinal measurement of fly social networks and behavior.

Links to materials:

CAD files

Control Software

Raw data and analysis scripts 

De Bivort Lab Site 


ArControl: Arduino Control Platform

January 3rd, 2018

The following behavioral platform was developed and published by Xinfeng Chen and Haohong Li, from Huazhong University of Science and Technology, Wuhan, China

ArControl: Arduino Control Platform is a comprehensive behavioral platform developed to deliver stimuli and monitor responses. This easy-to-use, high-performance system uses an Arduino UNO board and a simple drive circuit along with a stand-along GUI application. Experimental data is automatically recorded with the built-in data acquisition function and the entire behavioral schedule is stored within the Arduino chip. Collectively, this makes ArControl a “genuine, real-time system with high temporal resolution”. Chen and Li have tested ArControl using a Go/No-Go task and a probabilistic switching behavior task. The results of their work show that ArControl is a reliable system for behavioral research.

Source codes and PCB drafts may be found here: ArControl Github




December 18, 2017

ZebraTrack is a cost-effective imaging setup for distraction-free behavioral acquisition with automated tracking using open-source ImageJ software and workflow for extraction of behavioral endpoints of zebrafish. This ImageJ algorithm is capable of providing control to users at key steps while maintaining automation in tracking without the need for the installation of external plugins.

Nema, S., Hasan, W., Bhargava, A., & Bhargava, Y. (2016). A novel method for automated tracking and quantification of adult zebrafish behaviour during anxiety. Journal of Neuroscience Methods, 271, 65-75. doi:10.1016/j.jneumeth.2016.07.004



November 28, 2017

Pyper is developed by The Margrie Laboratory.

Pyper provides real-time or pre-recorded motion tracking of a specimen in an open-field. Pyper can send TTL pulses based on detection of the specimen within user-defined regions of interest.  The software can be used through the command line or through a built-in graphical user interface. The live feed can be provided by a USB or Raspberry Pi camera.

Example of Pyper tracking a mouse in an open field

Find more information here.

Manual for Pyper.