Repository navigation
Conversation
Apply a time window built from pairs of bounds: start <= end fades out (ones, falling half window, zeros), start > end fades in, several pairs multiply, and symmetric mirrors the window about the centre of the signal. Bounds in seconds or zero based samples; the slope has abs(end - start) + 1 samples and is one half of a symmetric window twice as long, so a hann slope ends at exactly zero. Follows ita_time_window of the ITA-Toolbox (RWTH Aachen), without the move of the bounds to even sample numbers. Tests pin each rule on a signal of ones and compare five cases sample by sample with the ITA-Toolbox output stored in tests/golden/time_window_ita.mat, which tests/golden/make_time_window_ita.m regenerates with MATLAB.
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
pytta.time_window(signalObj, interval, unit='time', window='hann', symmetric=False).The window is built from pairs of bounds.
start <= endis a fade out (ones, falling half window, zeros);start > endis a fade in; several pairs multiply, so the usual impulse response window is[fadeInEnd, 0, fadeOutStart, fadeOutEnd].symmetric=Truemirrors the window about the centre of the signal, for slightly non causal impulse responses. Bounds are given in seconds or in zero based samples. The slope hasabs(end - start) + 1samples and is one half of a symmetric window twice as long, so ahannslope ends at exactly zero. The input is not modified; a newSignalObjwith the same metadata is returned.The behaviour follows
ita_time_windowof the ITA-Toolbox (RWTH Aachen), except that the bounds are not moved to even sample numbers. The implementation is written from the documented behaviour; no ITA code is copied.Tests (
tests/test_time_window.py, 9 tests):tests/golden/time_window_ita.mat(79 kB), generated bytests/golden/make_time_window_ita.mwith MATLAB and the ITA-Toolbox. Measured difference: 5e-8 of the signal peak, the float32 floor ofSignalObj.Checked with Python 3.12, numpy 1.26, 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. NumPy 2 support is in #53.Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com