chipmuenk / pyfda

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

Save/Load Table to/from file #240

Closed escherstair closed 1 year ago

escherstair commented 1 year ago

I'm not sure I understood how Save/Load Table to/from file is expected to work.

  1. I open pyfda and I select "b,a" tab

  2. I select FIR type and I leave everyhting else as it is. I see some default coefficients immagine

  3. I click on "Save table to file" and I get a csv file with the coefficients

  4. I click on "Load table from file" and I select the file just saved

  5. pyfda crashes immediately with the following error

    [   INFO] [pyfda.libs.pyfda_io_lib:649] Parsing CSV data with header = 'False'
        Delimiter = ',' | Lineterm. = '\r\n' | quotechar = ' " as 'TextIOWrapper'
    [   INFO] [pyfda.libs.pyfda_io_lib:721] Building transposed table with 11 row(s) and 1 columns.
    [   INFO] [pyfda.libs.pyfda_io_lib:1003] Imported file "C:/Users/<username>/Desktop/ggg.csv"
        Type: ndarray of float64, shape = (r11 x c1)
        [5.10699577e-05]
        [0.0005107]
        [0.00229815]
        [0.00612839]
        [0.01072469]
         ...
    Traceback (most recent call last):
    File "C:\Users\<username>\AppData\Local\Programs\Python\Python39\lib\site-packages\pyfda\input_widgets\input_coeffs.py", line 749, in _import
    self._filter_type(ftype='FIR')
    File "C:\Users\<username>\AppData\Local\Programs\Python\Python39\lib\site-packages\pyfda\input_widgets\input_coeffs.py", line 525, in _filter_type
    self.ba[1][0] = 1.
    IndexError: index 0 is out of bounds for axis 0 with size 0
chipmuenk commented 1 year ago

Fixed in latest.