from pylab import *
x = loadtxt(DATA+'thermocouples.dat',skiprows=1)
hold(True)
plot(x[:,0],x[:,1],'b')
savefig('.')
t = x[:,0]
x = x[:,1]
x_mean = mean(x)
x_median = median(x)
x_variance = var(x)
x_std = std(x)
x_modes = histogram(x)
x_mode_ind = argmax(x_modes[0])
x_mode_count = x_modes[0][x_mode_ind]
x_mode_val = x[x_mode_ind]
print "Mean: %f " % x_mean
print "Median: %f" % x_median
print "Variance: %f" % x_variance
print "STD: %f " % x_std
print "Mode of x %f appears %d times" % (x_mode_val,x_mode_count)
xr = x_mean + x_std*rand(10000)
figure()
n, bins, patches = hist(x, 20, normed=1, facecolor='green', alpha=0.75)
from matplotlib.mlab import normpdf
y = normpdf( bins, x_mean, x_std)
l = plot(bins, y, 'r--', linewidth=2)
savefig('.')