Skip to content

Commit 13193e0

Browse files
authored
Merge pull request #1666 from AllenNeuralDynamics/production_testing
[update main] 2025-11-11
2 parents ba12c33 + 69b2467 commit 13193e0

10 files changed

Lines changed: 3527 additions & 2083 deletions

File tree

README.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ A [Bonsai](https://bonsai-rx.org/) workflow for lick-based foraging experiments,
1313
- [Menu](#menu)
1414
- [Toolbars](#toolbars)
1515
- [Training Parameters](#training-parameters)
16+
- [How training parameters define the task](#how-training-parameters-define-the-task)
1617
- [Automatic training](#automatic-training)
1718
- [Water Calibration](#water-calibration)
1819
- [Laser Calibration](#laser-calibration)
@@ -151,7 +152,7 @@ To configure automatic updates consistent with the [update protocol](https://git
151152
- **Example Curriculum**:
152153
<img width="646" height="295" alt="image" src="https://github.com/user-attachments/assets/088a5bb1-8070-4d46-bbba-3b9977453b41" />
153154

154-
#### Trial-related parameters
155+
#### Task-related parameters
155156
- **training stage**: Select the training stage parameters. These parameters can be saved in **TrainingStagePar.json** through "**Save training**" button. They are task dependent.
156157
- **randomness**: There are **exponential** and **even distribution** available. This random generator will be applied to generate **Block length**/**ITI**/**Delay period**.
157158
- **L(s)**: The left valve open time. The **L(s)** and **L(ul)** are dependent on each other, and the relationship is determined by the water calibration.
@@ -208,6 +209,37 @@ To configure automatic updates consistent with the [update protocol](https://git
208209
- **Early licking**: Statistics of early licking rate in different behavior epochs.
209210
- **Double dipping**: Double dipping statistics in different behavior epochs and conditions.
210211

212+
### How training parameters define the task
213+
214+
#### Block structure
215+
1. **Uncoupled tasks (Uncoupled Baiting or Uncoupled Without Baiting)**
216+
<img width="1447" height="386" alt="image" src="https://github.com/user-attachments/assets/6879325d-0a2a-45c5-8ada-9387e99c0024" />
217+
([Grossman et al. 2022](https://www.sciencedirect.com/science/article/pii/S0960982221016821))
218+
- The actual reward probabilities are controled by the parameter `UncoupledReward` (typically {0.1, 0.4, 0.7}).
219+
- "Baiting" = if an unchosen action would have been rewarded, the reward was delivered upon the next choice of
220+
that alternative.
221+
- See [code here](https://github.com/AllenNeuralDynamics/dynamic-foraging-task/blob/main/src/foraging_gui/reward_schedules/uncoupled_block.py).
222+
223+
2. **Coupled tasks (Coupled Baiting or Coupled Without Baiting)**
224+
- The reward probabilities on both sides ($p_L$ and $p_R$) change together in an anticorrelated manner.
225+
- $p_L + p_R$ is fixed at `BaseRewardSum`, whereas their ratio is chosen from a "ratio pool" that consists of the first `RewardPairsN` pairs in a certain `RewardFamily`. There are four preset families:
226+
- Family 1: {8:1, 6:1, 3:1, 1:1}
227+
- Family 2: {8:1, 1:1}
228+
- Family 3: {1:0, 9:1, 8:2, 7:3, 6:4, 5:5}
229+
- Family 4: {6:1, 3:1, 1:1}
230+
231+
For example,
232+
- `RewardFamily` = 3, `RewardPairsN` = 1, `BaseRewardSum` = 0.8 (typical STAGE_1_WARMUP stage) gives you a ratio pool with only one ratio {1:0} and two possible $p_L$, $p_R$ pairs: [0.8, 0.0], [0.0, 0.8]
233+
- `RewardFamily` = 1, `RewardPairsN` = 4, `BaseRewardSum` = 0.45 (typical GRADUATED stage) gives you a ratio pool of {8:1, 6:1, 3:1, 1:1} and seven possible $p_L$, $p_R$ pairs: [0.4, 0.05], [0.39, 0.06], [0.34, 0.11], [0.225, 0.225], [0.11, 0.34], [0.06, 0.39], [0.05, 0.4]
234+
- The consecutive blocks will never have the same better side (or have a ratio of 1:1 at the same time). For example, [0.4, 0.05] will never follow [0.39, 0.06], and [0.225, 0.225] will never follow another [0.225, 0.225].
235+
- Block lengths were drawn from a truncated exponential distribution controled by `block_min`, `block_max`, and `block_beta` (see [code](https://github.com/AllenNeuralDynamics/dynamic-foraging-task/blob/main/src/foraging_gui/reward_schedules/test_truncexp.py)).
236+
- "Baiting" is the same as above.
237+
- See [code here](https://github.com/AllenNeuralDynamics/dynamic-foraging-task/blob/ba12c335daae87144585b70325b048786188cd4d/src/foraging_gui/MyFunctions.py#L552).
238+
239+
#### Trial structure
240+
Here is an overview of the trial structure using a rewarded trial, an unrewarded trial, and an ignored trial as examples.
241+
![image](https://github.com/AllenNeuralDynamics/dynamic-foraging-task/assets/24734299/2530ff82-8b78-4feb-af03-410dcdcbfcc6)
242+
211243
### Automatic training
212244
1. In the main dialog, press `Auto Train` button <img src="https://github.com/AllenNeuralDynamics/dynamic-foraging-task/assets/24734299/836a4432-b1b2-4f92-9c66-2441a9d77a82" width="150"> or `Ctrl + Alt + A` to open the Automatic Training dialog
213245
> [!IMPORTANT]
@@ -288,10 +320,6 @@ Data for each session is saved as a JSON file with the following files:
288320
- **goCue_start_time**: 'The go cue start time'
289321
- **reward_outcome_time**: 'The reward outcome time (reward/no reward/no response)'
290322

291-
### Training paramters
292-
Here is an overview of the trial structure using a rewarded trial, an unrewarded trial, and an ignored trial as examples.
293-
![image](https://github.com/AllenNeuralDynamics/dynamic-foraging-task/assets/24734299/2530ff82-8b78-4feb-af03-410dcdcbfcc6)
294-
295323
#### Behavior structure
296324
- **bait_left**:'Whether the current left licksprout has a bait or not'
297325
- **bait_right**:'Whether the current right licksprout has a bait or not'

0 commit comments

Comments
 (0)