Find turning points that exceed the threshold. If P.nneigh_min_detect>0, the number of consecutive points below the threshold must be greater than one. For example, the figure below has three consecutive points below the threshold thus it will be detected if P.nneigh_min_detect=1 or 2. This is turned off by default (P.nneigh_min_detect = 0).
vrWav1: filtered trace
thresh1: spike detection threshold (referenced from P.vnThresh_site).
nneigh_min: Minimum nearest neighbors. If 1, there must be at least two consecutive points below the threshold. If 2, there must be at least three consecutive points below the threshold (default: 0).
viSpk1: Spike times (at the peak)