Telecominfraproject / oopt-gnpy

Optical Route Planning Library, Based on a Gaussian Noise Model
http://telecominfraproject.com
BSD 3-Clause "New" or "Revised" License
198 stars 87 forks source link

nf_avg = polyval(nf_fit_coeff, -dg) in elements.py line 785 #422

Closed caffery-chen closed 2 years ago

caffery-chen commented 2 years ago

Describe the bug nf_avg = polyval(nf_fit_coeff, -dg) The minus sign seems not correct.

According to the definition of the polynomial NF under https://gnpy.readthedocs.io/en/master/extending.html NF = f(G_max - G) I did a regression based on my NF vs Gain data and got the following coef: nf_fit_coeff = [0.0016, 0.036, 0.094, 5.0352] and when G_max-G = 4. I shall expecting polyval(nf_fit_coeff, 4) = 6.1 dB

But what I got is actually polyval(nf_fit_coeff, 4) = 5.14 dB NF is underestimated.

ojnas commented 2 years ago

Yes, that minus sign has been the source of much confusion (see e.g. #355 and #387). We should update the documentation to match the code.

caffery-chen commented 2 years ago

Thanks, it is quite easy to cause wrong simultion results.