-
Notifications
You must be signed in to change notification settings - Fork 62
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
WCS information lost in unit conversion of LowerDimensionalObject #256
Conversation
It seems this is true for slicing as well. |
Yeah, I've run into this. It shouldn't be too hard. PR may be forthcoming. |
@e-koch care to review this? |
|
||
if new_qty.ndim < 2: | ||
# do not return a projection | ||
return u.Quantity(new_qty) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what should be returned here. If a Quantity
is returned, then you still lose all of the WCS info. If you have a PV slice, you would want a OneDSpectrum
when slicing along the spectral axis, but something else when slicing in the spatial dimension.
Could we check for the axis type when a slice reduces ndim<2
? A OneDSpectrum
would be returned when the remaining axis is spectral. I'm not sure how to treat 1D spatial slices. Treat it like a mock-projection with a 1 pixel second dimension or define a spatial 1D slice class? Is there a use case for such a thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be. I chose to ignore it for now because it's not trivial, but I think we could inspect the WCS and see if one of the axes is spectral; if so, we'd then return the OneDSpectrum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I think for single pixels, we really want to drop all the way to a Quantity
with no wcs information
@keflavich - Apart from the one comment, it looks good! I tested on the use case the brought this up and everything checks out. Depending on what you think about the comment above, |
There is a bug in WCS that prevents creating 1D slices from 2D WCSs that are half celestial, half spectral:
I'll make a separate issue for this. |
WCS information lost in unit conversion of LowerDimensionalObject
A similar custom
to
attribute should be defined (as is already done forSpectralCube
).