Skip to content

Commit

Permalink
🐛 Try fixing planetary coordinate as target
Browse files Browse the repository at this point in the history
  • Loading branch information
Xen0Xys committed Aug 1, 2024
1 parent 2e1a97b commit afe0dd1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/ipyaladin/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import warnings

import anywidget
import astropy.units as u
from astropy.coordinates import SkyCoord, Angle, BaseBodycentricRepresentation
from astropy.coordinates.name_resolve import NameResolveError
from astropy.table.table import QTable
Expand Down Expand Up @@ -373,7 +374,9 @@ def target(self) -> Union[SkyCoord, BaseBodycentricRepresentation]:
frame="icrs",
unit="deg",
)
return BaseBodycentricRepresentation(lon, lat)
return BaseBodycentricRepresentation(
Angle(lon, unit="deg"), Angle(lat, unit="deg"), 0 * u.m
)

@target.setter
def target(self, target: Union[str, SkyCoord]) -> None:
Expand All @@ -391,7 +394,11 @@ def target(self, target: Union[str, SkyCoord]) -> None:
raise ValueError(
"target must be a string or an astropy.coordinates.SkyCoord object"
)
self._target = f"{target.icrs.ra.deg} {target.icrs.dec.deg}"
if isinstance(target, SkyCoord):
self._target = f"{target.icrs.ra.deg} {target.icrs.dec.deg}"
elif isinstance(target, BaseBodycentricRepresentation):
self._target = f"{target.lon.deg} {target.lat.deg}"
print(self._target)
self._wcs = {}
self.send(
{
Expand Down

0 comments on commit afe0dd1

Please sign in to comment.