Repository navigation
Smooth log-uniform spectra on their native samples in smooth_vel_fft - #51
Open
Nikhil0504 wants to merge 3 commits into
Open
Nikhil0504 wants to merge 3 commits into
Nikhil0504 wants to merge 3 commits into
Conversation
Owner
|
Hi @Nikhil0504 thanks. Yes I've recently gone over sedpy smoothing and noticed some issues. Barely critically sampled spectra are certainly a concern, there's an (inelegant) attempt to handle it in prospector (https://github.com/bd-j/prospector/blob/main/prospect/observation/observation.py#L557) I am working on a wholesale replacement (with gradients), but I will try to give this a look soon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
smooth_vel_fftalways resamples the input onto a power-of-two log grid withnp.interp(
resample_wave) before the FFT. For spectra that are only just sampled, the linear interpolation alters absorption lines before the kernel is applied, sofftsmooth=Trueno longer agrees with the direct convolution ofsmooth_vel.Changes
smooth_vel_fft: if the input is already uniform in log wavelength, smooth the native samplesand skip
resample_wave. Other grids take the existing path unchanged.smooth_fft: passn=len(spec)toirfft, so odd-length input keeps its length (needed oncenative grids are used; even lengths give identical results).
Tests
New
tests/test_smoothing.py: FFT vs direct convolution on a barely sampled log-uniform spectrum(agree to 1e-6; ~1e-15 measured), odd-length input, and a non-uniform grid that still takes the
resampled path. Two of these fail on current main (odd length, FFT vs direct).
Note: CI runs only
tests/tests.py; changing the workflow topytest tests/would include them.