You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/creating_custom_components.md
+6-13Lines changed: 6 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,12 @@
1
1
# Creating Custom Components in Ethopy
2
2
3
-
This guide provides an introduction to extending Ethopy with your own custom components. Ethopy's modular design allows you to create specialized experiments by implementing three core component types:
3
+
This guide provides an introduction to extending Ethopy with custom components. Ethopy's modular design allows you to create specialized experiments by implementing three core component types:
4
4
5
5
1.**Experiments**: Define the overall experimental flow and state transitions
6
-
2.**Stimuli**: Create visual, auditory, or other sensory presentations
7
-
3.**Behaviors**: Handle animal interactions and responses
6
+
2.**Stimuli**: Create and control visual, auditory, or other sensory presentations
7
+
3.**Behaviors**: Handle and track animal interactions and responses
8
8
9
-
## Core Architecture
10
-
11
-
Ethopy uses a modular architecture where each component has specific responsibilities:
12
-
13
-
14
-
-**Experiments** manage the overall flow of your task using a state machine
15
-
-**Stimuli** control what is presented to the subject
16
-
-**Behaviors** track and validate responses
9
+
In addition, the following two core modules can be implemented
17
10
-**Interfaces** communicate with hardware
18
11
-**Loggers** record data to the database
19
12
@@ -27,7 +20,7 @@ We provide three detailed examples to help you understand how to create your own
27
20
28
21
The Match Port experiment implements a 2-Alternative Forced Choice (2AFC) task where animals need to choose the correct port based on stimuli. This example demonstrates:
29
22
30
-
- Creating a complex state machine with multiple states
23
+
- Creating a state machine with multiple states
31
24
- Implementing state transitions based on animal behavior
32
25
- Managing adaptive difficulty through staircase methods
33
26
- Handling reward, punishment, and intertrial periods
@@ -55,7 +48,7 @@ The MultiPort behavior handles interactions with multiple response ports. This e
55
48
These three component types work together to create a complete experimental setup:
56
49
57
50
1. The **Experiment** defines the sequence of states (e.g., ready → trial → reward)
58
-
2. The **Stimulus** determines what the animal sees or hears in each state
51
+
2. The **Stimulus** determines what the stimulus the animal experiences in each state
59
52
3. The **Behavior** handler tracks and validates the animal's responses
Copy file name to clipboardExpand all lines: docs/getting_started.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,11 +80,11 @@ EthoPy relies on a MariaDB database for experiment configuration and data loggin
80
80
```bash
81
81
ethopy-setup-djdocker
82
82
```
83
-
alterative follow the instruction from datajoint [here](https://github.com/datajoint/mysql-docker)
83
+
Alteratively follow the instructions from datajoint [here](https://github.com/datajoint/mysql-docker)
84
84
85
85
The default username is "root".
86
86
87
-
> **Note:** if ethopy-setup-djdocker not works try to setup the docker image based on the [datajoint instructions](https://github.com/datajoint/mysql-docker)
87
+
> **Note:** if ethopy-setup-djdocker does not work try to setup the docker image based on the [datajoint instructions](https://github.com/datajoint/mysql-docker)
88
88
89
89
90
90
> **Note:** By default, Docker requires sudo because the Docker daemon runs as root.
@@ -109,7 +109,7 @@ This command adds your user to the docker group, so you can run Docker commands
109
109
110
110
=== "Windows"
111
111
`%USERPROFILE%\.ethopy\local_conf.json`
112
-
dj_local_conf have all the parameters refers to [datajoint configuration](https://datajoint.com/docs/elements/element-miniscope/0.2/tutorials/01-Configure/):
112
+
dj_local_conf includes the parameters relevant to the [datajoint configuration](https://datajoint.com/docs/elements/element-miniscope/0.2/tutorials/01-Configure/):
Copy file name to clipboardExpand all lines: docs/index.md
+22-64Lines changed: 22 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,8 +17,8 @@ Ethopy is a state control system for automated, high-throughput behavioral train
17
17
18
18
-**Modular Design**: Comprised of several overridable modules that define the structure of experiments, stimuli, and behavioral control
19
19
-**Database Integration**: Automatic storage and management of experimental data using Datajoint
20
-
-**Multiple Experiment Types**: Support for various experiment paradigms (match to sample, 2AFC, open field, etc.)
21
-
-**Hardware Integration**: Interfaces with multiple hardware setups (raspberry, arduino, desktop computer, screen, camera etc.)
20
+
-**Multiple Experiment Types**: Support for various experiment paradigms (Go-NoGo, 2AFC, open field, etc.)
21
+
-**Hardware Integration**: Interfaces with multiple hardwares (raspberry, arduino, desktop computer, screen, camera etc.)
22
22
-**Stimulus Control**: Various stimulus types supported (Gratings, Movies, Olfactory, 3D Objects)
23
23
-**Real-time Control**: State-based experiment control with precise timing
24
24
-**Extensible**: Easy to add new experiment types, stimuli, or behavioral interfaces
@@ -34,29 +34,20 @@ The following diagram illustrates the relationship between the core modules:
34
34
---
35
35
## Installation & Setup
36
36
37
+
For a step-by-step guide of installation procedure see [here](getting_started.md)
38
+
37
39
### Requirements
38
40
39
41
- Python 3.8 or higher
40
-
- Maria DB Database (instructions for [database setup](database.md))
42
+
- Maria DB Database (instructions for [database setup](database_setup.md))
41
43
42
44
43
45
### Basic Installation
44
46
45
47
```bash
46
48
pip install ethopy
47
49
```
48
-
49
-
For optional features:
50
-
```bash
51
-
# For 3D object support
52
-
pip install "ethopy[obj]"
53
-
54
-
# For development
55
-
pip install "ethopy[dev]"
56
-
57
-
# For documentation
58
-
pip install "ethopy[docs]"
59
-
```
50
+
For more detailed instructions follow the [Installation](installation.md)
60
51
61
52
### Running Experiments
62
53
@@ -76,7 +67,7 @@ ethopy --task-idx 1
76
67
77
68
## Core Architecture
78
69
79
-
Understanding Ethopy's core architecture is essential for both using the system effectively and extending it for your needs. Ethopy is built around four core modules that work together to provide a flexible and extensible experimental framework. Each module handles a specific aspect of the experiment, from controlling the overall flow to managing stimuli and recording behavior.
70
+
Understanding Ethopy's core architecture is essential for both using the system effectively and extending it for your needs. Ethopy is built around five core modules that work together to provide a flexible and extensible experimental framework. Each module handles a specific aspect of the experiment, from controlling the overall flow to managing stimuli and recording behavior.
80
71
81
72
### 1. Experiment Module
82
73
@@ -95,14 +86,7 @@ Each state has four overridable functions that control its behavior:
95
86
-**FreeWater**: Water delivery experiments
96
87
-**Calibrate**: Port calibration for water delivery
97
88
98
-
#### Configuration
99
-
100
-
Experiments require setup configuration through:
101
-
-`SetupConfiguration`
102
-
-`SetupConfiguration.Port`
103
-
-`SetupConfiguration.Screen`
104
-
105
-
Experiment parameters are defined in Python configuration files and stored in the `Task` table within the `lab_experiment` schema.
89
+
Experiment parameters are defined in Python configuration files and stored in the `Task` table within the `lab_experiments` schema.
106
90
107
91
### 2. Behavior Module
108
92
@@ -125,8 +109,18 @@ Controls stimulus presentation and management.
125
109
- Bar: Moving bars for retinotopic mapping
126
110
- Dot: Moving dots
127
111
112
+
### 4. Interface Module (Non-overridable)
113
+
Manages hardware communication and control.
114
+
115
+
#### Configuration
116
+
117
+
Experiments require setup configuration through:
118
+
-`SetupConfiguration`
119
+
-`SetupConfiguration.Port`
120
+
-`SetupConfiguration.Screen`
121
+
Configuration files are stored within the `lab_interface` schema.
128
122
129
-
####Logger Module (Non-overridable)
123
+
###5. Logger Module (Non-overridable)
130
124
Manages all database interactions across modules. Data is stored in three schemas:
131
125
132
126
**lab_experiments**:
@@ -138,51 +132,15 @@ Manages all database interactions across modules. Data is stored in three schema
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. Please follow thse [instructions] (https://github.com/ef-lab/ethopy_package/blob/main/docs/contributing.md) for contributions.
145
138
146
-
### Development Setup
147
-
148
-
1. Clone the repository:
149
-
```bash
150
-
git clone https://github.com/ef-lab/ethopy_package/ # Main repository
151
-
cd ethopy
152
-
```
153
-
154
-
2. Install development dependencies:
155
-
```bash
156
-
pip install -e ".[dev,docs]"
157
-
```
158
-
159
-
### Code Quality
160
-
161
-
The project uses several tools to maintain code quality:
162
-
163
-
-**ruff**: Code formatting and linting
164
-
-**isort**: Import sorting
165
-
-**pytest**: Testing and test coverage
166
-
167
-
Run tests:
168
-
```bash
169
-
pytest tests/
170
-
```
171
-
172
-
### Documentation
173
-
174
-
Documentation is built using MkDocs. Install documentation dependencies and serve locally:
175
-
176
-
```bash
177
-
pip install ".[docs]"
178
-
mkdocs serve
179
-
```
180
-
181
-
### License
139
+
## License
182
140
183
141
This project is licensed under the MIT License - see the [LICENSE](https://github.com/ef-lab/ethopy_package/blob/master/LICENSE) file for details.
Copy file name to clipboardExpand all lines: docs/local_conf.md
+27-21Lines changed: 27 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,6 @@ EthoPy automatically looks for a file called `local_conf.json` in a special fold
12
12
13
13
## Quick Start Guide
14
14
15
-
### Step 1: Basic Setup
16
15
When you first start EthoPy, you'll need to create a configuration file. Here's a simple example to get you started:
17
16
18
17
```json
@@ -28,7 +27,7 @@ When you first start EthoPy, you'll need to create a configuration file. Here's
28
27
}
29
28
```
30
29
31
-
### Step 2: What Each Part Means
30
+
What Each Part Means
32
31
-**database settings**: How to connect to your MySQL database
33
32
-**source_path**: Where your experimental data is stored
34
33
-**target_path**: Where backup copies should be saved
@@ -40,30 +39,38 @@ Here's what a full configuration file looks like with all the optional settings:
40
39
```json
41
40
{
42
41
"dj_local_conf": {
43
-
"database.host": "127.0.0.1",
44
-
"database.user": "root",
45
-
"database.password": "your_password",
46
-
"database.port": 3306
42
+
"database.host": "YOUR DATABASE",
43
+
"database.user": "USERNAME",
44
+
"database.password": "PASSWORD",
45
+
"database.port": "PORT",
46
+
"database.reconnect": true,
47
+
"database.enable_python_native_blobs": true
47
48
},
48
-
"source_path": "/path/to/data",
49
-
"target_path": "/path/to/backup",
50
49
"logging": {
51
50
"level": "INFO",
52
51
"directory": "~/.ethopy/",
53
52
"filename": "ethopy.log"
54
53
},
54
+
"SCHEMATA": {
55
+
"experiment": "Experiment_Name",
56
+
"behavior": "Behavior_Name",
57
+
"stimulus": "Stimulus_Name",
58
+
"interface": "Interface_Name",
59
+
"recording": "Recording_Name",
60
+
},
55
61
"channels": {
56
-
"Liquid": {"1": 22, "2": 23},
57
-
"Lick": {"1": 17, "2": 27}
58
-
}
62
+
"Signal": {"PORT1": "GPIO_pin", "PORT2": "GPIO"},
63
+
},
64
+
"source_path": "LOCAL_RECORDINGS_DIRECTORY",
65
+
"target_path": "TARGET_RECORDINGS_DIRECTORY",
59
66
}
60
67
```
61
68
62
69
## Understanding Each Section
63
70
64
71
### 1. Database Settings (`dj_local_conf`)
65
72
66
-
This section tells EthoPy how to connect to your MySQL database:
73
+
This section instructs EthoPy to connect to your MySQL database. Below we analyze an indicative example:
67
74
68
75
```json
69
76
{
@@ -82,7 +89,7 @@ This section tells EthoPy how to connect to your MySQL database:
82
89
83
90
### 2. File Paths
84
91
85
-
These tell EthoPy where to find and save your data:
92
+
These instruct EthoPy where to find and save your data:
86
93
87
94
```json
88
95
{
@@ -107,9 +114,9 @@ This controls how EthoPy saves information about what it's doing:
107
114
}
108
115
```
109
116
110
-
### 4. Schema Names
117
+
### 4. Schema Names (Optional)
111
118
112
-
If your database uses custom names for different parts of your experiment data:
119
+
If your database uses custom names for different parts of your experiment data, e.g.:
113
120
114
121
```json
115
122
{
@@ -127,13 +134,12 @@ If your database uses custom names for different parts of your experiment data:
127
134
128
135
**Skip this section if you're not using physical hardware like valves, sensors, or LEDs.**
129
136
130
-
If you're running experiments with physical hardware (like water valevs, lick detectors, or LEDs), you need to tell EthoPy which pins on your Raspberry Pi connect to which devices.
137
+
If you're running experiments with physical hardware (like water valves, lick detectors, or LEDs) connected to a Rasberry Pi, you need to instruct EthoPy which GPIO pins on your Raspberry Pi connect to which devices.
131
138
132
139
```json
133
140
{
134
141
"channels": {
135
-
"Liquid": {"1": 22, "2": 23}, // Water valve connections
0 commit comments