I've got an accelerometer swinging back and forth on a string collecting data. But because of the tolerance of the accelerometer, the data is not quite clean enough to simply determine when positive turns to negative, or passes through equilibrium. Here's the data. (arbitrary reading vs. time in milliseconds). It's easy to eyeball and see that the period is roughly 1.2 seconds. What kind of logic can I give my code so it doesn't get confused by the outliers?