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.
This PR was originally supposed to fix slicing and arithmetic operations, and others things that were not working as expected which it does but not as trivially as before because in the process found some other deeper issues.
The
Spectrumobject now requires aspectral_axisto be given in all cases as either aQuantityorSpectralAxis. So the minimum requirement to create aSpectrumis now a data array and corresponding spectral axis (matching at least one dimension of the data). If aWCSis also given we try to ensure the givenspectral_axis"matches" the givenWCSat lest in terms of the bin centers. In doing some of this it became obvious I don't have a clear idea of what the API should be some of the could maybe be made less convoluted with sunpy/ndcube/pull/713In the interest of expediency and I think we should limit the API we can always expand it later much harder to reduce but we should discuss this.
Still some code be removed because we now require a
spectral_axisand also edge cases e.g if you slice away the spectral_axis what should happen - get a NDCube, error ...There is currently some code to automatically find the
spectral_axis_indexwhich is nice but again for the moment we could also require that as would simplify the code?Also the
__init__is mess hard to follow and sometime has self referencing calls I think could be refactored to be more linear and straightforward but don't want to do that until we have some discussion agreement