Sensory-Motor Closed-Loop Stimulus

Overview

The Sensory-Motor Closed-Loop stimulus provides a visual environment where the movement of the mouse (via a running wheel) directly controls the phase of drifting gratings. This creates a closed sensorimotor loop that allows investigation of how neural responses are modulated by self-generated visual feedback. In the oddball variant, the relationship between wheel movement and visual feedback is occasionally broken, creating sensorimotor prediction errors.

Stimulus Structure

Sensory-Motor Mismatch Analysis

The figure above shows a comprehensive analysis of the sensory-motor mismatch stimulus structure:

  1. Block Structure Timeline: Displays the temporal organization including:
  2. Motor Oddball Blocks: Main experimental periods where sensory-motor coupling is established and violated
  3. Motor Control Blocks: Baseline periods with standard sensory-motor relationships
  4. RF Mapping Blocks: Spatial tuning phases

  5. Grating Orientations Over Time: Shows how visual stimuli change throughout the session, including both coupled and decoupled phases

  6. Oddball Events Distribution: Highlights sensory-motor mismatch events where the expected relationship between wheel movement and visual feedback is violated

This analysis demonstrates how the protocol creates predictable sensory-motor relationships and systematically violates them to study prediction error signals in the context of self-generated sensory feedback.

Script Location

The stimulus script is located at: - /code/stimulus-control/src/Sensory_motor_oddball_slap2.bonsai - Closed-loop implementation with oddball functionality

Hardware Requirements

  • SLAP2 imaging system
  • Behavior device with encoder/wheel for tracking animal movement
  • Running wheel connected to an encoder on Port 2

Stimulus Parameters

Basic Parameters

  • Display Type: Drifting gratings
  • Spatial Frequency: 0.04 cycles per degree
  • Temporal Frequency: 0 Hz (static, since motion is controlled by the wheel)
  • Contrast: 1.0 (full contrast)
  • Size: 90° (covering a large portion of the visual field)
  • Aperture: 90°
  • Angle: 0° (horizontal grating)

Oddball Parameters

  • Oddball Frequency: Random intervals, controlled by experiment duration and number of oddballs
  • Oddball Duration: Configurable, default is ~1 second per event
  • Total Oddballs: Configurable, default is 5 per session
  • Oddball Type: Orientation change (0° → 45° during oddball events)

Experimental Design

Closed-Loop Sensorimotor Integration

The core of this experiment is the direct coupling between:

  1. Mouse Movement: Rotary encoder on Port 2 tracks the animal's wheel running
  2. Visual Feedback: Encoder data is used to update the phase of the visual gratings in real-time

This creates a predictable relationship where: - Forward wheel movement → Forward grating motion - Backward wheel movement → Backward grating motion - Stationary → Static grating

The script implements this coupling by: - Reading encoder values from the behavior device - Dividing encoder values by 300 to create an appropriate scaling factor - Using the modulus of 360 to convert the wheel position to grating phase - Applying this calculated phase to the gratings in real-time

Oddball Implementation

The oddball implementation introduces brief violations of the sensorimotor contingency:

  1. Random Timing: Oddballs occur at unpredictable intervals throughout the session
  2. Brief Duration: Each oddball lasts for a configurable duration (default ~1 second)
  3. Orientation Change: During an oddball, the grating orientation changes from 0° to 45°
  4. Limited Quantity: A configurable number of oddballs (default 5) occur per session
  5. Layer Priority: Oddball gratings are displayed on a higher layer (Layer 1) than the standard gratings (Layer 0)

The oddball generator uses frame permutation for randomization and implements a detection system to display the oddball stimulus when the current frame matches one of the predefined oddball frames.

Technical Implementation

  • Encoder values are acquired at high frequency and published to a subject called "Encoder"
  • The DrawGratings workflow subscribes to this encoder data
  • Real-time mapping applies encoder position to grating phase
  • The temporal frequency parameter is set to 0 Hz as the movement is controlled by the wheel

Data Collection

  • Running data is collected via an encoder on Port 2 of the behavior device

Synchronization

  • SLAP2 recording is automatically started and stopped during the experiment
  • The experiment can be controlled via spacebar (start) and End key (stop)

Running the Experiment

  1. Start the Bonsai workflow
  2. Press the spacebar to begin the experiment
  3. The mouse can then control the gratings by running on the wheel
  4. In the oddball variant, brief sensorimotor mismatches will occur automatically
  5. The experiment can be terminated with the End key