Workflow for DEC experiments and analysis
Proper experimental parameter selection is important for successful delay eyeblink conditioning (DEC) training. For the data presented here, the GUI was used to choose a CS duration of 350 ms and a US duration of 50 ms. This pairing results in an inter-stimulus interval of 300 ms: long enough to prevent low-amplitude CR production10 and short enough to avoid getting into the regime of poor learning or trace conditioning, a process that engages additional brain regions11. The time between trials was set using the ITI low and high fields to be randomly chosen uniformly from a range of 5-15 s. The randomization of the inter-trial intervals makes it impossible for animal subjects to use timing cues other than the CS and US themselves for task performance.
Including trials that omit either the CS or US allows assessment of the CR and UR kinematics even in trained animals. The user can define the proportion of trials in which CS and US are paired or presented in isolation. In the data presented here, we ran all sessions at 10% CS-only trials with paired trials constituting the rest and no US-only trials. Note that including excessive numbers of unpaired trials can negatively impact training. For example, sessions with greater than 50% of trials unpaired are commonly used to drive the extinction of CRs in trained animals19,26.
Camera preparation and lighting conditions are also critical for acquiring high-quality data. The frame rate of acquisition can be adjusted in the Picamera acquisition software. In the data presented here, we set a frame rate of 120 Hz for DEC experiments. The Picamera module itself allows frame rates of up to ~200 Hz, but we find that lower rates prevent frame loss and give adequate temporal resolution for eyelid tracking. The infrared light must be placed to illuminate the periocular fur evenly without creating excessive reflection from the cornea when the eye is open. Figure 3A shows a sample image from a recording session with acceptable lighting. The picamera acquisition software (picameraStream.py) is designed to provide consistent settings across a session by setting and holding the camera's white balance and gain based on illumination conditions when the camera is initialized.
Once a behavioral session is initialized, data from the camera and other platform hardware components will be automatically logged. Data logs are created in a directory named by the date and value input to the animal ID field in the GUI. Camera frames and time stamps for each trial are stored in individual files which are named using the animal ID, experiment date, and trial number. Platform events for each session, including wheel speed, trial starts, trial stops, and CS and US timing, are saved as a single .txt file.
Data transferred to the host machine can then be analyzed as described in section 4 of the protocol. Running analyzeData.py on a target directory will create a .npy container for eyelid position versus time for all trials in an array based on analysis of the camera files. This container file is created in the directory that is analyzed. Once all sessions have been analyzed for a given animal, all sessions can be aligned and concatenated using summarizeSessions.py. Results from an animal trained for 8 sessions of DEC are shown in Figure 3B. In addition, individual trials can be rendered as viewable .mp4 files using the session2mp4s.py utility. This utility imprints a square in the upper lefthand corner of the movie to indicate when the CS and US are applied. Sample DEC trials prepared in this way are presented side by side as Supplementary Video 1. The left panel shows a trial in which the animal successfully closes its eye in response to the LED CS. In the right panel, the animal does not blink until the US starts.
Animals trained on DEC following the protocols in section 3 and recorded with the preceding considerations should show clear evidence of well-timed CRs acquired gradually over multiple training days. Examples of behavioral traces with no CRs in an untrained animal and traces containing robust CRs from a trained animal are presented in Figure 3B. As these traces show, naïve animals should show no response to the CS but a robust response to the US. CRs should increase progressively in both size and frequency through behavioral sessions performed across days (Figure 3B-D). In contrast, suboptimal lighting conditions severely limit the quality of data acquired. When the contrast between the eye and surrounding fur is low (Figure 3E), slight changes in the image can significantly alter the recorded shape of the UR over a single session and decrease the signal-to-noise ratio for detecting eyelid position (Figure 3F-G).
To ensure high fidelity eyelid recordings, optimal light source placement is critical. The illumination LED should be trained directly on the recorded eye. If placement results in excessive glare on the corneal surface, a diffuser can be placed over the LED array to reduce this effect.
Workflow for DTSC experiments and analysis
Many of the considerations for experimental parameter selection are similar between delay tactile startle conditioning (DTSC) and DEC. Here, we will point out those that differ. In the example data, DTSC CS duration was set to 250 ms with a US duration of 50 ms. This shorter inter-stimulus interval was chosen to closely align with the shorter duration described as optimal for DTSC learning20. Other platform parameters set through the GUI were identical to those used for DEC.
Proper placement of the tactile stimulus is critical for learning in DTSC. We mount the tactile stimulus such that the foam end is centered slightly above the animal's nose at a distance of approximately 1.5 cm when in the neutral position. Once mounted, the stimulus can be turned by hand when a session is not running. During sessions, the stepper motor holds the stimulus at a precise location until an US is triggered. To ensure that the positioning is correct, we run a preparatory session of around three trials. Events logged on the rotary encoder are printed to the terminal screen, and this printout can be used to monitor the amplitude of animal URs in real time. While the maximum amplitude will vary from trial to trial, animals with an average maximum of ~40 counts on the encoder across the short session should perform well in the DTSC task. Based on the rotary encoder control settings, this value corresponds to 24 cm/s, with a negative value indicating that the animal is moving backward on the wheel.
The organization and naming of files produced in the course of DTSC sessions are the same as those produced in DEC. Running analyzeSession.py will create a .npy container for wheel speed versus time for all trials in an array from analysis of the data logged in the .csv file. Once all sessions have been analyzed for a given animal, all sessions can be aligned and concatenated using summarizeSession.py. Results from an animal trained for 5 sessions of DEC are presented in Figure 4A. As for DEC, the camera captures from DTSC can be converted to viewable .mp4 files. Sample DTSC trials are shown side by side in Supplementary Video 2. The left panel shows a trial in which the animal successfully backs the wheel in response to the LED CS. In the right panel, the animal fails to move the wheel until the tactile stimulus US is applied.
The time course and amplitude relative to the UR of responses in animals trained on the DTSC paradigm show qualitative similarities to those trained on DEC. Naïve animals should show no response to the CS, and learn to move the wheel backward in response to the CS only after repeated exposures to the paired CS and US. The frequency and amplitude of CRs increase as training proceeds (Figure 4A,B). In the case of DTSC, we have found that UR amplitude early in training is a good predictor of the success of learning. In a cohort of animals trained with an US that produced low amplitude URs (<20 cm/s), no animal learned to consistently produce CRs after 4 days of training (Figure 4C,D).
Differences between DEC and DTSC training
DEC and DTSC differ in important ways. First, DTSC learning on this platform occurs more rapidly, with most animals achieving a high degree of task proficiency by the third day of training and asymptotic performance by day five. DEC learning is slower for most animals by at least 3 days. Second, the DTSC system incorporates automatic detection of successful CRs, which serve as a feedback signal to the apparatus to decrease the amplitude of the tactile stimulus. This training procedure mimics eyeblink conditioning, in which improved CR performance provides partial protection from an aversive corneal air puff. In contrast, head-fixed animals in the DTSC paradigm are unable to protect themselves from the tactile stimulus by their motor response alone. By basing US amplitude on the presence of a CR, animals have the opportunity to shield themselves from the aversive stimulus.

Figure 1: Platform attributes and design. (A) Platform elements for recording animal behavior under head-fixed conditions. The mouse was adapted from a Biorender image. (B) Timing and stimuli for DEC and DTSC conditioning. A user-defined inter-stimulus interval (ISI) determines how long the CS only epoch lasts. CS and US epochs are designed to co-terminate. (C) Picture demonstrating placement of key platform elements. 1) Stepper motor for control of the DTSC US. 2) Running wheel for the animal. 3) Rotary encoder for tracking wheel movement. 4) Foam taped over an acrylic arm that serves as the DTSC tactile stimulus. 5) LED CS. 6) Solenoid valve and outlet that provides the DEC US. 7) Picamera for recording animal behavior. 8) Infrared LED for stage illumination. Please click here to view a larger version of this figure.

Figure 2: Wiring of platform hardware elements. (A) Fritzing wiring diagram of platform hardware when fully assembled. Wires are colored by modules with orange = Camera module; yellow = DEC US module; blue = LED CS module; purple = DTSC US module; green = Rotary encoder module. The picamera is excluded but attaches to the camera serial interface located on the surface of the Raspberry Pi. Batteries indicate direct current power supplies at the specified voltage. (B-F) Equivalent wiring scheme for isolated modules. Wires have been recolored, so that red and black always indicate positive supply rail and ground, respectively, while other wires are colored to allow easy following of the circuit. Please click here to view a larger version of this figure.

Figure 3: Representative results of DEC training. (A) Example camera frame from a session with acceptable illumination conditions. Note the high contrast between the eye and periocular fur. (B) Performance of a single animal during sessions performed across days in the DEC paradigm. Horizontal lines indicate performance on each trial, with warm colors indicating more eyelid closure. The leftmost red black vertical line indicates the onset of the CS, while the dotted line indicates the initiation of the US. The second solid line indicates cessation of the CS and US. Note that the number of trials with successful responses during the CS increases across training sessions. (C) Animal performance from (B) with individual traces derived from the trial average for the session each day. The hue saturation indicates session number with higher saturation for later sessions. (D) Performance for all animals in the DEC group (n = 7). The thin lines indicate the percent of trials with a detectable CR from each session for each animal. The thick lines indicate the session means across all animals. (E) Example camera frame from a session with sub-optimal illumination conditions. (F) Quantification of single trials recorded with poor illumination. The UR is detectable but with lower contrast and higher variability than under optimal light conditions. (G) Session average traces from trials presented in (F). Please click here to view a larger version of this figure.

Figure 4: Representative results of DTSC training. (A) Performance of a single animal during sessions performed across days in the DTSC paradigm. Horizontal lines indicate performance on each trial, with warm colors indicating backward wheel movement. The leftmost black vertical line indicates the onset of the CS, while the dotted line indicates the initiation of the US. The second solid line indicates cessation of the CS and US. (B) Animal performance from (A) with individual traces derived from the trial average for the session each day. The hue saturation indicates session number with higher saturation for later sessions. (C) Performance for all animals in the DTSC group (n = 6). The thin lines indicate the percent of trials with a detectable CR from each session for each animal. The thick lines indicate the session means across all animals. (D) Single trials as in (A) from a cohort where the US intensity elicited low amplitude URs. (E) Session average traces presented as in (B) for the animals subjected to the weak US. (F) Performance for all animals in DTSC with weak US (n = 6). Please click here to view a larger version of this figure.
Supplementary Video 1: Sample DEC hit and miss trials. DEC trials are compared in video 1. Each video shows trials in which the subject makes (Left) or fails to make (Right) the target CR synchronized and played side by side for comparison. The LED CS comes on when the blue square appears in the upper left corner of each video. The US control signal is active when a white square replaces the blue square. CS and US control signals co-terminate when the square disappears. Please click here to download this Video.
Supplementary Video 2: Sample DTSC hit and miss trials. Video 2 shows DTSC trial comparison. Each video shows trials in which the subject makes (Left) or fails to make (Right) the target CR synchronized and played side by side for comparison. The LED CS comes on when the blue square appears in the upper left corner of each video. The US control signal is active when a white square replaces the blue square. CS and US control signals co-terminate when the square disappears. Please click here to download this Video.