Had left some debugging plots uncommented in the event detection function. Fixed.