Welcome

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
Lecture Introduction to Bonsai Reactive Operators Higher Order Operators Computer Graphics Closed-loop VR
Workshop Acquisition and Tracking Closed-loop experiments State Machines Shaders Visual Environments / Final Projects

Day 1 - Introduction to Bonsai

  • What is visual reactive programming?
  • Marble diagrams and how to read them
  • Learning your way around the Bonsai IDE
  • How to measure and control almost anything with Bonsai
  • Real-time tracking of colored objects, moving objects and contrasting objects
  • Measuring behavior using voltages and an Arduino

Tutorial: acquisition and tracking

Day 2 - Real-time closed-loop experiments

  • Fundamental reactive operators
  • 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
  • Continuous and conditional feedback: closed-loop experiment building blocks
  • Synchronising asynchronous data streams

Tutorial: closed-loop systems, data synchronisation

Day 3 - Operant behavioral tasks

  • Sharing observable sequences
  • Creating dynamic observable sequences with higher-order operators
  • Modeling trial sequences: states, events, and side-effects
  • Driving state transitions with external inputs
  • Best practices for composing complex workflows

Tutorial: state-machines for operant tasks

Day 4 - Computer Graphics

  • Introduction to modern graphics programming
  • Writing your first fragment shader
  • Introduction to BonVision
  • Projection mapping and multi-display systems

Tutorial: Bonsai shaders

Day 5 - From shaders to complex visual scenes

  • Integration with external modelling tools
  • Building closed-loop virtual reality experiments
  • Reproducible deployment and versioning of experiments

Tutorial: Visual environments, final projects