mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-22 14:57:34 +08:00
14 lines
391 B
Python
14 lines
391 B
Python
#!/bin/bash
|
|
from __future__ import print_function
|
|
import pylab as pl
|
|
import scipy.optimize
|
|
from scipy.stats import chi2
|
|
|
|
for fa_rate in 1.0/pl.array([1e1, 1e2, 1e4, 1e6, 1e9]):
|
|
print(fa_rate)
|
|
for df in range(1,7):
|
|
f_eq = lambda x: ((1- fa_rate) - chi2.cdf(x, df))**2
|
|
res = scipy.optimize.minimize(f_eq, df)
|
|
assert res['success']
|
|
print('\t', res.x[0])
|