chipmuenk / pyfda

Python Filter Design Analysis Tool
http://chipmuenk.github.io/
MIT License
644 stars 94 forks source link

Documentation for filter widget design needed #194

Closed HungYu-Lin closed 2 years ago

HungYu-Lin commented 3 years ago

My goal is to use pyfda as a design platform with all existing great input/output/plot functions for developing new customized filters. To accomplish this goal, I am looking for a template or sample code regarding how to add additional filter and UI components using current pyfda framework. It could be possible to significantly modify current source code, however, an API-based implementation using existing configuration with minimal change to the code is more appropriated.

For example, to create a new filter with filter class of "my_filter_class" and filter type of "my_filter_type" in pckg:filter_designs. Furthermore, this new filter has its own InputNewSpecs function and UI input fields to take several input values from the user. After clicking "DESIGN FILTER", the program uses the user-input values for designing a filter. Finally, calculated values of the new filter can be displayed in pakg: plot_widgets.

Any alternative solution and comments are highly welcome for discussion.

chipmuenk commented 3 years ago

The pyfda distribution has a directory called widget templates, unfortunately it only contains examples for input and plot widgets at the moment. The subdirectory filter_designs is empty but I think we should provide an example there. I'll create a new branch and copy a stripped down filter design there.

chipmuenk commented 3 years ago

I've made some changes to the branch "custom_filter_widget", a.o. I've renamed the subdirectory filter_designs to filter_widgets to be consistent with the other custom widgets. This requires an update to your pyfda.conf, its version number needs to be 4 now. You can replace your pyfda.conf file by running pyfdax -r (backups will be made).

The custom filter widget my _filter_widget now implements a simple (incomplete) allpass filter design that actually interacts with the rest of pyfda. Please check out the design example, tell me what is incomprehensible and make a PR with your own filter design (or mail it to me) so that I can take a look.