Skip to content

Commit 71e0804

Browse files
cppartsbmatthieu3
authored andcommitted
updating to allow for astropy angles
1 parent 5bd3c35 commit 71e0804

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/ipyaladin/widget.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,16 +309,22 @@ def rotation(self) -> float:
309309
Positive angles rotates the view in the counter clockwise
310310
order (or towards the east).
311311
312+
It can be set with either a float number in degrees
313+
or an astropy.coordinates.Angle object.
314+
312315
Returns
313316
-------
314-
float
315-
The center rotation of the widget in degrees.
316-
The default rotation is 0 degrees.
317+
astropy.coordinates.Angle
318+
An astropy.coordinates.Angle object representing the center
319+
rotation of the widget in degrees. The default rotation is
320+
0 degrees.
317321
"""
318-
return self._rotation
322+
return Angle(self._rotation, unit="deg")
319323

320324
@rotation.setter
321-
def rotation(self, rotation: float) -> None:
325+
def rotation(self, rotation: Union[float, Angle]) -> None:
326+
if isinstance(rotation, Angle):
327+
rotation = rotation.deg
322328
if np.isclose(self._rotation, rotation):
323329
return
324330
self._wcs = {}

0 commit comments

Comments
 (0)