Research Article

Development and Validation of a Spike Detection and Classification Algorithm Aimed at Implementation on Hardware Devices

Algorithm 1

Pseudocode for AdaBandFlt and Limada.
AdaBandFlt
number_of_samples=0;
number_of_windows=0;
F; // definition of sample frequency //
while number_of_windows 100 do  O( )
   while number_of_samples F*0.01 // define a 10 ms window // O(F* )
      take a sample
      number_of_samples number_of_samples 1;
   end
   compute the RMS and put it in a vector named “error”   O( )
   number_of_windows number_of_windows 1;
end
BubbleSort(error) // sort the vector of 100 RMS // O( 2)
define the threshold initial value (25th percentile)  O( )
Limada
number_of_samples=0;
number_of_windows=0;
threshold_init=0;
F; // definition of sample frequency //
ok=false;
while ok == false do //ok is false until 100 clean windows are collected // O( )
   while number_of_samples F*0.01 // define a 10 ms window //  O(F* )
      take a sample
      number_of_samples number_of_samples 1;
   end
   BubbleSort(samples) //sort the voltage values of a window //  O( 2)
   compute the 2nd (V .02) and the 30th (V .30) percentiles    O( )
   if number_of_windows 100    O( )
      test= V .02/V .30;    O( )
      if test 5 & is significantly non zero O( )
         threshold_init 0.99* threshold_init 0.01*
         number_of_windows number_of_windows 1;
      end
   else ok==true; // 100 clean windows are collected //
   end
end