-
-
Notifications
You must be signed in to change notification settings - Fork 129
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 spectral axis to be anywhere, instead of forcing it to be last #999
Conversation
Codecov Report
@@ Coverage Diff @@
## main #999 +/- ##
==========================================
+ Coverage 70.09% 70.47% +0.37%
==========================================
Files 64 64
Lines 4344 4396 +52
==========================================
+ Hits 3045 3098 +53
+ Misses 1299 1298 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I finally have all tests passing for this, so I'm moving it to ready for review. I still need to update some of the narrative docs, and I'm sure there are a couple things that I haven't considered/weren't caught by the tests, so extra eyes are welcome. |
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 think this looks good, but there's also a lot of change to uncertainty things - is that unrelated cleanup being smuggled in? Fine by me if it is, but I didn't review that carefully.
The addition to the narrative docs will be needed, so approval waits on that. Spectrum1D.spectral_axis_index
is the key variable, right?
The uncertainty stuff was mostly deletions of the handling for making sure the uncertainty also got reordered when moving the spectral axis to last. The rest of the diffs with uncertainty in them are just adding another argument after uncertainty in function calls. |
I pushed a small update to the docs to change from specifying that the spectral axis is always last to saying that it can be anywhere. |
If we do this, how do we know how to access the |
It should be by explicitly identifying the axis type, e.g., |
Re: #999 (comment) -- How would the spatial component work in terms of |
re: #999 (comment), should be |
|
Ah, right. Then I'm not sure. That's the API I'd like to see & use, and it's what I've had in mind during our conversations on the topic, but maybe it's a little more complicated because we need to use the more general APE14 version that can handle spatial axes unassociated with celestial coordinates. |
@rosteen , any input on #999 (comment) ? |
@pllim I've done some investigating on this to refresh my memory, since I still don't mess with GWCS that often. For the spectral axis at least, with this PR you can use Is that a sufficient answer to your question? (and did I actually answer the question you were asking? 😆 ) |
FYI I edited the initial description to include the context of why I think we should do this - I'll also add some more information to the narrative docs about the change. |
Not sure. Yes, it is about the mouseover. I just fixed a subtle bug over there (spacetelescope/jdaviz#2009). It is very subtle because even if you mess up the axes order in your Indeed, |
…k so I'm committing here
Closing this in favor of #1033 (merging into a new specutils 2.0 development branch for now rather than |
Currently under heavy development (in other words, super broken 😆 ).
Edit to provide context in the initial comment:
The motivation for this is that the insistence on the spectral axis being last hinders integration with other packages that make different (or no) assumptions on the location of the spectral axis. The two biggest examples, currently, are that
spectral-cube
assumes that the spectral axis is first, and they would be interested in usingspecutils
objects as the basis of their code but are hindered by our assumption. We don't need to switch to that assumption, I think being flexible here is the right call.jdaviz
also had to do a lot of coding aroundGlue
assumptions about where the spectral axis is as well, since they differ from ours.I have also been concerned for a while that
specutils
putting the flux axis into a different order than a user would get out fromastropy.io.fits
is potentially confusing and/or a barrier to uptake ofspecutils
. In my mind at least, this combined with the above outweighs the convenience of numpy broadcasting properly automatically if you index solely on the spectral axis when it is last for a multi-dimensionalSpectrum1D
, which if I'm recalling correctly was the motivation for forcing the spectral axis to be last.I do think that it would be useful to provide a
spectral_axis_location
keyword when initializing aSpectrum1D
so that users could either get the legacy behavior (force it to be last) or do the opposite (force first) if desired, which I haven't yet implemented here. I could get that in before merging this, but I also think that I'm going to end up closing this PR and reopening it to merge into a newv2.0-dev
branch to keep these breaking changes out ofmain
for now, so I could also open a followup PR to that branch after this is merged.