FPmotion an Automated Signal Processing and Statistical Analysis Tool for Fiber Photometry Data

preprint OA: closed
Full text JSON View at publisher
Full text 141,664 characters · extracted from preprint-html · click to expand
FPmotion an Automated Signal Processing and Statistical Analysis Tool for Fiber Photometry Data | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article FPmotion an Automated Signal Processing and Statistical Analysis Tool for Fiber Photometry Data Ye Hong, Jismi John, Eleanor Coffey, Patrik Hollos, Thomas Tobilko This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-8506067/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract Fiber photometry measures neural activity in vivo from genetically encoded indicators. Recordings generate large datasets that require extensive preprocessing and robust statistical methods for meaningful interpretation. However, existing analysis tools demand programming expertise, limiting accessibility. Here we describe FPmotion , a comprehensive, user-friendly software platform for batchwise processing, integration, and statistical analysis of fiber photometry data with or without accompanying behavioral information. FPmotion performs filtering, isosbestic regression, ΔF/F computation, detrending, and z-scoring. It also extracts detailed peak properties at whole-file, block-level, and individual-peak resolution. When behavioral data is provided, FPmotion automatically identifies behavioral bouts, computes bout-level statistics, performs peri-event signal extraction, and supports multi-group comparisons through ANOVA- and LMEM-based statistical frameworks. All analyses generate publication-ready figures and structured CSV outputs suitable for downstream workflows. FPmotion also introduces a dedicated alignment module for peri-event signal analysis. This module applies dynamic time warping followed by barycenter averaging to realign peri-event traces while preserving the behavioral time anchor, producing cleaner and more temporally coherent peri-event motifs. We demonstrate FPmotion’s capabilities using the dlight1.1 sensor to measure dopamine responses from ventral striatum in behaving mice before and after amphetamine treatment. Together, FPmotion offers a fully automated framework for FP data analysis that improves interpretability and accessibility while reducing analysis time substantially. Fiber photometry batch processing statistics automation amphetamine striatum dopamine software Figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 1. Introduction Fiber photometry (FP) enables real-time measurement of fluorescence reporter activity in specific brain regions of awake behaving mice ( 1 ). Initially used to monitor calcium transients from genetically encoded GCaMP reporters, FP facilitates investigation of neuronal circuit dynamics ( 1 , 2 ). Chronically implanted optical fibers (200–400 µm in diameter) deliver excitation light to defined brain coordinates, enabling 1000 Hz acquisition with around 200 µm axial sensitivity, dependent on reporter expression and brightness ( 1 , 3 ). A variety of fluorescent reporters are now used including dLight for dopamine, GRABNA for norepinephrine, iGluSnFR for glutamate, GABASnFR for GABA, in addition to serotonin, endocannabinoid and voltage sensors ( 4 – 7 ). The method is increasingly used to understand how neurotransmission and signalling in the nervous system control behavioural responses. Existing tools for FP analysis GuPPy ( 8 ), pMAT ( 9 ), pyPhotometry ( 10 ), FiPhA ( 11 ), Pyfiber ( 12 ), and PhAT ( 13 ), can be used to process the data and decode the underlying signals. However, these software packages do not provide built-in, robust statistical analysis combined with batch processing. Moreover, coding knowledge is required to run these pipelines. For this reason, FP has remained somewhat a niche method and the data analysis remains time consuming. FPmotion is an FP analysis software package with G.U.I. that offers flexibility to the user. It is packaged entirely within an .exe file that can be downloaded and executed directly in a Windows environment. The user can choose to compare groups of differently treated mice during the analysis setup, so that in the output, the statistically significant changes are already annotated and indicated, both in csv and graphical formats, across a range of measurements and output files. Options for signal normalisation setup, applied either across animals or individually are available. This supports identification of patterns that are consistent across subjects, or accurate detection of stimulus responses within an individual. In addition to these features, FPmotion introduces a dedicated alignment module for peri-event signal analysis. This method uses dynamic time warping (DTW) combined with barycenter averaging to correct latency jitter across trials while preserving the behavioral time anchor, enabling cleaner visualization and quantification of peri-event motifs. To our knowledge, barycentering-based alignment is not included in existing FP workflows. Together with these analytical capabilities, FPmotion also emphasizes accessibility. The user-friendly GUI built with ttkbootstrap simplifies the analysis process, eliminating the need for coding and making sophisticated data analysis accessible to a broader range of researchers. 2. Materials and Methods 2.1 Introduction to the Software FPmotion is distributed as a standalone Windows executable that can be downloaded directly from GitHub ( https://github.com/TCB-yehong/FPmotion ) and run without additional installations or programming expertise. The software provides an accessible, clearly structured graphical interface that guides users through the analysis in an intuitive step-by-step format, enabling users to begin analysis immediately after download. The software interface comprises four sequential sections that unlock progressively as each previous section is set up. The input interface accepts signal files and optional behavior and video files in bulk. The parameter interface provides customization settings for the analysis and output. The information input interface collects file information necessary for statistical methods and settings not covered in the parameter interface. The group comparison interface allows users to set up multiple groups and comparisons from the input files. Detailed descriptions and demonstrations are available in the accompanying vignette. File naming - To match signal files with their respective behavior files and extract information directly from file names, we implemented specific naming conventions. The signal file name consists of six information fragments connected by underscores or spaces: “Trial_X” (trial number), mouse ID, genotype, behavior test name, and two experiment conditions. For example, "Trial_1_1827_control_OF_before_MK801" indicates treatment ("MK801") and time segment condition ("before"). Behavior and video files only need to match the trial number with the signal files. Manual adjustments are possible if naming conventions are not followed. Optional video file - Users can include mouse behavior videos in the analysis with any of the following format: mp4, .mov, .avi, .webm, .ogv, .mkv, or .gif,. If selected, additional video outputs align mouse movement, fiber photometry signals, and behavior bouts in the video. This option is time-consuming and is opted out by default but can be enabled in the parameter interface. Fiber photometry signal processing - The default source for signal input files is Doric Lenses (Québec, Canada), although output from Tucker-Davis Technologies (TDT) and RWD Life Science (RWD) devices can also be directly imported into FPmotion. For signals from other sources, the required format includes three columns: the first for time points, the second for the isosbestic channel, and the third for the dopamine/calcium channel, saved in a .csv file. Raw fiber photometry signals undergo initial filtering. If the "dopamine" signal is selected, a Butterworth lowpass filter is applied, with customizable cutoff frequency and filter order. For "calcium" signals, a zero-phase moving average filter is applied in both forward and backward directions, with a customizable filter window. These filters are independently applied to the isosbestic and dopamine/calcium channels. The isosbestic channel is then fitted to the dopamine/calcium channel using least squares linear regression. The percent dF/F is calculated by subtracting the fitted isosbestic channel from the dopamine/calcium channel, dividing by the fitted isosbestic channel, and multiplying by 100%. This % dF/F signal is detrended by subtracting a linear least-squares fit. Users can choose to calculate either a standard Z-score or an "external" Z-score. The standard Z-score is computed by subtracting the signal mean and dividing by the standard deviation. For the external Z-score, users can specify a set of baseline files and/or time periods; the mean and standard deviation of the % dF/F from these baseline signals are used in the calculation. All these calculations are performed using Python packages such as SciPy, sklearn, and NumPy. In addition, the following Python modules are used: OS, pickle, traceback, datetime, types, tkinter, ttkbootstrap, pandas, re, math, colorsys, webcolors, threading, peakutils, moviepy, matplotlib, seaborn, pingouin, statistics, statannot, csv, textwrap, scipy, sklearn, itertools, statsmodels, functools, pygam, tslearn, fastdtw, joblib and multiprocessing. Behavior information processing - The default source for behavior information is output from EthoVision XT tracking software. For other sources, the input file should be in .xlsx format and have a column named "Recording time" for the behavior test time points, and subsequent columns for each behavior, with values of 0 (behavior not present) or 1 (behavior present). In the parameter interface, the behavior starting row should be set to 1. Each behavior is processed into behavior bouts, defined as continuous periods of 1s. The start time, end time, and duration of each bout are recorded. Bouts are adjusted to remove artifacts from signal processing, and those closer than a user-defined merging distance are combined. Bouts shorter than a user-defined minimum duration are excluded. The behavior syllable labels are automatically detected by Fpmotion from within the uploaded .csv file during the initial processing (see Supplementary User Guide, page 6, information interface I, point 2). The user can select one or multiple behaviors to analyse. Combining Signal and Behavior - Combining signal and behavior - For each processed behavior bout, the lengths and counts per recording session are calculated and visualized with histogram overlaying kernel density estimates. Signal z-scores before and after each bout's start are extracted, with each time segment defaulting to 5 seconds (customizable by the user). Peak thresholds define signal peaks, with customizable relative and absolute thresholds. The relative threshold uses the median absolute deviation of the signal z-scores multiplied by 2.91, while the absolute threshold is user-defined. A default peak distance threshold, defined as 100 data points, can also be customized. Once peaks are identified, their amplitude and frequency are calculated. Bar plots compare AUC, amplitude, and frequency before and after behavior bouts for each input file. Single peak properties, such as time point, amplitude, width, prominence, and AUC, are categorized as within behavior bouts, outside of behavior bouts, and all passing signal peaks. This data is accumulated for statistical analysis on bulk data. Signals are also divided into shorter blocks to capture momentary variations, with a default block length of one minute. Each block inherits behavior bout and peak property information within its timeframe. Block-level data, along with behavior bout and peak property information, are output in CSV format for each input file. Signal peaks are extracted using Python's SciPy package. Group comparison utilizing bulk data - After individual file processing, data from all files are combined and saved in CSV files. Users can customize groups and comparisons in the group comparison interface, specifying which files belong to each group and which groups to compare. For behavior bout length and count values, statistical comparisons across groups utilize ANOVA with False Discovery Rate (FDR) corrections are performed. The results are visualized with detailed boxplots. For before/after behavior bouts data, grouped bar plots are created for amplitude, frequency, and AUC, showing pre- and post-bout measurements by comparison groups. A 2-way ANOVA with post hoc Tukey test is conducted to assess the significance of comparison groups and behavior effects. Pooled behavior bout data are visualized in heatmaps. For each pre- and post- bout signal combination with user chosen lengths, an optional outlier removal step can be performed by detecting and removing signals that are statistical outliers using robust covariance methods. Subsequently, signals are grouped into clusters based on their shape and temporal pattern similarity using Dynamic Time Warping (DTW) ( 14 , 15 ). Once clustered, signals within each group are precisely aligned around the behavior events using DTW-based averaging (barycenter alignment). Alignment is performed separately for periods before and after behavioral events if chosen. The aligned signals are then analyzed for their peak properties, such as amplitude and prominence, and visualized in bar plots and violin plots. Signal peak data are analyzed on three levels: whole file average, block average, and individual peak level. For whole file averages, each peak property's average value per file is used in statistical tests and visualized in bar plots with T-test significance. For block averages, average values are calculated per block, and line plots display these averages by group. For individual peaks, signal peak data are analyzed using linear mixed-effects models (LMEM) to account for within-subject variability and repeated measures. The resulting fixed-effects summaries, predictions, and statistical output are recorded, and visualized in scatterplots. Two conditions comparison - A comparison setup allows optional comparison of two conditions from the file information: genotype and one other condition (e.g., drug treatment). This feature can be activated through the GUI's parameter interface under 'General' settings when relevant. Users can switch the genotype information if needed. Segment line plots and scatter plots are generated for time block and single peak data of peak properties, segmented by the first condition and grouped by genotype. ANOVA tests, including 3-way ANOVA and 2-way ANOVA with post hoc Tukey tests, assess the significance of genotype, behavior bout presence, and the first condition, along with their interactions. Figures and statistical tests are created using Python packages seaborn, statannot, analys, and pingouin. Analysis without behavioral input - Although FPmotion is designed to integrate behavioral tracking with fiber photometry data, users may also perform the full signal-based analysis without supplying behavior files. In this mode, all behavior-dependent steps—including bout detection, bout length and count summaries, peri-event signal extraction, and behavior-segmented analyses at file, block, and single-peak levels—are omitted. All signal-centric analyses remain available. This includes peak preprocessing, peak detection and characterization, and all statistical comparisons involving peak amplitude, frequency, width, prominence, and AUC at whole-file level, block-partition level, and single-peak level. This option enables users working with simple photometry recordings, pilot datasets, or experiments without behavioral annotation to obtain comprehensive signal-based results. Peak alignment and outlier removal– FPmotion includes a dedicated module to enhance peri-event fiber photometry signal interpretation, before and after a behavior. Although all events in our datasets are time-locked to the annotated behavioral timestamps, peaks and troughs that are typically temporally misaligned across trials, lead to flattening and masking of physiologically relevant transients. To this overcome limitation, we implemented a multi-step workflow consisting of robust outlier removal, time-series clustering, and dynamic time-warping (DTW)-based alignment to a consensus template ( 16 ). Outlier detection was performed using the Mahalanobis distance, which is well-suited for high-dimensional time-series data. However, directly applying Mahalanobis distance to raw signals proved unstable due to singular covariance matrices, as signals often contain thousands of timepoints but far fewer trials. To address this, each signal was projected onto a reduced principal component (PCA) space, retaining N–1 principal components for N trials ( 17 ). This ensured that the dimensionality never exceeded the number of observations. To prevent minor principal components, which primarily capture noise, from disproportionately influencing the distance metric, each component is normalized by its explained variance, effectively weighting the features in proportion to their contribution to overall signal structure. A robust covariance estimate is then obtained using the Minimum Covariance Determinant (MCD) method, which is less sensitive to extreme signals ( 18 , 19 ). Outliers were identified by comparing principal component-space distances to a chi-squared threshold determined by the number of retained components. This approach consistently removes anomalous signals that deviate strongly from the dominant temporal structure, enabling cleaner downstream modelling. Even after outlier removal, the signal ensemble can contain multiple distinct temporal motifs depending on behavioral context or neural heterogeneity. To assess whether the dataset naturally partitions into discreet patterns, we incorporated an unsurpervised clustering step. Because clustering raw signals is confounded by onset jitter and latency differences, we first computed dynamic time warping (DTW) distances between all second-half segments (the behavior-evoked portion of the signal). DTW was chosen because Euclidean distance cannot account for temporal misalignment of peaks or valleys, which is especially relevant when physiological latencies differ across trials despite shared behavioral timing. Classical DTW is computationally prohibitive for datasets of this size ( 20 ), so we used fast DTW, an approximate implementation that provides strong performance with substantially reduced runtime. Parallel processing further accelerates distance computations, with our software automatically detecting available CPU cores and allocating two-thirds of them to the DTW process. We also apply time-series k-means clustering using the precomputed DTW distance matrix and evaluate clustering performance using silhouette scores. Other indices, such as Davies–Bouldin and Calinski–Harabasz were tested but removed due to excessive computational cost under DTW metrics. To guard against spurious structure, we generate random cluster assignments and recompute silhouette scores as a null baseline. A cluster solution is accepted only if its silhouette score exceeds the random baseline by more than two standard deviations; otherwise, all trials are treated as a single group. In practice, clusters containing only a few signals typically represent residual noise and are considered outlier-dominated. This step ensures that alignment is not forced into artificial partitions and preserves the integrity of behavior-linked signal motifs. FPviewer: a results browser for FPmotion output) - To facilitate navigation of the large number of output files generated during bulk processing, we developed a standalone results viewer for FPmotion. This .exe file can be downloaded from here: https://github.com/TCB-yehong/FPmotion . The FPviewer organizes outputs into structured tabs corresponding to major result types: file overview, results from group comparisons for behavior bouts, file-level signal summaries, block-level signal properties, peak-level statistics, and before/after behavior segment analyses. For proper visualization of this structure, users should select the main results directory rather than an individual subfolder. FPviewer will automatically map the folder hierarchy into its tab-based layout. Both image and text-based results can be previewed directly within the viewer, allowing users to browse heatmaps, bar plots, violin plots, and CSV-based statistical tables without opening files individually. Selecting a file from the tab displays its content in the central viewing panel, and a dedicated button allows users to open the displayed file externally when preparing figures or extracting values for manuscripts and presentations. 2.2 Mouse surgeries and fiberphotometry Mice - Adult (8–12-week-old male) C57BL/6NCrl wild-type mice were maintained on a 12 h light/dark cycle and supplied with food and water ad libitum. Behavioural tests were performed between 08:00 and 15:00 h. The number of animals used in each experiment is indicated in the legends. Ethical permission: The animal work was done according to the project permit (ESAVI/30686/2022 and ESAVI/26777/2023) granted by the Regional administrative Agency of Finland. Stereotaxic surgery - Individually housed mice were weighed and anesthetized with isofluorane (Isoflurane concentration in breathing zone of 2.5% for induction and 2 − 1% maintenance) and placed on a stereotaxic frame (KOPF, US) for the surgery. The depth of anaesthesia was estimated using the paw or tail response. A heating pad (Physitemp MTC-1, temperature controller at 37°C) was used during the surgery to keep mice warm. Local anaesthesia 1mg/kg Lidocaine (Orion Pharma) in 125µl was administered subcutaneously at the incision point 2 minutes prior to making the incision. Temgesic (Indivior) 0.1mg/kg (170µl for a 25 g mouse) was given intra-peritoneally just before the surgery. The head was straightened and fixed on the frame. Viscotears were applied to prevent eyes from drying. An incision was made along the midline, the scalp retracted, and the area surrounding bregma was cleaned and dried. Coordinates (+ 1.54 mm AP, +/-0.6 mm ML, − 4.5 mm DV) were marked carefully on the head and holes are drilled using the dentist’s drill (FOREDOM, K.1070). Infusion with pAAV-CAG-dLight1.1 viruses (0.2µl, Plasmid #111067 from Addgene) was performed using an automated sterotaxic injector (#53311, Stoelting, IL, US) at a rate of 0.10 µl/min and the needle was left in place for 10 minutes to prevent back flow. Fiber optic cannulas (Doric lenses, core diameter 200 µm, code- 200/230 − 0.48, MF1.25-X mono fiber optic cannulas) are then placed in the exact coordinates using the cannula holder (Thorlabs, SE) and fixed using dental cement (Super-bond C&B, Sun medicals, Japan). The wounds are stitched and saline 10 ml/kg is injected intra-peritoneally. After surgery, the animals are transferred to their “heat-pad warmed” home-cage to recover. Mice are monitored twice daily during the recovery period. Following surgeries, mice are housed alone for at least 2 weeks before behavioural tests are conducted. This period allows ample expression of virus. Fiber photometry - Fiber photometry data was collected using a Doric fiber photometry customised system with optical components from Doric Lenses (Quebec, CA). For recording from ventral striatum using dLight1.1. FP measurements were acquired with an analog/digital acquisition console using LED excitation for dLight1.1 through an LED driver with 488 nm and background 530 nm. Excitation power was set between 40–60 µW and measured from the flat-end optic fiber. Emission was recorded at 1000 Hz sampling rate using Newport 2151 Femtowatt photoreceivers (Irvine, CA, US) in ‘DC-LO’ mode. Before connecting the fibers to the mice, fibers were photo-bleached for 10 to 15 minutes using 500 mA current in both the LED channels. After head mounting the fiber, in vivo autofluorescence from tissue was bleached for 5 minutes with 60µW before the experiments commenced. Behaviour tracking and FP acquisition were synchronised using a TTL trigger from Noldus I/O box (The Netherlands) connected to the FP console. Raw signals were recorded with Doric Neuroscience studio software and thereafter analysis was done using FPmotion software. The following settings were used for the FPmotion analysis; signal type: Dopamine, second order Butterworth low pass filter:10, order 2, peak distance: 100, peak absolute threshold: 2, Time block: 60 seconds. Behavioural test - Open Field test - Distance travelled in the open field (45 x 45 cm arena) was recorded using an acA1300-60gc GigE video camera (Basler). To start the test, mice were released in the corner of the arena facing the wall. Horizontal and vertical activities wwereere recorded for 30 min. For analysis, Ethovision-13 software (Noldus, The Netherlands) was used. Various behavioural parameters such as run straight and turning were scored manually using Ethovision software. All experiments are calculated from 7 mice before and after amphetamine treatment. No mice were removed from the experiment. Amphetamine treatment - Following 30 min open field behavior tests, mice were injected with Amphetamine (5 mg/kg) intraperitoneally and allowed to rest in their home cage for 10 min. Then mice next underwent 30 min open field. 3. Results 3.1 Testing FPmotion with experimental data To demonstrate the functionality of the FPmotion software (overviewed in Fig. 1 ), we used the dLight1.1 reporter to measure extracellular dopamine in the ventral striatum of behaving mice in an aversive space, before and after amphetamine administration. Dopamine release in this brain region is important for initiation of movement in response to a motivational signal ( 21 ). We measured peak parameters and dopamine patterns that accompanied behavioral syllables associated with the amphetamine hyperactivity response i.e. turning and running behaviors (Fig. 2 A). Spontaneous behaviors were captured using Ethovision XT setup and the photometry signal and behavior tracking were saved as .csv files for automated analysis using FPmotion software. The use of FPmotion software to analyse the fiberphotometry and behavior data is described first (2.2), followed by a description of the results obtained in these experiments using FPmotion (2.3). 3.2 Software setup Here we walk the user through the software setup and parameter selection. Data analysis was performed through the FPmotion graphical user interface (GUI). In the Input interface, we loaded the photometry signal files acquired with Doric Lenses FP console and the corresponding behavioral tracking files exported from EthoVision XT. Behavior videos can be uploaded at this stage. Parameter selection was done through the Settings interface. Under “General”, we kept the default settings which skip genotype-treatment combined analyses (as this is used when treatments are done in more than one type of mouse, e.g. in different genotypes). We left the “skip video creation” option at its default disabled state. For “Ethovision” settings, we used FPmotion’s default starting row of 36, the default 7s maximum behavior-bout merging threshold, and the default 1s minimum bout-length threshold. Under “Doric”, we retained the default fluorescence and isosbestic channel labels (“Aln-1” and “Aln-2”). Under “Video”, the frame rate down sampling remained at the default value of 10 fps, although this parameter had no effect because no videos were loaded. For “Peak extraction”, we kept the default setting for minimum inter-peak distance of 100 ms in this instance where acquisition is 1000 Hz) and the default 60s time-block duration for time-resolved analyses. Under “Plot parameters”, all figure types used the default y-axis limits. For “Segment modelling”, we retained the default setting to enable automatic detection and removal of outliers, and we kept the default option that aligns before/after behavior-triggered signal segments as a single continuous trace rather than splitting them into pre- and post-components. We also kept the default option to perform follow-up analyses on barycenter-aligned segments, using the default maximum of 10 clusters, and retained the default minimum peak-distance threshold of 5. The only modifications we made were in the “Signal preprocessing” and “Peak extraction” settings. In “Signal preprocessing”, we changed the signal type from the calcium preset to dopamine, as dLight 1.1 (and not GCaMP) was the sensor used in these experiments. Accordingly, we increased the frequency threshold to 25 Hz and applied a second-order Butterworth low-pass filter to remove high frequence noise. In “Peak extraction”, we adjusted the amplitude-based peak-detection threshold to an absolute value of 2. Next, we proceeded to the Information Input interface. File metadata were automatically populated from filenames following FPmotion’s naming conventions. After confirming file information, we opened the Group Comparison interface and created a single comparison contrasting the pre-amphetamine (group 1) and post-amphetamine (group 2) recordings. After saving this comparison, we returned to the Information Input interface to complete the remaining configuration, including behavioral selections and z-score normalization. From the auto-detected EthoVision behavior labels, we selected “Run straight,” “Turn L,” and “Turn R” for inclusion in the analysis. For z-score normalization of the Doric signals, we selected “External” baseline mode and used all pre-injection recordings across mice as the baseline distribution. Because the entire pre-amphetamine window was used, no specific baseline time interval was entered. The user can alternatively select another baseline mode if desired. Genotype color settings were left at their default values. After confirming all parameters across the four interfaces, we initiated the analysis. FPmotion then executed all processing steps autonomously taking 2 hours to complete the analysis from 14 trials (30 min trial duration, 1000 Hz) on a Windows laptop with 32GB RAM. If generation of alignment videos is selected, it takes 4 hours. Upon completion, all graphical outputs, spreadsheets, statistical summaries, and processed signal files were available in the designated output directory. 3.3 Sample workflow measuring amphetamine responses with dLight1.1 We measured dopamine signals and behavior from mice freely behaving in an open field arena before and after amphetamine administration. Extracellular dopamine was measured using the dLight1.1 sensor made from a fusion of a D1 receptor fragment with circularly permutated GFP. dLight1.1 is excited by blue light and emits with a peak at around 515 nm. The resulting signal provides sub second time resolution and sub-micromolar sensitivity for dopamine detection, suitable for measuring tonic and phasic dopamine release ( 4 , 22 ). Figures 2 to 5 present some of the results from the automatically generated output. Two weeks following viral injection and cannula implantation to the nucleus accumbens (NAc), mice underwent fiber photometry and behavior tracking. Freely behaving mice were monitored during 30 min in the open field after which amphetamine (5mg/kg) was injected intraperitoneally. After 15 min rest, mice were returned to the arena and behavior monitored for a further 30 min (Fig. 2 A). Full file averaged data before and after amphetamine shows that peak prominence was significantly reduced after amphetamine whether measured across the entire 30 min monitoring (p = 7E-03) (Fig. 2 B), or within “run straight” behaving bouts (p = 4E-03) (Fig. 2 C). Peak prominence is the vertical distance between the peak and the lowest contour line that connects it to higher peaks or the signal baseline. The decrease in peak prominence during this period is likely because the extracellular dopamine is high due to amphetamine inhibition of the dopamine transporter (DAT), preventing a return to baseline dopamine between the peaks. The linear graphs (Fig. 2 D), show 1-min time binned output for frequency, amplitude and prominence. Frequency increased sharply 20 min following amphetamine injection and remained elevated for 15 min after which the plateau diminished. The high frequency period showed good overlap with reduced peak prominence period (Fig. 2 D), consistent with dopamine being highly elevated. Amplitude was not significantly altered by amphetamine when looking at the full file output, although it visibly decreased at the point when frequency returned to baseline. These data closely match the timeline of dopamine release measured by microdialysis following intraperitoneal injection of amphetamine ( 23 ). FPmotion also analyses single peaks. Figure 3 shows a selection of outputs from the “single peak” analysis. Amphetamine decreases prominence once more as shown by plot and scatterplot (Fig. 3 A, B). The statistical significance for single peak output is based on LMEM, accounting for within subject variability and repeated measures. Within and outside of behaving windows calculations are automatically generated for all “selected” behaviors within the software. Here we show peak prominence during “run straight” bouts also decreases after amphetamine treatment, visualised by barplot and z-score scatter plot (Fig. 3 C, D). FPmotion also calculates “peak-width-height”, which is the height of the contours at the point where widths were calculated (Fig. 3 G). Peak-width-height increases two-fold following amphetamine. The “turn right” width-height results from non-behaving (p = 0.0372) and behaving (p = 0.00491) bouts is shown (Fig. 3 H, I). A temporal view of amplitude changes before and after amphetamine highlights a significant interaction between amplitude and time, where amplitude is higher after amphetamine but decreases by about 30 min following intraperitoneal injection of amphetamine. This decrease may reflect vesicular dopamine store depletion following amphetamine ( 24 ) (Fig. 3 J). Figure 4 shows examples of FPmotion’s calculated behavioral bout output. Following amphetamine, “run straight” bout length increases (p = 1-26E-07) (Fig. 4 A), while bout number decreases, reflecting prolonged hyperlocomotion following amphetamine (Fig. 4 B) ( 25 ). For “turn left” syllables, bout length also increases significantly (p = 3.08E-05), consistent with amphetamine-induced circling (Fig. 4 C) ( 25 ). In this case, bout count similarly increases (p = 0.00623; Fig. 4 D). In contrast, “turn right” syllables show a significant increase in bout length, but no change in bout number (Fig. 4 E, F). Individual dopamine responses can be examined from the .csv files and from the synchronized alignment video (Fig. 1 C; supplementary video). The peak alignment function is illustrated for 5s before and after behavior initiation as peri-plots (Fig. 5 A, B). The purpose of the peri-plot is to show how dopamine peaks occur relative to behavior bout onset, allowing identification of co-occurring dopamine patterns. Temporal alignment of peaks is necessary to correct for peak latency. This improves signal clarity and reduces errors caused by misaligned signals (Fig. 5 B). The outlier function is demonstrated in Fig. 5 C. Here FPmotion identifies an outlier based on gross difference in amplitude (red). This trace will be removed from the quantification if the “ outlier removal ” option is selected. The user can also choose not to remove outliers. All outliers are highlighted as shown, in the graphical output so that the user can check that they agree. Figure 5 D shows “run straight” events before dynamic time warping-based peak alignment and clustering. The signal to noise ratio is poor and no clear pattern is visible from the heatmap. In contrast, after aligning and clustering, a distinct pattern emerges (Fig. 5 E). This shows that dF/F (z-score) dips before initiation of “run straight” followed by a gradual incline (Fig. 5 E). Clusters 0 and 1 after amphetamine represent possible dopamine patterns (Fig. 5 F, G). dF/F (z-score) for cluster 1 (Fig. 5 G) resembles the “run straight” pattern before amphetamine (Fig. 5 E). However, as cluster 0 for “run straight” after amphetamine (Fig. 5 F) only occurs 5 times, this signal is likely the result of noise and would be considered an outlier. Note, the cluster numbering is arbitrary and does not signify rank. Also, the user should use discretion in deciding which clusters are likely to represent authentic signals. Turning behavior is associated with asymmetry in dopamine signaling, where turn direction is towards the hemisphere with lower dopamine levels ( 26 ), while bilateral dopamine elevation produces generalized hyperlocomotion, as reflected in this case by increased run straight bout length ( 27 ) (Fig. 4 ). Note that in these experiments, the fiber photometry canula is implanted in the right hemisphere. Consistent with this, the peri-plots for “turn left” syllables before and after amphetamine show increased dopamine when turning initiates (Fig. 5 H, J). However, another pattern is also seen during turn left where phasic dopamine release is observed − 2.5s before turn initiation and + 2.5s after (Fig. 5 I). Following amphetamine, the same peaks are observed (Fig. 5 K). While the pattern is identical before and after amphetamine, a greater proportion of “turn left” bouts display it (15 bouts before verses 25 bouts after, I and K), suggesting that it represents an authentic dopamine signal ensemble. We also examined peri-plots for “turn right” behavior syllables. Dopamine in the right hemisphere dipped before “turn right” behavior commenced in control trials (Fig. 5 L, cluster 1), however, after amphetamine administration, three signal ensembles emerged from the clustering analysis (Fig. 5 M-O). All clusters showed a dip in DF/F (z-score) from − 5 to -2 s before turn initiation at timepoint 0, by which point dopamine was higher. This was followed by a dip in dF/F (z-sc) signal following turn right initiation (Fig. 5 M-O). Given the reasonable signal to noise ratio and the repeated nature of these ensembles, we propose that they represent bonafide NAc dopamine patterns accompanying turning. These data show that FPmotion peri-event plots successfully resolve discreet ensembles within the data. 4. Discussion FPmotion balances a structured analytical workflow with the flexibility needed to accommodate diverse experimental designs. The core processing steps, spanning signal preprocessing, behavior-event extraction, normalization, visualization, and advanced analyses, is organized to allow users to obtain meaningful results from a single analysis. At the same time, most steps of the workflow include adjustable parameters, allowing the analysis to be refined for example for different biosensors. Although the software provides default parameter choices that are robust, users can adjust filtering cutoffs, normalization modes, and event-alignment windows. Group comparisons can also be configured. In this way, the framework provides consistency for users preferring a turnkey approach while remaining adaptable. The software generates a comprehensive set of results during the analysis run, rather than requiring users to preselect specific outputs. This approach minimizes the risk of missing relevant summaries, and the need to repeat the analysis. By providing all outputs at once, researchers can focus on the figures and tables most meaningful for their experimental questions. These files can be easily viewed in the FPviewer software. This analysis environment is easy to navigate and supports a broad range of users. The final and most critical component of the workflow is the alignment of peri-event signals using DTW barycenter averaging (DBA). Behavioral onset alone does not guarantee temporal alignment of fluorescence features across trials; even after time-locking all segments to the same event. The latency of prominent peaks and valleys in FP traces varies between trials. Such latency jitter is well documented in other neural modalities, such as event-related potentials and calcium imaging, where a simple stimulus-locked averaging attenuates waveforms unless temporal realignment is applied ( 28 , 29 ). To address this, we incorporated DTW-based alignment, constrained by the fixed behavioral time anchor, permitting local latency corrections while preserving the event reference. We adopted DTW DBA to compute a consensus waveform for each cluster. DBA provides a more faithful representation of average temporal shape than arithmetic mean, particularly when peaks and troughs occur with slightly different latencies across trials. Prior work highlights its ability to preserve shared temporal motifs in time-series datasets subject to latency variability and non-uniform warping ( 20 , 30 ). In practice, this alignment pipeline enabled clearer peri-event motifs to emerge that were largely invisible in the raw, unaligned averages despite time locking. Nonetheless, we emphasize that this method is optimal only when the trials share broadly consistent temporal dynamics. Our simulation experiments reveal that alignment performance degrades when large frequency differences occur across signals. Users should therefore use it cautiously when underlying kinetics are highly heterogenous. Throughout the development of this workflow, we evaluated method performance using simulated datasets that varied in amplitude, asymmetry, frequency, and polynomial shape. These tests revealed that the pipeline is sensitive to data characteristics, particularly signal frequency (Supplementary data 1). DTW-based approaches perform well when signals share broadly similar dominant frequencies, as is typical for FP dopamine or calcium recordings. DTW may attempt to warp high-frequency structures into low-frequency ones, producing biologically unrealistic alignments. This underscores the importance of empirically validating outlier removal, clustering, and alignment decisions, and avoiding overinterpretation of motifs that emerge from datasets with high-frequency variability or poor signal-to-noise ratios. In summary, the combination of PCA-based Mahalanobis distance calculation, variance-weighted MCD estimation, fast DTW clustering, and DBA-derived consensus templates alignment provides a robust and scalable framework for detecting meaningful temporal patterns in peri-event FP signals. The pipeline is specifically designed for datasets with many trials, moderate event-related variability, and relatively consistent signal frequency; conditions typically met in dopamine and calcium FP experiments. Overall, the methods implemented here provide a principled and computationally fast and automated way to uncover reproducible FP dynamics surrounding behavior with batch processing, full statistical analysis and graphical, .csv and video output. We tested the pipeline with fiber photometry recordings from the ventral striatum of mice before and after amphetamine to investigate what transient dopamine signals accompanied behavior syllables in freely behaving mice. Our results show that amphetamine increases the frequency of dopamine transients while reducing peak prominence. This makes sense given the sustained elevation in extracellular dopamine upon amphetamine-mediated DAT inhibition. Normally, extracellular dopamine in striatum clears within 100 to 300 ms ( 31 , 32 ). Following systemic amphetamine injection, we find that dopamine is elevated in ventral striatum by 20 min post injection, consistent with previous reports for amphetamine and cocaine ( 23 , 33 ). Frequency remains elevated for 15 min from this time point while amplitude and AUC increase significantly. Moreover, peak prominence decreases while peak-width-height increases significantly following amphetamine treatment, consistent with prolonged dopamine availability in the extracellular space. Temporal views of the data reveal changes over time, for example amplitude decreases by 30 min following amphetamine, suggesting a decline in dopamine, and consistent with this, frequency decreases in parallel. Finally, the peri-event plots capture an expected dip in dF/F (z-score) for dopamine in the right hemisphere of NAc when initiating right turns as previously described ( 33 ). This improved peak alignment combined with clustering allows detection of discreet signal ensembles that would otherwise be masked. Overall, we demonstrate that the FPmotion features including automation of fiber photometry data processing, outlier removal, modelling, peri-event analysis (with dynamic time warping and clustering) and statistical analysis simplifies the translation of fiber photometry signals into biological insight and makes it accessible to non-programmers. Declarations Author Contribution Y.H. wrote the code with contribution from T.T. and P.H. J.J. performed mouse experiments tested software. Y.H. and E.C. wrote the manuscript. All authors reviewed the manuscript. Acknowledgement We acknowledge Nikita Tiwari and Francesca Marchisella for their contributions towards fiberphotometry method optimization . Data Availability The software generated for this study FPmotion and FPviewer are available on the GitHub repository: https://github.com/TCB-yehong/FPmotion References Gunaydin, L. A., Grosenick, L., Finkelstein, J. C., Kauvar, I. V., Fenno, L. E., Adhikari, A. et al. (2014) Natural neural projection dynamics underlying social behavior Cell 157 , 1535-1551 Chen, T. W., Wardill, T. J., Sun, Y., Pulver, S. R., Renninger, S. L., Baohan, A. et al. (2013) Ultrasensitive fluorescent proteins for imaging neuronal activity Nature 499 , 295-300 Kim, C. K., Yang, S. J., Pichamoorthy, N., Young, N. P., Kauvar, I., Jennings, J. H. et al. (2016) Simultaneous fast measurement of circuit dynamics at multiple sites across the mammalian brain Nat Methods 13 , 325-328 Patriarchi, T., Cho, J. R., Merten, K., Howe, M. W., Marley, A., Xiong, W. H. et al. (2018) Ultrafast neuronal imaging of dopamine dynamics with designed genetically encoded sensors Science 360 , Feng, J., Zhang, C., Lischinsky, J. E., Jing, M., Zhou, J., Wang, H. et al. (2019) A Genetically Encoded Fluorescent Sensor for Rapid and Specific In Vivo Detection of Norepinephrine Neuron 102 , 745-761.e748 Marvin, J. S., Shimoda, Y., Magloire, V., Leite, M., Kawashima, T., Jensen, T. P. et al. (2019) A genetically encoded fluorescent sensor for in vivo imaging of GABA Nat Methods 16 , 763-770 Simpson, E. H., Akam, T., Patriarchi, T., Blanco-Pozo, M., Burgeno, L. M., Mohebi, A. et al. (2024) Lights, fiber, action! A primer on in vivo fiber photometry Neuron 112 , 718-739 Sherathiya, V. N., Schaid, M. D., Seiler, J. L., Lopez, G. C., and Lerner, T. N. (2021) GuPPy, a Python toolbox for the analysis of fiber photometry data Sci Rep 11 , 24212 Bruno, C. A., O'Brien, C., Bryant, S., Mejaes, J. I., Estrin, D. J., Pizzano, C. et al. (2021) pMAT: An open-source software suite for the analysis of fiber photometry data Pharmacol Biochem Behav 201 , 173093 Akam, T., and Walton, M. E. (2019) pyPhotometry: Open source Python based hardware and software for fiber photometry data acquisition Sci Rep 9 , 3521 Bridge, M. F., Wilson, L. R., Panda, S., Stevanovic, K. D., Letsinger, A. C., McBride, S. et al. (2024) FiPhA: an open-source platform for fiber photometry analysis Neurophotonics 11 , 014305 Conlisk, D., Ceau, M., Fiancette, J. F., Winke, N., Darmagnac, E., Herry, C. et al. (2023) Integrating operant behavior and fiber photometry with the open-source python library Pyfiber Sci Rep 13 , 16562 Murphy, K. Z., Haile, E. D., McTigue, A. D., Pierce, A. F., and Donaldson, Z. R. (2023) PhAT: A Flexible Open-Source GUI-Driven Toolkit for Photometry Analysis Curr Protoc 3 , e763 Han, R., Li, Y., Gao, X., and Wang, S. (2018) An accurate and rapid continuous wavelet dynamic time warping algorithm for end-to-end mapping in ultra-long nanopore sequencing Bioinformatics 34 , i722-i731 Krumbholz, K., Hardy, A. J., and de Boer, J. (2020) Automated extraction of auditory brainstem response latencies and amplitudes by means of non-linear curve registration Comput Methods Programs Biomed 196 , 105595 Vorpe K, H. S., Poth R, Miljkovic T. (2023) Clustering regions with dynamic time warping to model obesity prevalence disparities in the United States. Journal of Applied Statistics 51 , 793-807 Mejia AF, N. M., Eloyan A, Caffo B, Lindquist, and MA. (2017) PCA leverage: outlier detection for high-dimensional functional magnetic resonance imaging data. Biostatistics 18 , 521-536 Rousseeuw, P. J., and Katrien van Driessen. (1999) A Fast Algorithm for the Minimum Covariance Determinant Estimator Technometrics 41 , 212-223 Hubert M, D. M., Rousseeuw PJ. (2018) Minimum covariance determinant and extensions. WIREs Comput Stat . 10 , e1421 Chan., S. S. a. P. (2007) Toward accurate dynamic time warping in linear time and space. Intelligent data analysis 11 , 561-580 Salamone, J. D., Pardo, M., Yohn, S. E., López-Cruz, L., SanMiguel, N., and Correa, M. (2016) Mesolimbic Dopamine and the Regulation of Motivated Behavior Curr Top Behav Neurosci 27 , 231-257 Labouesse, M. A., Cola, R. B., and Patriarchi, T. (2020) GPCR-Based Dopamine Sensors-A Detailed Guide to Inform Sensor Choice for In vivo Imaging Int J Mol Sci 21 , Siciliano, C. A., Calipari, E. S., Ferris, M. J., and Jones, S. R. (2014) Biphasic mechanisms of amphetamine action at the dopamine terminal J Neurosci 34 , 5575-5582 Sulzer, D. (2011) How addictive drugs disrupt presynaptic dopamine neurotransmission Neuron 69 , 628-649 Kokkinidis, L., and Anisman, H. (1979) Circling behavior following systemic d-amphetamine administration: potential noradrenergic and dopaminergic involvement Psychopharmacology (Berl) 64 , 45-54 Carli, M., Evenden, J. L., and Robbins, T. W. (1985) Depletion of unilateral striatal dopamine impairs initiation of contralateral actions and not sensory attention Nature 313 , 679-682 Kokkinidis, L., and Anisman, H. (1977) Perseveration and rotational behavior elicited by d-amphetamine in a Y-maze exploratory task: differential effects of intraperitoneal and unilateral intraventricular administration Psychopharmacology (Berl) 52 , 123-128 Zoumpoulaki A, A. A., Filetti M, Brammer M, Bowman H. (2015) Latency as a region contrast: Measuring ERP latency differences with Dynamic Time Warping. Psychophysiology 52 , 1559-1576 Guy, M. W., Conte, S., Bursalıoğlu, A., and Richards, J. E. (2021) Peak selection and latency jitter correction in developmental event-related potentials Dev Psychobiol 63 , e22193 Petitjean, F., Ketterlin, Alain, Gancarski, P. (2011) A global averaging method for dynamic time warping with applications to clustering. Pattern recognition. 44 , 678-693 Fleckenstein, A. E., Volz, T. J., Riddle, E. L., Gibb, J. W., and Hanson, G. R. (2007) New insights into the mechanism of action of amphetamines Annu Rev Pharmacol Toxicol 47 , 681-698 Calipari, E. S., and Ferris, M. J. (2013) Amphetamine mechanisms and actions at the dopamine terminal revisited J Neurosci 33 , 8923-8925 Jørgensen, S. H., Ejdrup, A. L., Lycas, M. D., Posselt, L. P., Madsen, K. L., Tian, L. et al. (2023) Behavioral encoding across timescales by region-specific dopamine dynamics Proc Natl Acad Sci U S A 120 , e2215230120 Additional Declarations No competing interests reported. Supplementary Files Supplementarydatacombined.pdf SupplementaryTrackingvideoTurnLafteramphetaminetracked.mp4 Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-8506067","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":576275995,"identity":"16c42ba2-92fa-4d66-b846-c31b1b9baa5f","order_by":0,"name":"Ye Hong","email":"","orcid":"","institution":"Åbo Akademi University","correspondingAuthor":false,"prefix":"","firstName":"Ye","middleName":"","lastName":"Hong","suffix":""},{"id":576275999,"identity":"d24ef354-be0e-4f39-a778-4af0bc6e3522","order_by":1,"name":"Jismi John","email":"","orcid":"","institution":"University of Turku","correspondingAuthor":false,"prefix":"","firstName":"Jismi","middleName":"","lastName":"John","suffix":""},{"id":576276000,"identity":"7e6e8e45-8a67-4203-9756-ea6f54890199","order_by":2,"name":"Eleanor Coffey","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAtElEQVRIiWNgGAWjYJCCDxUMDHIMEkBWhQFxOhhnnGFgMAZrOUOKlsQGsBZi1POzHz7YcKDicHr/7OYDDAcKiNAi2ZOW2HDgzOHcGXeOJTAcIMZhBjd4zB9/bDuc23Ajx4D5AzFa7G/wGDYc/Hc4XR6ohUhbJEBaGg4nGBCtReIMyC/H0g03Av1ygCgt/O2gEKuxlpe73XzwwYE/RGiBgmYweYB4DQwMdaQoHgWjYBSMgpEGADz4QQcKydf9AAAAAElFTkSuQmCC","orcid":"","institution":"Åbo Akademi University","correspondingAuthor":true,"prefix":"","firstName":"Eleanor","middleName":"","lastName":"Coffey","suffix":""},{"id":576276001,"identity":"eaa0acc1-dd4e-4fea-a1ac-98589a179a85","order_by":3,"name":"Patrik Hollos","email":"","orcid":"","institution":"Åbo Akademi University","correspondingAuthor":false,"prefix":"","firstName":"Patrik","middleName":"","lastName":"Hollos","suffix":""},{"id":576276002,"identity":"023d29c2-739c-408e-821f-487cfe65678d","order_by":4,"name":"Thomas Tobilko","email":"","orcid":"","institution":"Vibraint ApS","correspondingAuthor":false,"prefix":"","firstName":"Thomas","middleName":"","lastName":"Tobilko","suffix":""}],"badges":[],"createdAt":"2026-01-03 10:08:37","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-8506067/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-8506067/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":100725023,"identity":"dd4b983b-655f-4dab-a1b0-aaba436b993c","added_by":"auto","created_at":"2026-01-20 20:10:10","extension":"docx","order_by":0,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":4123532,"visible":true,"origin":"","legend":"","description":"","filename":"FPmotionManuscript.docx","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/fadb702f2757374b1cf0438f.docx"},{"id":100724761,"identity":"d4221d12-9510-4010-ba1e-fa1cb0a0a14a","added_by":"auto","created_at":"2026-01-20 20:08:30","extension":"json","order_by":1,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":6812,"visible":true,"origin":"","legend":"","description":"","filename":"8a41772da5c946ed8d301544ac6fcc48.json","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/298b295f7c570f9667bee8ea.json"},{"id":100725309,"identity":"c6f50865-451a-4ed2-a3fe-4a66f6e1e068","added_by":"auto","created_at":"2026-01-20 20:11:42","extension":"mp4","order_by":2,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":12820975,"visible":true,"origin":"","legend":"","description":"","filename":"SupplementaryTrackingvideoTurnLafteramphetaminetracked.mp4","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/7ed53924a11a136d69334ba3.mp4"},{"id":100724636,"identity":"10b13f61-7f6d-41e6-a1f0-5d753478aee4","added_by":"auto","created_at":"2026-01-20 20:07:03","extension":"pdf","order_by":3,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":2805130,"visible":true,"origin":"","legend":"","description":"","filename":"Supplementarydatacombined.pdf","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/31b3897b3821eadd9754cea2.pdf"},{"id":100724962,"identity":"1ba9781d-2ed6-4a4d-b730-67c00d73c84f","added_by":"auto","created_at":"2026-01-20 20:09:52","extension":"xml","order_by":4,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":106729,"visible":true,"origin":"","legend":"","description":"","filename":"8a41772da5c946ed8d301544ac6fcc481enriched.xml","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/5e4d63157082d85761faa274.xml"},{"id":100724736,"identity":"08210237-e34e-45ef-b857-3b2c55c7d8ee","added_by":"auto","created_at":"2026-01-20 20:07:51","extension":"emf","order_by":5,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":4557936,"visible":true,"origin":"","legend":"","description":"","filename":"floatimage1.emf","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/6502002fcee54364e21453b9.emf"},{"id":100724748,"identity":"42f15edf-79b1-4d22-83ee-8145e04ae94a","added_by":"auto","created_at":"2026-01-20 20:08:05","extension":"png","order_by":6,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":291772,"visible":true,"origin":"","legend":"","description":"","filename":"floatimage2.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/969a6d480b2834416bf4e605.png"},{"id":100724762,"identity":"8279d824-7ac9-435b-91be-5defc23b679d","added_by":"auto","created_at":"2026-01-20 20:08:31","extension":"png","order_by":7,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":367725,"visible":true,"origin":"","legend":"","description":"","filename":"floatimage3.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/9818795432993947200eab50.png"},{"id":100724551,"identity":"018bab52-898e-4c41-bbfd-d505e8858c12","added_by":"auto","created_at":"2026-01-20 20:06:39","extension":"wmf","order_by":8,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":9327050,"visible":true,"origin":"","legend":"","description":"","filename":"floatimage4.wmf","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/11f1b7f438fb339ebbf1e699.wmf"},{"id":100724790,"identity":"6b3ec0ce-a506-426a-9881-957b682238e3","added_by":"auto","created_at":"2026-01-20 20:08:36","extension":"jpeg","order_by":9,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":1738977,"visible":true,"origin":"","legend":"","description":"","filename":"floatimage5.jpeg","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/8a1ad9d123b63c51e1770a48.jpeg"},{"id":100724793,"identity":"8eb1a4cc-6605-443c-8285-642351b7b580","added_by":"auto","created_at":"2026-01-20 20:08:38","extension":"wmf","order_by":10,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":9327050,"visible":true,"origin":"","legend":"","description":"","filename":"floatimage4.wmf","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/39b729c464c48e1501d3f89f.wmf"},{"id":100724956,"identity":"55bed0c6-b9c2-4cc2-8db3-9b76de8bd8e2","added_by":"auto","created_at":"2026-01-20 20:09:40","extension":"png","order_by":11,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":513889,"visible":true,"origin":"","legend":"","description":"","filename":"Onlinefloatimage1.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/96c82c3c11603ae10d4ba13b.png"},{"id":100723503,"identity":"68dd990a-d163-4d3d-be07-db4d43951f65","added_by":"auto","created_at":"2026-01-20 19:59:42","extension":"png","order_by":12,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":58280,"visible":true,"origin":"","legend":"","description":"","filename":"Onlinefloatimage2.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/9765f6ad6220035d6082c0b4.png"},{"id":100724542,"identity":"5e62855f-118a-46f8-a682-b8736536bc8e","added_by":"auto","created_at":"2026-01-20 20:06:32","extension":"png","order_by":13,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":65518,"visible":true,"origin":"","legend":"","description":"","filename":"Onlinefloatimage3.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/2bfee8cda3d76b194af85568.png"},{"id":100724427,"identity":"275b7cff-861d-489e-93c9-508cba95e5f6","added_by":"auto","created_at":"2026-01-20 20:05:09","extension":"png","order_by":14,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":40416,"visible":true,"origin":"","legend":"","description":"","filename":"Onlinefloatimage4.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/a96271a7919c38920e556bf7.png"},{"id":100725021,"identity":"5dc17d52-3465-4a3e-bfaf-5eed8e9301a8","added_by":"auto","created_at":"2026-01-20 20:10:08","extension":"png","order_by":15,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":365435,"visible":true,"origin":"","legend":"","description":"","filename":"Onlinefloatimage5.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/f6d1a4bc09996c7af72c091a.png"},{"id":100723867,"identity":"1477602b-f67a-4e9a-b4a9-91ae4e9ae908","added_by":"auto","created_at":"2026-01-20 20:02:25","extension":"png","order_by":16,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":40416,"visible":true,"origin":"","legend":"","description":"","filename":"Onlinefloatimage4.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/1f23407b478b9a3014f57b59.png"},{"id":100724239,"identity":"b9db9a13-9ee5-4591-987f-ba4dbd35fe71","added_by":"auto","created_at":"2026-01-20 20:03:27","extension":"xml","order_by":17,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":106591,"visible":true,"origin":"","legend":"","description":"","filename":"8a41772da5c946ed8d301544ac6fcc481structuring.xml","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/fa7ee18a1e06595877f77d40.xml"},{"id":100724246,"identity":"38bdf3d2-ff17-4be8-a550-3bc9d5d97b10","added_by":"auto","created_at":"2026-01-20 20:03:32","extension":"html","order_by":18,"title":"","display":"","copyAsset":false,"role":"acdc-reference","size":116940,"visible":true,"origin":"","legend":"","description":"","filename":"earlyproof.html","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/7d777f203fee83800c8af0fe.html"},{"id":100724247,"identity":"61cb29e2-d592-4e97-af3f-32d519e67d2f","added_by":"auto","created_at":"2026-01-20 20:03:32","extension":"png","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":291875,"visible":true,"origin":"","legend":"\u003cp\u003eWorkflow of the software.\u003cstrong\u003e A.\u003c/strong\u003e FPmotion software takes fiber photometry signal files and optional behavior tracking and tracking video files, and applies signal processing (low pass filtering, fitting to the reference isosbestic signal, normalisation by calculation of % dF/F, detrending (optional moving average or Butterworth), and z-score calculation. \u003cstrong\u003eB, C.\u003c/strong\u003e As an option, video files can be imported and combined with the respective signal file and behaviour time-stamped file to generate an alignment video where the fluorescence reporter signal (green) is synchronized with the animal motility in the tracking video and the behaviour bout tracking (red).\u003cstrong\u003e D.\u003c/strong\u003e Results from all files are then compiled and analysed together with user customized groups and comparisons. The output is organised into a data library (Supplementary data – User Guide Software documentation). Output results include graphical views according to z-score line graphs with and without binning, heat maps, peri-plots and histograms. Statistical test adjusted p-values are illustrated on the graphs as shown, n=7. All data is also output in .csv file with complete statistical breakdown.\u003c/p\u003e","description":"","filename":"1.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/4d622bf1b9bbabdcb5b01731.png"},{"id":100724932,"identity":"5f8f1d15-b960-436a-bca2-62e396712b52","added_by":"auto","created_at":"2026-01-20 20:09:22","extension":"png","order_by":2,"title":"Figure 2","display":"","copyAsset":false,"role":"figure","size":347063,"visible":true,"origin":"","legend":"\u003cp\u003e\u003cstrong\u003eFull file average output before and after amphetamine. A.\u003c/strong\u003e The time course of the mouse experiment is shown. Mice with implanted optic fibres were connected to the fiber photometry console and allowed to move freely in the open field arena for 30 min. Amphetamine or saline was administered I.P. and animals allowed to rest for 15 min after which dLight1.1 signal and behavior were again monitored. \u003cstrong\u003eB.\u003c/strong\u003e Example output from FPmotion for “peak prominence” based on the total file output for mice before and after amphetamine. \u003cstrong\u003eC.\u003c/strong\u003e An example of peak prominence output from within a behavioral bout, here shown for “run straight” bouts, before and after amphetamine. Significance for these outputs is determined with Student’s t-test as indicated on the graphic output shown. \u003cstrong\u003eD.\u003c/strong\u003e Frequency, amplitude and prominence measured from 1min time blocks provide a temporal overview of these parameters before and after amphetamine. Frequency is significantly increased. Significance values for time block data is from two-way ANOVA. All graphical outputs are also generated in csv format. Statistics are shown above the panels. Linear graph p-values are from two-way mixed ANOVA, n=7.\u003c/p\u003e","description":"","filename":"2.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/e856c1bcd5c9169662012fe0.png"},{"id":100724544,"identity":"303e9b75-cb46-4785-bcb9-bcf6e4dfbd8a","added_by":"auto","created_at":"2026-01-20 20:06:34","extension":"png","order_by":3,"title":"Figure 3","display":"","copyAsset":false,"role":"figure","size":489272,"visible":true,"origin":"","legend":"\u003cp\u003e\u003cstrong\u003eA.\u003c/strong\u003e \u003cstrong\u003eSingle peak output before and after amphetamine. A. \u003c/strong\u003eSingle peak data for peak prominence before and after amphetamine is shown in a bar plot and \u003cstrong\u003eB,\u003c/strong\u003e as a scatter plot (z-score). Data is calculated from single peaks before and after amphetamine administration. Statistics are from LMEM. \u003cstrong\u003eC, D.\u003c/strong\u003e Single peak data for prominence during “run straight” in behaving window is shown as bar plot and scatterplot, before and after amphetamine. \u003cstrong\u003eE. \u003c/strong\u003eA.U.C of peaks during “run straight” is shown. \u003cstrong\u003eF.\u003c/strong\u003e Single peak amplitude before and after amphetamine during “turn right” behavior bouts. \u003cstrong\u003eG.\u003c/strong\u003e A scheme illustrating peak width-height. \u003cstrong\u003eH, I.\u003c/strong\u003e Peak width-height results during “turn right” bouts is shown before and after amphetamine in non-behaving and behaving windows respectively. \u003cstrong\u003eJ.\u003c/strong\u003e A scatter plot of amplitude before and after amphetamine in “turn right” bouts. Statistics are from LMEM, (n= 7), Area under the curve (AUC) within “run straight” bouts is significantly changed with respect to time (Time:comparison p-value = 0.01) (Fig. 3E). Although there is no significant difference between the groups for the average overall AUC values, there is a significant change in AUC between the groups with respect to time (p=0.01) (Fig. 3E). We next show an example of amplitude data. Within “Turn right” bouts, peak amplitude increases by 14% (p-value=0.00461) following amphetamine. Amplitude also changes significantly with respect to time (time: Comparison p-value = 0.00019; Fig. 3F).\u003c/p\u003e","description":"","filename":"3.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/7f20d46e240e06befa57e49f.png"},{"id":100724849,"identity":"77ef44d1-f0dd-4c19-b859-ca9af7c343d5","added_by":"auto","created_at":"2026-01-20 20:08:56","extension":"png","order_by":4,"title":"Figure 4","display":"","copyAsset":false,"role":"figure","size":171760,"visible":true,"origin":"","legend":"\u003cp\u003e\u003cstrong\u003eBehavioral output before and after amphetamine. A, B. “\u003c/strong\u003eRun straight” bout length and count are shown before and after amphetamine administration. \u003cstrong\u003eC, D.\u003c/strong\u003e “Turn left” bout length and count are shown before and after amphetamine. \u003cstrong\u003eE, F.\u003c/strong\u003e “Turn right” bout length and count are shown before and after amphetamine. Statistical analysis is with ANOVA, n=7.\u003c/p\u003e","description":"","filename":"4.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/2751b213988b4fe24a5fa8bd.png"},{"id":100725092,"identity":"651c6168-eda6-42d2-94d8-126752782cc5","added_by":"auto","created_at":"2026-01-20 20:10:48","extension":"png","order_by":5,"title":"Figure 5","display":"","copyAsset":false,"role":"figure","size":910606,"visible":true,"origin":"","legend":"\u003cp\u003e\u003cstrong\u003eA, B. \u003c/strong\u003eIndividual and meaned dLight1.1 signal before and after DTW alignment is shown. \u003cstrong\u003eC.\u003c/strong\u003e An example of a removed outlier (red) based on amplitude measurements. The mean trace is shown in black. \u003cstrong\u003eD.\u003c/strong\u003e Before alignment peri-event-plot of mice without amphetamine shows 5s before and after time anchored “run straight” bouts. The lack of alignment is visible from the heat map which shows all events. The dopamine signal is dark green and standard errors are pale green. \u003cstrong\u003eE\u003c/strong\u003e. Peri-plot of “run straight” events after alignment is shown for mice without amphetamine plotted. \u003cstrong\u003eF, G.\u003c/strong\u003e Alternative (cluster 0, cluster 1) peri-plots for “run straight” events after amphetamine. The user must use discretion in selecting clusters. In this case, cluster 0 may be an outlier, as there are few occurrences compared to “F”. \u003cstrong\u003eH-K.\u003c/strong\u003e Peri-plots during “turn left” syllables before and after amphetamine are shown. In each case two alternative clusters are shown. \u003cstrong\u003eL.\u003c/strong\u003e Peri-plots before, and (\u003cstrong\u003eM-O\u003c/strong\u003e) after amphetamine during “turn right” syllables, are shown. Three alternative clusters are shown after amphetamine. The similarity in dopamine peaks and troughs suggest that all clusters may represent real bout-associated signals.\u003c/p\u003e","description":"","filename":"5.png","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/fd82855c6df9c19c5b1e3d4d.png"},{"id":103504540,"identity":"50ef8aa4-4ad3-4c92-8ee1-ee139ce4fbc5","added_by":"auto","created_at":"2026-02-26 13:20:28","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":2639880,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/1f722fb7-f40b-461f-bf02-d97bc9c0ff81.pdf"},{"id":100724744,"identity":"2ed02f39-41c7-412f-a1e5-d97b976bb9f7","added_by":"auto","created_at":"2026-01-20 20:08:02","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"supplement","size":2805130,"visible":true,"origin":"","legend":"","description":"","filename":"Supplementarydatacombined.pdf","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/57163d89d3f8557733b430c6.pdf"},{"id":100724345,"identity":"3e98a2a4-2d4f-4366-8139-1ef0e5d87941","added_by":"auto","created_at":"2026-01-20 20:04:24","extension":"mp4","order_by":1,"title":"","display":"","copyAsset":false,"role":"supplement","size":12820975,"visible":true,"origin":"","legend":"","description":"","filename":"SupplementaryTrackingvideoTurnLafteramphetaminetracked.mp4","url":"https://assets-eu.researchsquare.com/files/rs-8506067/v1/68f955d9f366859c36277d1f.mp4"}],"financialInterests":"No competing interests reported.","formattedTitle":"FPmotion an Automated Signal Processing and Statistical Analysis Tool for Fiber Photometry Data","fulltext":[{"header":"1. Introduction","content":"\u003cp\u003eFiber photometry (FP) enables real-time measurement of fluorescence reporter activity in specific brain regions of awake behaving mice (\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e). Initially used to monitor calcium transients from genetically encoded GCaMP reporters, FP facilitates investigation of neuronal circuit dynamics (\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e, \u003cspan citationid=\"CR2\" class=\"CitationRef\"\u003e2\u003c/span\u003e). Chronically implanted optical fibers (200\u0026ndash;400 \u0026micro;m in diameter) deliver excitation light to defined brain coordinates, enabling 1000 Hz acquisition with around 200 \u0026micro;m axial sensitivity, dependent on reporter expression and brightness (\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e, \u003cspan citationid=\"CR3\" class=\"CitationRef\"\u003e3\u003c/span\u003e). A variety of fluorescent reporters are now used including dLight for dopamine, GRABNA for norepinephrine, iGluSnFR for glutamate, GABASnFR for GABA, in addition to serotonin, endocannabinoid and voltage sensors (\u003cspan additionalcitationids=\"CR5 CR6\" citationid=\"CR4\" class=\"CitationRef\"\u003e4\u003c/span\u003e\u0026ndash;\u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e). The method is increasingly used to understand how neurotransmission and signalling in the nervous system control behavioural responses. Existing tools for FP analysis GuPPy (\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e), pMAT (\u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e9\u003c/span\u003e), pyPhotometry (\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e), FiPhA (\u003cspan citationid=\"CR11\" class=\"CitationRef\"\u003e11\u003c/span\u003e), Pyfiber (\u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e12\u003c/span\u003e), and PhAT (\u003cspan citationid=\"CR13\" class=\"CitationRef\"\u003e13\u003c/span\u003e), can be used to process the data and decode the underlying signals. However, these software packages do not provide built-in, robust statistical analysis combined with batch processing. Moreover, coding knowledge is required to run these pipelines. For this reason, FP has remained somewhat a niche method and the data analysis remains time consuming.\u003c/p\u003e \u003cp\u003eFPmotion is an FP analysis software package with G.U.I. that offers flexibility to the user. It is packaged entirely within an .exe file that can be downloaded and executed directly in a Windows environment. The user can choose to compare groups of differently treated mice during the analysis setup, so that in the output, the statistically significant changes are already annotated and indicated, both in csv and graphical formats, across a range of measurements and output files. Options for signal normalisation setup, applied either across animals or individually are available. This supports identification of patterns that are consistent across subjects, or accurate detection of stimulus responses within an individual. In addition to these features, FPmotion introduces a dedicated alignment module for peri-event signal analysis. This method uses dynamic time warping (DTW) combined with barycenter averaging to correct latency jitter across trials while preserving the behavioral time anchor, enabling cleaner visualization and quantification of peri-event motifs. To our knowledge, barycentering-based alignment is not included in existing FP workflows. Together with these analytical capabilities, FPmotion also emphasizes accessibility. The user-friendly GUI built with ttkbootstrap simplifies the analysis process, eliminating the need for coding and making sophisticated data analysis accessible to a broader range of researchers.\u003c/p\u003e"},{"header":"2. Materials and Methods","content":"\u003cdiv id=\"Sec3\" class=\"Section2\"\u003e \u003ch2\u003e2.1 Introduction to the Software\u003c/h2\u003e \u003cp\u003eFPmotion is distributed as a standalone Windows executable that can be downloaded directly from GitHub (\u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://github.com/TCB-yehong/FPmotion\u003c/span\u003e\u003cspan address=\"https://github.com/TCB-yehong/FPmotion\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e) and run without additional installations or programming expertise. The software provides an accessible, clearly structured graphical interface that guides users through the analysis in an intuitive step-by-step format, enabling users to begin analysis immediately after download. The software interface comprises four sequential sections that unlock progressively as each previous section is set up. The input interface accepts signal files and optional behavior and video files in bulk. The parameter interface provides customization settings for the analysis and output. The information input interface collects file information necessary for statistical methods and settings not covered in the parameter interface. The group comparison interface allows users to set up multiple groups and comparisons from the input files. Detailed descriptions and demonstrations are available in the accompanying vignette.\u003c/p\u003e \u003cp\u003e \u003cem\u003eFile naming\u003c/em\u003e - To match signal files with their respective behavior files and extract information directly from file names, we implemented specific naming conventions. The signal file name consists of six information fragments connected by underscores or spaces: \u0026ldquo;Trial_X\u0026rdquo; (trial number), mouse ID, genotype, behavior test name, and two experiment conditions. For example, \"Trial_1_1827_control_OF_before_MK801\" indicates treatment (\"MK801\") and time segment condition (\"before\"). Behavior and video files only need to match the trial number with the signal files. Manual adjustments are possible if naming conventions are not followed.\u003c/p\u003e \u003cp\u003e \u003cem\u003eOptional video file -\u003c/em\u003e Users can include mouse behavior videos in the analysis with any of the following format: mp4, .mov, .avi, .webm, .ogv, .mkv, or .gif,. If selected, additional video outputs align mouse movement, fiber photometry signals, and behavior bouts in the video. This option is time-consuming and is opted out by default but can be enabled in the parameter interface.\u003c/p\u003e \u003cp\u003e \u003cem\u003eFiber photometry signal processing -\u003c/em\u003e The default source for signal input files is Doric Lenses (Qu\u0026eacute;bec, Canada), although output from Tucker-Davis Technologies (TDT) and RWD Life Science (RWD) devices can also be directly imported into FPmotion. For signals from other sources, the required format includes three columns: the first for time points, the second for the isosbestic channel, and the third for the dopamine/calcium channel, saved in a .csv file. Raw fiber photometry signals undergo initial filtering. If the \"dopamine\" signal is selected, a Butterworth lowpass filter is applied, with customizable cutoff frequency and filter order. For \"calcium\" signals, a zero-phase moving average filter is applied in both forward and backward directions, with a customizable filter window. These filters are independently applied to the isosbestic and dopamine/calcium channels.\u003c/p\u003e \u003cp\u003eThe isosbestic channel is then fitted to the dopamine/calcium channel using least squares linear regression. The percent dF/F is calculated by subtracting the fitted isosbestic channel from the dopamine/calcium channel, dividing by the fitted isosbestic channel, and multiplying by 100%. This % dF/F signal is detrended by subtracting a linear least-squares fit. Users can choose to calculate either a standard Z-score or an \"external\" Z-score. The standard Z-score is computed by subtracting the signal mean and dividing by the standard deviation. For the external Z-score, users can specify a set of baseline files and/or time periods; the mean and standard deviation of the % dF/F from these baseline signals are used in the calculation. All these calculations are performed using Python packages such as SciPy, sklearn, and NumPy. In addition, the following Python modules are used: OS, pickle, traceback, datetime, types, tkinter, ttkbootstrap, pandas, re, math, colorsys, webcolors, threading, peakutils, moviepy, matplotlib, seaborn, pingouin, statistics, statannot, csv, textwrap, scipy, sklearn, itertools, statsmodels, functools, pygam, tslearn, fastdtw, joblib and multiprocessing.\u003c/p\u003e \u003cp\u003e \u003cem\u003eBehavior information processing\u003c/em\u003e - The default source for behavior information is output from EthoVision XT tracking software. For other sources, the input file should be in .xlsx format and have a column named \"Recording time\" for the behavior test time points, and subsequent columns for each behavior, with values of 0 (behavior not present) or 1 (behavior present). In the parameter interface, the behavior starting row should be set to 1. Each behavior is processed into behavior bouts, defined as continuous periods of 1s. The start time, end time, and duration of each bout are recorded. Bouts are adjusted to remove artifacts from signal processing, and those closer than a user-defined merging distance are combined. Bouts shorter than a user-defined minimum duration are excluded. The behavior syllable labels are automatically detected by Fpmotion from within the uploaded .csv file during the initial processing (see Supplementary User Guide, page 6, information interface I, point 2). The user can select one or multiple behaviors to analyse.\u003c/p\u003e \u003cp\u003e \u003cem\u003eCombining Signal and Behavior - Combining signal and behavior\u003c/em\u003e - For each processed behavior bout, the lengths and counts per recording session are calculated and visualized with histogram overlaying kernel density estimates. Signal z-scores before and after each bout's start are extracted, with each time segment defaulting to 5 seconds (customizable by the user). Peak thresholds define signal peaks, with customizable relative and absolute thresholds. The relative threshold uses the median absolute deviation of the signal z-scores multiplied by 2.91, while the absolute threshold is user-defined. A default peak distance threshold, defined as 100 data points, can also be customized. Once peaks are identified, their amplitude and frequency are calculated. Bar plots compare AUC, amplitude, and frequency before and after behavior bouts for each input file.\u003c/p\u003e \u003cp\u003eSingle peak properties, such as time point, amplitude, width, prominence, and AUC, are categorized as within behavior bouts, outside of behavior bouts, and all passing signal peaks. This data is accumulated for statistical analysis on bulk data. Signals are also divided into shorter blocks to capture momentary variations, with a default block length of one minute. Each block inherits behavior bout and peak property information within its timeframe. Block-level data, along with behavior bout and peak property information, are output in CSV format for each input file. Signal peaks are extracted using Python's SciPy package.\u003c/p\u003e \u003cp\u003e \u003cem\u003eGroup comparison utilizing bulk data\u003c/em\u003e - After individual file processing, data from all files are combined and saved in CSV files. Users can customize groups and comparisons in the group comparison interface, specifying which files belong to each group and which groups to compare. For behavior bout length and count values, statistical comparisons across groups utilize ANOVA with False Discovery Rate (FDR) corrections are performed. The results are visualized with detailed boxplots. For before/after behavior bouts data, grouped bar plots are created for amplitude, frequency, and AUC, showing pre- and post-bout measurements by comparison groups. A 2-way ANOVA with post hoc Tukey test is conducted to assess the significance of comparison groups and behavior effects. Pooled behavior bout data are visualized in heatmaps. For each pre- and post- bout signal combination with user chosen lengths, an optional outlier removal step can be performed by detecting and removing signals that are statistical outliers using robust covariance methods. Subsequently, signals are grouped into clusters based on their shape and temporal pattern similarity using Dynamic Time Warping (DTW) (\u003cspan citationid=\"CR14\" class=\"CitationRef\"\u003e14\u003c/span\u003e, \u003cspan citationid=\"CR15\" class=\"CitationRef\"\u003e15\u003c/span\u003e). Once clustered, signals within each group are precisely aligned around the behavior events using DTW-based averaging (barycenter alignment). Alignment is performed separately for periods before and after behavioral events if chosen. The aligned signals are then analyzed for their peak properties, such as amplitude and prominence, and visualized in bar plots and violin plots. Signal peak data are analyzed on three levels: whole file average, block average, and individual peak level. For whole file averages, each peak property's average value per file is used in statistical tests and visualized in bar plots with T-test significance. For block averages, average values are calculated per block, and line plots display these averages by group. For individual peaks, signal peak data are analyzed using linear mixed-effects models (LMEM) to account for within-subject variability and repeated measures. The resulting fixed-effects summaries, predictions, and statistical output are recorded, and visualized in scatterplots.\u003c/p\u003e \u003cp\u003e \u003cem\u003eTwo conditions comparison\u003c/em\u003e - A comparison setup allows optional comparison of two conditions from the file information: genotype and one other condition (e.g., drug treatment). This feature can be activated through the GUI's parameter interface under 'General' settings when relevant. Users can switch the genotype information if needed. Segment line plots and scatter plots are generated for time block and single peak data of peak properties, segmented by the first condition and grouped by genotype. ANOVA tests, including 3-way ANOVA and 2-way ANOVA with post hoc Tukey tests, assess the significance of genotype, behavior bout presence, and the first condition, along with their interactions. Figures and statistical tests are created using Python packages seaborn, statannot, analys, and pingouin.\u003c/p\u003e \u003cp\u003e \u003cem\u003eAnalysis without behavioral input\u003c/em\u003e - Although FPmotion is designed to integrate behavioral tracking with fiber photometry data, users may also perform the full signal-based analysis without supplying behavior files. In this mode, all behavior-dependent steps\u0026mdash;including bout detection, bout length and count summaries, peri-event signal extraction, and behavior-segmented analyses at file, block, and single-peak levels\u0026mdash;are omitted. All signal-centric analyses remain available. This includes peak preprocessing, peak detection and characterization, and all statistical comparisons involving peak amplitude, frequency, width, prominence, and AUC at whole-file level, block-partition level, and single-peak level. This option enables users working with simple photometry recordings, pilot datasets, or experiments without behavioral annotation to obtain comprehensive signal-based results.\u003c/p\u003e \u003cp\u003e \u003cem\u003ePeak alignment and outlier removal\u0026ndash;\u003c/em\u003e FPmotion includes a dedicated module to enhance peri-event fiber photometry signal interpretation, before and after a behavior. Although all events in our datasets are time-locked to the annotated behavioral timestamps, peaks and troughs that are typically temporally misaligned across trials, lead to flattening and masking of physiologically relevant transients. To this overcome limitation, we implemented a multi-step workflow consisting of robust outlier removal, time-series clustering, and dynamic time-warping (DTW)-based alignment to a consensus template (\u003cspan citationid=\"CR16\" class=\"CitationRef\"\u003e16\u003c/span\u003e). Outlier detection was performed using the Mahalanobis distance, which is well-suited for high-dimensional time-series data. However, directly applying Mahalanobis distance to raw signals proved unstable due to singular covariance matrices, as signals often contain thousands of timepoints but far fewer trials. To address this, each signal was projected onto a reduced principal component (PCA) space, retaining \u003cem\u003eN\u0026ndash;1\u003c/em\u003e principal components for \u003cem\u003eN\u003c/em\u003e trials (\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e). This ensured that the dimensionality never exceeded the number of observations. To prevent minor principal components, which primarily capture noise, from disproportionately influencing the distance metric, each component is normalized by its explained variance, effectively weighting the features in proportion to their contribution to overall signal structure. A robust covariance estimate is then obtained using the Minimum Covariance Determinant (MCD) method, which is less sensitive to extreme signals (\u003cspan citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e, \u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e). Outliers were identified by comparing principal component-space distances to a chi-squared threshold determined by the number of retained components. This approach consistently removes anomalous signals that deviate strongly from the dominant temporal structure, enabling cleaner downstream modelling.\u003c/p\u003e \u003cp\u003eEven after outlier removal, the signal ensemble can contain multiple distinct temporal motifs depending on behavioral context or neural heterogeneity. To assess whether the dataset naturally partitions into discreet patterns, we incorporated an unsurpervised clustering step. Because clustering raw signals is confounded by onset jitter and latency differences, we first computed dynamic time warping (DTW) distances between all second-half segments (the behavior-evoked portion of the signal). DTW was chosen because Euclidean distance cannot account for temporal misalignment of peaks or valleys, which is especially relevant when physiological latencies differ across trials despite shared behavioral timing.\u003c/p\u003e \u003cp\u003eClassical DTW is computationally prohibitive for datasets of this size (\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e), so we used fast DTW, an approximate implementation that provides strong performance with substantially reduced runtime. Parallel processing further accelerates distance computations, with our software automatically detecting available CPU cores and allocating two-thirds of them to the DTW process. We also apply time-series k-means clustering using the precomputed DTW distance matrix and evaluate clustering performance using silhouette scores. Other indices, such as Davies\u0026ndash;Bouldin and Calinski\u0026ndash;Harabasz were tested but removed due to excessive computational cost under DTW metrics. To guard against spurious structure, we generate random cluster assignments and recompute silhouette scores as a null baseline. A cluster solution is accepted only if its silhouette score exceeds the random baseline by more than two standard deviations; otherwise, all trials are treated as a single group. In practice, clusters containing only a few signals typically represent residual noise and are considered outlier-dominated. This step ensures that alignment is not forced into artificial partitions and preserves the integrity of behavior-linked signal motifs.\u003c/p\u003e \u003cp\u003e \u003cem\u003eFPviewer: a results browser for FPmotion output)\u003c/em\u003e - To facilitate navigation of the large number of output files generated during bulk processing, we developed a standalone results viewer for FPmotion. This .exe file can be downloaded from here: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://github.com/TCB-yehong/FPmotion\u003c/span\u003e\u003cspan address=\"https://github.com/TCB-yehong/FPmotion\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e. The FPviewer organizes outputs into structured tabs corresponding to major result types: file overview, results from group comparisons for behavior bouts, file-level signal summaries, block-level signal properties, peak-level statistics, and before/after behavior segment analyses. For proper visualization of this structure, users should select the main results directory rather than an individual subfolder. FPviewer will automatically map the folder hierarchy into its tab-based layout. Both image and text-based results can be previewed directly within the viewer, allowing users to browse heatmaps, bar plots, violin plots, and CSV-based statistical tables without opening files individually. Selecting a file from the tab displays its content in the central viewing panel, and a dedicated button allows users to open the displayed file externally when preparing figures or extracting values for manuscripts and presentations.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec4\" class=\"Section2\"\u003e \u003ch2\u003e2.2 Mouse surgeries and fiberphotometry\u003c/h2\u003e \u003cp\u003e \u003cem\u003eMice -\u003c/em\u003e Adult (8\u0026ndash;12-week-old male) C57BL/6NCrl wild-type mice were maintained on a 12 h light/dark cycle and supplied with food and water ad libitum. Behavioural tests were performed between 08:00 and 15:00 h. The number of animals used in each experiment is indicated in the legends. Ethical permission: The animal work was done according to the project permit (ESAVI/30686/2022 and ESAVI/26777/2023) granted by the Regional administrative Agency of Finland.\u003c/p\u003e \u003cp\u003e \u003cem\u003eStereotaxic surgery -\u003c/em\u003e Individually housed mice were weighed and anesthetized with isofluorane (Isoflurane concentration in breathing zone of 2.5% for induction and 2\u0026thinsp;\u0026minus;\u0026thinsp;1% maintenance) and placed on a stereotaxic frame (KOPF, US) for the surgery. The depth of anaesthesia was estimated using the paw or tail response. A heating pad (Physitemp MTC-1, temperature controller at 37\u0026deg;C) was used during the surgery to keep mice warm. Local anaesthesia 1mg/kg Lidocaine (Orion Pharma) in 125\u0026micro;l was administered subcutaneously at the incision point 2 minutes prior to making the incision. Temgesic (Indivior) 0.1mg/kg (170\u0026micro;l for a 25 g mouse) was given intra-peritoneally just before the surgery. The head was straightened and fixed on the frame. Viscotears were applied to prevent eyes from drying. An incision was made along the midline, the scalp retracted, and the area surrounding bregma was cleaned and dried. Coordinates (+\u0026thinsp;1.54 mm AP, +/-0.6 mm ML, \u0026minus;\u0026thinsp;4.5 mm DV) were marked carefully on the head and holes are drilled using the dentist\u0026rsquo;s drill (FOREDOM, K.1070). Infusion with pAAV-CAG-dLight1.1 viruses (0.2\u0026micro;l, Plasmid #111067 from Addgene) was performed using an automated sterotaxic injector (#53311, Stoelting, IL, US) at a rate of 0.10 \u0026micro;l/min and the needle was left in place for 10 minutes to prevent back flow.\u003c/p\u003e \u003cp\u003eFiber optic cannulas (Doric lenses, core diameter 200 \u0026micro;m, code- 200/230\u0026thinsp;\u0026minus;\u0026thinsp;0.48, MF1.25-X mono fiber optic cannulas) are then placed in the exact coordinates using the cannula holder (Thorlabs, SE) and fixed using dental cement (Super-bond C\u0026amp;B, Sun medicals, Japan). The wounds are stitched and saline 10 ml/kg is injected intra-peritoneally. After surgery, the animals are transferred to their \u0026ldquo;heat-pad warmed\u0026rdquo; home-cage to recover. Mice are monitored twice daily during the recovery period. Following surgeries, mice are housed alone for at least 2 weeks before behavioural tests are conducted. This period allows ample expression of virus.\u003c/p\u003e \u003cp\u003e \u003cem\u003eFiber photometry\u003c/em\u003e - Fiber photometry data was collected using a Doric fiber photometry customised system with optical components from Doric Lenses (Quebec, CA). For recording from ventral striatum using dLight1.1. FP measurements were acquired with an analog/digital acquisition console using LED excitation for dLight1.1 through an LED driver with 488 nm and background 530 nm. Excitation power was set between 40\u0026ndash;60 \u0026micro;W and measured from the flat-end optic fiber. Emission was recorded at 1000 Hz sampling rate using Newport 2151 Femtowatt photoreceivers (Irvine, CA, US) in \u0026lsquo;DC-LO\u0026rsquo; mode. Before connecting the fibers to the mice, fibers were photo-bleached for 10 to 15 minutes using 500 mA current in both the LED channels. After head mounting the fiber, \u003cem\u003ein vivo\u003c/em\u003e autofluorescence from tissue was bleached for 5 minutes with 60\u0026micro;W before the experiments commenced. Behaviour tracking and FP acquisition were synchronised using a TTL trigger from Noldus I/O box (The Netherlands) connected to the FP console. Raw signals were recorded with Doric Neuroscience studio software and thereafter analysis was done using FPmotion software. The following settings were used for the FPmotion analysis; signal type: Dopamine, second order Butterworth low pass filter:10, order 2, peak distance: 100, peak absolute threshold: 2, Time block: 60 seconds.\u003c/p\u003e \u003cp\u003e \u003cem\u003eBehavioural test\u003c/em\u003e - Open Field test - Distance travelled in the open field (45 x 45 cm arena) was recorded using an acA1300-60gc GigE video camera (Basler). To start the test, mice were released in the corner of the arena facing the wall. Horizontal and vertical activities wwereere recorded for 30 min. For analysis, Ethovision-13 software (Noldus, The Netherlands) was used. Various behavioural parameters such as run straight and turning were scored manually using Ethovision software. All experiments are calculated from 7 mice before and after amphetamine treatment. No mice were removed from the experiment.\u003c/p\u003e \u003cp\u003e \u003cem\u003eAmphetamine treatment\u003c/em\u003e - Following 30 min open field behavior tests, mice were injected with Amphetamine (5 mg/kg) intraperitoneally and allowed to rest in their home cage for 10 min. Then mice next underwent 30 min open field.\u003c/p\u003e \u003c/div\u003e"},{"header":"3. Results","content":"\u003cdiv id=\"Sec6\" class=\"Section2\"\u003e \u003ch2\u003e3.1 \u003cem\u003eTesting FPmotion with experimental data\u003c/em\u003e\u003c/h2\u003e \u003cp\u003eTo demonstrate the functionality of the FPmotion software (overviewed in Fig.\u0026nbsp;\u003cspan refid=\"Fig1\" class=\"InternalRef\"\u003e1\u003c/span\u003e), we used the dLight1.1 reporter to measure extracellular dopamine in the ventral striatum of behaving mice in an aversive space, before and after amphetamine administration. Dopamine release in this brain region is important for initiation of movement in response to a motivational signal (\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e). We measured peak parameters and dopamine patterns that accompanied behavioral syllables associated with the amphetamine hyperactivity response i.e. turning and running behaviors (Fig.\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003eA). Spontaneous behaviors were captured using Ethovision XT setup and the photometry signal and behavior tracking were saved as .csv files for automated analysis using FPmotion software. The use of FPmotion software to analyse the fiberphotometry and behavior data is described first (2.2), followed by a description of the results obtained in these experiments using FPmotion (2.3).\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec7\" class=\"Section2\"\u003e \u003ch2\u003e3.2 Software setup\u003c/h2\u003e \u003cp\u003eHere we walk the user through the software setup and parameter selection. Data analysis was performed through the FPmotion graphical user interface (GUI). In the Input interface, we loaded the photometry signal files acquired with Doric Lenses FP console and the corresponding behavioral tracking files exported from EthoVision XT. Behavior videos can be uploaded at this stage. Parameter selection was done through the Settings interface. Under \u0026ldquo;General\u0026rdquo;, we kept the default settings which skip genotype-treatment combined analyses (as this is used when treatments are done in more than one type of mouse, e.g. in different genotypes). We left the \u0026ldquo;skip video creation\u0026rdquo; option at its default disabled state. For \u0026ldquo;Ethovision\u0026rdquo; settings, we used FPmotion\u0026rsquo;s default starting row of 36, the default 7s maximum behavior-bout merging threshold, and the default 1s minimum bout-length threshold. Under \u0026ldquo;Doric\u0026rdquo;, we retained the default fluorescence and isosbestic channel labels (\u0026ldquo;Aln-1\u0026rdquo; and \u0026ldquo;Aln-2\u0026rdquo;). Under \u0026ldquo;Video\u0026rdquo;, the frame rate down sampling remained at the default value of 10 fps, although this parameter had no effect because no videos were loaded.\u003c/p\u003e \u003cp\u003eFor \u0026ldquo;Peak extraction\u0026rdquo;, we kept the default setting for minimum inter-peak distance of 100 ms in this instance where acquisition is 1000 Hz) and the default 60s time-block duration for time-resolved analyses. Under \u0026ldquo;Plot parameters\u0026rdquo;, all figure types used the default y-axis limits. For \u0026ldquo;Segment modelling\u0026rdquo;, we retained the default setting to enable automatic detection and removal of outliers, and we kept the default option that aligns before/after behavior-triggered signal segments as a single continuous trace rather than splitting them into pre- and post-components. We also kept the default option to perform follow-up analyses on barycenter-aligned segments, using the default maximum of 10 clusters, and retained the default minimum peak-distance threshold of 5.\u003c/p\u003e \u003cp\u003eThe only modifications we made were in the \u0026ldquo;Signal preprocessing\u0026rdquo; and \u0026ldquo;Peak extraction\u0026rdquo; settings. In \u0026ldquo;Signal preprocessing\u0026rdquo;, we changed the signal type from the calcium preset to dopamine, as dLight 1.1 (and not GCaMP) was the sensor used in these experiments. Accordingly, we increased the frequency threshold to 25 Hz and applied a second-order Butterworth low-pass filter to remove high frequence noise. In \u0026ldquo;Peak extraction\u0026rdquo;, we adjusted the amplitude-based peak-detection threshold to an absolute value of 2. Next, we proceeded to the Information Input interface. File metadata were automatically populated from filenames following FPmotion\u0026rsquo;s naming conventions. After confirming file information, we opened the Group Comparison interface and created a single comparison contrasting the pre-amphetamine (group 1) and post-amphetamine (group 2) recordings. After saving this comparison, we returned to the Information Input interface to complete the remaining configuration, including behavioral selections and z-score normalization.\u003c/p\u003e \u003cp\u003eFrom the auto-detected EthoVision behavior labels, we selected \u0026ldquo;Run straight,\u0026rdquo; \u0026ldquo;Turn L,\u0026rdquo; and \u0026ldquo;Turn R\u0026rdquo; for inclusion in the analysis. For z-score normalization of the Doric signals, we selected \u0026ldquo;External\u0026rdquo; baseline mode and used all pre-injection recordings across mice as the baseline distribution. Because the entire pre-amphetamine window was used, no specific baseline time interval was entered. The user can alternatively select another baseline mode if desired. Genotype color settings were left at their default values. After confirming all parameters across the four interfaces, we initiated the analysis. FPmotion then executed all processing steps autonomously taking 2 hours to complete the analysis from 14 trials (30 min trial duration, 1000 Hz) on a Windows laptop with 32GB RAM. If generation of alignment videos is selected, it takes 4 hours. Upon completion, all graphical outputs, spreadsheets, statistical summaries, and processed signal files were available in the designated output directory.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec8\" class=\"Section2\"\u003e \u003ch2\u003e3.3 \u003cem\u003eSample workflow measuring amphetamine responses with dLight1.1\u003c/em\u003e\u003c/h2\u003e \u003cp\u003eWe measured dopamine signals and behavior from mice freely behaving in an open field arena before and after amphetamine administration. Extracellular dopamine was measured using the dLight1.1 sensor made from a fusion of a D1 receptor fragment with circularly permutated GFP. dLight1.1 is excited by blue light and emits with a peak at around 515 nm. The resulting signal provides sub second time resolution and sub-micromolar sensitivity for dopamine detection, suitable for measuring tonic and phasic dopamine release (\u003cspan citationid=\"CR4\" class=\"CitationRef\"\u003e4\u003c/span\u003e, \u003cspan citationid=\"CR22\" class=\"CitationRef\"\u003e22\u003c/span\u003e).\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003eFigures \u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003e to \u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003e present some of the results from the automatically generated output. Two weeks following viral injection and cannula implantation to the nucleus accumbens (NAc), mice underwent fiber photometry and behavior tracking. Freely behaving mice were monitored during 30 min in the open field after which amphetamine (5mg/kg) was injected intraperitoneally. After 15 min rest, mice were returned to the arena and behavior monitored for a further 30 min (Fig.\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003eA). Full file averaged data before and after amphetamine shows that peak prominence was significantly reduced after amphetamine whether measured across the entire 30 min monitoring (p\u0026thinsp;=\u0026thinsp;7E-03) (Fig.\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003eB), or within \u0026ldquo;run straight\u0026rdquo; behaving bouts (p\u0026thinsp;=\u0026thinsp;4E-03) (Fig.\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003eC). Peak prominence is the vertical distance between the peak and the lowest contour line that connects it to higher peaks or the signal baseline. The decrease in peak prominence during this period is likely because the extracellular dopamine is high due to amphetamine inhibition of the dopamine transporter (DAT), preventing a return to baseline dopamine between the peaks. The linear graphs (Fig.\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003eD), show 1-min time binned output for frequency, amplitude and prominence. Frequency increased sharply 20 min following amphetamine injection and remained elevated for 15 min after which the plateau diminished. The high frequency period showed good overlap with reduced peak prominence period (Fig.\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003eD), consistent with dopamine being highly elevated. Amplitude was not significantly altered by amphetamine when looking at the full file output, although it visibly decreased at the point when frequency returned to baseline. These data closely match the timeline of dopamine release measured by microdialysis following intraperitoneal injection of amphetamine (\u003cspan citationid=\"CR23\" class=\"CitationRef\"\u003e23\u003c/span\u003e).\u003c/p\u003e \u003cp\u003eFPmotion also analyses single peaks. Figure\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003e shows a selection of outputs from the \u0026ldquo;single peak\u0026rdquo; analysis. Amphetamine decreases prominence once more as shown by plot and scatterplot (Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003eA, B). The statistical significance for single peak output is based on LMEM, accounting for within subject variability and repeated measures. Within and outside of behaving windows calculations are automatically generated for all \u0026ldquo;selected\u0026rdquo; behaviors within the software. Here we show peak prominence during \u0026ldquo;run straight\u0026rdquo; bouts also decreases after amphetamine treatment, visualised by barplot and z-score scatter plot (Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003eC, D).\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003eFPmotion also calculates \u0026ldquo;peak-width-height\u0026rdquo;, which is the height of the contours at the point where widths were calculated (Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003eG). Peak-width-height increases two-fold following amphetamine. The \u0026ldquo;turn right\u0026rdquo; width-height results from non-behaving (p\u0026thinsp;=\u0026thinsp;0.0372) and behaving (p\u0026thinsp;=\u0026thinsp;0.00491) bouts is shown (Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003eH, I). A temporal view of amplitude changes before and after amphetamine highlights a significant interaction between amplitude and time, where amplitude is higher after amphetamine but decreases by about 30 min following intraperitoneal injection of amphetamine. This decrease may reflect vesicular dopamine store depletion following amphetamine (\u003cspan citationid=\"CR24\" class=\"CitationRef\"\u003e24\u003c/span\u003e) (Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003eJ).\u003c/p\u003e \u003cp\u003eFigure \u003cspan refid=\"Fig4\" class=\"InternalRef\"\u003e4\u003c/span\u003e shows examples of FPmotion\u0026rsquo;s calculated behavioral bout output. Following amphetamine, \u0026ldquo;run straight\u0026rdquo; bout length increases (p\u0026thinsp;=\u0026thinsp;1-26E-07) (Fig.\u0026nbsp;\u003cspan refid=\"Fig4\" class=\"InternalRef\"\u003e4\u003c/span\u003eA), while bout number decreases, reflecting prolonged hyperlocomotion following amphetamine (Fig.\u0026nbsp;\u003cspan refid=\"Fig4\" class=\"InternalRef\"\u003e4\u003c/span\u003eB) (\u003cspan citationid=\"CR25\" class=\"CitationRef\"\u003e25\u003c/span\u003e). For \u0026ldquo;turn left\u0026rdquo; syllables, bout length also increases significantly (p\u0026thinsp;=\u0026thinsp;3.08E-05), consistent with amphetamine-induced circling (Fig.\u0026nbsp;\u003cspan refid=\"Fig4\" class=\"InternalRef\"\u003e4\u003c/span\u003eC) (\u003cspan citationid=\"CR25\" class=\"CitationRef\"\u003e25\u003c/span\u003e). In this case, bout count similarly increases (p\u0026thinsp;=\u0026thinsp;0.00623; Fig.\u0026nbsp;\u003cspan refid=\"Fig4\" class=\"InternalRef\"\u003e4\u003c/span\u003eD). In contrast, \u0026ldquo;turn right\u0026rdquo; syllables show a significant increase in bout length, but no change in bout number (Fig.\u0026nbsp;\u003cspan refid=\"Fig4\" class=\"InternalRef\"\u003e4\u003c/span\u003eE, F). Individual dopamine responses can be examined from the .csv files and from the synchronized alignment video (Fig.\u0026nbsp;\u003cspan refid=\"Fig1\" class=\"InternalRef\"\u003e1\u003c/span\u003eC; supplementary video).\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003eThe peak alignment function is illustrated for 5s before and after behavior initiation as peri-plots (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eA, B). The purpose of the peri-plot is to show how dopamine peaks occur relative to behavior bout onset, allowing identification of co-occurring dopamine patterns. Temporal alignment of peaks is necessary to correct for peak latency. This improves signal clarity and reduces errors caused by misaligned signals (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eB). The outlier function is demonstrated in Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eC. Here FPmotion identifies an outlier based on gross difference in amplitude (red). This trace will be removed from the quantification if the \u0026ldquo;\u003cem\u003eoutlier removal\u003c/em\u003e\u0026rdquo; option is selected. The user can also choose not to remove outliers. All outliers are highlighted as shown, in the graphical output so that the user can check that they agree.\u003c/p\u003e \u003cp\u003eFigure \u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eD shows \u0026ldquo;run straight\u0026rdquo; events \u003cem\u003ebefore\u003c/em\u003e dynamic time warping-based peak alignment and clustering. The signal to noise ratio is poor and no clear pattern is visible from the heatmap. In contrast, after aligning and clustering, a distinct pattern emerges (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eE). This shows that dF/F (z-score) dips before initiation of \u0026ldquo;run straight\u0026rdquo; followed by a gradual incline (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eE). Clusters 0 and 1 after amphetamine represent possible dopamine patterns (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eF, G). dF/F (z-score) for cluster 1 (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eG) resembles the \u0026ldquo;run straight\u0026rdquo; pattern before amphetamine (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eE). However, as cluster 0 for \u0026ldquo;run straight\u0026rdquo; after amphetamine (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eF) only occurs 5 times, this signal is likely the result of noise and would be considered an outlier. Note, the cluster numbering is arbitrary and does not signify rank. Also, the user should use discretion in deciding which clusters are likely to represent authentic signals.\u003c/p\u003e \u003cp\u003eTurning behavior is associated with asymmetry in dopamine signaling, where turn direction is towards the hemisphere with lower dopamine levels (\u003cspan citationid=\"CR26\" class=\"CitationRef\"\u003e26\u003c/span\u003e), while bilateral dopamine elevation produces generalized hyperlocomotion, as reflected in this case by increased run straight bout length (\u003cspan citationid=\"CR27\" class=\"CitationRef\"\u003e27\u003c/span\u003e) (Fig.\u0026nbsp;\u003cspan refid=\"Fig4\" class=\"InternalRef\"\u003e4\u003c/span\u003e). Note that in these experiments, the fiber photometry canula is implanted in the right hemisphere. Consistent with this, the peri-plots for \u0026ldquo;turn left\u0026rdquo; syllables before and after amphetamine show increased dopamine when turning initiates (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eH, J). However, another pattern is also seen during turn left where phasic dopamine release is observed \u0026minus;\u0026thinsp;2.5s before turn initiation and +\u0026thinsp;2.5s after (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eI). Following amphetamine, the same peaks are observed (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eK). While the pattern is identical before and after amphetamine, a greater proportion of \u0026ldquo;turn left\u0026rdquo; bouts display it (15 bouts before verses 25 bouts after, I and K), suggesting that it represents an authentic dopamine signal ensemble.\u003c/p\u003e \u003cp\u003eWe also examined peri-plots for \u0026ldquo;turn right\u0026rdquo; behavior syllables. Dopamine in the right hemisphere dipped before \u0026ldquo;turn right\u0026rdquo; behavior commenced in control trials (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eL, cluster 1), however, after amphetamine administration, three signal ensembles emerged from the clustering analysis (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eM-O). All clusters showed a dip in DF/F (z-score) from \u0026minus;\u0026thinsp;5 to -2 s before turn initiation at timepoint 0, by which point dopamine was higher. This was followed by a dip in dF/F (z-sc) signal following turn right initiation (Fig.\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003eM-O). Given the reasonable signal to noise ratio and the repeated nature of these ensembles, we propose that they represent bonafide NAc dopamine patterns accompanying turning. These data show that FPmotion peri-event plots successfully resolve discreet ensembles within the data.\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003c/div\u003e"},{"header":"4. Discussion","content":"\u003cp\u003eFPmotion balances a structured analytical workflow with the flexibility needed to accommodate diverse experimental designs. The core processing steps, spanning signal preprocessing, behavior-event extraction, normalization, visualization, and advanced analyses, is organized to allow users to obtain meaningful results from a single analysis. At the same time, most steps of the workflow include adjustable parameters, allowing the analysis to be refined for example for different biosensors. Although the software provides default parameter choices that are robust, users can adjust filtering cutoffs, normalization modes, and event-alignment windows. Group comparisons can also be configured. In this way, the framework provides consistency for users preferring a turnkey approach while remaining adaptable.\u003c/p\u003e \u003cp\u003eThe software generates a comprehensive set of results during the analysis run, rather than requiring users to preselect specific outputs. This approach minimizes the risk of missing relevant summaries, and the need to repeat the analysis. By providing all outputs at once, researchers can focus on the figures and tables most meaningful for their experimental questions. These files can be easily viewed in the FPviewer software. This analysis environment is easy to navigate and supports a broad range of users.\u003c/p\u003e \u003cp\u003eThe final and most critical component of the workflow is the alignment of peri-event signals using DTW barycenter averaging (DBA). Behavioral onset alone does not guarantee temporal alignment of fluorescence features across trials; even after time-locking all segments to the same event. The latency of prominent peaks and valleys in FP traces varies between trials. Such latency jitter is well documented in other neural modalities, such as event-related potentials and calcium imaging, where a simple stimulus-locked averaging attenuates waveforms unless temporal realignment is applied (\u003cspan citationid=\"CR28\" class=\"CitationRef\"\u003e28\u003c/span\u003e, \u003cspan citationid=\"CR29\" class=\"CitationRef\"\u003e29\u003c/span\u003e). To address this, we incorporated DTW-based alignment, constrained by the fixed behavioral time anchor, permitting local latency corrections while preserving the event reference. We adopted DTW DBA to compute a consensus waveform for each cluster. DBA provides a more faithful representation of average temporal shape than arithmetic mean, particularly when peaks and troughs occur with slightly different latencies across trials. Prior work highlights its ability to preserve shared temporal motifs in time-series datasets subject to latency variability and non-uniform warping (\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e, \u003cspan citationid=\"CR30\" class=\"CitationRef\"\u003e30\u003c/span\u003e). In practice, this alignment pipeline enabled clearer peri-event motifs to emerge that were largely invisible in the raw, unaligned averages despite time locking. Nonetheless, we emphasize that this method is optimal only when the trials share broadly consistent temporal dynamics. Our simulation experiments reveal that alignment performance degrades when large frequency differences occur across signals. Users should therefore use it cautiously when underlying kinetics are highly heterogenous.\u003c/p\u003e \u003cp\u003eThroughout the development of this workflow, we evaluated method performance using simulated datasets that varied in amplitude, asymmetry, frequency, and polynomial shape. These tests revealed that the pipeline is sensitive to data characteristics, particularly signal frequency (Supplementary data 1). DTW-based approaches perform well when signals share broadly similar dominant frequencies, as is typical for FP dopamine or calcium recordings. DTW may attempt to warp high-frequency structures into low-frequency ones, producing biologically unrealistic alignments. This underscores the importance of empirically validating outlier removal, clustering, and alignment decisions, and avoiding overinterpretation of motifs that emerge from datasets with high-frequency variability or poor signal-to-noise ratios.\u003c/p\u003e \u003cp\u003eIn summary, the combination of PCA-based Mahalanobis distance calculation, variance-weighted MCD estimation, fast DTW clustering, and DBA-derived consensus templates alignment provides a robust and scalable framework for detecting meaningful temporal patterns in peri-event FP signals. The pipeline is specifically designed for datasets with many trials, moderate event-related variability, and relatively consistent signal frequency; conditions typically met in dopamine and calcium FP experiments. Overall, the methods implemented here provide a principled and computationally fast and automated way to uncover reproducible FP dynamics surrounding behavior with batch processing, full statistical analysis and graphical, .csv and video output.\u003c/p\u003e \u003cp\u003eWe tested the pipeline with fiber photometry recordings from the ventral striatum of mice before and after amphetamine to investigate what transient dopamine signals accompanied behavior syllables in freely behaving mice. Our results show that amphetamine increases the frequency of dopamine transients while reducing peak prominence. This makes sense given the sustained elevation in extracellular dopamine upon amphetamine-mediated DAT inhibition. Normally, extracellular dopamine in striatum clears within 100 to 300 ms (\u003cspan citationid=\"CR31\" class=\"CitationRef\"\u003e31\u003c/span\u003e, \u003cspan citationid=\"CR32\" class=\"CitationRef\"\u003e32\u003c/span\u003e). Following systemic amphetamine injection, we find that dopamine is elevated in ventral striatum by 20 min post injection, consistent with previous reports for amphetamine and cocaine (\u003cspan citationid=\"CR23\" class=\"CitationRef\"\u003e23\u003c/span\u003e, \u003cspan citationid=\"CR33\" class=\"CitationRef\"\u003e33\u003c/span\u003e). Frequency remains elevated for 15 min from this time point while amplitude and AUC increase significantly. Moreover, peak prominence decreases while peak-width-height increases significantly following amphetamine treatment, consistent with prolonged dopamine availability in the extracellular space. Temporal views of the data reveal changes over time, for example amplitude decreases by 30 min following amphetamine, suggesting a decline in dopamine, and consistent with this, frequency decreases in parallel. Finally, the peri-event plots capture an expected dip in dF/F (z-score) for dopamine in the right hemisphere of NAc when initiating right turns as previously described (\u003cspan citationid=\"CR33\" class=\"CitationRef\"\u003e33\u003c/span\u003e). This improved peak alignment combined with clustering allows detection of discreet signal ensembles that would otherwise be masked. Overall, we demonstrate that the FPmotion features including automation of fiber photometry data processing, outlier removal, modelling, peri-event analysis (with dynamic time warping and clustering) and statistical analysis simplifies the translation of fiber photometry signals into biological insight and makes it accessible to non-programmers.\u003c/p\u003e"},{"header":"Declarations","content":"\u003ch2\u003eAuthor Contribution\u003c/h2\u003e\u003cp\u003eY.H. wrote the code with contribution from T.T. and P.H. J.J. performed mouse experiments tested software. Y.H. and E.C. wrote the manuscript. All authors reviewed the manuscript.\u003c/p\u003e\u003ch2\u003eAcknowledgement\u003c/h2\u003e\u003cp\u003eWe acknowledge Nikita Tiwari and Francesca Marchisella for their contributions towards fiberphotometry method optimization .\u003c/p\u003e\u003ch2\u003eData Availability\u003c/h2\u003e\u003cp\u003eThe software generated for this study FPmotion and FPviewer are available on the GitHub repository: https://github.com/TCB-yehong/FPmotion\u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\n\u003cli\u003eGunaydin, L. A., Grosenick, L., Finkelstein, J. C., Kauvar, I. V., Fenno, L. E., Adhikari, A.\u003cem\u003e et al.\u003c/em\u003e (2014) Natural neural projection dynamics underlying social behavior \u003cem\u003eCell\u003c/em\u003e \u003cstrong\u003e157\u003c/strong\u003e, 1535-1551\u003c/li\u003e\n\u003cli\u003eChen, T. W., Wardill, T. J., Sun, Y., Pulver, S. R., Renninger, S. L., Baohan, A.\u003cem\u003e et al.\u003c/em\u003e (2013) Ultrasensitive fluorescent proteins for imaging neuronal activity \u003cem\u003eNature\u003c/em\u003e \u003cstrong\u003e499\u003c/strong\u003e, 295-300\u003c/li\u003e\n\u003cli\u003eKim, C. K., Yang, S. J., Pichamoorthy, N., Young, N. P., Kauvar, I., Jennings, J. H.\u003cem\u003e et al.\u003c/em\u003e (2016) Simultaneous fast measurement of circuit dynamics at multiple sites across the mammalian brain \u003cem\u003eNat Methods\u003c/em\u003e \u003cstrong\u003e13\u003c/strong\u003e, 325-328\u003c/li\u003e\n\u003cli\u003ePatriarchi, T., Cho, J. R., Merten, K., Howe, M. W., Marley, A., Xiong, W. H.\u003cem\u003e et al.\u003c/em\u003e (2018) Ultrafast neuronal imaging of dopamine dynamics with designed genetically encoded sensors \u003cem\u003eScience\u003c/em\u003e \u003cstrong\u003e360\u003c/strong\u003e, \u003c/li\u003e\n\u003cli\u003eFeng, J., Zhang, C., Lischinsky, J. E., Jing, M., Zhou, J., Wang, H.\u003cem\u003e et al.\u003c/em\u003e (2019) A Genetically Encoded Fluorescent Sensor for Rapid and Specific In Vivo Detection of Norepinephrine \u003cem\u003eNeuron\u003c/em\u003e \u003cstrong\u003e102\u003c/strong\u003e, 745-761.e748\u003c/li\u003e\n\u003cli\u003eMarvin, J. S., Shimoda, Y., Magloire, V., Leite, M., Kawashima, T., Jensen, T. P.\u003cem\u003e et al.\u003c/em\u003e (2019) A genetically encoded fluorescent sensor for in vivo imaging of GABA \u003cem\u003eNat Methods\u003c/em\u003e \u003cstrong\u003e16\u003c/strong\u003e, 763-770\u003c/li\u003e\n\u003cli\u003eSimpson, E. H., Akam, T., Patriarchi, T., Blanco-Pozo, M., Burgeno, L. M., Mohebi, A.\u003cem\u003e et al.\u003c/em\u003e (2024) Lights, fiber, action! A primer on in vivo fiber photometry \u003cem\u003eNeuron\u003c/em\u003e \u003cstrong\u003e112\u003c/strong\u003e, 718-739\u003c/li\u003e\n\u003cli\u003eSherathiya, V. N., Schaid, M. D., Seiler, J. L., Lopez, G. C., and Lerner, T. N. (2021) GuPPy, a Python toolbox for the analysis of fiber photometry data \u003cem\u003eSci Rep\u003c/em\u003e \u003cstrong\u003e11\u003c/strong\u003e, 24212\u003c/li\u003e\n\u003cli\u003eBruno, C. A., O\u0026apos;Brien, C., Bryant, S., Mejaes, J. I., Estrin, D. J., Pizzano, C.\u003cem\u003e et al.\u003c/em\u003e (2021) pMAT: An open-source software suite for the analysis of fiber photometry data \u003cem\u003ePharmacol Biochem Behav\u003c/em\u003e \u003cstrong\u003e201\u003c/strong\u003e, 173093\u003c/li\u003e\n\u003cli\u003eAkam, T., and Walton, M. E. (2019) pyPhotometry: Open source Python based hardware and software for fiber photometry data acquisition \u003cem\u003eSci Rep\u003c/em\u003e \u003cstrong\u003e9\u003c/strong\u003e, 3521\u003c/li\u003e\n\u003cli\u003eBridge, M. F., Wilson, L. R., Panda, S., Stevanovic, K. D., Letsinger, A. C., McBride, S.\u003cem\u003e et al.\u003c/em\u003e (2024) FiPhA: an open-source platform for fiber photometry analysis \u003cem\u003eNeurophotonics\u003c/em\u003e \u003cstrong\u003e11\u003c/strong\u003e, 014305\u003c/li\u003e\n\u003cli\u003eConlisk, D., Ceau, M., Fiancette, J. F., Winke, N., Darmagnac, E., Herry, C.\u003cem\u003e et al.\u003c/em\u003e (2023) Integrating operant behavior and fiber photometry with the open-source python library Pyfiber \u003cem\u003eSci Rep\u003c/em\u003e \u003cstrong\u003e13\u003c/strong\u003e, 16562\u003c/li\u003e\n\u003cli\u003eMurphy, K. Z., Haile, E. D., McTigue, A. D., Pierce, A. F., and Donaldson, Z. R. (2023) PhAT: A Flexible Open-Source GUI-Driven Toolkit for Photometry Analysis \u003cem\u003eCurr Protoc\u003c/em\u003e \u003cstrong\u003e3\u003c/strong\u003e, e763\u003c/li\u003e\n\u003cli\u003eHan, R., Li, Y., Gao, X., and Wang, S. (2018) An accurate and rapid continuous wavelet dynamic time warping algorithm for end-to-end mapping in ultra-long nanopore sequencing \u003cem\u003eBioinformatics\u003c/em\u003e \u003cstrong\u003e34\u003c/strong\u003e, i722-i731\u003c/li\u003e\n\u003cli\u003eKrumbholz, K., Hardy, A. J., and de Boer, J. (2020) Automated extraction of auditory brainstem response latencies and amplitudes by means of non-linear curve registration \u003cem\u003eComput Methods Programs Biomed\u003c/em\u003e \u003cstrong\u003e196\u003c/strong\u003e, 105595\u003c/li\u003e\n\u003cli\u003eVorpe K, H. S., Poth R, Miljkovic T. (2023) Clustering regions with dynamic time warping to model obesity prevalence disparities in the United States. \u003cem\u003eJournal of Applied Statistics\u003c/em\u003e \u003cstrong\u003e51\u003c/strong\u003e, 793-807\u003c/li\u003e\n\u003cli\u003eMejia AF, N. M., Eloyan A, Caffo B, Lindquist, and MA. (2017) PCA leverage: outlier detection for high-dimensional functional magnetic resonance imaging data. \u003cem\u003eBiostatistics\u003c/em\u003e \u003cstrong\u003e18\u003c/strong\u003e, 521-536\u003c/li\u003e\n\u003cli\u003eRousseeuw, P. J., and Katrien van Driessen. (1999) A Fast Algorithm for the Minimum Covariance Determinant Estimator \u003cem\u003eTechnometrics\u003c/em\u003e \u003cstrong\u003e41\u003c/strong\u003e, 212-223\u003c/li\u003e\n\u003cli\u003eHubert M, D. M., Rousseeuw PJ. (2018) Minimum covariance determinant and extensions. \u003cem\u003eWIREs Comput Stat . \u003c/em\u003e\u003cstrong\u003e10\u003c/strong\u003e, e1421\u003c/li\u003e\n\u003cli\u003eChan., S. S. a. P. (2007) Toward accurate dynamic time warping in linear time and space. \u003cem\u003eIntelligent data analysis\u003c/em\u003e \u003cstrong\u003e11\u003c/strong\u003e, 561-580\u003c/li\u003e\n\u003cli\u003eSalamone, J. D., Pardo, M., Yohn, S. E., L\u0026oacute;pez-Cruz, L., SanMiguel, N., and Correa, M. (2016) Mesolimbic Dopamine and the Regulation of Motivated Behavior \u003cem\u003eCurr Top Behav Neurosci\u003c/em\u003e \u003cstrong\u003e27\u003c/strong\u003e, 231-257\u003c/li\u003e\n\u003cli\u003eLabouesse, M. A., Cola, R. B., and Patriarchi, T. (2020) GPCR-Based Dopamine Sensors-A Detailed Guide to Inform Sensor Choice for In vivo Imaging \u003cem\u003eInt J Mol Sci\u003c/em\u003e \u003cstrong\u003e21\u003c/strong\u003e, \u003c/li\u003e\n\u003cli\u003eSiciliano, C. A., Calipari, E. S., Ferris, M. J., and Jones, S. R. (2014) Biphasic mechanisms of amphetamine action at the dopamine terminal \u003cem\u003eJ Neurosci\u003c/em\u003e \u003cstrong\u003e34\u003c/strong\u003e, 5575-5582\u003c/li\u003e\n\u003cli\u003eSulzer, D. (2011) How addictive drugs disrupt presynaptic dopamine neurotransmission \u003cem\u003eNeuron\u003c/em\u003e \u003cstrong\u003e69\u003c/strong\u003e, 628-649\u003c/li\u003e\n\u003cli\u003eKokkinidis, L., and Anisman, H. (1979) Circling behavior following systemic d-amphetamine administration: potential noradrenergic and dopaminergic involvement \u003cem\u003ePsychopharmacology (Berl)\u003c/em\u003e \u003cstrong\u003e64\u003c/strong\u003e, 45-54\u003c/li\u003e\n\u003cli\u003eCarli, M., Evenden, J. L., and Robbins, T. W. (1985) Depletion of unilateral striatal dopamine impairs initiation of contralateral actions and not sensory attention \u003cem\u003eNature\u003c/em\u003e \u003cstrong\u003e313\u003c/strong\u003e, 679-682\u003c/li\u003e\n\u003cli\u003eKokkinidis, L., and Anisman, H. (1977) Perseveration and rotational behavior elicited by d-amphetamine in a Y-maze exploratory task: differential effects of intraperitoneal and unilateral intraventricular administration \u003cem\u003ePsychopharmacology (Berl)\u003c/em\u003e \u003cstrong\u003e52\u003c/strong\u003e, 123-128\u003c/li\u003e\n\u003cli\u003eZoumpoulaki A, A. A., Filetti M, Brammer M, Bowman H. (2015) Latency as a region contrast: Measuring ERP latency differences with Dynamic Time Warping. \u003cem\u003ePsychophysiology\u003c/em\u003e \u003cstrong\u003e52\u003c/strong\u003e, 1559-1576\u003c/li\u003e\n\u003cli\u003eGuy, M. W., Conte, S., Bursalıoğlu, A., and Richards, J. E. (2021) Peak selection and latency jitter correction in developmental event-related potentials \u003cem\u003eDev Psychobiol\u003c/em\u003e \u003cstrong\u003e63\u003c/strong\u003e, e22193\u003c/li\u003e\n\u003cli\u003ePetitjean, F., Ketterlin, Alain, Gancarski, P. (2011) A global averaging method for dynamic time warping with applications to clustering. \u003cem\u003ePattern recognition.\u003c/em\u003e \u003cstrong\u003e44\u003c/strong\u003e, 678-693\u003c/li\u003e\n\u003cli\u003eFleckenstein, A. E., Volz, T. J., Riddle, E. L., Gibb, J. W., and Hanson, G. R. (2007) New insights into the mechanism of action of amphetamines \u003cem\u003eAnnu Rev Pharmacol Toxicol\u003c/em\u003e \u003cstrong\u003e47\u003c/strong\u003e, 681-698\u003c/li\u003e\n\u003cli\u003eCalipari, E. S., and Ferris, M. J. (2013) Amphetamine mechanisms and actions at the dopamine terminal revisited \u003cem\u003eJ Neurosci\u003c/em\u003e \u003cstrong\u003e33\u003c/strong\u003e, 8923-8925\u003c/li\u003e\n\u003cli\u003eJ\u0026oslash;rgensen, S. H., Ejdrup, A. L., Lycas, M. D., Posselt, L. P., Madsen, K. L., Tian, L.\u003cem\u003e et al.\u003c/em\u003e (2023) Behavioral encoding across timescales by region-specific dopamine dynamics \u003cem\u003eProc Natl Acad Sci U S A\u003c/em\u003e \u003cstrong\u003e120\u003c/strong\u003e, e2215230120\u003c/li\u003e\n\u003c/ol\u003e"}],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"Fiber photometry, batch processing, statistics, automation, amphetamine, striatum, dopamine, software","lastPublishedDoi":"10.21203/rs.3.rs-8506067/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-8506067/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003eFiber photometry measures neural activity \u003cem\u003ein vivo\u003c/em\u003e from genetically encoded indicators. Recordings generate large datasets that require extensive preprocessing and robust statistical methods for meaningful interpretation. However, existing analysis tools demand programming expertise, limiting accessibility. Here we describe \u003cem\u003eFPmotion\u003c/em\u003e, a comprehensive, user-friendly software platform for batchwise processing, integration, and statistical analysis of fiber photometry data with or without accompanying behavioral information. FPmotion performs filtering, isosbestic regression, ΔF/F computation, detrending, and z-scoring. It also extracts detailed peak properties at whole-file, block-level, and individual-peak resolution. When behavioral data is provided, FPmotion automatically identifies behavioral bouts, computes bout-level statistics, performs peri-event signal extraction, and supports multi-group comparisons through ANOVA- and LMEM-based statistical frameworks. All analyses generate publication-ready figures and structured CSV outputs suitable for downstream workflows. FPmotion also introduces a dedicated alignment module for peri-event signal analysis. This module applies dynamic time warping followed by barycenter averaging to realign peri-event traces while preserving the behavioral time anchor, producing cleaner and more temporally coherent peri-event motifs. We demonstrate FPmotion\u0026rsquo;s capabilities using the dlight1.1 sensor to measure dopamine responses from ventral striatum in behaving mice before and after amphetamine treatment. Together, FPmotion offers a fully automated framework for FP data analysis that improves interpretability and accessibility while reducing analysis time substantially.\u003c/p\u003e","manuscriptTitle":"FPmotion an Automated Signal Processing and Statistical Analysis Tool for Fiber Photometry Data","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2026-01-20 16:58:47","doi":"10.21203/rs.3.rs-8506067/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"f0121d7e-70ad-4e81-93bf-e3d72bc280c2","owner":[],"postedDate":"January 20th, 2026","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[],"tags":[],"updatedAt":"2026-02-22T18:23:58+00:00","versionOfRecord":[],"versionCreatedAt":"2026-01-20 16:58:47","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-8506067","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-8506067","identity":"rs-8506067","version":["v1"]},"buildId":"XKTyCvWXoU3ODBz1xrDgd","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}

Text is read by the "Ask this paper" AI Q&A widget below. Extraction quality varies by source — PMC NXML preserves structure cleanly, OA-HTML may include some navigation residue, and OA-PDF can have broken hyphenation. The publisher copy (via DOI) is the canonical version.

My notes (saved in your browser only)

Ask this paper AI returns verbatim quotes from the full text · source: preprint-html

Answers must be backed by verbatim quotes from this paper's full text. Hallucinated quotes are dropped automatically; if no verbatim passage answers the question, we say so. How this works

Citation neighborhood (no data yet)

We don't have any in-corpus citations linked to this paper yet. This is a recent paper (2026) — citers typically take a year or two to land, and the OpenAlex reference graph may still be filling in.

Source provenance

europepmc
last seen: 2026-05-20T01:45:00.602351+00:00