Skip to content

Commit aff9ae0

Browse files
authored
Merge pull request #1 from athpapoutsi/fixes
Fixes on the documentation
2 parents 8d20782 + 3f706c2 commit aff9ae0

File tree

10 files changed

+134
-119
lines changed

10 files changed

+134
-119
lines changed

docs/creating_custom_components.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
# Creating Custom Components in Ethopy
22

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:
44

55
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
88

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
1710
- **Interfaces** communicate with hardware
1811
- **Loggers** record data to the database
1912

@@ -27,7 +20,7 @@ We provide three detailed examples to help you understand how to create your own
2720

2821
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:
2922

30-
- Creating a complex state machine with multiple states
23+
- Creating a state machine with multiple states
3124
- Implementing state transitions based on animal behavior
3225
- Managing adaptive difficulty through staircase methods
3326
- Handling reward, punishment, and intertrial periods
@@ -55,7 +48,7 @@ The MultiPort behavior handles interactions with multiple response ports. This e
5548
These three component types work together to create a complete experimental setup:
5649

5750
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
5952
3. The **Behavior** handler tracks and validates the animal's responses
6053

6154
For example, in a typical trial:

docs/dot_stimulus_example.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,12 @@ def prepare(self, curr_cond):
8484
```
8585

8686
This method:
87-
1. Stores the current condition parameters
88-
2. Sets the background color
89-
3. Calculates the dot's position and size based on:
87+
1. Sets the background color
88+
2. Calculates the dot's position and size based on:
9089
- Monitor resolution (to maintain aspect ratio)
9190
- Condition parameters for position and size
9291
- Conversion from normalized coordinates to actual screen coordinates
93-
4. Creates a rectangle tuple (left, top, right, bottom) for drawing
92+
3. Creates a rectangle tuple (left, top, right, bottom) for drawing
9493

9594
### 3. `start()` method
9695

docs/getting_started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ EthoPy relies on a MariaDB database for experiment configuration and data loggin
8080
```bash
8181
ethopy-setup-djdocker
8282
```
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)
8484

8585
The default username is "root".
8686

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)
8888
8989

9090
> **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
109109
110110
=== "Windows"
111111
`%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/):
113113
```json
114114
{
115115
"dj_local_conf": {

docs/index.md

Lines changed: 22 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Ethopy is a state control system for automated, high-throughput behavioral train
1717

1818
- **Modular Design**: Comprised of several overridable modules that define the structure of experiments, stimuli, and behavioral control
1919
- **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.)
2222
- **Stimulus Control**: Various stimulus types supported (Gratings, Movies, Olfactory, 3D Objects)
2323
- **Real-time Control**: State-based experiment control with precise timing
2424
- **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:
3434
---
3535
## Installation & Setup
3636

37+
For a step-by-step guide of installation procedure see [here](getting_started.md)
38+
3739
### Requirements
3840

3941
- 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))
4143

4244

4345
### Basic Installation
4446

4547
```bash
4648
pip install ethopy
4749
```
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)
6051

6152
### Running Experiments
6253

@@ -76,7 +67,7 @@ ethopy --task-idx 1
7667

7768
## Core Architecture
7869

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.
8071

8172
### 1. Experiment Module
8273

@@ -95,14 +86,7 @@ Each state has four overridable functions that control its behavior:
9586
- **FreeWater**: Water delivery experiments
9687
- **Calibrate**: Port calibration for water delivery
9788

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.
10690

10791
### 2. Behavior Module
10892

@@ -125,8 +109,18 @@ Controls stimulus presentation and management.
125109
- Bar: Moving bars for retinotopic mapping
126110
- Dot: Moving dots
127111

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.
128122

129-
#### Logger Module (Non-overridable)
123+
### 5. Logger Module (Non-overridable)
130124
Manages all database interactions across modules. Data is stored in three schemas:
131125

132126
**lab_experiments**:
@@ -138,51 +132,15 @@ Manages all database interactions across modules. Data is stored in three schema
138132
**lab_stimuli**:
139133
<img src="http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/ef-lab/EthoPy/master/utils/plantuml/stimuli.iuml">
140134

141-
#### Interface Module (Non-overridable)
142-
Manages hardware communication and control.
143135

144136
## Development & Contributing
137+
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.
145138

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
182140

183141
This project is licensed under the MIT License - see the [LICENSE](https://github.com/ef-lab/ethopy_package/blob/master/LICENSE) file for details.
184142

185-
### Support
143+
## Support
186144

187145
For questions and support:
188146

docs/local_conf.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ EthoPy automatically looks for a file called `local_conf.json` in a special fold
1212

1313
## Quick Start Guide
1414

15-
### Step 1: Basic Setup
1615
When you first start EthoPy, you'll need to create a configuration file. Here's a simple example to get you started:
1716

1817
```json
@@ -28,7 +27,7 @@ When you first start EthoPy, you'll need to create a configuration file. Here's
2827
}
2928
```
3029

31-
### Step 2: What Each Part Means
30+
What Each Part Means
3231
- **database settings**: How to connect to your MySQL database
3332
- **source_path**: Where your experimental data is stored
3433
- **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:
4039
```json
4140
{
4241
"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
4748
},
48-
"source_path": "/path/to/data",
49-
"target_path": "/path/to/backup",
5049
"logging": {
5150
"level": "INFO",
5251
"directory": "~/.ethopy/",
5352
"filename": "ethopy.log"
5453
},
54+
"SCHEMATA": {
55+
"experiment": "Experiment_Name",
56+
"behavior": "Behavior_Name",
57+
"stimulus": "Stimulus_Name",
58+
"interface": "Interface_Name",
59+
"recording": "Recording_Name",
60+
},
5561
"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",
5966
}
6067
```
6168

6269
## Understanding Each Section
6370

6471
### 1. Database Settings (`dj_local_conf`)
6572

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:
6774

6875
```json
6976
{
@@ -82,7 +89,7 @@ This section tells EthoPy how to connect to your MySQL database:
8289

8390
### 2. File Paths
8491

85-
These tell EthoPy where to find and save your data:
92+
These instruct EthoPy where to find and save your data:
8693

8794
```json
8895
{
@@ -107,9 +114,9 @@ This controls how EthoPy saves information about what it's doing:
107114
}
108115
```
109116

110-
### 4. Schema Names
117+
### 4. Schema Names (Optional)
111118

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.:
113120

114121
```json
115122
{
@@ -127,13 +134,12 @@ If your database uses custom names for different parts of your experiment data:
127134

128135
**Skip this section if you're not using physical hardware like valves, sensors, or LEDs.**
129136

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.
131138

132139
```json
133140
{
134141
"channels": {
135-
"Liquid": {"1": 22, "2": 23}, // Water valve connections
136-
"Lick": {"1": 17, "2": 27}, // Lick sensor connections
142+
"Signal": {"PORT1": "GPIO_pin", "PORT2": "GPIO_pin"},
137143
}
138144
}
139145
```
@@ -205,12 +211,12 @@ Your database is on a different computer in the lab:
205211
```json
206212
{
207213
"dj_local_conf": {
208-
"database.host": "192.168.1.100",
214+
"database.host": "database_ip", // Database server address (make sure your db has fix ip)
209215
"database.user": "lab_user",
210216
"database.password": "lab_password",
211217
"database.port": 3306
212218
},
213-
"source_path": "/Users/yourname/experiment_data",
219+
"source_path": "/Users/yourname/experiment_data",
214220
"target_path": "/Users/yourname/experiment_backup"
215221
}
216222
```
@@ -272,7 +278,7 @@ You're running behavioral experiments with physical hardware:
272278

273279
### Problem: "Hardware not responding"
274280

275-
**Symptoms:** Your pumps, sensors, or LEDs aren't working
281+
**Symptoms:** Your valves, sensors, or LEDs aren't working
276282

277283
**Solutions to try:**
278284
1. **Check physical connections** - Make sure all wires are properly connected

docs/match_port_example.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The StateMachine in Ethopy automatically finds all state classes that inherit fr
3838

3939
## Overview of the Match Port Experiment
4040

41-
The Match Port experiment challenges animals to correctly choose between ports based on stimuli.
41+
The Match Port experiment requires animals to correctly choose between ports based on stimuli.
4242

4343
It implements:
4444
- Adaptive difficulty using staircase methods
@@ -139,7 +139,6 @@ Each state is implemented as a class inheriting from the base `Experiment` class
139139
```python
140140
class Trial(Experiment):
141141
def entry(self):
142-
self.resp_ready = False
143142
super().entry()
144143
self.stim.start()
145144

@@ -179,16 +178,15 @@ Let's break down the Trial state's functionality in detail:
179178

180179
```python
181180
def entry(self):
182-
self.resp_ready = False
183181
super().entry()
184182
self.stim.start()
185183
```
186184

187-
- `self.resp_ready = False`: Resets the response readiness flag at the beginning of each trial
188185
- `super().entry()`: Calls the parent class's entry method which:
189186
- Records the current state in the logger
190187
- Logs a state transition event with timestamp
191188
- Starts the state timer
189+
- Resets the response readiness flag at the beginning of each Trial
192190
- `self.stim.start()`: Initializes the stimulus for the current trial, activating any hardware or software components needed
193191

194192
### 2. `run()` method
@@ -282,7 +280,7 @@ def exit(self):
282280

283281
## State Machine Flow
284282

285-
The experiment implements a state machine that flows through these main states:
283+
The MatchPort experiment implements a state machine that flows through these main states:
286284

287285
1. `Entry` → Initial setup
288286
2. `PreTrial` → Prepare stimulus and wait for animal readiness

0 commit comments

Comments
 (0)