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

[BUG] Typo in a formula in itur.models.itu530.multipath_loss #82

Open
krzygorz opened this issue May 31, 2024 · 0 comments
Open

[BUG] Typo in a formula in itur.models.itu530.multipath_loss #82

krzygorz opened this issue May 31, 2024 · 0 comments
Assignees
Labels

Comments

@krzygorz
Copy link

Describe the bug
itur.models.itu530.multipath_loss returns wrong results for A in the shallow fading region. This is due to a missing bracket in step 3b. Here's how to fix it:

        def step_3b(p_0, At, A):
            ...
            q_t = ((qa_p - 2) /
-                   (1 + 0.3 * 10 ** (-At / 20) * 10 ** (-0.016 * At)) -
+                  ((1 + 0.3 * 10 ** (-At / 20)) * 10 ** (-0.016 * At)) -
                   4.3 * (10**(-At / 20) + At / 800))
            ...

And here's the relevant fragment of the recommendation:
screenshot of ITU-R P.530 equation 16

To Reproduce
With the original code, plot of p_W vs fade depth contains a discontinuity, which probably shouldn't happen (the curves in figure 3 of the recommendation are smooth):

import numpy as np
import matplotlib.pyplot as plt
from itur.models import itu530
A = np.linspace(0,30,100)
p = itu530.multipath_loss(lat=22.443907, lon=-74.220397, h_e=40, h_r=40, d=20, f=18, A=A)
plt.plot(A,p)
plt.xlabel("fade depth [dB]")
plt.ylabel("% avg worst month")
plt.yscale("log")
plt.show()

image

Expected behavior
After applying the suggested change, the discontinuity becomes negligibly small (still, shouldn't it be perfectly smooth???)
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants