summaryrefslogtreecommitdiff
path: root/gpsprof
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-09-06 23:22:54 -0700
committerGary E. Miller <gem@rellim.com>2018-09-06 23:22:54 -0700
commit8d5d68758176d933be65aaaf2d983a6c7fd58990 (patch)
treec112c6534ebd9623928aed92c4e6868e0ed2633f /gpsprof
parentc27742ff87ed9dc157e10f1c2c1600a985ed987e (diff)
downloadgpsd-8d5d68758176d933be65aaaf2d983a6c7fd58990.tar.gz
gpsprof: Fix sigma calculation.
Diffstat (limited to 'gpsprof')
-rwxr-xr-xgpsprof8
1 files changed, 4 insertions, 4 deletions
diff --git a/gpsprof b/gpsprof
index 132070ff..1c99cf17 100755
--- a/gpsprof
+++ b/gpsprof
@@ -171,15 +171,15 @@ class stats(object):
m3 = 0.0
m4 = 0.0
if type(fixes[0]) == tuple:
- sum_squares = [x[index] ** 2 for x in fixes]
- sigma = math.sqrt(sum(sum_squares) / len(fixes))
+ sum_squares = [(x[index] - self.mean) ** 2 for x in fixes]
+ sigma = math.sqrt(sum(sum_squares) / (len(fixes) - 1))
for fix in fixes:
m3 += pow(fix[index] - sigma, 3)
m4 += pow(fix[index] - sigma, 4)
else:
# must be float
- sum_squares = [x ** 2 for x in fixes]
- sigma = math.sqrt(sum(sum_squares) / len(fixes))
+ sum_squares = [(x - self.mean) ** 2 for x in fixes]
+ sigma = math.sqrt(sum(sum_squares) /( len(fixes) -1))
for fix in fixes:
m3 += pow(fix - sigma, 3)
m4 += pow(fix - sigma, 4)