BehavioPy - Python Evaluation and Plotting for Behaviour and Physiology

Focus and Impact

BehavioPy addresses the biomedical research and engineering need for easy-to-use, reproducible, and automatable high-level data analysis interfaces in analyzing behaviour and physiology. It brings the power of the scientific Python stack to fields still highly reliant on proprietary solutions, and serves as a repository for the complex and heterogeneous boilerplate code required to make multiple types of scientific Python plots consistent in appearance.


As part of the BehavioPy plotting capabilities we provide common timeseries, boxplot, and swarmplot functions, alongside wrappers which specifically tailor them to common behavioural tests (e.g. forced swim test, or sucrose preference) or common physiological measures (e.g. weight, or water intake). BehavioPy can also create and plot cross-correlation matrices for multiple behavioural and physiological read-outs, and seamlessy extend them to include e.g. region of interest values from neuroimaging - as demonstrated in Herde et al. (2017). All of the aforementioned plots support annotation with significance values. Additionally, we provide a unique quasi-calendar plotting functionality (the timetableplot) for animal treatment, test, or operation overview.

BehavioPy's evaluation capabilities center around an event tracking function which is usable in (randomized) batch mode for multiple trials, configurable to track any number of events via as many hotkeys, and which leverages experimental psychology tools to eliminate interference with the experiment evaluation. Evaluation results thus produced can be seamlessly piped to the provided plotting functions, or exported as Pandas DataFrames or CSV files for analysis with other packages.

Integration with the Scientific Python Environment

BehavioPy uses the capabilities of the scientific Python stack; including Pandas for the internal data structure and as an input and output option, Seaborn for common plotting styles, pure Matplotlib for the creation of novel plotting designs, Numpy, Scipy, and Statsmodels for data processing, and PsychoPy for accurate event tracking. The functionalities provided by our package can in turn be used for the creation of reproducible documents (e.g. via PythonTeX - as exemplified in the poster source code) or by other data management tools (e.g. LabbookDB) in order to seamlessy provide reports.