-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle units on input #162
Comments
@jdavies-st |
Ah, I see! |
I encountered this same error at ejeschke/ginga#719 but it is not obvious how I can use def radectopix(self, ra_deg, dec_deg, coords='data', naxispath=None):
# NOTE: origin is always 0, coords unused.
args = [ra_deg, dec_deg]
if naxispath:
args += [0] * len(naxispath)
skycrd = np.array([args], np.float_)
try:
xy = np.squeeze(self.wcs.world_to_pixel_values(skycrd))[:2]
except Exception as e:
self.logger.error(
"Error calculating radectopix: {}".format(str(e)))
raise common.WCSError(e)
return xy p.s. |
This ticket is now being tracked at AL-34 |
I think this can be closed?! |
Yes, I think so, as APE14 interface solves this. That said, there's still not very good documentation within the |
Right, the documentation needs a lot of work. Hopefully we can do some soon. |
The
gwcs.WCS.__call__
function has awith_units
parameter that can be used to return anastropy.coordinates.SkyCoord
object with units.But if one tries to round trip this by taking this
astropy.coordinates.SkyCoord
object and feed it back into thebackward_transform
, then it fails, as it's expecting N inputs, where N is the number of dimensions inside theSkyCoord
object.Following the example from the docs, we construct a simplified
gwcs.WCS
object:And then test it out:
Now, one can decompose the
SkyCoord
object by hand, but even here we have to be careful.One can jettison the units altogether, and it eventually works.
But the
with_units
parameter only seems defined on theWCS.__call__
method, notWCS.forward_transform
orWCS.backward_transform
.This is mostly to document this behavior to take into account any changes to the calling API that might be made in the future.
The text was updated successfully, but these errors were encountered: