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>
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.
Adds four DSP utilities that the ITA-Toolbox has and PyTTa lacks (
ita_groupdelay,ita_coherence,ita_cepstrumandita_icepstrum,ita_generate_mls). The ITA code was read for its semantics only and nothing was copied.pytta.group_delay(signal): group delay of each channel in seconds, atsignal.freqVector. It uses the derivative of the spectrum, tau = Re{DFT(n x[n]) / DFT(x[n])} / fs, which needs no phase unwrapping.pytta.coherence(x, y, winSize=1024): magnitude squared coherence fromscipy.signal.coherence, with a Hann window and 50 % overlap. Channels are paired one to one, and a one-channel signal is paired with every channel of the other.pytta.cepstrum(signal, kind='complex')andpytta.icepstrum(cepstrumObj, delay): real and complex cepstrum and the inverse complex cepstrum. As in Oppenheim and Schafer, section 13.5, the integer linear phase is removed before the complex cepstrum and returned, so thaticepstrumcan put it back. The magnitude floor is the same as inminimum_phase([FEATURE] add minimum_phase for SignalObj #56), but this branch does not depend on [FEATURE] add minimum_phase for SignalObj #56.pytta.generate.mls(order, samplingRate)andpytta.mls_deconvolution(response, order): one period of a symmetrical maximum length sequence fromscipy.signal.max_len_seq, and the impulse response from the response to that sequence played periodically. The deconvolution is a periodic cross-correlation normalized by L + 1 (Peltonen 2000, eq. 2.14 to 2.22). With more than one period, the first is dropped and the others are averaged.The tests in
tests/test_dsp_utilities.pyprint the measured differences: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