Visual Reactive Programming with Bonsai

This training course will introduce you to the basic concepts of data acquisition and behavioural control using the Bonsai visual programming language.

Course Schedule

Monday Tuesday Wednesday Thursday Friday
Seminar Introduction to Bonsai DeepLabCut
Higher Order Operators BonVision BonZeb
Workshop Acquisition and Tracking Closed-loop experiments Operant behavior Vision experiments Final projects

Day 1 - Introduction to Bonsai

  • Introduction to Bonsai. What is visual reactive programming?
  • How to measure almost anything with Bonsai (from quantities to bytes).
  • How to control almost anything with Bonsai (from bytes to effects).
  • Real-time tracking of colored objects, moving objects and contrasting objects.
  • Measuring behavior using voltages and an Arduino.

Day 2 - Real-time closed-loop experiments

  • Markerless behavior tracking using Bonsai + DeepLabCut.
  • Data synchronization and measuring closed-loop latency.
  • Conditional effects. Triggering a stimulus based on video activity.
  • Continuous feedback. Modulate stimulus intensity with speed or distance.
  • Feedback stabilization. Record video centered around a moving object.

Day 3 - Operant behavior tasks

  • Creating dynamic observable sequences with higher-order operators.
  • Modeling trial sequences: states, events, and side-effects.
  • Driving state transitions with external inputs.
  • Choice, timeouts and conditional logic. Building reaction time and Go/No-Go tasks.
  • Best practices for composing complex workflows.

Day 4 - Interactive visual environments

  • Creating and controlling visual environments with BonVision.
  • Building closed-loop virtual reality experiments.
  • Combining real-time and non real-time logic.
  • Building variable trial structures.
  • Logging stimulus and response outcomes.

Day 5 - Extending Bonsai

  • Multi-animal tracking and body part feature extraction with BonZeb.
  • Reproducible deployment and automation of experiments.
  • Interfacing Bonsai with Python and MATLAB.
  • Bonsai hackathon and project presentations.
  • Where Bonsai is going.