Repository navigation
Conversation
For signalType 'power', _ifft multiplied the whole half spectrum into the AC slice [1:, :], one row short, so building a SignalObj from a spectrum (domain='freq') raised a broadcast error. Index [1:, :] on both sides; the round trip time -> freq -> time closes at the float32 floor. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Smooth the magnitude spectrum over 1 / nthOct octave and keep the phase. The magnitude is interpolated onto a 1 cent logarithmic grid spanning the 20 octaves below Nyquist, box averaged over 1200 / nthOct cents (made odd, shrinking at the ends of the grid) and interpolated back onto the bins with a not-a-knot cubic spline. The DC bin is copied. Follows the LogFreqOctave1 smoothing of ita_smooth in the ITA-Toolbox (RWTH Aachen). Tests pin each rule on spectra built bin by bin and compare 1, 1/3 and 1/12 octave with the ITA-Toolbox output stored in tests/golden/smooth_frequency_ita.mat, which tests/golden/make_smooth_frequency_ita.m regenerates with MATLAB. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
plot_freq and SignalObj.plot_freq smoothed the dB curve with a Savitzky-Golay filter of 31 bins, a width in bins rather than in octaves. smooth now applies smooth_frequency: True for a third of an octave, a number n for 1/n octave. plot_phase draws the phase in degrees on the same logarithmic frequency axis, unwrapped by default, through the same plotting function as the magnitude. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 31, 2026
This branch has not been deployed
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.
This PR builds on #50, whose two commits come first, since it uses
smooth_frequency. The change proposed here is the last commit.plot_freqandSignalObj.plot_freqsmoothed the dB curve withscipy.signal.savgol_filterover 31 bins, a width in bins, so the same option smoothed a 1 s signal and a 10 s signal differently, and the docstring called it preliminary.smoothnow appliessmooth_frequencyto the magnitude:smooth=Truegives a third of an octave andsmooth=ngives 1/n octave.plot_phaseis new. It draws the phase in degrees on the same logarithmic frequency axis asplot_freq, unwrapped by default. It goes through the same plotting function as the magnitude, which now takesphase=True.The tests in
tests/test_plot_freq.pycheck the data of the plotted lines. Withsmooth=3and withsmooth=Truethe curve is the magnitude ofsmooth_frequency(signal, 3), and the phase of a delay of 12 samples is the line -360 f d / fs. Both tests fail with the previous code.Checked with Python 3.12, numpy 1.26 and scipy 1.17. The existing tests behave as on
development: the 7 failures there (3 intest_h5io.py, 4 intest_pyttasave.py) are the same with and without this change.Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com