1.9 KiB
pytfd-compat
pytfd-compat is a Python 3 compatibility layer for the small pytfd API
surface in this repository. It keeps the original centered-window STFT behavior
available while fixing the weak points in the older ports:
- explicit padding behavior
- consistent window construction
- tests for the core transforms
- example programs that exercise the API
Replacement assessment
Modern libraries already cover parts of the old pytfd feature set:
- SciPy provides production-quality STFT and ISTFT support.
- librosa provides a higher-level STFT API for audio workflows.
tftbprovides a larger collection of time-frequency distributions.
Those are useful building blocks, but none is a clean drop-in replacement for
the legacy pytfd module layout and its dense centered-window STFT semantics.
This package therefore implements the original transforms directly and uses
modern SciPy window generation where it helps.
Licensing and provenance
The original upstream codebase was located at code.google.com/archive/p/pytfd/
and is MIT licensed. This compatibility package preserves that lineage while
modernizing the implementation for Python 3.
What is included
pytfd_compat.stft.stftpytfd_compat.stft.specpytfd_compat.wd.wdpytfd_compat.pwd.pwdpytfd_compat.sm.smpytfd_compat.windows.get_window- validation scripts comparing against SciPy and, when installed,
tftb
Install
python -m pip install -e ./pytfd_compat
Test
cd pytfd_compat
pytest
Validation
cd pytfd_compat
PYTHONPATH=src python validation/run_validation.py
This runs reproducible comparisons against SciPy's ShortTimeFFT and reports
alignment, numerical differences, and timing. If tftb is installed, the same
script can extend the comparison set.
Examples
python examples/basic_stft.py
python examples/distributions_demo.py
If matplotlib is installed, the examples can also render images.