-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Convenience tool for up/downsampled spatial WCS #260
Comments
We have some functionality in ndcube which can do this kind of thing for any ape 14 WCS. |
could you link it here? |
https://github.com/sunpy/ndcube/blob/main/ndcube/wcs/wrappers/resampled_wcs.py#L7 I couldn't dig it up on my phone 🙈 These are things which were planning on being upstreamed to astropy but were instead taken into ndcube to incubate them for a bit. |
Thanks. That looks useful, but reproject doesn't support APE14 now, so we can't use it directly. |
Uh, rather, reproject does support APE14... #166... but... my example doesn't. |
Why doesn't your example? |
from ndcube.wcs.wrappers import ResampledLowLevelWCS
from spectral_cube import SpectralCube
import reproject
# read whatever random cube I have laying around
cube = SpectralCube.read('G000.00+00.00_H2CO_2pol.fits')[:25,:20,:21]
ww = ResampledLowLevelWCS(cube.wcs, [2,2,1])
reproject.reproject_interp(cube[0].hdu, ww) gives
|
It should work: Line 117 in 43b0d8a
but doesn't. |
Oh. reproject wants a high-level WCS, but we only have a low-level WCS. What do we do to wrap this to get a high-level WCS? |
aha, got it: from ndcube.wcs.wrappers import ResampledLowLevelWCS
from spectral_cube import SpectralCube
import reproject
reproject.reproject_interp(cube[0].hdu, ww)
from astropy.wcs.wcsapi import HighLevelWCSWrapper
# read whatever random cube I have laying around
cube = SpectralCube.read('G000.00+00.00_H2CO_2pol.fits')[:25,:20,:21]
ww = ResampledLowLevelWCS(cube.wcs.celesital, 2)
reproject.reproject_interp(cube[0].hdu, HighLevelWCSWrapper(ww), shape_out=(10,10)) |
|
and |
One use case for reproject is to resample data onto a new grid to enable direct comparison between images. For objects on different parts of the sky, this comparison can be done by keeping the WCS centers the same (or specifying a WCS center) and changing the pixel size - which is different from, but somewhat related to, what
find_optimal_celestial_wcs
does.Suggested feature is a tool to make a WCS with a spec like:
where for resampling you would do something like:
cc @privong
The text was updated successfully, but these errors were encountered: