lneuhaus / pyrpl

pyrpl turns your RedPitaya into a powerful DSP device, especially suitable as a lockbox in quantum optics experiments.
http://lneuhaus.github.io/pyrpl/
MIT License
140 stars 108 forks source link

IIR saturates during initialization #408

Closed GuanhaoHuang closed 3 years ago

GuanhaoHuang commented 4 years ago

Hi! I have a problem with the pyrpl initialization. Each time it always shows me these warnings:

WARNING:pyrpl.hardware_modules.iir.iir_theory:One value saturates positively: Increase totalbits or decrease gain! WARNING:pyrpl.hardware_modules.iir.iir_theory:One value saturates negatively: Increase totalbits or decrease gain!

I looked into the codes in iir_theory, and I am a bit problem understanding the function finiteprecision() where the warning is coming from. I don't have a clear idea what are being compared here, but it seems that it's comparing *xr=np.round(coeff 2 shiftbits) with xmax=2 (totalbits - 1)**.

My totalbits is 32 and shiftbits is 29, and considering coefficients is a six digits number (that is passed to the module), it makes sense that it's giving me a warning. However these are default values, and I guess they were supposed to work. So I wonder why it it's giving me the warning here, i.e. what is the meaning of the expression *coeff 2 shiftbits. Is there a mistake here?

Thanks in advance! Though the initialization gives me this warning, I did not notice any problem during the testing or the IIR module. I am using the python3-only branch with python 3.7

lneuhaus commented 3 years ago

Should be fixed then with the recent merge of #427 - otherwise please re-open.