Skip to content

Commit

Permalink
🎨 Improve WCS instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
Xen0Xys committed May 28, 2024
1 parent c6d9b5f commit 727e3d8
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/ipyaladin/aladin.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,9 @@ def wcs(self) -> WCS:
"You need to call synchronize_wcs before accessing the wcs attribute. "
"The WCS attribute need to be accessed from the next cell."
)
wcs = WCS(naxis=self._wcs["NAXIS"])
wcs.wcs.cdelt = [self._wcs["CDELT1"], self._wcs["CDELT2"]]
wcs.wcs.crpix = [self._wcs["CRPIX1"], self._wcs["CRPIX2"]]
wcs.wcs.crval = [self._wcs["CRVAL1"], self._wcs["CRVAL2"]]
wcs.wcs.ctype = [self._wcs["CTYPE1"], self._wcs["CTYPE2"]]
wcs.wcs.cunit = [self._wcs["CUNIT1"].strip(), self._wcs["CUNIT2"].strip()]
wcs.wcs.radesys = self._wcs["RADECSYS"].strip()
wcs.array_shape = (self._wcs["NAXIS2"], self._wcs["NAXIS1"])
return wcs
if "RADECSYS" in self._wcs: # RADECSYS keyword is deprecated for astropy.WCS
self._wcs["RADESYS"] = self._wcs.pop("RADECSYS")
return WCS(self._wcs)

def synchronize_wcs(self) -> None:
"""Synchronize the WCS of the Aladin Lite widget with the given WCS."""
Expand Down

0 comments on commit 727e3d8

Please sign in to comment.