From 2c5061add3e8503e10b4ab53f37fa4f8c673da10 Mon Sep 17 00:00:00 2001 From: Matteo Bachetti Date: Tue, 19 Mar 2024 19:18:35 +0100 Subject: [PATCH] Make it robust for tuples with less than 3 elements --- basie/valid_angles.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/basie/valid_angles.py b/basie/valid_angles.py index dede009..76a9793 100644 --- a/basie/valid_angles.py +++ b/basie/valid_angles.py @@ -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