-
-
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
Allow greater flexibility in crop bounds order #608
Comments
Hi @rosteen. Thanks for this comment. I tried to make this work when we were redesigning A further complication may be I can't say that I convinced myself that what you want is definitely impossible, but nor could I prove to myself that it was definitely possible and so we required that the inputs be given in an order that can be transparently be passed to the WCS. But if you are able to prove that this can be unambiguously determined in all cases and can come up with some (preferably) not complicated logic then that would be a great addition to |
Having thought more, I think it should be possible to implement this by first checking if there is repetition of types in the WCS components. If there is repetition then the inputs are passed to the WCS without order sanitisation as is currently done. If there isn't repetition, sanitisation can be performed. In this scenario, it could also be possible to drop the need to include The concern I'd have about this thought is that it would result in different behaviours depending on the underlying WCS and break our policy that all APIs should ideally work for all valid One solution would be to raise a warning whenever world type duplication is detected and tell the user that the order now matters and possible what the required order is for that WCS. Although raising a warning for valid operations is not best practice and many users will ignore those warnings. All that said, I think in the majority of cases this functionality would be very convenient. |
Describe the feature
I recently noticed while doing some work in
specutils
(see https://github.com/astropy/specutils/pull/1033/files#r1134253955) that when providing both a sky coordinate and spectral coordinate as bounds to the NDCubecrop
method, the physical types need to be in the same order as they appear in the WCS. For example, if the spectral axis is last in the WCS, you can do this:but not this:
It seems like it shouldn't matter in what order the
SpectralCoord
andSkyCoord
are provided, since in the WCS it's unambiguous which axes these apply to. I'm also not sure what would happen if you had the spectral axis in the middle of the WCS, (e.g., [RA, Wavelength, Dec]), which seems silly but isn't impossible. I propose adding some logic to make this a little more flexible and avoid the error trace that occurs currently if the bounds are provided out of order (I don't have the trace on hand right now, unfortunately, I can add it here later).Proposed solution
No response
The text was updated successfully, but these errors were encountered: