a, Schematic of the viral vector strategy and optical fiber placement for optogenetic stimulation of pPVTD2R–NAc axon terminals in the 2AA task. b, Fiber placements (Ctl, n = 8 mice; ChR, n = 12 mice). c-f, Avoidance rate (c), latency to avoid (d) and freezing time during the CS (e) and ITI (f) across training sessions for each group. g-j, Top: Avoidance rate (g), latency to avoid (h) and freezing time during the CS (i) and the ITI (j) during optogenetic stimulation of pPVTD2R–NAc axon terminals. Bottom: Normalization to Day 1 for each group. Two-way ANOVA followed by two-stage linear step-up procedure of Benjamini, Krieger and Yekutieli. Avoidance rate: F(2, 36) = 6.21. Latency to avoid: F(2, 36) = 3.34. CS freezing: F(2, 36) = 0.16; ITI freezing: F(2, 36) = 0.21. For group comparisons **P < 0.01, *P < 0.05 k, Linear regression of the changes in freezing behavior across test sessions as a function of changes in avoidance behavior. l, Schematic of the viral vector strategy and optical fiber placement for optogenetic stimulating of pPVTD2R–CeA axon terminals in the 2AA task. m, Fiber placements (Ctl, n = 7 mice; ChR, n = 10 mice). n-q, Avoidance rate (n), latency to avoid (o) and freezing time during the CS (p) and ITI (q) across training sessions for both groups. r-u, Top: Avoidance rate (r), latency to avoid (s) and freezing time during the CS (t) and the ITI (u) during optogenetic stimulation of pPVTD2R–CeA axon terminals. Bottom: Normalization to Day 1 for each group. Two-way ANOVA followed by two-stage linear step-up procedure of Benjamini, Krieger and Yekutieli. Avoidance rate: F(2, 30) = 5.43. Latency to avoid: F(2, 30) = 1.89. CS freezing: F(2, 30) = 0.88; ITI freezing: F(2, 30) = 0.66. For group comparisons **P < 0.01, *P < 0.05. v, Linear regression of the changes in freezing behavior across test sessions as a function of changes in avoidance behavior. All data in figure shown as mean ± s.e.m.