feature: add frequency_at_index method to GenericSpectrogram (#129).#172
feature: add frequency_at_index method to GenericSpectrogram (#129).#172dhanushsaimudari wants to merge 4 commits intosunpy:mainfrom
Conversation
|
Thanks for the PR just a few housekeeping issues please retain and use the PR template which is created when the PR is opened. (You can see it here: https://github.com/sunpy/.github/blob/main/.github/PULL_REQUEST_TEMPLATE.md) Also, please note, as discussed on the #129, this isn’t really ready for work until after the decision on the underlying data structure for the Spectrogram object. |
|
Thank you for the feedback! @samaloney I have updated the PR description to follow the official template. I understand that the data structure decision for the Spectrogram object is still pending; I'm happy to keep this PR as a draft or wait for the decision before making further adjustments. Also I'm looking at the background subtraction task. Are we prioritizing a specific algorithm like constant-median subtraction for the initial implementation, or are we more focused on the pluggable API structure first? |
Added the frequency_at_index method to the GenericSpectrogram class. This method allows users to retrieve the physical frequency value associated with a specific array index along the frequency axis.
The implementation includes:
-Validation logic to ensure the provided index is within the bounds of the frequency axis.
-Raising a descriptive IndexError if the index is out of range, helping users debug data mapping issues.
AI Assistance Disclosure
AI tools were used for :
[x] Code generation (Initial drafting of the method structure)
[x] Research and understanding (Clarifying rST syntax for the changelog)
Note: I have manually verified the logic using a local test suite with dummy spectrogram data to ensure the mapping is accurate.
Related Issues
Closes #129