Skip to content

Detect Events

Compute Credits

This tool uses 0.5 compute credits per hour.

The event detection algorithm attempts to automatically identify when bursts of cell activity occur in cell sets.

This should be used after you have used either CNMF-E or PCA-ICA to identify cells.

Inputs

Parameter Required? Default Description
Input Cell Sets True N/A paths to the input cell sets
Event Threshold True 4.0 The threshold in median-absolute-deviations that the trace has to cross to be considered an event.
Tau True 0.2 The minimum time in seconds that an event has to last in order to be considered.
Event Time Reference True beginning The temporal reference that defines the event time.
Ignore Negative Transients True True If true, ignore event if most of the increase in signal due to an event takes on negative values, otherwise keep them.
Accepted Cells Only True False If true, detect events only for accepted cells.

File Inputs

Source Parameter File Type File Format
Input Cell Sets cell_set isxd

Description

This algorithm extracts calcium events from traces. The events are identified by their fast increase in amplitude followed by a long decay back to baseline level. There is assumption that the calcium activity associated with an event should result in a monotonic rise followed by an exponential decay of the following form:

\[ a(t + \delta) = a(t) \exp \left( -\frac{\delta}{\tau} \right) \]

where \(t\) is time in seconds, \(\delta\) is some period of time in seconds and \(\tau\) is the mean lifetime in seconds, which corresponds to the Event Smallest Decay Time setting. Note that the mean lifetime and the half-life of a decay, \(t_{\frac{1}{2}}\) are related as follows:

\[ t_{\frac{1}{2}} = \tau \ln(2). \]

The default value of this setting is 0.2 seconds, which roughly corresponds to the mean lifetime measured from the response of GCaMP6f to 1 action potential in mouse V1 in vivo1. In order to choose a value for a different indicator, please consult Supplementary Table 3 in 1

Note that, even though an event will likely include signal from many action potentials, rather than just one, this parameter only helps to exclude events whose signal decays too quickly. Therefore, using a reference value for 1 action potential provides a suitable lower bound on the value, which can be increased if many false events are detected.

The Event Detection algorithm has several computational stages for each input trace:

MAD estimation

An estimate of the amplitude of fluctuation from baseline is calculated using Median Absolute Deviation (MAD), where i and j take the values \(1, 2, ..., n_{frames}\).

\[ \operatorname{MAD} = \operatorname{median}_{i}(\ | X_{i} - \operatorname{median}_{j} (X_{j}) |\ ) \]

The median absolute deviation is a measure of statistical dispersion, which is more resilient to outliers in a data set than the standard deviation. The MAD only takes one value for the whole data signal of the cell.

Derivative estimation

The first derivative of the input temporal trace is computed - this indicates how much the amplitude of the trace changes over periods of time. The change in amplitude can be used to track the two major components of a calcium event: rise and decay.

For each element in the first derivative of the input temporal trace, the algorithm tracks consecutive positive values in order to compute the rise amplitude of a potential calcium event.

Constraints

Once a negative value is observed in the first derivative, the algorithm evaluates a set of constraints on the potential calcium event in order to filter out false positives. These constraints include:

  • Negative transients: It’s possible for a calcium trace to contain negative amplitudes. If most of the rise in amplitude of a potential event comes from negative amplitudes and Discard Negative Transients is set to true, then the event is not valid.

  • Event threshold: If the rise amplitude is below an event threshold, then the event is not valid. The event threshold is computed as a multiple of the MAD of the input temporal trace with the Event Threshold Factor

  • Rate of decay: If the event satisfies the constraints above, then the algorithm computes the decay amplitude as the difference in amplitude from the peak to the point in time where the calcium activity should have decayed completely - that is one \(\tau\) constant later. If the rate of decay between these two amplitudes is faster than what would be expected from an exponential decay model with a decay constant of \(\tau\), then the event is not valid.

Event classification

If a potential event satisfies the constraints above, then it is classified as an event and recorded in the output event set. The amplitude of the event is the rise amplitude and the time of the event is recorded based on the Time of Event specified.