factored out convert angle to cart function
@@ -192,7 +192,14 @@ def get_channelpos_from_angle(channame, chan_pos_list=CHANNEL_10_20_APPROX):
if i[0].lower() == channame:
# convert the 90/4th angular position into x, y, z
p = i[1]
- ea, eb = p[0] * (90 / 4), p[1] * (90 / 4)
+ x, y = _convert_2d_angle_to_2d_coord(*p)
+ return x, y
+ return None
+
+
+def _convert_2d_angle_to_2d_coord(a,b):
+ # convert the 90/4th angular position into x, y, z
+ ea, eb = a * (90 / 4), b * (90 / 4)
ea = ea * math.pi / 180
eb = eb * math.pi / 180
x = math.sin(ea) * math.cos(eb)
@@ -214,4 +221,3 @@ def get_channelpos_from_angle(channame, chan_pos_list=CHANNEL_10_20_APPROX):
x *= mu
y *= mu
return x, y
- return None
