chipmuenk / pyfda

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

cannot save filter as txt file #157

Open TaoTaoUncle opened 4 years ago

TaoTaoUncle commented 4 years ago

[ERROR] [input_files.py:370] filter has no residues/poles, cannot save txt file

can you tell me why ? or can you give me a txt file can be loaded by pyfda?

chipmuenk commented 4 years ago

Can you tell me what you're trying to do?

TaoTaoUncle commented 4 years ago

Can you tell me what you're trying to do?

Acutally , I have some data —just coeefficient of FIR filters I just want to use pyfda to load these FIR coefficient to generate the simulation results. I think that will be more user-friendly.

chipmuenk commented 4 years ago

Could you be so kind to attach a sample file? There are so many variations in text file formats debugging is hard for me without a proper testcase.

TaoTaoUncle commented 4 years ago

1_1.txt 2.txt As you can see these two files, They're the coefficient of 32 order Lowpass FIR filter. The first is float number. The second is in the form of csd. So I hope pyfda can load these data to generate the simulation results.

chipmuenk commented 4 years ago

Thanks for the files, now I know what you're trying to do:

pyfda can read "comma separated value" (csv) lists where the separator (delimiter) between values can also be a ";", a "|", a blank or a tab. Values may be in one (FIR) or two (IIR) columns or rows.

After renaming the file with CSD data to "2.csv" I can read the coefficients and display the filter:

I could not read the other file even after renaming; the values were arranged in an irregular matrix which I also wasn't sure how to interprete - column or rows? The data crashed pyfda, so I guess it will help me to make the software more error tolerant :-) With which software did you generate the two files?

I will add 'txt' as a suffix for csv data as well and I need to hide the "save text file poles and residues" which is quite a special option for zero-phase (not linear phase) filters.

TaoTaoUncle commented 4 years ago

Thank you so much ! It helps a lot ! Besides, Can I adjust the accuracy of the coefficient? As you can see from the appendix picture: The coefficient saved in my file is 32bit. Once the file is loaded into the fda, the coefficient become 16bit.

At last, I generate these two files by a filter-design software developed by my tutor. You can find that in his github——https://github.com/luk036

Screen Shot 2019-11-27 at 9 35 06 AM
chipmuenk commented 4 years ago

no problem, you have to set W=32 before loading the coefficients into pyfda. Your screenshot shows that W=16 (default setting).

TaoTaoUncle commented 4 years ago

Thank you so much !

chipmuenk commented 4 years ago

Just a final question (I'm curious): What do use the CSD coefficients for? I've never met someone using CSD format. Do you do ASIC/FPGA design?

TaoTaoUncle commented 4 years ago

Just a final question (I'm curious): What do use the CSD coefficients for? I've never met someone using CSD format. Do you do ASIC/FPGA design?

Yes, we do ASIC/FPGA Design. Actually, we design multiplierless filter with CSD coefficients.

chipmuenk commented 4 years ago

Two issues need to be fixed:

chipmuenk commented 4 years ago

The file no longer crashes pyfda but it still is not read correctly, the line separators are not ignored.