Repository navigation
Conversation
group_delay(signal) returns the group delay of each channel in seconds,
from the derivative of the spectrum, Re{DFT(n x[n]) / DFT(x[n])} / fs,
which needs no phase unwrapping.
coherence(x, y, winSize=1024) returns the magnitude squared coherence
with scipy.signal.coherence (Welch, Hann, 50 % overlap). Channels are
paired one to one, and a single channel is paired with all of the other.
cepstrum(signal, kind='complex') returns the real or complex cepstrum.
For the complex one the integer linear phase is removed first and
returned, and icepstrum(cepstrumObj, delay) inverts it. The magnitude
floor is the same as in minimum_phase.
generate.mls(order, samplingRate) returns one period of a symmetrical
MLS from scipy.signal.max_len_seq, and mls_deconvolution(response,
order) recovers the impulse response by periodic cross-correlation
normalized by L + 1. With more than one period the first is dropped and
the others are averaged.
Tests pin the group delay of a pure delay and of a first order allpass,
the coherence of a noisy filtered signal against SNR / (1 + SNR), the
cepstra of a minimum phase filter against the analytic series, the
complex cepstrum round trip with its delay, the exact MLS
autocorrelation and the deconvolution of a FIR with its known offset
-sum(h) / (L + 1).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.functionsfour plots that the ITA-Toolbox has (ita_plot_groupdelay,ita_plot_nyquist,ita_plot_zplaneandita_plot_polar). Each one returns the matplotlib Figure:plot_group_delay(*sigObjs, xLim=None, yLim=None, title=None): the group delay of every channel, in ms, on a logarithmic frequency axis, fromgroup_delayof [FEATURE] add group_delay, coherence, cepstrum and MLS #80.plot_nyquist(*sigObjs, title=None): the imaginary against the real part of the spectrum (freqSignal, asplot_freqshows it) of every channel.plot_zplane(zeros, poles, title=None): zeros and poles with the unit circle;scipy.signal.tf2zpk(b, a)gives them from the coefficients.plot_polar(angles, levels, labels=None, rLim=None, title=None): a directivity, levels in dB against angles in degrees with 0 to the front, one column per curve, closed at the first angle.This pull request builds on #80 and shows its commit until #80 is merged.
The tests in
tests/test_plot_more.pyread the plotted data back:plot_zplaneare at the zeros and poles of a fourth-order Butterworth filter.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