spike detection algorithm python