Example: Visual Discrimination ‐ description - fdechaumont/micecraft GitHub Wiki
Here we present an example of a Visual Discrimination task. We provide provide all necessary codes and explanations for you to reproduce this experiment using MiceCraft. This experiment design ensure experimental consistency, animal welfare, and reliable data collection.
All codes are divided into 3 parts:
- the experiment logic with control on MiceCraft devices (experiment)
- the visual interface linked to the experiment logic and results that can interact with it (interface)
- the data analysis to convert logs produce by the experiment logic into python dataframe, csv files and graphs (analysis)
This experiment is designed to assess visual discrimination and cognitive flexibility in mice using a touchscreen-based task. The experiment consists of several phases, each with specific rules and performance criteria:
- BLACK_WHITE Phase: The mouse is presented with two screens, one black and one white, at random positions. The mouse must learn to touch the white screen to receive a reward. Advancement to the next phase requires to retrieve 10 rewards and make 50 trials (so touch the screen 50 times).
- FLOWER_PLANE Phase: The mouse is shown images of a flower and a plane at random positions. The mouse must learn to touch the correct image to receive a reward. For half of the mice, the correct image is the flower, and the plane is the correct one for the other half. Advancement requires at least 80% accuracy over the last 100 trials.
- REVERSAL Phase: The same images (flower and plane) are presented, but the rule is reversed. The mouse must now touch the previously incorrect image to receive a reward. Advancement again requires at least 80% accuracy over the last 100 trials.
- END Phase: We go back to the white and black screen but this time, the black screen must be touch to get a reward. It is kind of a reversal of the BLACK_WHITE phase. Mice still have access to the experiment and you still have access to the data generated by mice in this phase.
When the mouse is in the test room, it cannot change its current phase. To proceed to the next phase, the animal must get out of the test room and have fulfill its phase criteria. When in the test room, the logic of the task is represented by the room states. Each state ensures the correct setup, cleanup, logging, etc for the experiment to work. There are 5 states of the test room:
- INITIAL state
- Purpose: The INITIAL state is set when an animal enters the room. It defines the start of a session.
- Description: It does nothing except logging a session start and then logs the room state. Immediately after logging, it switch to the TRIAL state. Before entering this state, the code register the RFID tag of the mouse if it has not been registered yet.
- TRIAL state:
- Purpose: The TRIAL state prepares the room for a new trial, presenting the animal with a choice.
- Description: Save experiment data, randomly displays the correct and incorrect images on the touchscreen depending on the mouse's phase, enables mouse actions on the touchscreen and logs the state change.
- SUCCESS state:
- Purpose: The SUCCESS state is triggered when an animal completes a trial correctly.
- Description: Cancel all timers, delivers a reward (sugar water in this case), turn the water pump light on and logs the reward delivery and the state change.
- FAIL state:
- Purpose: The FAIL state is set when an animal fails a trial.
- Description: Cancel all timers, flush any remaining reward for a long time, logs the state change and start a timer of 10 seconds before starting the next trial.
- EXIT state:
- Purpose: The EXIT state is set when an animal leaves the room, ensuring a clean transition and data integrity.
- Description: Turn off all devices, flush any remaining rewards, cancel all timers, check for phase completion by the mouse, save experiment data, remove mouse from the room, logs the state change and then logs the session end. For unplugged device reconnection, a hardware initialisation is made at the end of this phase but not logged.