Skip to content
Snippets Groups Projects
Commit bb27d4f1 authored by Sepehr Madani's avatar Sepehr Madani
Browse files

Adds wrapToPi function for angles

parent 46e01594
No related branches found
No related tags found
No related merge requests found
from math import cos, acos, pi
from numpy import arange
from cmath import exp, phase
def deg_to_u(degrees):
return [cos(x * pi / 180) for x in degrees]
......@@ -9,3 +10,11 @@ def range_in_deg(res):
def u_to_deg(u):
return [acos(x) * 180 / pi for x in u]
def vectorWrapToPi(vector):
"""Wraps a list of angles in the [-π, π] range."""
return [wrapToPi(x) for x in vector]
def wrapToPi(theta):
"""Wraps an angle in the [-π, π] range."""
return phase(exp(1j * theta))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment