The second argument to unwrap is not the period of the input data, but the tolerance. The function always unwraps data assuming a 2π interval. That is, it wants to see that x(i)-x(i+1) is larger than the tolerance before unwrapping, and smaller after unwrapping. In the case of a tolerance of pi/2, if, for example, x(i)=0 and x(i+1)=3, the jump is larger than the tolerance, but adding or subtracting 2*pi to x(i+1) does not improve things.
One work-around would be to multiply the input by 2, and divide by 2 after unwrapping:
unwrap(theta_atan * 2) / 2
However, it is always best to use atan2 to obtain an angle.
The second argument to unwrap is not the period of the input data, but the tolerance. The function always unwraps data assuming a 2π interval. That is, it wants to see that x(i)-x(i+1) is larger than the tolerance before unwrapping, and smaller after unwrapping. In the case of a tolerance of pi/2, if, for example, x(i)=0 and x(i+1)=3, the jump is larger than the tolerance, but adding or subtracting 2*pi to x(i+1) does not improve things.
One work-around would be to multiply the input by 2, and divide by 2 after unwrapping:
unwrap(theta_atan * 2) / 2
However, it is always best to use atan2 to obtain an angle.
Atan takes single argument and Atan2 takes two arguments.The purpose of using two arguments instead of one is to gather information on the signs of the inputs in order to return the appropriate quadrant of the computed angle, which is not possible for the single-argument Atan

Atan2 result is always between -pi and pi.
Reference: https://en.wikipedia.org/wiki/Atan2
docstring for math.atan:
atan(x) Return the arc tangent (measured in radians) of x.
docstring for math.atan2:
atan2(y, x) Return the arc tangent (measured in radians) of y/x. Unlike atan(y/x), the signs of both x and y are considered.
To be very complete, here's what the doc says about atan2:
math.atan2(y, x) Return atan(y / x), in radians. The result is between -pi and pi. The vector in the plane from the origin to point (x, y) makes this angle with the positive X axis. The point of atan2() is that the signs of both inputs are known to it, so it can compute the correct quadrant for the angle. For example, atan(1) and atan2(1, 1) are both pi/4, but atan2(-1, -1) is -3*pi/4.
So it's pretty clear: the outputs are different because of the signs of ImZ and ImR. atan2 returns the appropriate quadrant, unlike atan.