In [4]:
from pandas import DataFrame
import itertools
import numpy as np
from pymatgen.util.plotting_utils import get_publication_quality_plot
%matplotlib inline
In [5]:
d = np.array(list(itertools.product(range(1, 5), range(1, 5))))
In [6]:
data = DataFrame({"X": d[:, 0], "Y": d[:, 1]})
data["Average"] = data.mean(axis=1)
In [7]:
plt = get_publication_quality_plot(12, 8)
print plt.hist(data["Average"], color='k', bins=np.arange(0.75, 4.5, 0.5), width=0.05, normed=True)
plt.xticks(np.arange(0.75, 4.5, 0.5), np.arange(0.75, 4.5, 0.5) + 0.25)
plt.xlabel("Sample Mean")
plt.ylabel("Probability")
Out[7]:
In [8]:
data = [105, 97, 245, 163, 207, 134, 218, 199, 160, 196]
In [15]:
avg = np.average(data)
stddev = 34 / np.sqrt(10)
a = 2.58
interval = (avg - stddev * a, avg + stddev * a)
print interval
In [ ]: