Getting Started with EthoPy¶
This guide will walk you through the process of setting up and running your first experiment with EthoPy. After completing this guide, you'll have a solid understanding of how to configure and run basic behavioral experiments.
Prerequisites¶
Before starting, ensure you have:
- Python 3.8 or higher (but less than 3.12) installed
- MariaDB database
Note
We recommend using Docker for setting up a new database.
Step 1: Installation¶
Setting Up a Virtual Environment¶
Before installing dependencies, it's recommended to use a virtual environment to keep your project isolated and manageable. Choose one of the following methods:
1 2 |
|
1 2 |
|
1 2 |
|
Once activated, proceed with installation.
Install EthoPy Package¶
Choose the installation method that fits your needs:
Install with pip:
1 |
|
Install from source:
1 |
|
For contributing or modifying the package:
1 2 3 |
|
Verify installation:
1 |
|
Step 2: Database Setup¶
EthoPy relies on a MariaDB database for experiment configuration and data logging. If there is not a database availabe, here is a quick setup of setting mysql database with docker:
- Start the database container:
1 |
|
The default username is "root".
Note: if ethopy-setup-djdocker does not work try to setup the docker image based on the datajoint instructions
Note: By default, Docker requires sudo because the Docker daemon runs as root. This command adds your user to the docker group, so you can run Docker commands without sudo.
1
sudo usermod -aG docker $USER
restart your session (log out and back in) or run:
1
newgrp docker
Step 3: Configure ethopy¶
Create a configuration file at path:
~/.ethopy/local_conf.json
%USERPROFILE%\.ethopy\local_conf.json
dj_local_conf includes the parameters relevant to the datajoint configuration:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Check if connection with db is established with your local configuration.
1 |
|
Step 4: Create required schemas¶
Create all required database schemas.
1 |
|
Tip
For verifing the schema/tables creation you can download DBeaver which is a popular and versatile database tool.
Step 5: Run your first experiment¶
1 |
|
Simulation Interface (setup_conf_idx 0): in this task, EthoPy runs with setup_conf_idx 0, which uses the DummyPorts interface for simulation. This allows you to test tasks on your computer without requiring actual hardware. The interface maps keyboard inputs to behavioral ports: left arrow activates the left port, right arrow activates the right port, and spacebar controls proximity detection (press to indicate animal in position, release for off position). This simulation mode enables fast prototyping and testing of behavioral tasks.
You can check all the options of ethopy by:
1 |
|
Example Tasks¶
Explore these sample tasks in the ethopy/task/
directory:
- grating_test.py - Grating stimulus presentation
- bar_test.py - Moving bar stimulus
- dot_test.py - Moving dot patterns
Troubleshooting and Help¶
If you encounter issues, refer to the Troubleshooting Guide.
For specific questions, check the: - API Reference for detailed module documentation - GitHub Issues for known problems
Where to Go Next¶
Now that you have a basic understanding of EthoPy:
- Creating Custom Components
- How to create a Task
- Explore the Plugin System to extend functionality
- Dive deeper into Local Configuration for advanced settings
- Understand setup configuration index
- Learn more about Database Setup
- Study the API Reference for detailed documentation
- Check Contributing if you want to help improve EthoPy