Skip to content

Conversation

@samaloney
Copy link
Member

@samaloney samaloney commented Nov 20, 2025

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 Spectrum object now requires a spectral_axis to be given in all cases as either a Quantity or SpectralAxis. So the minimum requirement to create a Spectrum is now a data array and corresponding spectral axis (matching at least one dimension of the data). If a WCS is also given we try to ensure the given spectral_axis "matches" the given WCS at 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/713

In 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_axis and 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_index which 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant