EthoPy: Reproducible Behavioral Neuroscience Made Simple

Alexandros Evangelou, Maria Diamantaki, Κωνσταντίνα Γεωργέλου, Zoi Drakaki, Lydia Ntanavara, Gerasimos Gerardos, Sofia Morou, Nikolaos Chatziris, Zoi Dogani, Elissavet Anna Petsalaki, Odysseas Nikolaos Raos, Anastasios Gratsakis, Athanasia Papoutsi, Emmanouil FroudarakisbioRxiv 2025 · DOI

TL;DR

EthoPy is a new open-source Python framework designed to simplify and standardize the creation of complex behavioral experiments for neuroscience research. It integrates stimulus presentation, hardware control, and data logging, making sophisticated behavioral paradigms more accessible, reproducible, and scalable, even on affordable hardware like Raspberry Pis.

What Problem Does This Paper Address?

Understanding how brain activity translates to behavior is fundamental to neuroscience. However, current methods for training animals in behavioral experiments are often:

  • Labor-intensive and costly: Manual training requires significant time and effort, making it difficult to scale up for large cohorts or high-throughput studies.
  • Difficult to standardize: Variations in training procedures and experimenter involvement can lead to inconsistencies and reduce the reproducibility of results across different labs.
  • Limited in flexibility: Existing software platforms are often rigid, task-specific, and struggle to integrate diverse hardware or adapt to new experimental demands.
  • Challenging for data management: Reproducibility requires meticulous logging of experimental parameters (metadata), which is often inconsistent across different systems, hindering data sharing and reuse.

These challenges hinder the progress of neuroscience research, particularly in areas requiring complex behavioral tasks and large-scale data collection.

Methods

EthoPy tackles these problems with a modular, Python-based framework built around several key principles:

  • Modular Architecture: The framework is divided into five core modules: Experiment (protocol control), Behavior (interpreting animal actions), Stimulus (presenting sensory cues), Interface (hardware communication), and Logger (data management). This separation allows for easy customization and integration of new components.
  • Database Integration (DataJoint): All experimental parameters, hardware configurations, and behavioral data are stored in a relational database using DataJoint. This ensures comprehensive traceability, enables complex queries, and facilitates data sharing.
  • Hardware Agnosticism: EthoPy is designed to work with a variety of hardware, from low-cost Raspberry Pis and Arduinos to more specialized components. This allows researchers to build setups tailored to their needs and budget.
  • Extensibility through Plugins: The framework supports a plugin system, allowing users to easily add custom behaviors, stimuli, or hardware interfaces without modifying the core code.
  • State Machine for Experiment Control: The Experiment module uses object-oriented state machines to define experimental protocols, enabling flexible and adaptive task designs.
  • Real-time Monitoring and Control: EthoPy includes a web-based interface for monitoring experiments in real-time, allowing for remote control and immediate assessment of animal performance.
  • Reproducibility Focus: Comprehensive metadata tracking, version control for task configurations, and standardized data export formats (like NWB) are central to ensuring reproducible research.

Datasets

The paper does not describe specific datasets used for training machine learning models. Instead, it focuses on the framework's ability to generate and manage data from behavioral experiments. The "datasets" in this context are the experimental data collected from animals performing various tasks. The paper demonstrates the framework's utility across several established behavioral paradigms, including:

  • Go/no-Go olfactory discrimination
  • 2 Alternative Forced Choice (2AFC) tasks (visual, auditory)
  • Delayed Visual Discrimination tasks
  • Open-field visual discrimination
  • Virtual reality olfactory discrimination

Key Insights and Ideas

  • Democratizing Complex Behavioral Experiments: EthoPy makes sophisticated and previously difficult-to-implement behavioral paradigms accessible to a wider range of labs, including those with limited budgets or technical expertise.
  • Reproducibility as a Core Feature: By deeply integrating data management and metadata tracking, EthoPy directly addresses the reproducibility crisis in neuroscience.
  • Scalability on a Budget: The ability to run experiments on affordable hardware like Raspberry Pis, combined with the modular design, allows for high-throughput experiments without prohibitive costs.
  • Bridging the Gap Between Training and Recording: The framework facilitates pre-training animals in less stressful homecage environments before moving them to head-fixed setups for neural recordings, ensuring a more consistent behavioral foundation.
  • Community-Driven Development: The open-source nature and plugin system encourage community contributions, fostering long-term sustainability and adaptation to future neuroscience needs.

Key Results

The paper demonstrates EthoPy's capabilities through various implementations:

  • Rapid Learning: Animals trained using EthoPy's adaptive protocols achieved high performance in tasks like the Go/No-Go olfactory discrimination in as little as two sessions.
  • Millisecond Precision: The system achieves millisecond-level precision in timing-sensitive computations, crucial for accurate behavioral control and data acquisition.
  • Diverse Paradigm Support: EthoPy successfully supports a wide range of behavioral systems (homecage, head-fixed, open-field, virtual reality) and task types (discrimination, navigation, decision-making).
  • Cost-Effectiveness: An indicative cost for a homecage setup with a screen is estimated at approximately €339, highlighting its affordability.
  • Synchronization: The system demonstrates high temporal alignment across devices, with synchronization offsets as low as 1.4ms using PTP.

Limitations and Future Work

  • Limitations:
    • While the framework is designed for extensibility, the initial implementation relies on Python and its associated libraries.
  • The paper mentions that concerns about stress from social isolation in homecage training were not evident in their experiments, but this could be a factor for other research questions.
  • Future Work:
    • The authors envision EthoPy being extended to support new hardware, integrate neural feedback mechanisms, and promote standardized behavioral protocols across research groups.
  • Further development could focus on expanding the library of pre-built behavioral paradigms and stimuli.
  • The integration of more advanced machine learning for real-time behavioral analysis and adaptive task modulation is a natural progression.

Summary updated

Abstract

As brain activity is tightly coupled to behavior, an accurate understanding of neural function necessitates consideration of behavioral tasks that capture the complexity and variety animals encounter. Nevertheless, animal training for behavioral experiments is often labor-intensive, costly, and difficult to standardize. To overcome these challenges, we developed EthoPy, an open-source, Python-based behavioral control framework that integrates stimulus presentation, hardware management, and data logging. EthoPy supports diverse behavioral paradigms, stimulus modalities, and experimental systems, from homecage to head-fixed configurations, while operating on affordable hardware, such as Raspberry Pi. Its modular architecture and database integration enable scalable, high-throughput automatic behavioral training with minimal experimenter involvement while ensuring reproducibility through comprehensive metadata tracking. By automating training workflows, EthoPy makes it feasible to implement sophisticated behavioral paradigms that are traditionally difficult to achieve. EthoPy thus provides an accessible, extensible framework to study behavior and the underlying neural activity.
BibTeX
@misc{evangelou2025ethopy,
  author = {Alexandros Evangelou and Maria Diamantaki and Κωνσταντίνα Γεωργέλου and Zoi Drakaki and Lydia Ntanavara and Gerasimos Gerardos and Sofia Morou and Nikolaos Chatziris and Zoi Dogani and Elissavet Anna Petsalaki and Odysseas Nikolaos Raos and Anastasios Gratsakis and Athanasia Papoutsi and Emmanouil Froudarakis},
  title = {{EthoPy: Reproducible Behavioral Neuroscience Made Simple}},
  year = {2025},
  doi = {10.1101/2025.09.08.673974},
  howpublished = {bioRxiv},
}
Figure