1
0
mirror of https://github.com/TREX-CoE/qmc-lttc.git synced 2024-07-09 12:53:54 +02:00
qmc-lttc/qmc_stats.py

8 lines
207 B
Python
Raw Normal View History

2021-01-07 10:01:55 +01:00
from math import sqrt
def ave_error(arr):
M = len(arr)
assert (M>1)
average = sum(arr)/M
variance = 1./(M-1) * sum( [ (x - average)**2 for x in arr ] )
return (average, sqrt(variance/M))