pyfda package¶
Subpackages¶
- pyfda.filter_widgets package
- Submodules
- pyfda.filter_widgets.bessel module
- pyfda.filter_widgets.butter module
- pyfda.filter_widgets.cheby1 module
- pyfda.filter_widgets.cheby2 module
- pyfda.filter_widgets.common module
- pyfda.filter_widgets.delay module
- pyfda.filter_widgets.ellip module
- pyfda.filter_widgets.ellip_zero module
- pyfda.filter_widgets.equiripple module
EquirippleEquiripple.BPman()Equiripple.BPmin()Equiripple.BSman()Equiripple.BSmin()Equiripple.DIFFman()Equiripple.FRMTEquiripple.HILman()Equiripple.HPman()Equiripple.HPmin()Equiripple.LPman()Equiripple.LPmin()Equiripple.construct_UI()Equiripple.dict2filter_params()Equiripple.emit()Equiripple.infoEquiripple.sig_txEquiripple.ui2dict()
classes
- pyfda.filter_widgets.firwin module
- pyfda.filter_widgets.ma module
- pyfda.filter_widgets.manual module
- Module contents
- pyfda.fixpoint_widgets package
- pyfda.input_widgets package
- Submodules
- pyfda.input_widgets.amplitude_specs module
- pyfda.input_widgets.freq_specs module
- pyfda.input_widgets.freq_units module
- pyfda.input_widgets.input_coeffs module
- pyfda.input_widgets.input_coeffs_ui module
- pyfda.input_widgets.input_fixpoint_specs module
- pyfda.input_widgets.input_info module
- pyfda.input_widgets.input_info_about module
- pyfda.input_widgets.input_pz module
- pyfda.input_widgets.input_pz_ui module
- pyfda.input_widgets.input_specs module
- pyfda.input_widgets.input_tab_widgets module
- pyfda.input_widgets.select_filter module
- pyfda.input_widgets.target_specs module
- pyfda.input_widgets.weight_specs module
- Module contents
- pyfda.libs package
- Submodules
- pyfda.libs.compat module
- pyfda.libs.csv_option_box module
- pyfda.libs.frozendict module
- pyfda.libs.pyfda_dirs module
- pyfda.libs.pyfda_fft_windows_lib module
- pyfda.libs.pyfda_fix_lib module
- pyfda.libs.pyfda_fix_lib_amaranth module
- pyfda.libs.pyfda_io_lib module
- pyfda.libs.pyfda_lib module
- pyfda.libs.pyfda_qt_lib module
- pyfda.libs.pyfda_sig_lib module
- pyfda.libs.tree_builder module
- Module contents
- pyfda.plot_widgets package
- Subpackages
- Submodules
- pyfda.plot_widgets.mpl_widget module
- pyfda.plot_widgets.plot_3d module
- pyfda.plot_widgets.plot_fft_win module
- pyfda.plot_widgets.plot_hf module
- pyfda.plot_widgets.plot_impz module
- pyfda.plot_widgets.plot_impz_ui module
- pyfda.plot_widgets.plot_phi module
- pyfda.plot_widgets.plot_pz module
- pyfda.plot_widgets.plot_tab_widgets module
- pyfda.plot_widgets.plot_tau_g module
- Module contents
Submodules¶
pyfda.filter_factory module¶
Dynamic parameters and settings are exchanged via the dictionaries in this file.
Importing filterbroker.py runs the module once, defining all module variables
which have a global scope like class variables and can be imported like
>>> import filter_factory as ff
>>> myfil = ff.fil_factory
- class pyfda.filter_factory.FilterFactory[source]¶
Bases:
objectThis class implements a filter factory that (re)creates the globally accessible filter instance
fil_instfrom module path and class name, passed as strings.- call_fil_method(method, fil_dict, fc=None)[source]¶
Instantiate the filter design class passed as string
fcwith the globally accessible handlefil_inst. Iffc = None, use the previously instantiated filter design class.Next, call the design method passed as string
methodof the instantiated filter design class.- Parameters:
method (string) – The name of the design method to be called (e.g. ‘LPmin’)
fil_dict (dictionary) – A dictionary with all the filter specs that is passed to the actual filter design routine. This is usually a copy of
fb.fil[0]The results of the filter design routine are written back to the same dict.fc (string (optional, default: None)) – The name of the filter design class to be instantiated. When nothing is specified, the last filter selection is used.
- Returns:
err_code –
- one of the following error codes:
- -1:
filter design operation has been cancelled by user
- 0:
filter design method exists and is callable
- 16:
passed method name is not a string
- 17:
filter design method does not exist in class
- 18:
filter design error containing “order is too high”
- 19:
filter design error containing “failure to converge”
- 99:
unknown error
- Return type:
Examples
>>> call_fil_method("LPmin", fil[0], fc="cheby1")
The example first creates an instance of the filter class ‘cheby1’ and then performs the actual filter design by calling the method ‘LPmin’, passing the global filter dictionary
fil[0]as the parameter.
- create_fil_inst(fc, mod=None)[source]¶
Create an instance of the filter design class passed as a string
fcfrom the module found infb.filter_classes[fc]. This dictionary has been collected bytree_builder.py.The instance can afterwards be globally referenced as
fil_inst.- Parameters:
- Returns:
err_code –
- one of the following error codes:
- -1:
filter design class was instantiated successfully
- 0:
filter instance exists, no re-instantiation necessary
- 1:
filter module not found by FilterTreeBuilder
- 2:
filter module found by FilterTreeBuilder but could not be imported
- 3:
filter class could not be instantiated
- 4:
unknown error during instantiation
- Return type:
Examples
>>> create_fil_instance('cheby1') >>> fil_inst.LPmin(fil[0])
The example first creates an instance of the filter class ‘cheby1’ and then performs the actual filter design by calling the method ‘LPmin’, passing the global filter dictionary fil[0] as the parameter.
- pyfda.filter_factory.fil_factory = <pyfda.filter_factory.FilterFactory object>¶
Class instance of FilterFactory that can be accessed in other modules
- pyfda.filter_factory.fil_inst = None¶
Instance of current filter design class (e.g. “cheby1”), globally accessible
>>> import filter_factory as ff >>> ff.fil_factory.create_fil_instance('cheby1') # create instance of dynamic class >>> ff.fil_inst.LPmin(fil[0]) # design a filter
pyfda.filterbroker module¶
Dynamic parameters and settings are exchanged via the dictionaries in this file.
Importing filterbroker.py runs the module once, defining all module variables
which have a global scope like class variables and can be imported like
>>> import filterbroker as fb
>>> myfil = fb.fil[0]
The entries in this file are only used as initial / default entries and to demonstrate the structure of the global dicts and lists. These initial values are also handy for module-level testing where some useful settings of the variables is required.
Notes
Alternative approaches for data persistence could be the packages shelve or pickleshare More info on data persistence and storing / accessing global variables:
http://stackoverflow.com/questions/13034496/using-global-variables-between-files-in-python
http://stackoverflow.com/questions/1977362/how-to-create-module-wide-variables-in-python
http://stackoverflow.com/questions/9058305/getting-attributes-of-a-class
http://stackoverflow.com/questions/2447353/getattr-on-a-module
- pyfda.filterbroker.base_dir = ''¶
Project base directory
- pyfda.filterbroker.clipboard = None¶
Handle to central clipboard instance
- pyfda.filterbroker.filter_classes = {'Bessel': {'mod': 'pyfda.filter_widgets.bessel', 'name': 'Bessel'}, 'Butter': {'mod': 'pyfda.filter_widgets.butter', 'name': 'Butterworth'}, 'Cheby1': {'mod': 'pyfda.filter_widgets.cheby1', 'name': 'Chebyshev 1'}, 'Cheby2': {'mod': 'pyfda.filter_widgets.cheby2', 'name': 'Chebyshev 2'}, 'Ellip': {'mod': 'pyfda.filter_widgets.ellip', 'name': 'Elliptic'}, 'EllipZeroPhz': {'mod': 'pyfda.filter_widgets.ellip_zero', 'name': 'EllipZeroPhz'}, 'Equiripple': {'mod': 'pyfda.filter_widgets.equiripple', 'name': 'Equiripple'}, 'Firwin': {'mod': 'pyfda.filter_widgets.firwin', 'name': 'Windowed FIR'}, 'MA': {'mod': 'pyfda.filter_widgets.ma', 'name': 'Moving Average'}, 'Manual_FIR': {'mod': 'pyfda.filter_widgets.manual', 'name': 'Manual'}, 'Manual_IIR': {'mod': 'pyfda.filter_widgets.manual', 'name': 'Manual'}}¶
The keys of this dictionary are the names of all found filter classes, the values are the name to be displayed e.g. in the comboboxes and the fully qualified name of the module containing the class.
- pyfda.filterbroker.get_fil_dict(keys: list)[source]¶
Get the value of fb.fil[0][“key_0”][“key_1”]…[“key_n], nested keys are passed as a list of strings keys, e.g. keys=[‘fxq’, ‘QACC’] accesses fb.fil[0][‘fxq’][‘QACC’].
- pyfda.filterbroker.key_list_to_dict(keys: list) dict[source]¶
Convert a list of keys (str) to access a nested dict that can be read or written to and return that dict.
The nested dict is always based on fb.fil[0]. In order to set or get the value of the nested dict, use the key for the lowest nesting level on the returned dict d, i.e. d[keys[-1]] = arg resp. arg = d[keys[-1]].
- pyfda.filterbroker.restore_fil()[source]¶
Restore current global dict fb.fil[0] from undo memory fil_undo
- pyfda.filterbroker.set_fil_dict(keys: list, arg, backup: bool = True) None[source]¶
Set the value of fb.fil[0][“key_0”][“key_1”]…[“key_n] to arg, nested keys are passed as a list of strings, e.g. keys=[‘fxq’, ‘QACC’] accesses fb.fil[0][‘fxq’][‘QACC’].
Store the old state of fb.fil[0] before making any changes when backup == True.
pyfda.pyfda_class module¶
Mainwindow for the pyFDA app
- class pyfda.pyfda_class.DynFileHandler(*args)[source]¶
Bases:
FileHandlersubclass FileHandler with a customized handler for dynamic definition of the logging filepath and -name
- class pyfda.pyfda_class.QEditHandler[source]¶
Bases:
Handlersubclass Handler to also log messages to textWidget on main display Overrides stdout to print messages to textWidget (XStream)
- class pyfda.pyfda_class.XStream[source]¶
Bases:
QObjectsubclass for log messages on logger window Overrides stdout to print messages to textWidget
- messageWritten¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class pyfda.pyfda_class.pyFDA(parent=None)[source]¶
Bases:
QMainWindowCreate the main window consisting of a tabbed widget for entering filter specifications, poles / zeros etc. and another tabbed widget for plotting various filter characteristics
QMainWindow is used here as it is a class that understands GUI elements like toolbar, statusbar, central widget, docking areas etc.
Show right mouse button context menu
- process_sig_rx(dict_sig=None)[source]¶
Process signals coming from sig_rx: - trigger close event in response to ‘close_event’ emitted in another subwidget:
- sig_rx¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
pyfda.pyfda_rc module¶
This file contains layout definitions for Qt and matplotlib widgets A dark and a light theme can be selected via a constant but this more a demonstration on how to set things than a finished layout yet.
Default parameters, paths etc. are also defined at the end of the file.
Importing pyfda_rc runs the module once, defining all module variables which are global (similar to class variables).
pyfda.pyfdax module¶
pyfda.qrc_resources module¶
pyfda.version module¶
Store the version number here for setup.py and pyfdax.py