Skip to content
This repository has been archived by the owner on Jun 16, 2018. It is now read-only.

Commit

Permalink
Merge d007d6d into af164ad
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed May 24, 2016
2 parents af164ad + d007d6d commit 1f38253
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
0.8 (unreleased)
----------------

- No changes yet.
- Fix a bug that caused WCSAxes to crash when trying to transform arrays with
zero coordinates.

0.7 (2016-05-06)
----------------
Expand Down
10 changes: 8 additions & 2 deletions wcsaxes/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ def transform(self, world):
if world.shape[1] != self.wcs.wcs.naxis:
raise ValueError("Second dimension of input values should match number of WCS coordinates")

pixel = self.wcs.wcs_world2pix(world, 1) - 1
if world.shape[0] == 0:
pixel = np.zeros((0, 2))
else:
pixel = self.wcs.wcs_world2pix(world, 1) - 1

if self.slice is None:
return pixel
Expand Down Expand Up @@ -162,7 +165,10 @@ def transform(self, pixel):

pixel_full += 1

world = self.wcs.wcs_pix2world(pixel_full, 1)
if pixel_full.shape[0] == 0:
world = np.zeros((0, 2))
else:
world = self.wcs.wcs_pix2world(pixel_full, 1)

# At the moment, one has to manually check that the transformation
# round-trips, otherwise it should be considered invalid.
Expand Down

0 comments on commit 1f38253

Please sign in to comment.