Skip to content

Commit

Permalink
Make pixel index correspond to center of pixel in viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Jul 28, 2021
1 parent 24cb2cf commit dc63626
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions astrowidgets/bqplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,11 @@ def set_data(self, image_data, reset_view=True):

# Set the image data and map it to the bqplot figure so that
# cursor location corresponds to the underlying array index.
# The offset follows the convention that the index corresponds
# to the center of the pixel.
self._image.image = image_data
self._image.x = [0, self._image_shape[1]]
self._image.y = [0, self._image_shape[0]]
self._image.x = [-0.5, self._image_shape[1] - 0.5]
self._image.y = [-0.5, self._image_shape[0] - 0.5]

@property
def center(self):
Expand Down

0 comments on commit dc63626

Please sign in to comment.