Python Filter Design Analysis Tool
pyFDA is a GUI based tool in Python / Qt for analysing and designing discrete time filters. When the migen module is installed, fixpoint implementations (for some filter types) can be simulated and exported as synthesizable Verilog netlists.
More screenshots from the current version:
Binaries / Bundles
Currently, binaries (created with pyInstaller) are provided for 64 bit Win 7 ... 10 and for 64 bit Ubuntu (created with 2020.04). The binaries may work with other systems, too (untested). The binaries don't modify the system (except for two ASCII configuration files and a log file), they self-extract to a temporary directory that is automatically deleted when pyfda is terminated (except when it crashes). No additionaly software / libraries need to be installed. For details, see INSTALLATION.md.
pyFDA source code ist distributed under a permissive MIT license, binaries / bundles come with a GPLv3 license due to bundled components with stricter licenses.
- Python versions: 3.5 ... 3.8
- All operating systems - there should be no OS specific requirements.
- migen for fixpoint simulation and Verilog export. When missing, the "Fixpoint" tab is hidden
- mplcursors for annotating cursorsd
- docutils for rich text in documentation
- xlwt and / or XlsxWriter for exporting filter coefficients as *.xls(x) files
Unless running a binary, you need to have a working Python installation on your computer, preferrably including the libraries listed above.
There is only one version of pyfda for all supported operating systems, Python and Qt versions. As pyfda is a pure Python project (no binaries, no compilation required), you don't need to install anything in principle:
Installation from PyPI works the usual way, required libraries are installed automatically if missing:
> pip3 install pyfda
or upgrade using
> pip3 install pyfda -U
For more details and options see INSTALLATION.md.
You can also download the zip file and extract it to a temp directory of your choice. Install it either to your
<python>/Lib/site-packages subdirectory (this creates a copy) using
> python setup.py install
or just create a link to where you have copied the python source files (for testing / development) using
> python setup.py develop
For development purposes, you should fork the latest version of pyfda from https://github.com/chipmuenk/pyfda.git and create a local copy using
> git clone https://github.com/<your pyfda fork>
This command creates a new folder "pyfda" at your current directory level and copies the complete pyfda project into it.
The tutorial at https://help.github.com/en/articles/fork-a-repo provides a good starting point. As described above, pyfda can be installed locally using either
> pip3 install -e <YOUR_PATH_TO_PYFDA>
> python setup.py develop
Now you can edit the code and test it. If you're happy with it, push it to your repo and create a Pull Request so that the code can be reviewed and merged into the
In any case, a start script
pyfdax has been created in
<python>/Scripts which should be in your path. So, simply start pyfda using
The location of the following two configuration files (copied to user space) can be checked via the tab
Files -> About:
- Logging verbosity can be controlled via the file
- Widgets and filters can be enabled / disabled via the file
pyfda.conf. You can also define one or more user directories containing your own widgets and / or filters.
Layout and some default paths can be customized using the file
pyfda/pyfda_rc.py, at the moment you have to edit that file at its original location.
The following features are currently implemented:
- Filter design
- Design methods: Equiripple, Firwin, Moving Average, Bessel, Butterworth, Elliptic, Chebychev 1 and 2 (from scipy.signal and custom methods)
- Second-Order Sections are used in the filter design when available for more robust filter design and analysis
- Remember all specifications when changing filter design methods
- Fine-tune manually the filter order and corner frequencies calculated by minimum order algorithms
- Compare filter designs for a given set of specifications and different design methods
- Filter coefficients and poles / zeroes can be displayed, edited and quantized in various formats
- Clearly structured User Interface
- only widgets needed for the currently selected design method are visible
- enhanced matplotlib NavigationToolbar (nicer icons, additional functions)
- display help files (own / Python docstrings) as rich text
- tooltips for all UI widgets
- Common interface for all filter design methods:
- specify frequencies as absolute values or normalized to sampling or Nyquist frequency
- specify ripple and attenuations in dB, as voltage or as power ratios
- enter expressions like exp(-pi/4 * 1j)
- Graphical Analyses
- Magnitude response (lin / power / log) with optional display of specification bands, phase and an inset plot
- Phase response (wrapped / unwrapped) and group delay
- Pole / Zero plot
- Transient response (impulse, step and various stimulus signals) in the time and frequency domain. Roll your own stimuli (courtesy of numexpr module)!
- 3D-Plots (|H(f)|, mesh, surface, contour) with optional pole / zero display
- Modular architecture, facilitating the implementation of new filter design and analysis methods
- Filter design files not only contain the actual algorithm but the GUI definition
- Special widgets needed by design methods (e.g. for choosing the window type in Firwin) are included in the filter design file, not in the main program
- Import / export
- Export and import filter designs in pickled and in numpy's NPZ-format
- Export and import coefficients and poles/zeros as comma-separated values (CSV), in numpy's NPY- and NPZ-formats, in Excel (R) as a Matlab (R) workspace or in FPGA vendor specific formats like Xilinx (R) COE-format
Why yet another filter design tool?
- Education: Provide an easy-to-use FOSS tool for demonstrating basic digital stuff and filter design interactively that also works with the limited resolution of a beamer.
- Show-off: Demonstrate that Python is a potent tool for digital signal processing as well.
- Fixpoint filter design: Recursive fixpoint filter design has become a niche for experts. Convenient design and simulation support (round-off noise, stability under different quantization options and topologies) could attract more designers to these filters that are easier on hardware resources and much more suitable especially for uCs and low-budget FPGAs.
- HDL filter implementation: Implementing a fixpoint filter in VHDL / Verilog without errors requires some experience, verifying the correct performance in a digital design environment with very limited frequency domain simulation options is even harder. The Python module nMigen allows to describe and test fixpoint behaviour within the python ecosystem, allowing for easy stimulus generation and plotting in time and frequency domain. When everythin works fine, the filter can be exported as synthesizable Verilog code.
Release History / Roadmap
For details, see CHANGELOG.md.
Upcoming release (0.4.0)
- Matplotlib 3.3 compatibility
- Define your own stimulus interactively (based on the numexpr module)
- Add cursor / annotations in plots using the mplcursors module
- Derive the name of the top level Verilog module from the name of the Verilog file
- Improve setup of user and user log config files
- State licensing conditions more clearly
- Distribution as Flatpak
- Display filtered data as spectrogram plot
- Move fixpoint library to [https://github.com/chipmuenk/pyfixp]
- Simulate and synthesize IIR filters with nMigen
- Dark mode
Ideas (for the not so near future or for )
- Use audio files as stimuli in the impz widget and store results. Maybe real-time for FIR filters?
- Keep multiple designs in memory, switch between them, compare results and store the whole set
- Graphical modification of poles / zeros
- Document filter designs in PDF / HTML format
- Design, analysis and export of filters as second-order sections, display and edit them in the P/Z widget
- Multiplier-free filter designs (CIC, GCIC, LDI, SigmaDelta-Filters, ...) for fixpoint filters with a low number of multipliers (or none at all)
- Export of Python filter objects
- Analysis of different fixpoint filter topologies (direct form, cascaded form, parallel form, ...) concerning overflow and quantization noise