Python/ Numpy How to use arctan or arctan2 on the interval 0, pi/2?
<p>Is it possible use the arctan or arctan2 numpy functions with the result always on the 1st quadrant (0,pi/2)?
Thanks</p>

<p>if you want to calculate the minimum "deviation" angle (in the interval <code>[0,pi/2]</code>) between the <code>x</code>-axis and the segment connecting points (0, 0) and (x, y), you could use:</p>

<pre><code>phi = numpy.arctan2(y, x)
phi = min(abs(phi), math.pi - abs(phi))
</code></pre>

<p>or:</p>

<pre><code>phi = numpy.arctan2(abs(y), abs(x))
</code></pre>

python numpy trigonometry