-
Notifications
You must be signed in to change notification settings - Fork 0
dFF Tools
The file dff_tools.py
contains several functions that can help with the analysis of dF/F traces. In general, almost all functions take a data
variable that corresponds to the dF/F traces of neurons, each row being a cell with the columns as time. This wiki is in addition to the (detailed) documentation of each function.
Functions that facilitate cell-by-cell dF/F calculation. A list of files can be presented to _batch
, and if these files have corresponding CaImAn-results files, the returned dF/F matrix will be derived from there. Else, it will calculate its own dF/F metric.
Uses the peakutils
package to analyze the fluorescent trace of dF/F matrices. The threshold and minimal distance between subsequent peaks can be controlled. The result is a matrix with a similar shape to that of the raw data, containing 1 wherever a peak was detected, and 0 otherwise.
Creates a scatter plot in which each cell's dF/F is a row, and the detected peaks are shown as dots on the individual traces. The method requires both the raw dF/F data and the spike timing data that was calculated using the locate_spike
method.
Computes a mean rolling window across all cells. Input data can either be the raw dF/F trace, creating an output of the mean dF/F value over time for an "average" cell, or the spike timings matrix, creating the rolling mean spike rate over the entire FOV.
Shows an "image" of the activity of cells over time, each row being a cell, columns representing time, and the dF/F value is the brightness of the image. Accepts an "epoch" argument for the title, a downsampling factor and the recording's FPS.
Shows a "mosaic" of cells over time, as their calcium activity changes. Requires an .npz
file with the CaImAn results and the path to the original .tif
stack. You can also supply the specific indices you wish to view (if you have some cells which were co-labeled with a morphological marker, for example). You can also supply the expected cell radius in pixels. Other parameters are self-explanatory.
For a given .tif
stack, find the analyzed ROIs that CaImAn generated and draw their contours around the cells. Also adds a small number label next to each component.