Repository navigation
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Nov 1, 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.
Adds to
pytta.functionsthe two fits ofita_prony_analysisof the ITA-Toolbox, which give the coefficients of an IIR filter from a measured response:prony(h, nb, na): Prony's method in the time domain (Parks and Burrus, Digital Filter Design, 1987). The denominator fits the samples afternbby least squares, and the numerator then matches the firstnb + 1samples exactly.invfreqz(H, w, nb, na, weights=None): the linear equation error fit in the frequency domain of Levi, "Complex curve fitting", IRE Trans. Automatic Control 4(1), 1959, which minimizes Σ weights |B(w) - H(w) A(w)|², as MATLAB'sinvfreqzwithout iterations. SciPy has no such function.Both return
bandawitha[0] = 1;scipy.signal.tf2zpk(b, a)gives the zeros and poles thatita_prony_analysisreturns. The ITA-Toolbox calls MATLAB'sinvfreqzand, for the time domain,pdi_prony, a copy of MATLAB'sprony; neither was ported, and both functions here are written from the references.The tests in
tests/test_prony.pyrecover known filters and print the largest relative difference of the coefficients:pronyrecovers a filter with three zeros and the five poles of a Chebyshev type I filter from 200 samples of its impulse response (9.0e-14).invfreqzrecovers a fourth-order Butterworth filter from its response at 512 frequencies (1.2e-14).Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of
development(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