# HG changeset patch # User Jeff Hammel # Date 1500667847 25200 # Node ID 637507918c17b83c1a2e0b68e912d5e37cb8fbf9 # Parent 100697f7c1959f9ef40f99a05cce409ae655c5c0 untested implementation of choosing Gaussian parameters diff -r 100697f7c195 -r 637507918c17 numerics/gaussian.py --- a/numerics/gaussian.py Fri Jul 21 12:58:40 2017 -0700 +++ b/numerics/gaussian.py Fri Jul 21 13:10:47 2017 -0700 @@ -9,8 +9,23 @@ import argparse import os -import subprocess import sys +from .filters import mean + +def gaussian(data): + """ + find mean + variance; fit to a Gaussian distribution + """ + + # find mean + _mean = mean(data) + + # find variance + sigma_squared = sum([(x-_mean)**2 + for x in data])/float(len(data)) + + # return parameters + return (_mean, sigma_squared) def main(args=sys.argv[1:]):