Esempio n. 1
0
def test_contour(grad):
    # FIXME: check the result
    m = Minuit(
        func3, grad=grad, pedantic=False, x=1.0, y=2.0, error_x=3.0, print_level=0
    )
    m.migrad()
    m.contour("x", "y")
Esempio n. 2
0
def test_contour_with_gradient():
    # FIXME: check the result
    m = Minuit(func3,
               grad_fcn=func3_grad,
               pedantic=False,
               x=1.,
               y=2.,
               error_x=3.,
               print_level=0)
    m.migrad()
    m.contour('x', 'y')
Esempio n. 3
0
# <codecell>

#1D value Scan
x,y = m.profile('x',subtract_min=True);
plot(x,y) #if you have matplotlib

# <codecell>

#we also provide convenience wrapper for drawing it
m.draw_profile('x');

# <codecell>

#2d contour NOT minos contour
x,y,z = m.contour('x','y',subtract_min=True)
cs = contour(x,y,z)
clabel(cs)

# <codecell>

#or a convenience wrapper
m.draw_contour('x','z');

# <markdowncell>

# ###Hesse and Minos

# <markdowncell>

# ####Hesse
Esempio n. 4
0
def test_contour():
    # FIXME: check the result
    m = Minuit(func3, pedantic=False, x=1., y=2., error_x=3., print_level=0)
    m.migrad()
    m.contour('x', 'y')
Esempio n. 5
0
def test_contour_subtract():
    m = Minuit(func0, x=1.0, y=2.0)
    m.migrad()
    m.contour("x", "y", subtract_min=True)
Esempio n. 6
0
def test_contour(grad):
    # FIXME: check the result
    m = Minuit(func0, grad=grad, x=1.0, y=2.0)
    m.migrad()
    m.contour("x", "y")
Esempio n. 7
0
# Minos calculates asymmetric errors for more complicated cases
m.minos(var="slope")
m.minos(var="offset")

# Some output
m.print_param()

# And now contours of the fitted function
# (very similar to testFit_V2.py version)
fittedSlope = param[0]['value']
fittedOffset = param[1]['value']
fig2, ax2 = plt.subplots()

# bound=4   --> got to +/- 4 sigma
# bins=100  --> how many bins to do
xx, yy, zz = m.contour('slope', 'offset', subtract_min=True, bound=4, bins=100)
CS = ax2.contour(xx, yy, zz, [2.30, 5.99, 9.21])
fmt = {}
strs = ['68%', '95%', '99%']
for l, s in zip(CS.levels, strs):
    fmt[l] = s
ax2.clabel(CS, inline=True, fmt=fmt, fontsize=9)
ax2.plot(fittedSlope, fittedOffset, 'ko')
ax2.set_xlabel('slope')
ax2.set_ylabel('offset')
fig2.show()
input('Enter something to continue ')

# If we are particularly interested in one parameter
# (say: the slope) we can scan the chisquared as a function
# of "slope" minimizing wrt to the other parameter ("offset"