Here is the code that the issue is in:
angles = -atan(deriv) angles = angles*(180/pi) #shift coordinates onto their polynomials d[1:mtp,3] = d[1:mtp,3] +