%matplotlib inline
import numpy as np
import pandas as pd
import scipy.stats
import matplotlib.pyplot as plt
plt.style.use('ggplot')

plt.plot([1, 3, 6], [2, 5, 3]);

"""
Explanation: PyGamma15 statistics tutorial
Welcome to the PyGamma15 statistics tutorial!
The actual tutorial will consist of an IPython notebook
with some descriptions and code to get you started,
and instructions / excercises where you get to implement
a statistical analysis.
This IPython notebook is not the actual tutorial,
it's just here for you to check if you have all the
required software installed and working.
Please install all the packages mentioned here
and then execute the code below to verify that
everything works before the workshop or at least
before the tutorial.
For further information see the description here.
Scientific Python packages
You'll need numpy, pandas, scipy and matplotlib.
End of explanation
"""


from iminuit import Minuit

def f(x, y, z):
    return (x - 2) ** 2 + (y - 3) ** 2 + (z - 4) ** 2

m = Minuit(f, pedantic=False, print_level=0)
m.migrad()
print(m.values)  # {'x': 2,'y': 3,'z': 4}
print(m.errors)  # {'x': 1,'y': 1,'z': 1}

"""
Explanation: iminuit
Let's see if the first example from the iminuit docs works ...
End of explanation
"""


import emcee

def lnprob(x, ivar):
    return -0.5 * np.sum(ivar * x ** 2)

ndim, nwalkers = 10, 100
ivar = 1. / np.random.rand(ndim)
p0 = [np.random.rand(ndim) for i in range(nwalkers)]

sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=[ivar])
samples = sampler.run_mcmc(p0, 1000)

"""
Explanation: emcee
Same for emcee ... let's see if the first example from the docs works.
(You don't have to understand what this does for now ... just check if it runs for you without error.)
End of explanation
"""


from uncertainties import ufloat
x = ufloat(1, 0.1)
print(2 * x)

"""
Explanation: uncertainties
We might also use the uncertainties package for error propagation. So please install that as well ...
End of explanation
"""


