Trace Processing

Calculating Δf/f0

CalSciPy supports a variety of methods for calculating the fold fluorescence over baseline through a single function.

from CalScipy.traces import calculate_dfof

dFoF = calculate_dfof(traces, method="mean")

Supported baseline calculation methods

  • “low-pass”: x-th percentile of the :func:` low-pass <CalSciPy.traces.baseline.low_pass_baseline>` filtered trace

  • “mean”: mean of the trace

  • “median”: median of the trace

  • “moving_mean”: moving mean of the trace using a specified window length

  • “percentile”: x-th percentile of the trace

  • “sliding_mean”: sliding mean calculated using a sliding window of specified length

  • “sliding_median: sliding median calculated using a sliding window of specified length

  • “sliding_percentile: sliding percentile calculated using a sliding window of specified length

Baseline Corrections

CalSciPy currently provides a function for polynomial detrending to correct for a drifting baseline due to time-dependent degradation of signal-to-noise

from CalScipy.traces import detrend_polynomial

detrended_traces = detrend_polynomial(traces, frame_rate=frame_rate)

Assessing Trace Quality

CalSciPy supports assessment of trace quality using a standardized noise metric first defined in the publication associated with the spike-inference software package CASCADE.

from CalScipy.traces import calculate_standardized_noise

# acquisition frequency
frame_rate = 30
standardized_noise = calculate_standardized_noise(dFoF, frame_rate=frame_rate)