introduction of detectStepAverageSpike function