Skip to content

Commit

Permalink
Imviz: Show coordinates in degrees too
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim committed Nov 23, 2021
1 parent 0124f3b commit a77e7b7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions jdaviz/configs/imviz/plugins/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ def on_mouse_or_key_event(self, data):
# we aren't actually guaranteed to get a SkyCoord out, just for images
# with valid celestial WCS
try:
celestial_coordinates = (image.coords.pixel_to_world(x, y).icrs
.to_string('hmsdms', precision=4, pad=True))
coo = image.coords.pixel_to_world(x, y).icrs
celestial_coordinates = coo.to_string('hmsdms', precision=4, pad=True)
celestial_coordinates_deg = coo.to_string('decimal', precision=6, pad=True)
except Exception:
self.label_mouseover.world = ''
else:
self.label_mouseover.world = f'{celestial_coordinates:32s} (ICRS)'
self.label_mouseover.world = (f'{celestial_coordinates:32s} (ICRS)\n'
f'{celestial_coordinates_deg}')
else:
self.label_mouseover.world = ''

Expand Down

0 comments on commit a77e7b7

Please sign in to comment.