created program to find indices of peak events