Did not figure out what causes the "loops" in the separation. Since sep is made from force, it's most likely associated with the noise. Zsens is a much better x variable to use for the differentiation anyways - detection with differentiation and zsens works well. Now I need to detect the end of the map region.
Program now successfully maps the "JKR fit" region of the curve for the last curve. Now I need to try troubleshooting and making it work for all the curves.
Increased the sensitivity for beginning event detection, which seems to have worked for most curves, although some curves are simply not detected. Changed the detection method for the end of the fit region by using second derivatives. The second derivative is usually the most negative at the rupture point. However, this is not always true. I will try either absolute value OR I will try to find commonalities in "difficult" curves to adress the issue.