chipmuenk/pyfda

unexpected crash in input_coeffs.py

escherstair opened this issue · 6 comments

Some months ago I used pyfda to create a halfband decimator filter, and I saved it into a .npz file.
Everything worked fine.
Now I can load the same file, but when I click on "b,a"
immagine
pyfda crashed immediately.
In my Windows 10 terminal I can see the following error messages

[   INFO] [pyfda.libs.pyfda_io_lib:1357] Successfully loaded filter
        "D:/.../halfband_fir_decimator_by2.npz"
Traceback (most recent call last):
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\pyfda\input_widgets\input_coeffs.py", line 325, in process_sig_rx
    self.load_dict()
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\pyfda\input_widgets\input_coeffs.py", line 661, in load_dict
    self.qdict2ui()  # set quantization UI from dictionary
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\pyfda\input_widgets\input_coeffs.py", line 795, in qdict2ui
    self.refresh_table()
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\pyfda\input_widgets\input_coeffs.py", line 583, in refresh_table
    self.quant_coeffs_view()
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\pyfda\input_widgets\input_coeffs.py", line 448, in quant_coeffs_view
    if fb.fil[0]['fxqc']['QCB']['fx_base'] == 'float':
KeyError: 'fx_base'

I attach here the zip archive with my file halfband_fir_decimator_by2.npz
halfband_fir_decimator_by2.zip

Thanx for reporting and sorry for the delay. I cannot exactly reproduce your error but I do get other errors (I dimly remember fixing something related to the key 'fx_base') so I will look into the issue!

I see this crash with the last official release v0.7.1.
Maybe this is the reason why you can't reproduce it.

Hm, could you perhaps try running the latest release (self-extracting executable for Windows and OSX, Flatpack for Linux)? There will be a new official release soon.

Can you share the link of the release I should try?

I had to rewrite the part for reading and writing filters as numpy arrays with irregular shapes ("ragged arrays") are discouraged / deprecated (https://numpy.org/devdocs/release/1.24.0-notes.html) and have become difficult to handle. Therefore, pyfda v0.8.0 no longer crashes but it also cannot read the old filter format anymore. Sorry aboout that!

Hi @chipmuenk

Therefore, pyfda v0.8.0 no longer crashes

This is not 100% true, unfortunately.
If I open my old halfband_fir_decimator_by2 filter, pyfda shows the error message
[ ERROR][14:43:34.367] [pyfda_io_lib.py:1576] Missing key 'zpk' or wrong data type!
and it doesn't crash.
This is ok.

But as soon as I click on "b,a" tab, pyfda crashes with the following error

Traceback (most recent call last):
  File "C:\Users\<username>\AppData\Local\Programs\Python\Python39\lib\site-packages\pyfda\input_widgets\input_coeffs.py", line 159, in displayText
    if fb.fil[0]['fxqc']['QCB']['fx_base'] == 'float':
KeyError: 'fx_base'