This MATLAB code is used to align operant behavior (Pavlovian conditioning) with fiber photometery imaging of genetically encoded biosensors (ACh3.0, dLight1.2).