allensdk.brain_observatory.dff module

allensdk.brain_observatory.dff.compute_dff(traces, save_plot_dir=None, mode_kernelsize=5400, mean_kernelsize=3000)[source]

Compute dF/F of a set of traces using a low-pass windowed-mode operator. The operation is basically:

T_mm = windowed_mean(windowed_mode(T))

T_dff = (T - T_mm) / T_mm

Parameters:
traces: np.ndarray

2D array of traces to be analyzed

Returns:
np.ndarray with the same shape as the input array.
allensdk.brain_observatory.dff.main()[source]
allensdk.brain_observatory.dff.movingaverage(x, kernelsize, y)[source]

Compute the windowed average of an array.

Parameters:
x: np.ndarray

Array to be analyzed

kernelsize: int

Size of the moving window

y: np.ndarray

Output array to store the results

allensdk.brain_observatory.dff.movingmode_fast(x, kernelsize, y)[source]

Compute the windowed mode of an array. A running mode is initialized with a histogram of values over the initial kernelsize/2 values. The mode is then updated as the kernel moves by adding and subtracting values from the histogram.

Parameters:
x: np.ndarray

Array to be analyzed

kernelsize: int

Size of the moving window

y: np.ndarray

Output array to store the results

allensdk.brain_observatory.dff.plot_onetrace(dff, fc)[source]

Debug plotting function