-
Notifications
You must be signed in to change notification settings - Fork 65
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
WIP: Keep full 3D WCS objects for LDOs #395
Open
keflavich
wants to merge
12
commits into
radio-astro-tools:master
Choose a base branch
from
keflavich:keep_full_wcs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tests are pretty close to passable, but they fail for the aplpy case because now we're writing out HDUs with 3 dimensions for a 2 dimensional object. We just need to tell that to aplpy in the vis calls... |
wcs_pix2world allows (so if you've 'dropped' a dimension, allow indexing with ndim-1 coordinates)
operation makes a non-self-consistent WCS object, i.e., one where `wcs.naxis != wcs.wcs.naxis`, which is supposed to be impossible, and unfortunately is beyond my immediate capability to debug because that part is not written in python
17 tasks
We really need this, unfortunately. Here's an example case I had to do to get WCSes attached properly: for fn in cubefns:
cube = SpectralCube.read(fn).subcube_from_regions([reg])
print(cube)
avg = cube.mean(axis=(1,2))
hdu = avg.hdu
y,x = cube.wcs.celestial.world_to_pixel(reg.center)
slc = getslice()[int(floor(x)):int(ceil(x)), int(floor(y)):int(ceil(y)), :]
ww = wcs_utils.slice_wcs(cube.wcs, slc, numpy_order=False)
hdu.header.update(ww.to_header())
hdu.data = hdu.data[None,None,:] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #111, #367, #392, #394:
When slicing or projecting a cube, there is generally still a 3rd dimension,
even if it is not reflected in the data. Currently, if you attempt to do
anything with the WCS of a position-velocity slice, the WCS crashes, and we
want to avoid that.
There are big open questions though:
.max
?axis) is the appropriate coordinate?
in slices, I think all of these questions are easily answered.
We will need to provide convenience functions (WCS wrappers) to get the
coordinates in projections and slices, because most users will never care about
the sliced-over axes, or they will care but only want to see them as metadata.
cc @e-koch, who has contributed significantly to this discussion already.