[helper script] Loss rate calculator
I wrote a scrtipt to calculate the loss rate easier. What makes it more than a simple calculator of the probability mass function of binomial distribution is that it can calculate the reverse way (see get_p_from_x_y_fxyp), making it feasible to calculate the loss rate before FEC as per the loss rate after FEC, for a scenario like iperf/ping the VPN gateway itself over a VPN that is already built up over udpspeeder.
Script
https://gist.github.com/Equim-chan/41a8b4e0cad115e5a689cbd99b0a8655
Examples
Post-FEC loss rate from pre-FEC loss rate
$ ./loss-calc.py 20 10 14.33
FEC parameters : 20:10
Loss rate before FEC : 14.330 000 000 000%
Loss rate after FEC : 0.202 945 671 705% (calculated)
calculates
where x = 20+10, y = 10, p = 0.1433, i.e. the post-FEC loss rate with param
-f 20:10 under pre-FEC loss rate 14.33%.
Pre-FEC loss rate from post-FEC loss rate
$ # note that this requires sympy to be installed, and the calculation may take some time.
$ ./loss-calc.py -R 3.261 20 10
FEC parameters : 20:10
Loss rate before FEC : 20.718 422 559 973% (calculated)
Loss rate after FEC : 3.261 000 000 000%
calculates p where F(x, y, p) = 0.03261, x = 20+10, y = 10, i.e. the pre-FEC loss rate that produces post-FEC loss rate 3.261% with param -f 20:10.
Hopefully it can be helpful for udpspeeder's users who demand certain adaptive control over FEC parameters.