Converting xy coordinates to theta without discontinutities This one is, or rather, should be, fairly simple. I have a list of tuples of XY positions, and am trying to pull out angles relative to the origin from it. However, unlike atan2 / friends, I want it to be continuous, in other words not wrapping. I know (and am assuming) that the differences between successive XY coordinates are small, and that there is a minimum radius. (In other words, it should pick the multiple of \$2\pi\$ that makes the difference between the previous angle and the current angle the smallest.) 

Currently, this is the relevant snippet:

thetas = [math.atan2(coords[0][1], coords[0][0])]
prev = thetas[0]
for index in range(1, len(coords)):
    coord = coords[index]
    theta = math.atan2(coord[1], coord[0]) + (prev // (2*math.pi)) * (2 * math.pi)
    while theta - prev &gt; math.pi:
        theta -= 2*math.pi
    while prev - theta &gt; math.pi:
        theta += 2*math.pi
    assert abs(theta - prev) &lt; math.pi/2
    thetas.append(theta)
    prev = theta


However, it's slow, and I doubt it's Pythonic. It's also doing a lot of "magic", for lack of a better word. Any suggestions for improvement?

Line profiler results here.
for index in range() is almost always wrong. Consider

prev = coords[0]
for coord in coords[1:]:
    theta = ...
    prev = coord

Instead of computing theta directly, compute delta - this way you may actually take an advantage of small differences:

prev = (1, 0)    # Initial vector is along the X axis
theta = 0.0
for coord in coords[]:
    delta = angle_between(coord, prev)
    theta += delta
    prev = coord


Computing delta is simply an application of a cross-product formula:

def angle_between(curr, prev):
    return asin(cross_product(curr, prev) / (norm(curr) / norm(prev))