The walking arena used in most of our experiments consisted of a temperature-controlled 24.5 cm diameter platform surrounded by a static backlit visual pattern (Fig. 1). Flies were maintained in the arena by a thermal barrier around the outside edge of the walking platform and by clipping the wings as described above. The thermal barrier consisted of a rope heater wrapped around a galvanized steel band insulated from the platform by a layer of neoprene. Although some flies would occasionally hop over the arena’s edge, most would avoid walking off the platform due to the heat barrier. Above the arena were mounted infrared-LEDs and a 1280×1024 pixel camera sensitive in the near-infrared. Images were recorded at 20 fps by a computer using the Motmot Python camera interface package31 . For more details see the Supplementary Note. Although our software was developed in conjunction with this set up, it is adaptable to other arrangements with similar characteristics (Supplementary Videos 67).