Skip to content

Commit

Permalink
Make it robust for tuples with less than 3 elements
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobachetti committed Mar 19, 2024
1 parent 1761758 commit 2c5061a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion basie/valid_angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def __new__(cls, angle, unit=u.deg, wrap_angle=360 * u.deg, **kwargs):
if isinstance(angle, tuple) and unit in (u.deg, u.hour):
# The tuple of values does not work with astropy Angle, due to
# its ambiguous behavior when the degree value is 0.
angle = angle[0] + angle[1] / 60 + angle[2] / 3600
final_angle = 0.
for i, a in enumerate(angle[:3]):
final_angle += a * 60**(-i)

was_tuple = True
self = Angle.__new__(cls, angle, unit=unit, **kwargs)
self.original_unit = unit
Expand Down

0 comments on commit 2c5061a

Please sign in to comment.