Current Biology Data README: Data for each animal is stored as a MATLAB struct. Each trial is a field in this struct, and the fields within each trial are consistent between datasets. The following is a description of all fields and subfields of the data. Fields within each trial data field: "img" : Contains data recorded from the 2p microscope. "t" : Timestamps for each frame taken from the 2p microscope. "fret" : Normalized FRET response, calculated from raw CFP and YFP frame data as described in the manuscript. "lab" : Contains data recorded from the PowerLab. "t" : Timestamps for each data point. "vel" : Angular velocity (in deg/s), calculated from the raw encoder values as described in the manuscript. "lick" : Licking frequency, calculated from the raw optical lickport signal as described in the manuscript. "rewidx" : Frames where reward was given (if feedback was ON), or where reward would have been given (if feedback was OFF) "mat" : Contains control data from the MATLAB routine used to control reward delivery. "t" : Timestamps for frames where the reward detection algorithm was run (this should correspond to "img.t" if no frames were dropped) "rewardframes" : Same as "rewidx" "thresh" : The reward threshold for each frame. "traces" : Raw CFP and YFP traces calculated in realtime from the imaging data "vfr" : Number of frames recorded in a separate video file triggered from the 2p microscope acquisition (not used in this dataset) "fr" : Imaging frame number corresponding to each run of the reward detection algorithm (this is simply [1,2,3,4,....] unless there are dropped frames) Trial names for trained animals: "baseline" : Day 1 (Naive animals) "fbd1" : Day 2 (Day 1 of feedback training) "fbd2" : Day 3 (Day 2 of feedback training) "post" : Day 4 (Feedback turned OFF) Trial names for randomly rewarded animals "baseline" : Day 1 (Naive animals) "rand1" : Day 2 (Randomly rewarded) "baseline_2" : Day 3 (No reward) "rand2" : Day 3 (Randomly rewarded) "post" : Day 4 (No reward) "rand3" : Day 5 (Randomly rewarded) Animal 3: Data from this animal had discontinuities due to a bad electronic pre-amplifier. This was corrected by manually shifting the data during such jumps by subtracting the median value of the artificially elevated data and adding the mean value of the data 10s before the jump point. Jump points (in frames) are indicated below: Day 1 ("baseline"): 1060-3617 6170-8792 11351-15000 Day 2 ("fbd1"): 1901-4459 7009-9568 Day 3 ("fbd2"): 2755-5316 7875-10430 12979-15000 Day 4 ("post"): 1779-4319 7397-9941 12507-15000