Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot save filter as txt file #157

Open
TaoTaoUncle opened this issue Nov 25, 2019 · 12 comments
Open

cannot save filter as txt file #157

TaoTaoUncle opened this issue Nov 25, 2019 · 12 comments
Labels
bug CSV related to reading / writing CSV files

Comments

@TaoTaoUncle
Copy link

[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
Copy link
Owner

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

@TaoTaoUncle
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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:

  • Select the "b,a" (coefficients) tab
  • Choose CSD format
  • Click on the cog icon with the settings to select "file" instead of "clipboard", delimiter should be set to "," or "auto"
  • Open the file
  • Copy the values from the table to the filter dict and update all filter widgets by clicking on the (now highiighted) up arrow

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
Copy link
Author

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
Copy link
Owner

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

@TaoTaoUncle
Copy link
Author

Thank you so much !

@chipmuenk
Copy link
Owner

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
Copy link
Author

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 chipmuenk reopened this Dec 30, 2019
@chipmuenk
Copy link
Owner

chipmuenk commented Dec 30, 2019

Two issues need to be fixed:

  • *.txt should be an alternative suffix for csv files, not for specialized poles-residues files
  • one of the files above has an irregular format that crashes pyfda, more robustness is needed here

@chipmuenk chipmuenk added the bug label Feb 6, 2020
@chipmuenk
Copy link
Owner

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

@chipmuenk chipmuenk added the CSV related to reading / writing CSV files label Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug CSV related to reading / writing CSV files
Projects
None yet
Development

No branches or pull requests

2 participants