Skip to content

Preserve wave0 and wave attributes on SpectralGradient indexing and slicing - #458

Closed
DYNOSuprovo wants to merge 1 commit into
NASA-Planetary-Science:mainfrom
DYNOSuprovo:fix/457-spectral-gradient-wave0-indexing
Closed

DYNOSuprovo wants to merge 1 commit into
NASA-Planetary-Science:mainfrom
DYNOSuprovo:fix/457-spectral-gradient-wave0-indexing

Conversation

@DYNOSuprovo

Copy link
Copy Markdown

Fixes #457

Summary of Changes

  • Implement __array_finalize__(self, obj) in SpectralGradient to preserve wave0 and wave attributes when slicing, indexing, or copying instances.
  • In SpectralGradient.__new__, preserve existing wave and wave0 attributes when converting or re-instantiating SpectralGradient instances unless explicitly overridden.
  • Add test coverage in sbpy/spectroscopy/tests/test_specgrad.py verifying that scalar indexing, subarray slicing, copying, and re-instantiation preserve wave0 and wave.
  • Update CHANGES.rst under v0.7.0 (unreleased) -> Bug Fixes -> sbpy.spectroscopy.

@github-actions

Copy link
Copy Markdown

Thank you for your contribution to sbpy, an Astropy affiliated package! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the sbpy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related?
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label.
  • Is a milestone added?

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to sbpy 👋 and congratulations on your first pull request! 🎉

A project member will respond to you as soon as possible; in the meantime, please have a look over the Checklist for Contributed Code at Astropy and make sure you've addressed as many of the questions there as possible and relevant for sbpy.

@DYNOSuprovo DYNOSuprovo closed this Oct 3, 2026
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.

SpectralGradient loses normalization wavelength

1 participant