DOI: 10.5061/dryad.w6m905qzv
title: Mouse behavior and neural activities of dopamine and D1- and D2- neurons in the tail of the striatum under threat-reward conflict and dopamine action onto the striatal neurons

description: We recorded dopamine sensor signals and calcium indicator signals in
 dopamine receptor type 1-expressing neurons (D1-neurons) and dopamine
 receptor type 1-expressing neurons (D2 neurons) in the tail of the
 striatum (TS), while thirsty mice collected water in the presence of a big
 moving object (“monster paradigm”). In some experiments, we examined mouse
 behaviors in the monster paradigm with manipulation of TS (and
 dorsolateral striatum, DLS as comparison) such as ablation of
 TS-projecting dopamine neurons, or D1 neurons or D2 neurons in TS,
 increase of dopamine concentration in TS, and blocking or activating
 dopamine receptor type 1 (D1R) or D2R. To map dopamine responses to
 sensory stimuli and reward in the striatum, we recorded dopamine sensor
 signals in the various parts of the striatum while mice were presented
 with reward or tone in head-fixed mice (“tone-reward paradigm”). In
 addition, we performed optogenetic activation of dopamine axons in TS in
 head-fixed preparation and examined its effects on sensory responses of
 D1-neurons and D2 neurons (“optogenetic activation of TS dopamine”).
description: GRABDA2m or GRABDA3m was expressed in the striatum to record
 dopamine. GCaMP7f or GCaMP8m was expressed in the striatum in Tac1- or
 Adora2A-cre mice to record activity of D1- or D2-neurons. An optic fiber
 was implanted at a recording location to measure population activity
 (fiber fluorometry or photometry). Recordings were performed either in a
 monster paradigm where thirsty mice collected water in a foraging arena
 with or without a monster object, a tone-reward paradigm where head-fixed
 mice were presented different sizes of water or tone, or in optogenetic
 experiments where mice were presented with a sensory stimulus with or
 without optogenetic activation of dopamine axons in the tail of the
 striatum. Dopamine, D1-, or D2-neuron ablation or drug
 infusion was performed and animal behavior was tested in a monster
 paradigm with or without a big moving, big static, medium moving, or small
 moving monster. In the monster paradigm, mice were
 first trained to obtain a water reward (10 mL) located in the foraging
 arena (40 cm from the door) without monster for 3 days. Mice were first
 placed in a shelter and allowed to forage in a foraging arena. Door was
 closed after the mouse returned to the shelter and 20 sec ITI was given.
 After training, test sessions with or without a monster were given. In the
 monster sessions, when the mouse crossed an invisible trigger line (30 cm
 from the door), a monster started to move toward door (10 cm, 20 cm/s) and
 stayed for 500 ms during which a loud sound was presented, then the
 monster moved backward. This sequence was continued until the mouse
 returned to the shelter. 10 trials for 1 session.
description: # Mouse behavior and neural activities of dopamine and D1- and D2 neurons
 in the tail of the striatum under threat-reward conflict and dopamine
 action onto the striatal neurons
 [https://doi.org/10.5061/dryad.w6m905qzv](https://doi.org/10.5061/dryad.w6m905qzv) ## Description of the data and file structure There are 3 types of behavioral paradigms: monster paradigm, tone-reward paradigm, and optogenetic activation of TS dopamine. In each paradigm, there are several datasets as described below. Spreadsheet “**animalList**” shows a list of all datasets with animal information. ### File: 0\_readme\_241203.docx **Description:** a readme file ### File: animalList240809.xlsx **Description:** a list of all animals used ### File: 1\_Monster\_paradigm.zip **Description:** In this paradigm, thirsty mice collect water in a foraging arena with an occasional “monster” object. Behavioral data are stored in .txt files and photometry data are stored in .dat files. There are 12 types of datasets for behavior and/or neural activity. * Behavioral data: ablation of dopamine neurons or striatal neurons in TS or DLS (1), responses to a small monster with DAT inhibitor in TS on monster day 1 (2), rescue of animals with ablation of dopamine neurons with dopamine receptor agonist in TS (3), responses to different sizes of monster (4), responses to a moving or motionless monster (5), knockout of glutamate transporter in dopamine neurons (6), responses to a big monster with DAT inhibitor in TS on monster days 2-3 (10), D2 receptor agonist (11), D2 receptor antagonist (12) * Photometry data: calcium indicator signals of D1- and D2-neurons in TS (7), dopamine sensor signals in TS and DLS (8), dopamine responses in TS to different sizes of monster (9) **File structure** 1\) Behavioral data with ablation of dopamine neurons or striatal neurons TS- or DLS-projecting dopamine neurons, D1-neurons in TS or DLS, or D2-neuron in TS were bilaterally ablated with 6-hydroxydopamine (6OHDA) (for dopamine neurons) or diphtheria toxin (dTA) (for D1- or D2-neurons). Mice were tested for 7 days of alternating sessions with no monster and sessions with monster, starting from a session with no monster. File name: * *AAA*ablation_*BBBCCCDDD* * “*AAA*” indicates the ablated neuron type, which is either “DA”, “D1”, or “D2”. * “*BBB*” indicates the procedure, which is either “ablation”, “Anteriorablation”, or “control”. “ablation” indicates that the ablation was performed in the tail of the striatum (TS). “Anteriorablation” indicates that the ablation was performed in more anterior striatum than TS (i.e. DLS). “control” is with vehicle injection. * “*CCC*” indicates animal ID (see an excel file “animalList”). * “*DDD*” indicates test types, which is either “baseline” or “test” 1 to 6. “Baseline” denotes a session with no monster, before starting the monster tests. Test1, 3, and 5 are sessions with a monster and test2, 4, 6 are sessions with no monster.  2\) Behavioral responses to a small monster with DAT (dopamine transporter) inhibitor in the tail of the striatum Mice were tested for 2 days, with no monster on day 1 and with a small monster on day 2. Dopamine transporter inhibitor or vehicle was bilaterally injected into TS before the monster session on day 2. File name:             DATinhibitor_*EEECCCDDD* * “*EEE*” indicates the procedure, which is either “DATinhibitor” or “vehicle”. * “*DDD*” is either “baseline” or “test1”. 3\) Rescue of animals with ablation of TS-projecting dopamine neurons with dopamine receptor agonist TS-projecting dopamine neurons were bilaterally ablated by 6-OHDA. Animals were tested for 7 days, 4 days with no monster and 3 days with monster. D1R agonist (0.5 or 5 μg) or D2R agonist (0.2 or 2 μg) was bilaterally injected into the TS before each monster session. File name:             DopamineEffectsOnTSneurons_*FFFCCCDDD* * “*FFF*” indicates the procedure, which is either “6OHDAplusHighD1ago”, “6OHDAplusLowD1ago”, “6OHDAplusHighD2ago”, “6OHDAplusLowD2ago”, “6OHDAplusSaline” or “SalineplusSaline”. The first “6OHDA” and “Saline” before “plus” indicate ablation of TS-projecting dopamine neurons and control, respectively. “High” and “Low” indicate dose of injected agonist. “D1ago”, “D2ago” and “Saline” after “plus” indicate injection of D1 agonist, D2agonist, and saline, respectively. * “*DDD*” is either “baseline” or “test” 1 to 6. 4\) Behavioral responses to different sizes of a monster Mice were tested with 3 different sizes of monster in the monster task after a session without a monster. File name:             MonsterSize_*GGGCCCDDD* * “*GGG*” indicates the size of the monster used, which is either “big”, “medium”, or “small”. * “*DDD*” is either “baseline” or “test1”. 5\) Behavioral responses to a moving or motionless monster Mice were tested with either moving or static monster for 2 days, after a session with no monster. File name:             MovingMonsterAttachesThreat_*HHHCCCIII* * “*HHH*” indicates the procedure, which is either “Moving-no”, “Moving-static”, or “static-static”. Moving-no group received a moving monster session on the first day, which is followed by a session without a monster on the second day. Moving-static group received a moving monster session on the first day, which is followed by a session with a static monster on the second day. Static-static group received a session with a static monster on both days 1 and 2. * “*III*” indicates a test type, which is either “test1” or “test2”. Test1 corresponds to the first day and test2 corresponds to the second day in this study. 6\) Behavioral data in mice with vesicular glutamate transporter 2 (vGluT2) knock out (KO) in dopamine neurons Mice with vGluT2 KO in dopamine neurons or control mice were tested for 7 days of alternating sessions with no monster and sessions with monster, starting from a session with no monster. File name:             vGluT2KO_*JJJCCCDDD* * “*JJJ*” indicates the procedure, which is either “KO” or “control”. * “*DDD*” is either “baseline” or “test” 1 to 6. 7\) Photometry data of D1- or D2-neuron activity in the monster task Activity of D1- and D2-neurons in TS were recorded using GCaMP7f in Tac1-cre or A2a-cre mice for 11 days, 1 day without monster and 10 days with monster on every other day with a day of no recording in-between. File name:             FP_*KKKCCCLLL* * “*KKK*” indicates the cell type recorded in the TS, which is either “D1” or “D2”. * “*LLL*” indicates a test type and the session number, which is either “FPR” or “FPM”1-10. FPR denotes no-monster session before starting the monster tests. FPM denotes monster sessions. 8\) Photometry data of dopamine sensor signals in the monster task Dopamine sensor signals in TS or DLS were recorded for 11 or 4 days, 1 day with no monster, followed by 10 or 3 days with monster, respectively. File name:             FP_DA_*MMMCCCLLL* * “*MMM*” indicates the recorded site, which is either “TS” or “DLS”. * “*LLL*” is either “FPR1” or “FPM” 1-10. 9\) Photometry data with different sizes of a monster Dopamine sensor signals in TS were recorded for 1 day with a different size of monster. File name:             FP_size_*NNN*_*CCC*_FPM1 * “*NNN*” indicates the size of the monster used in the test, which is either “small” or “big”. 10\) Behavioral responses to a big monster with DAT (dopamine transporter) inhibitor  Mice were tested for 7 days of alternating sessions with no monster and sessions with monster, starting from a session with no monster, with manipulation of dopamine concentration in TS. DAT inhibitor or vehicle was bilaterally injected into the TS in the monster day 2 and day 3. File name:             bigDATinhibitor_*EEECCCDDD* * “EEE” indicates the procedure, which is either “DATinhibitor” or “vehicle”. * “*DDD*” is either “baseline” or “test” 1 to 6. 11\) Behavioral data with D2R agonist injection into TS D2 receptor agonist or vehicle was injected on monster day 2, after experiencing a big moving monster on monster day 1. Mice were tested for 7 days of alternating sessions with no monster and sessions with monster, starting from a session with no monster. File name:             D2Ragonist_*OOO_CCC*_*DDD* * “*OOO*” indicates the procedure, which is either “D2Ragonist” or “vehicle”. * “*DDD*” is either “baseline” or “test” 1 to 6. 12\) Behavioral data with D2R antagonist injection into TS Mice were tested for 2 days, 1 day without a monster and 1 day with a monster. D2 receptor antagonist or vehicle was bilaterally injected into the TS before a monster session on day 2. File name:             D2Rantagonist_*PPP_CCC*_*DDD* * “NNN” indicates the procedure, which is either “D2Rantagonist” or “vehicle”. * “*DDD*” is either “baseline” or “test1”. 13\) Training data with control mice After handling, 3 days of training without monster were performed. File name:             Training_* CCC*_*QQQ* “QQQ” indicates a training day, which is either training1-3. **Data structure of behavioral data in the monster tasks** Monster data Behavioral data are stored in .txt files. *Comments* Any line starting with the ‘#’ character is a comment or debug message. “State change” signals a switch of a “state” of the program. * state 0: setting the trial parameters * state 1: checking the water spout positions * state 2: checking the IR beam status * state 3: checking the conditions of the touch sensors attached to the water-spouts * state 4: signaling an initiation of a trial * state 5: in a trial; * state 10 checking the results of the previous trial to output “outcome” (see below) * state 11: inter-trial-interval (ITI) * motor_velocity: speed (a.u.) of a motor connecting to a monster * motor acceleration: acceleration (a.u.) of a motor connecting to a monster * sound_type: a type of sound which is presented before a trial start (not used in the current study) * trial_start_volume: a volume of the trial start sound (not used in the current study) * monster_volume a volume (a.u.) of monster sound * reward_location: a location of water reward (0-3). 0 = 10 cm, 1 = 20 cm, 2 = 30 cm, 3 = 40 cm from the door. * monster_location: a location of a monster object (not used in the current study) * reward_duration: duration (ms) of opening a reward valve * door_speed: speed (a.u.) of door closing * box_index: an ID of a monster apparatus in charge (either 255 or 2) * monster_stimulus.trigger_location: a location for a mouse to trigger monster movement (1-4). 1 = 10 cm, 2 = 20 cm, 3 = 30 cm, 4 = 40 cm from the door * inter_trial_interval: duration (ms) of ITI * max_trial_duration: a maximum duration (ms) of a trial (the trial is ended by closing a door if an animal does not enter the foraging arena within this duration) * no_monster_sound_interval: interval time of monster sounds in a no-monster condition (not used in the current study) * pre_trial_blink_time: duration (ms) of a sound which is presented before a trial start (not used in the current study) * n_touches_till_reward: the number of licks required to obtain a reward (not used in the current study) *Events* Other lines record events, described as comma separated values where the first value is the event identifier code. Each event may have additional values: trial time, session time and/or beam break bit flag. *Trial time* Trial time (ms) is defined by time in the current trial, either at session time (see below) 0 for the first trial (“trial” 0 in this dataset) or after 20s inter-trial-interval (ITI, from door-close to door-opening) for trials 1-9. Most event identifiers except for “trial” (see below) contain a trial time value after an event identifier code. *Session time* Session time (ms) is defined by time in the session, starting at the trial start of trial 0. Session time is indicated in “**sync**” event (see below) in the files 2), 3) and 6)-12) in ‘File structure’. *Beam break bit flag:* There are 8 IR beams to detect animal location. A bit flag is 8-digit number and indicates identity of beam in an event. (A door separates a shelter and a foraging arena with a water-spout.) -8 cm from a door toward a foraging arena: 00000001 = 1 -1 cm from a door toward a foraging arena: 00000010 = 2 1 cm from a door toward a foraging arena: 00000100 = 4 5 cm from a door toward a foraging arena: 00001000 = 8 10 cm from a door toward a foraging arena: 00010000 = 16 20 cm from a door toward a foraging arena: 00100000 = 32 30 cm from a door toward a foraging arena: 01000000 = 64 40 cm from a door toward a foraging arena: 10000000 = 128 Note that several beams can be broken or unbroken in one message. For example, 00000110=6 means that the message is about beams at two locations. *Event identifiers* **trial**: trial-starts. Trial number (0~9) is indicated after comma. **sync**: signals every 10s, starting at session time 0, to synchronize event data with photometry data. In the files 2), 3) and 6)-12) described in File structure, session time is also indicated after trial time. **door_open**: a door opening at trial time 0, which allows an animal to move to a foraging arena. Trial time (0) is indicated after comma. **fbbs**: falling beam break (an IR beam is broken). Trial time is indicated after comma, followed by beam break bit flag. A bit set to 1 signifies that beam was broken. **rbbs**: rising beam break (an IR beam is unbroken). Trial time is indicated after comma, followed by beam break bit flag. A bit set to 1 signifies that beam was unbroken. **in_arena**: animal entry to the foraging arena, which is defined as the mouse broke the IR beam at 5 cm from the door. Trial time is indicated after comma. **lick:** an animal licks the water spout at 40 cm from the door. Trial time is indicated after comma. **reward**: a water reward dispensed. Trial time is indicated after comma. **door_closing**: The onset of a door closing, when an animal returns to the shelter, which also marks the trial end. Animal’s return to the shelter is defined as the time when the IR beam at -1 cm is broken and the IR beam at +1 cm is not broken for 2 sec or when the IR bam at -8 cm is broken. Trial time is indicated after comma. “Door closing” could occur multiple times because a door was closed sequentially; when a mouse enters the shelter (breaks -1 cm beam), the door starts to close (marked as "door closing") and stops in the middle. If the mouse stays at the shelter (no beam break at +1 cm) for more than 2 seconds or reaches the deep end of the shelter (breaks -8 cm beam), the door closes completely and ITI starts. Otherwise, the door opens again to allow the mouse to fully return to the foraging arena. We used the last "door-closing" as arena exit. **monster**: preparation for the monster movement, which is triggered when a mouse breaks IR beam at 30 cm from the door. Trial time is indicated after comma. **mal**: the monster starts the forward movement (toward the shelter). Trial time is indicated after comma. **hlfb**: the monster stops movement. Trial time is indicated after comma. **mah**: the monster starts the backward movement (away from the shelter). Trial time is indicated after comma. **sound**: the onset of monster sound. Trial time is indicated after comma. **outcome:***There are 3 types of outcomes (trial types, 0, 2 or 6). 0 denotes that trial was timed out (an animal did not enter the arena within the duration “max_trial_duration”, see above), 2 denotes that an animal entered the arena but did not acquire reward, 6 indicates that an animal entered the arena and acquired reward. Outcome type is indicated after comma. **Data structure of photometry data in the monster tasks** File names for photometry data start with the same name as the corresponding behavioral data in .txt files. There are 3 types of files: original data with no processing, time information for easier synchronization, and normalized data. **Original data files** (_imaging.dat) .dat files are open binary files and contain 3 raw analog data (1000 Hz) in unit of Volt (V); GCaMP or DA sensor signals (1), tdTomato signals as control signals (2), and TTL signals (3). TTL signal is sent every 10s to synchronize photometry data and behavioral data. The first TTL in photometry data marks a session start in behavioral data, and the interval is exactly 10 seconds in behavioral data, which is not exactly 10,000 frames in photometry data. 3 types of signals can be extracted from the raw files in matlab as below (see an example code for details): ``` file_ID = fopen(file, 'r'); ``` ``` CC_cart_analog = fread(file_ID, inf, 'double', 0, 'b'); ``` ``` A = reshape(CC_cart_analog, 2, [ ]); ``` ``` B = reshape (A, 2, 3, [ ]); ``` ``` GCaMP = B (:,1,:); ``` ``` GCaMP = reshape (cart_GCaMP,[],1); %% GCaMP or DA sensor signals ``` ``` tdTom = B (:,2,:); ``` ``` tdTom = reshape (cart_tdTom,[],1); %%tdTom control signals ``` ``` TTL = B (:,3,:); ``` ``` TTL = reshape (TTL,[],1); %TTL signals for synchronization ``` **Time data** (_photometry_time.mat) These files include 8 vector data: 'photometry_t' and 7 event '_TS'. ‘photometry_t’ is session time (see above) for each photometry frame. Conversly, ‘_TS’ data is the number of photometry frames for key events. * door_TS: at start of door opening * enter_TS: at animal entrance from a shelter to a foraging arena (beam break at 5cm from the door) * reward_TS: at water reward onset * monster_TS: at start of monster movement * beam_TS: at any beam break * exit_TS: at animal exit from a foraging arena to a shelter (start of door closing) * sound_TS: at onset of monster sound **Normalized data** (_photometry_corrected.mat) These files have one vector data ‘GCaMP_zscore’, where global signal decays and potential motion-artifacts were corrected using an entire session, and signals are expressed as z-score of the entire session. The matlab code ‘Normalization_monster_photometry.mat’ is attached. ### File: 2\_Striatum\_mapping\_Tone\_Reward.zip **Description:** Dopamine sensor signals were recorded for 1 session while mice performed in tone-water tests; 3 intensities of 8 kHz pure tone (50 dB, 75 dB, and 100 dB, duration 1s) and 3 sizes of water (1 μl, 3 μl, and 10 μl) were presented in pseudo-random order. Each session consisted of 120 trials. ITI (exponential distribution between 10–20 sec, average 13 sec) was given between trials. **File structure** File name: FP_headfix*_CCC* “*CCC*” indicates animal ID (see an excel file “animalList”). The information of the recording site is included in an excel file “**animal_recordingSite**”. A-P: anterior-posterior (rostral-caudal) position from Bregma (mm). Plus sign means anterior to Bregma, minus sign means posterior to Bregma. M-L: medial-lateral position from the midline (mm). D-V: dorsal-ventral position from dura (mm) **Data structure in each file** There are 2 types of files, raw data (.dat) and trial-based data (_US_combined.mat). **Raw data** (.dat) .dat files are open binary files (see above) and contain 5 raw analog data (1000Hz) in unit of Volt (V); DA sensor signals (1), tdTomato signals as control signals (2), licks (3), water (4), 1 blank (5) and trial type signals (6). Trial type TTL signals were sent at tone or water to record trial types. 1 uL water: 1 pulse 3 uL water: 2 pulses 10 uL water: 3 pulses 50 dB tone: 5 pulses 75 dB tone: 7 pulses 100 dB tone: 9 pulses 5 types of signals can be extracted from the raw files in matlab as below:   ``` file_ID = fopen(file, 'r'); CC_cart_analog = fread(file_ID, inf, 'double', 0, 'b'); A = reshape(CC_cart_analog, 2, [ ]); B = reshape (A, 2, 8, [ ]); GCaMP = B (:,1,:); GCaMP = reshape (cart_GCaMP,[],1); %% GCaMP or DA sensor signals tdTom = B (:,2,:); tdTom = reshape (cart_tdTom,[],1); %% tdTom control signals lick = B (:,3,:); lick = reshape (lick,[],1); %% animal licks on water spout water = B (:,4,:); water = reshape (water,[],1); water_on = crossing(water,[],2); %threshold(mV) water_on_ts = (water_on(1:2:end)).'; %% water onset water_off_ts = (water_on(2:2:end)).'; %% water offset trial_type_sig = B (:,6,:); trial_type_sig = reshape (trial_type_sig,[],1); %% trial types (see above) ``` **Trial-based data** (_US_combined.mat) These files have 5 data 'DeltaF_combined','Response_combined', 'Response', 'Trial_number_combined', 'p_all'. * DeltaF_combined: a cell with 6 trial x time (ms) matrices of z-score dopamine sensor signals aligned at small water (1), medium water (2), big water (3), small tone (4), medium tone (5), big tone (6) (-2000 to 5000ms) for each animal. * Response_combined: a cell with 6 1 x trial vector of average dopamine responses to (1)-(6) (1-1000ms). * Response: a 6 x 1000 (ms) matrix for median dopamine activity patterns to (1)-(6) (1-1000ms). * Trial_number_combined: trial number for each trial type. * p_all: a 8 x 1 vector for p-value in student t-test for responses to big water vs 0 (1), responses to big tone vs 0 (2), responses to big water vs big tone (4), responses to big vs small water (6), responses to big vs small tone (7), blank (3, 5, 8). An example code for summary plots “summary_water_tone_test.mat” is attached. ### File: 3\_Optogenetics\_dopamine\_D1\_D2.zip **Description:** We recorded from dopamine axons in the tail of striatum (TS) using a dopamine sensor DA3m and calcium activity from D1 or D2 neurons in TS using a calcium indicator GCaMP8m. Recordings were performed when head-fixed mice were presented with a sensory stimulus, optogenetic activation of TS dopamine axons, or both at the same time. **File structure** The datasets are divided into 5 experiments with different task conditions. Each file contains the data for all mice used in one experiment. **‘0_masking' or '0_no_masking’:** Activity of TS dopamine axons was recorded with a dopamine sensor DA3m when dopamine axons in TS were optogenetically activated for 500ms with or without a background masking light. The masking light was used to eliminate the neuron activity caused by optogenetics excitation light itself. Two red lamps were placed on both sides of the mouse with approximately 15 cm distance to their eyes and were turned on before the mice entered the arena and kept on throughout the experiments. All the following experiments were performed with the masking light on. **‘1_natural_novel_response’:** Activity of TS dopamine axons was recorded with a dopamine sensor DA3m when mice were presented with a novel multi-modal sensory stimulus (blue LED light and a 100db complex tone). Each sensory pulse lasted for 0.5 s and was repeated four times with 0.5 s inter-stimulus intervals. **‘2_opto_three_frequencies_xxx’:** Activity of TS dopamine axons was recorded with a dopamine sensor DA3m when dopamine axons in TS were optogenetically activated at different frequencies (10, 20 and 40Hz) for 500ms or 4s as specified in the filename “xxx”. **‘3_task_yy_response_dxbx’:** Dopamine sensor (DA3m) signals in TS (DA in the filename “yy”) or calcium sensor (GCaMP8m) signals in TS D1 or D2 neurons (D1 or D2 in the filename “yy”) were recorded while mice were repeatedly presented with the same sensory stimulus (blue LED light and a 50db complex tone) with or without dopamine axon optogenetic activation in TS. Each sensory pulse lasted for 0.5 s and was repeated for four times with 0.5 s inter-stimulus intervals. Optogenetic activation covers 0 to 4s from stimulus onset. D1 and D2 neuron activities were recorded for two days with two blocks per day. Block 1 includes 20 trials with no optogenetic stimulation (“no stim trials”), and block 2 includes 30 trials, 15 trials with optogenetic stimulation (“stim trials”) and 15 “no stim-trials” in a pseudo-random order. The blocks are indicated by “dxbx” in the file name. For example, “d1b2” refers to day 1, block 2. **‘4_opto_only_D1_response’:** Activity of TS D1 neurons was recorded with a calcium indicator GCaMP8m when dopamine axons were optogenetically activated at 20Hz for 4s. **Data structure in each file** In each .mat file, there is a 1 * n cell array called "signal_raw", where n is the number of mice. For experiments 0, 1, 2, the first half (3 mice) are control mice without opsin and the second half (3 mice) are mice with opsin. The order of mice is the same across files. For experiment 3, the first half (6 mice) are mice with opsin and the second half (6 mice) are control mice without opsin. The order of mice is the same within D1 recordings and within D2 recordings. For experiment 4, all mice are with opsin. In the cell array, each element is a t * 3 matrix that contains the recorded raw data of one mouse from one session. t is the length of that session, and the columns are three separate channels recorded in unit of Volt (V). The sampling rate is 1000Hz. The first column is the recorded calcium activity, which is converted to electric signal by a photodetector. The second column is the signal that controls optogenetic stimulation laser. The laser is on when the value is nonzero, indicating that a voltage is applied, and the laser is off when the value fluctuates around zero. For the experiments that do not involve optogenetics, this channel is also included, and the values are around zero throughout the session. The third column is the signal that controls the sensory stimulus (blue LED light and tone). The LED and sound are on when the value is nonzero, indicating that a voltage is applied, and the LED and sound are off when the value fluctuates around zero. For the experiments that do not involve sensory stimulus, this channel is also included, and the values are around zero throughout the session. ## Code/software All analysis codes for optogenetic experiments are available on Github: [https://github.com/melissa0v0/TS_Dopamine_Optogenetics](https://github.com/melissa0v0/TS_Dopamine_Optogenetics)  “expX_xxxx.m” are the main codes for each experiment mentioned above. “SingleAnimal_xxx.m” include functions called by the main codes that preprocess the signal and segment the signal into trial-based structure. “[analyze_noise_onlyG.m](https://github.com/melissa0v0/TS_Dopamine_Optogenetics/blob/main/analyze_noise_onlyG.m "analyze_noise_onlyG.m")”, “crossing.m” and “[errorbar_patch.m](https://github.com/melissa0v0/TS_Dopamine_Optogenetics/blob/main/errorbar_patch.m "errorbar_patch.m")” are basic signal processing and plotting functions shared between different experiments.