i_high = i
x_contact = float(x[i_low])
x_high = float(x[i_high])
- if x_high == x_contact:
- x.tofile('x-bad.dat', sep='\n')
- y.tofile('y-bad.dat', sep='\n')
+ if x_high == x_contact: # things must be pretty flat
+ x_contact = (x_contact + x[0]) / 2
slope = (y_high - y_contact) / (x_high - x_contact)
return (x_contact, y_contact, slope)