You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/modules/qualitymetrics/isi_violations.rst
+29-25Lines changed: 29 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,46 +10,48 @@ Calculation
10
10
Neurons have a refractory period after a spiking event during which they cannot fire again.
11
11
Inter-spike-interval (ISI) violations refers to the rate of refractory period violations (as described by [Hill]_).
12
12
13
+
We aim to calculate the contamination rate :math:`C`, measuring the ratio of isi violations in the spike-train of a unit.
13
14
The calculation works under the assumption that the contaminant events happen randomly or come from another neuron that is not correlated with our unit.
14
15
A correlation will lead to an overestimation of the contamination, whereas an anti-correlation will lead to an underestimation.
15
16
16
-
Different formulas have been developed over the years.
17
+
Different formulas have been developed, but all require:
17
18
18
-
Calculation from the [Hill]_ paper
19
-
----------------------------------
19
+
- :math:`T` the duration of the recording in seconds.
20
+
- :math:`N` the number of spikes in the unit's spike train.
21
+
- :math:`t_r` the duration of the unit's refractory period in seconds.
22
+
23
+
Calculation from the [UMS]_ package
24
+
-----------------------------------
25
+
26
+
Originally implemented in the `rpv_contamination` calculation of the UltraMegaSort2000 package: `<https://github.com/danamics/UMS2K/blob/master/quality_measures/rpv_contamination.m>`_.
20
27
21
-
The following quantities are required:
28
+
In this method the number of spikes whose refractory period are violated, denoted :math:`n_v`, is used.
22
29
23
-
- :math:`ISI_t` : biological threshold for ISI violation.
24
-
- :math:`ISI_{min}`: minimum ISI threshold enforced by the data recording system used.
25
-
- :math:`ISI_s` : the array of ISI violations which are observed in the unit's spike train.
26
-
- :math:`\#`: denotes count.
30
+
Here, the refactory period :math:`t_r` is adjusted to take account of the data recording system's minimum possible refactory
31
+
period. E.g. if a system has a sampling rate of :math:`f \text{ Hz}`, the closest that two spikes from the same unit can possibly
32
+
be is :math:`1/f \, \text{s}`. Hence the refactory period :math:`t_r` is the expected biological threshold minus this minimum possible
33
+
threshold.
27
34
28
-
The threshold for ISI violations is the biological ISI threshold, :math:`ISI_t`, minus the minimum ISI threshold, :math:`ISI_{min}` enforced by the data recording system used.
29
-
The array of inter-spike-intervals observed in the unit's spike train, :math:`ISI_s`, is used to identify the count (:math:`\#`) of observed ISI's below this threshold.
30
-
For a recording with a duration of :math:`T_r` seconds, and a unit with :math:`N_s` spikes, the rate of ISI violations is:
- :math:`N` the number of spikes in the unit's spike train.
43
-
- :math:`t_r` the duration of the unit's refractory period.
44
-
- :math:`n_v` the number of violations of the refractory period.
44
+
In this method the number spikes which violate other spikes' refractory periods, denoted :math:`\tilde{n}_v`, is used.
45
45
46
-
The estimated contamination :math:`C` can be calculated with 2 extreme scenarios. In the first one, the contaminant spikes are completely random (or come from an infinite number of other neurons). In the second one, the contaminant spikes come from a single other neuron:
46
+
The estimated contamination :math:`C` is calculated in 2 extreme scenarios. In the first, the contaminant spikes
47
+
are completely random (or come from an infinite number of other neurons). In the second, the contaminant spikes
48
+
come from a single other neuron. In these scenarios, the contamination rate is
47
49
48
50
.. math::
49
51
50
52
C = \frac{FP}{TP + FP} \approx\begin{cases}
51
-
1 - \sqrt{1 - \frac{n_v T}{N^2 t_r}} \text{ for the case of random contamination} \\
52
-
\frac{1}{2} \left( 1 - \sqrt{1 - \frac{2n_v T}{N^2 t_r}} \right) \text{ for the case of 1 contaminant neuron}
53
+
1 - \sqrt{1 - \frac{\tilde{n}_v T}{N^2 t_r}} \text{ for the case of random contamination} \\
54
+
\frac{1}{2} \left( 1 - \sqrt{1 - \frac{2\tilde{n}_v T}{N^2 t_r}} \right) \text{ for the case of 1 contaminant neuron}
53
55
\end{cases}
54
56
55
57
Where :math:`TP` is the number of true positives (detected spikes that come from the neuron) and :math:`FP` is the number of false positives (detected spikes that don't come from the neuron).
@@ -58,7 +60,9 @@ Expectation and use
58
60
-------------------
59
61
60
62
ISI violations identifies unit contamination - a high value indicates a highly contaminated unit.
61
-
Despite being a ratio, ISI violations can exceed 1 (or become a complex number in the [Llobet]_ formula). This is usually due to the contaminant events being correlated with our neuron, and their number is greater than a purely random spike train.
63
+
Despite being a ratio, the contamination can exceed 1 (or become a complex number in the [Llobet]_ formula).
64
+
This is usually due to the contaminant events being correlated with our neuron, and their number is
0 commit comments