2023-04-05 16:48:43 +02:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"Exercise 3: Least square fit with a 3rd order polynomial with iminuit"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 1,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"import numpy as np\n",
|
|
|
|
"import matplotlib.pyplot as plt\n",
|
|
|
|
"import math"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 2,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"# Data x,y and dy\n",
|
|
|
|
"x = np.array([0.2 , 0.4 , 0.6 , 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2., 2.2, 2.4, 2.6, 2.8 , 3., 3.2 ,3.4, 3.6, 3.8,4.],dtype='d')\n",
|
|
|
|
"dy = np.array([0.04,0.021,0.035,0.03,0.029,0.019,0.024,0.018,0.019,0.022,0.02,0.025,0.018,0.024,0.019,0.021,0.03,0.019,0.03,0.024 ], dtype='d')\n",
|
|
|
|
"y = np.array([1.792,1.695,1.541,1.514,1.427,1.399,1.388,1.270,1.262,1.228,1.189,1.182,1.121,1.129,1.124,1.089,1.092,1.084,1.058,1.057 ], dtype='d')"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 3,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"# Define fit functions - a 3rd order polynomial\n",
|
|
|
|
"def pol3(a0, a1, a2, a3):\n",
|
|
|
|
" return a0 + x*a1 + a2*x**2 + a3*x**3"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 4,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"# least-squares function = sum of data residuals squared\n",
|
|
|
|
"def LSQ(a0, a1, a2, a3):\n",
|
|
|
|
" return np.sum((y - pol3(a0, a1, a2, a3)) ** 2 / dy ** 2)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 5,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"# import minuit2 fitting library\n",
|
|
|
|
"from iminuit import Minuit"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 6,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"# create instance of Minuit and use LSQ function to minimize\n",
|
|
|
|
"LSQ.errordef = Minuit.LEAST_SQUARES\n",
|
|
|
|
"m = Minuit(LSQ,a0=0.01, a1=0.05 ,a2=0.01 ,a3=0.001)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 7,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
2023-04-11 18:27:30 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/html": [
|
|
|
|
"<table>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td></td>\n",
|
|
|
|
" <th title=\"Variable name\"> Name </th>\n",
|
|
|
|
" <th title=\"Value of parameter\"> Value </th>\n",
|
|
|
|
" <th title=\"Hesse error\"> Hesse Error </th>\n",
|
|
|
|
" <th title=\"Minos lower error\"> Minos Error- </th>\n",
|
|
|
|
" <th title=\"Minos upper error\"> Minos Error+ </th>\n",
|
|
|
|
" <th title=\"Lower limit of the parameter\"> Limit- </th>\n",
|
|
|
|
" <th title=\"Upper limit of the parameter\"> Limit+ </th>\n",
|
|
|
|
" <th title=\"Is the parameter fixed in the fit\"> Fixed </th>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 0 </th>\n",
|
|
|
|
" <td> a0 </td>\n",
|
|
|
|
" <td> 10.0e-3 </td>\n",
|
|
|
|
" <td> 0.1e-3 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 1 </th>\n",
|
|
|
|
" <td> a1 </td>\n",
|
|
|
|
" <td> 50.0e-3 </td>\n",
|
|
|
|
" <td> 0.5e-3 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 2 </th>\n",
|
|
|
|
" <td> a2 </td>\n",
|
|
|
|
" <td> 10.0e-3 </td>\n",
|
|
|
|
" <td> 0.1e-3 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 3 </th>\n",
|
|
|
|
" <td> a3 </td>\n",
|
|
|
|
" <td> 1.00e-3 </td>\n",
|
|
|
|
" <td> 0.01e-3 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
"</table>"
|
|
|
|
],
|
|
|
|
"text/plain": [
|
|
|
|
"┌───┬──────┬───────────┬───────────┬────────────┬────────────┬─────────┬─────────┬───────┐\n",
|
|
|
|
"│ │ Name │ Value │ Hesse Err │ Minos Err- │ Minos Err+ │ Limit- │ Limit+ │ Fixed │\n",
|
|
|
|
"├───┼──────┼───────────┼───────────┼────────────┼────────────┼─────────┼─────────┼───────┤\n",
|
|
|
|
"│ 0 │ a0 │ 10.0e-3 │ 0.1e-3 │ │ │ │ │ │\n",
|
|
|
|
"│ 1 │ a1 │ 50.0e-3 │ 0.5e-3 │ │ │ │ │ │\n",
|
|
|
|
"│ 2 │ a2 │ 10.0e-3 │ 0.1e-3 │ │ │ │ │ │\n",
|
|
|
|
"│ 3 │ a3 │ 1.00e-3 │ 0.01e-3 │ │ │ │ │ │\n",
|
|
|
|
"└───┴──────┴───────────┴───────────┴────────────┴────────────┴─────────┴─────────┴───────┘"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 7,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
2023-04-05 16:48:43 +02:00
|
|
|
"source": [
|
|
|
|
"m.params"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 8,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
2023-04-11 18:27:30 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"Chi2/ndof = 0.8205035668806628\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
2023-04-05 16:48:43 +02:00
|
|
|
"source": [
|
|
|
|
"# run migrad for minimization\n",
|
2023-04-05 22:03:33 +02:00
|
|
|
"m.migrad()\n",
|
|
|
|
"chi2 = m.fval / (len(y) - len(m.values))\n",
|
|
|
|
"print (\"Chi2/ndof =\" , chi2)"
|
2023-04-05 16:48:43 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 9,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
2023-04-11 18:27:30 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/html": [
|
|
|
|
"<table>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th colspan=\"5\" style=\"text-align:center\" title=\"Minimizer\"> Migrad </th>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td colspan=\"2\" style=\"text-align:left\" title=\"Minimum value of function\"> FCN = 13.13 </td>\n",
|
|
|
|
" <td colspan=\"3\" style=\"text-align:center\" title=\"Total number of function and (optional) gradient evaluations\"> Nfcn = 120 </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td colspan=\"2\" style=\"text-align:left\" title=\"Estimated distance to minimum and goal\"> EDM = 7.21e-17 (Goal: 0.0002) </td>\n",
|
|
|
|
" <td colspan=\"3\" style=\"text-align:center\" title=\"Total run time of algorithms\"> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td colspan=\"2\" style=\"text-align:center;background-color:#92CCA6;color:black\"> Valid Minimum </td>\n",
|
|
|
|
" <td colspan=\"3\" style=\"text-align:center;background-color:#92CCA6;color:black\"> No Parameters at limit </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td colspan=\"2\" style=\"text-align:center;background-color:#92CCA6;color:black\"> Below EDM threshold (goal x 10) </td>\n",
|
|
|
|
" <td colspan=\"3\" style=\"text-align:center;background-color:#92CCA6;color:black\"> Below call limit </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> Covariance </td>\n",
|
|
|
|
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> Hesse ok </td>\n",
|
|
|
|
" <td style=\"text-align:center;background-color:#92CCA6;color:black\" title=\"Is covariance matrix accurate?\"> Accurate </td>\n",
|
|
|
|
" <td style=\"text-align:center;background-color:#92CCA6;color:black\" title=\"Is covariance matrix positive definite?\"> Pos. def. </td>\n",
|
|
|
|
" <td style=\"text-align:center;background-color:#92CCA6;color:black\" title=\"Was positive definiteness enforced by Minuit?\"> Not forced </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
"</table><table>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td></td>\n",
|
|
|
|
" <th title=\"Variable name\"> Name </th>\n",
|
|
|
|
" <th title=\"Value of parameter\"> Value </th>\n",
|
|
|
|
" <th title=\"Hesse error\"> Hesse Error </th>\n",
|
|
|
|
" <th title=\"Minos lower error\"> Minos Error- </th>\n",
|
|
|
|
" <th title=\"Minos upper error\"> Minos Error+ </th>\n",
|
|
|
|
" <th title=\"Lower limit of the parameter\"> Limit- </th>\n",
|
|
|
|
" <th title=\"Upper limit of the parameter\"> Limit+ </th>\n",
|
|
|
|
" <th title=\"Is the parameter fixed in the fit\"> Fixed </th>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 0 </th>\n",
|
|
|
|
" <td> a0 </td>\n",
|
|
|
|
" <td> 1.884 </td>\n",
|
|
|
|
" <td> 0.031 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 1 </th>\n",
|
|
|
|
" <td> a1 </td>\n",
|
|
|
|
" <td> -0.56 </td>\n",
|
|
|
|
" <td> 0.06 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 2 </th>\n",
|
|
|
|
" <td> a2 </td>\n",
|
|
|
|
" <td> 0.136 </td>\n",
|
|
|
|
" <td> 0.030 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 3 </th>\n",
|
|
|
|
" <td> a3 </td>\n",
|
|
|
|
" <td> -0.012 </td>\n",
|
|
|
|
" <td> 0.005 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
"</table><table>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td></td>\n",
|
|
|
|
" <th> a0 </th>\n",
|
|
|
|
" <th> a1 </th>\n",
|
|
|
|
" <th> a2 </th>\n",
|
|
|
|
" <th> a3 </th>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> a0 </th>\n",
|
|
|
|
" <td> 0.000952 </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(131,131,250);color:black\"> -0.0016 <strong>(-0.918)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(250,127,127);color:black\"> 0.000752 <strong>(0.822)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(153,153,250);color:black\"> -0.000105 <strong>(-0.746)</strong> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> a1 </th>\n",
|
|
|
|
" <td style=\"background-color:rgb(131,131,250);color:black\"> -0.0016 <strong>(-0.918)</strong> </td>\n",
|
|
|
|
" <td> 0.00317 </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(123,123,250);color:black\"> -0.00163 <strong>(-0.975)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(250,110,110);color:black\"> 0.00024 <strong>(0.930)</strong> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> a2 </th>\n",
|
|
|
|
" <td style=\"background-color:rgb(250,127,127);color:black\"> 0.000752 <strong>(0.822)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(123,123,250);color:black\"> -0.00163 <strong>(-0.975)</strong> </td>\n",
|
|
|
|
" <td> 0.000879 </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(122,122,250);color:black\"> -0.000134 <strong>(-0.988)</strong> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> a3 </th>\n",
|
|
|
|
" <td style=\"background-color:rgb(153,153,250);color:black\"> -0.000105 <strong>(-0.746)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(250,110,110);color:black\"> 0.00024 <strong>(0.930)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(122,122,250);color:black\"> -0.000134 <strong>(-0.988)</strong> </td>\n",
|
|
|
|
" <td> 2.1e-05 </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
"</table>"
|
|
|
|
],
|
|
|
|
"text/plain": [
|
|
|
|
"┌─────────────────────────────────────────────────────────────────────────┐\n",
|
|
|
|
"│ Migrad │\n",
|
|
|
|
"├──────────────────────────────────┬──────────────────────────────────────┤\n",
|
|
|
|
"│ FCN = 13.13 │ Nfcn = 120 │\n",
|
|
|
|
"│ EDM = 7.21e-17 (Goal: 0.0002) │ │\n",
|
|
|
|
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
|
|
|
|
"│ Valid Minimum │ No Parameters at limit │\n",
|
|
|
|
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
|
|
|
|
"│ Below EDM threshold (goal x 10) │ Below call limit │\n",
|
|
|
|
"├───────────────┬──────────────────┼───────────┬─────────────┬────────────┤\n",
|
|
|
|
"│ Covariance │ Hesse ok │ Accurate │ Pos. def. │ Not forced │\n",
|
|
|
|
"└───────────────┴──────────────────┴───────────┴─────────────┴────────────┘\n",
|
|
|
|
"┌───┬──────┬───────────┬───────────┬────────────┬────────────┬─────────┬─────────┬───────┐\n",
|
|
|
|
"│ │ Name │ Value │ Hesse Err │ Minos Err- │ Minos Err+ │ Limit- │ Limit+ │ Fixed │\n",
|
|
|
|
"├───┼──────┼───────────┼───────────┼────────────┼────────────┼─────────┼─────────┼───────┤\n",
|
|
|
|
"│ 0 │ a0 │ 1.884 │ 0.031 │ │ │ │ │ │\n",
|
|
|
|
"│ 1 │ a1 │ -0.56 │ 0.06 │ │ │ │ │ │\n",
|
|
|
|
"│ 2 │ a2 │ 0.136 │ 0.030 │ │ │ │ │ │\n",
|
|
|
|
"│ 3 │ a3 │ -0.012 │ 0.005 │ │ │ │ │ │\n",
|
|
|
|
"└───┴──────┴───────────┴───────────┴────────────┴────────────┴─────────┴─────────┴───────┘\n",
|
|
|
|
"┌────┬─────────────────────────────────────────┐\n",
|
|
|
|
"│ │ a0 a1 a2 a3 │\n",
|
|
|
|
"├────┼─────────────────────────────────────────┤\n",
|
|
|
|
"│ a0 │ 0.000952 -0.0016 0.000752 -0.000105 │\n",
|
|
|
|
"│ a1 │ -0.0016 0.00317 -0.00163 0.00024 │\n",
|
|
|
|
"│ a2 │ 0.000752 -0.00163 0.000879 -0.000134 │\n",
|
|
|
|
"│ a3 │ -0.000105 0.00024 -0.000134 2.1e-05 │\n",
|
|
|
|
"└────┴─────────────────────────────────────────┘"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 9,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
2023-04-05 16:48:43 +02:00
|
|
|
"source": [
|
|
|
|
"# run covariance \n",
|
|
|
|
"m.hesse()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 10,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
2023-04-11 18:27:30 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"┌────┬─────────────────────────────────────────┐\n",
|
|
|
|
"│ │ a0 a1 a2 a3 │\n",
|
|
|
|
"├────┼─────────────────────────────────────────┤\n",
|
|
|
|
"│ a0 │ 0.000952 -0.0016 0.000752 -0.000105 │\n",
|
|
|
|
"│ a1 │ -0.0016 0.00317 -0.00163 0.00024 │\n",
|
|
|
|
"│ a2 │ 0.000752 -0.00163 0.000879 -0.000134 │\n",
|
|
|
|
"│ a3 │ -0.000105 0.00024 -0.000134 2.1e-05 │\n",
|
|
|
|
"└────┴─────────────────────────────────────────┘\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
2023-04-05 16:48:43 +02:00
|
|
|
"source": [
|
|
|
|
"#get correlation matrix\n",
|
|
|
|
"cov = m.covariance\n",
|
|
|
|
"print (cov)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 11,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
2023-04-11 18:27:30 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"-0.0015953258466008735\n",
|
|
|
|
"0.0007515996501623164\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
2023-04-05 16:48:43 +02:00
|
|
|
"source": [
|
|
|
|
"# access elements of the numpy arrays\n",
|
|
|
|
"print(cov[0, 1])\n",
|
|
|
|
"print(cov[0, 2])"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 12,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
2023-04-11 18:27:30 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/html": [
|
|
|
|
"<table>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th colspan=\"5\" style=\"text-align:center\" title=\"Minimizer\"> Migrad </th>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td colspan=\"2\" style=\"text-align:left\" title=\"Minimum value of function\"> FCN = 13.13 </td>\n",
|
|
|
|
" <td colspan=\"3\" style=\"text-align:center\" title=\"Total number of function and (optional) gradient evaluations\"> Nfcn = 280 </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td colspan=\"2\" style=\"text-align:left\" title=\"Estimated distance to minimum and goal\"> EDM = 7.21e-17 (Goal: 0.0002) </td>\n",
|
|
|
|
" <td colspan=\"3\" style=\"text-align:center\" title=\"Total run time of algorithms\"> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td colspan=\"2\" style=\"text-align:center;background-color:#92CCA6;color:black\"> Valid Minimum </td>\n",
|
|
|
|
" <td colspan=\"3\" style=\"text-align:center;background-color:#92CCA6;color:black\"> No Parameters at limit </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td colspan=\"2\" style=\"text-align:center;background-color:#92CCA6;color:black\"> Below EDM threshold (goal x 10) </td>\n",
|
|
|
|
" <td colspan=\"3\" style=\"text-align:center;background-color:#92CCA6;color:black\"> Below call limit </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> Covariance </td>\n",
|
|
|
|
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> Hesse ok </td>\n",
|
|
|
|
" <td style=\"text-align:center;background-color:#92CCA6;color:black\" title=\"Is covariance matrix accurate?\"> Accurate </td>\n",
|
|
|
|
" <td style=\"text-align:center;background-color:#92CCA6;color:black\" title=\"Is covariance matrix positive definite?\"> Pos. def. </td>\n",
|
|
|
|
" <td style=\"text-align:center;background-color:#92CCA6;color:black\" title=\"Was positive definiteness enforced by Minuit?\"> Not forced </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
"</table><table>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td></td>\n",
|
|
|
|
" <th title=\"Variable name\"> Name </th>\n",
|
|
|
|
" <th title=\"Value of parameter\"> Value </th>\n",
|
|
|
|
" <th title=\"Hesse error\"> Hesse Error </th>\n",
|
|
|
|
" <th title=\"Minos lower error\"> Minos Error- </th>\n",
|
|
|
|
" <th title=\"Minos upper error\"> Minos Error+ </th>\n",
|
|
|
|
" <th title=\"Lower limit of the parameter\"> Limit- </th>\n",
|
|
|
|
" <th title=\"Upper limit of the parameter\"> Limit+ </th>\n",
|
|
|
|
" <th title=\"Is the parameter fixed in the fit\"> Fixed </th>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 0 </th>\n",
|
|
|
|
" <td> a0 </td>\n",
|
|
|
|
" <td> 1.884 </td>\n",
|
|
|
|
" <td> 0.031 </td>\n",
|
|
|
|
" <td> -0.031 </td>\n",
|
|
|
|
" <td> 0.031 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 1 </th>\n",
|
|
|
|
" <td> a1 </td>\n",
|
|
|
|
" <td> -0.56 </td>\n",
|
|
|
|
" <td> 0.06 </td>\n",
|
|
|
|
" <td> -0.06 </td>\n",
|
|
|
|
" <td> 0.06 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 2 </th>\n",
|
|
|
|
" <td> a2 </td>\n",
|
|
|
|
" <td> 0.136 </td>\n",
|
|
|
|
" <td> 0.030 </td>\n",
|
|
|
|
" <td> -0.030 </td>\n",
|
|
|
|
" <td> 0.030 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> 3 </th>\n",
|
|
|
|
" <td> a3 </td>\n",
|
|
|
|
" <td> -0.012 </td>\n",
|
|
|
|
" <td> 0.005 </td>\n",
|
|
|
|
" <td> -0.005 </td>\n",
|
|
|
|
" <td> 0.005 </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" <td> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
"</table><table>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td></td>\n",
|
|
|
|
" <th colspan=\"2\" style=\"text-align:center\" title=\"Parameter name\"> a0 </th>\n",
|
|
|
|
" <th colspan=\"2\" style=\"text-align:center\" title=\"Parameter name\"> a1 </th>\n",
|
|
|
|
" <th colspan=\"2\" style=\"text-align:center\" title=\"Parameter name\"> a2 </th>\n",
|
|
|
|
" <th colspan=\"2\" style=\"text-align:center\" title=\"Parameter name\"> a3 </th>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th title=\"Lower and upper minos error of the parameter\"> Error </th>\n",
|
|
|
|
" <td> -0.031 </td>\n",
|
|
|
|
" <td> 0.031 </td>\n",
|
|
|
|
" <td> -0.06 </td>\n",
|
|
|
|
" <td> 0.06 </td>\n",
|
|
|
|
" <td> -0.03 </td>\n",
|
|
|
|
" <td> 0.03 </td>\n",
|
|
|
|
" <td> -0.005 </td>\n",
|
|
|
|
" <td> 0.005 </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th title=\"Validity of lower/upper minos error\"> Valid </th>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> True </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> True </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> True </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> True </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> True </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> True </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> True </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> True </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th title=\"Did scan hit limit of any parameter?\"> At Limit </th>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th title=\"Did scan hit function call limit?\"> Max FCN </th>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th title=\"New minimum found when doing scan?\"> New Min </th>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" <td style=\"background-color:#92CCA6;color:black\"> False </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
"</table><table>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <td></td>\n",
|
|
|
|
" <th> a0 </th>\n",
|
|
|
|
" <th> a1 </th>\n",
|
|
|
|
" <th> a2 </th>\n",
|
|
|
|
" <th> a3 </th>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> a0 </th>\n",
|
|
|
|
" <td> 0.000952 </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(131,131,250);color:black\"> -0.0016 <strong>(-0.918)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(250,127,127);color:black\"> 0.000752 <strong>(0.822)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(153,153,250);color:black\"> -0.000105 <strong>(-0.746)</strong> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> a1 </th>\n",
|
|
|
|
" <td style=\"background-color:rgb(131,131,250);color:black\"> -0.0016 <strong>(-0.918)</strong> </td>\n",
|
|
|
|
" <td> 0.00317 </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(123,123,250);color:black\"> -0.00163 <strong>(-0.975)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(250,110,110);color:black\"> 0.00024 <strong>(0.930)</strong> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> a2 </th>\n",
|
|
|
|
" <td style=\"background-color:rgb(250,127,127);color:black\"> 0.000752 <strong>(0.822)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(123,123,250);color:black\"> -0.00163 <strong>(-0.975)</strong> </td>\n",
|
|
|
|
" <td> 0.000879 </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(122,122,250);color:black\"> -0.000134 <strong>(-0.988)</strong> </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
" <tr>\n",
|
|
|
|
" <th> a3 </th>\n",
|
|
|
|
" <td style=\"background-color:rgb(153,153,250);color:black\"> -0.000105 <strong>(-0.746)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(250,110,110);color:black\"> 0.00024 <strong>(0.930)</strong> </td>\n",
|
|
|
|
" <td style=\"background-color:rgb(122,122,250);color:black\"> -0.000134 <strong>(-0.988)</strong> </td>\n",
|
|
|
|
" <td> 2.1e-05 </td>\n",
|
|
|
|
" </tr>\n",
|
|
|
|
"</table>"
|
|
|
|
],
|
|
|
|
"text/plain": [
|
|
|
|
"┌─────────────────────────────────────────────────────────────────────────┐\n",
|
|
|
|
"│ Migrad │\n",
|
|
|
|
"├──────────────────────────────────┬──────────────────────────────────────┤\n",
|
|
|
|
"│ FCN = 13.13 │ Nfcn = 280 │\n",
|
|
|
|
"│ EDM = 7.21e-17 (Goal: 0.0002) │ │\n",
|
|
|
|
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
|
|
|
|
"│ Valid Minimum │ No Parameters at limit │\n",
|
|
|
|
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
|
|
|
|
"│ Below EDM threshold (goal x 10) │ Below call limit │\n",
|
|
|
|
"├───────────────┬──────────────────┼───────────┬─────────────┬────────────┤\n",
|
|
|
|
"│ Covariance │ Hesse ok │ Accurate │ Pos. def. │ Not forced │\n",
|
|
|
|
"└───────────────┴──────────────────┴───────────┴─────────────┴────────────┘\n",
|
|
|
|
"┌───┬──────┬───────────┬───────────┬────────────┬────────────┬─────────┬─────────┬───────┐\n",
|
|
|
|
"│ │ Name │ Value │ Hesse Err │ Minos Err- │ Minos Err+ │ Limit- │ Limit+ │ Fixed │\n",
|
|
|
|
"├───┼──────┼───────────┼───────────┼────────────┼────────────┼─────────┼─────────┼───────┤\n",
|
|
|
|
"│ 0 │ a0 │ 1.884 │ 0.031 │ -0.031 │ 0.031 │ │ │ │\n",
|
|
|
|
"│ 1 │ a1 │ -0.56 │ 0.06 │ -0.06 │ 0.06 │ │ │ │\n",
|
|
|
|
"│ 2 │ a2 │ 0.136 │ 0.030 │ -0.030 │ 0.030 │ │ │ │\n",
|
|
|
|
"│ 3 │ a3 │ -0.012 │ 0.005 │ -0.005 │ 0.005 │ │ │ │\n",
|
|
|
|
"└───┴──────┴───────────┴───────────┴────────────┴────────────┴─────────┴─────────┴───────┘\n",
|
|
|
|
"┌──────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐\n",
|
|
|
|
"│ │ a0 │ a1 │ a2 │ a3 │\n",
|
|
|
|
"├──────────┼───────────┬───────────┼───────────┬───────────┼───────────┬───────────┼───────────┬───────────┤\n",
|
|
|
|
"│ Error │ -0.031 │ 0.031 │ -0.06 │ 0.06 │ -0.03 │ 0.03 │ -0.005 │ 0.005 │\n",
|
|
|
|
"│ Valid │ True │ True │ True │ True │ True │ True │ True │ True │\n",
|
|
|
|
"│ At Limit │ False │ False │ False │ False │ False │ False │ False │ False │\n",
|
|
|
|
"│ Max FCN │ False │ False │ False │ False │ False │ False │ False │ False │\n",
|
|
|
|
"│ New Min │ False │ False │ False │ False │ False │ False │ False │ False │\n",
|
|
|
|
"└──────────┴───────────┴───────────┴───────────┴───────────┴───────────┴───────────┴───────────┴───────────┘\n",
|
|
|
|
"┌────┬─────────────────────────────────────────┐\n",
|
|
|
|
"│ │ a0 a1 a2 a3 │\n",
|
|
|
|
"├────┼─────────────────────────────────────────┤\n",
|
|
|
|
"│ a0 │ 0.000952 -0.0016 0.000752 -0.000105 │\n",
|
|
|
|
"│ a1 │ -0.0016 0.00317 -0.00163 0.00024 │\n",
|
|
|
|
"│ a2 │ 0.000752 -0.00163 0.000879 -0.000134 │\n",
|
|
|
|
"│ a3 │ -0.000105 0.00024 -0.000134 2.1e-05 │\n",
|
|
|
|
"└────┴─────────────────────────────────────────┘"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 12,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
2023-04-05 16:48:43 +02:00
|
|
|
"source": [
|
|
|
|
"# run minos error analysis\n",
|
|
|
|
"# The Minos algorithm uses the profile likelihood method to compute\n",
|
|
|
|
"# (generally asymmetric) confidence intervals.\n",
|
|
|
|
"m.minos()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 13,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
2023-04-11 18:27:30 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"<matplotlib.contour.ContourSet at 0x7f783a26f280>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 13,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAGwCAYAAABB4NqyAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAA9hAAAPYQGoP6dpAADUTElEQVR4nOzddZhV1RrH8e86Z7pn6O7uLkE6JCQEpFMQpBGQTmkkJQURUFIJaRQQJKW7u5nuk+v+sREvOufMwJlhiPV5nnmee7d777P3cK/nx4r3FVJKiaIoiqIoyntEl9wPoCiKoiiK8rqpAKQoiqIoyntHBSBFURRFUd47KgApiqIoivLeUQFIURRFUZT3jgpAiqIoiqK8d1QAUhRFURTlveOU3A/wJrJarTx48ABvb2+EEMn9OIqiKIqiJICUkoiICNKnT49OZ3+MRwWgODx48IBMmTIl92MoiqIoivIK7t69S8aMGe2eowJQHLy9vQHtF+jt/hgZNggsNwEdeHyG0PsjjSfAdAKsgf+6Wg/O+cCpOMKlOLgUReh8X/s7KIqiKMr7Jjw8nEyZMj3/HrdHBaA4/D3t5e20C2/TN+BhAF06hN90hEup5+dJKcFyG4x/IY1/gekYWO4BF7Uf648QK8ApN7iU0q51LonQp0qeF1MURVGU90BClq8I1Qvsv8LDw/H19SXkSnZ8vPXgUhHhNwWhC4j3Wml58E8gMv71bOToX/TZwK06wqMlQp8hCd5AURRFUd4/f39/h4WF4ePjY/dcFYDi8E8AyoVvugHg2QkhXm3DnLQEgunYP4HIfBn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A0k85vZMPdv7gdFfhaw4c
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
2023-04-05 16:48:43 +02:00
|
|
|
"source": [
|
|
|
|
"# Get a 2D contour of the function around the minimum for 2 parameters\n",
|
|
|
|
"# and draw a 2 D contours up to 4 sigma of a1 and a2 \n",
|
|
|
|
"m.draw_mncontour(\"a1\", \"a2\", cl=[1, 2, 3, 4])\n"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 14,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
2023-04-11 18:27:30 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"(array([0.07628965, 0.07748762, 0.07868559, 0.07988356, 0.08108153,\n",
|
|
|
|
" 0.0822795 , 0.08347748, 0.08467545, 0.08587342, 0.08707139,\n",
|
|
|
|
" 0.08826936, 0.08946733, 0.0906653 , 0.09186328, 0.09306125,\n",
|
|
|
|
" 0.09425922, 0.09545719, 0.09665516, 0.09785313, 0.0990511 ,\n",
|
|
|
|
" 0.10024908, 0.10144705, 0.10264502, 0.10384299, 0.10504096,\n",
|
|
|
|
" 0.10623893, 0.1074369 , 0.10863488, 0.10983285, 0.11103082,\n",
|
|
|
|
" 0.11222879, 0.11342676, 0.11462473, 0.1158227 , 0.11702068,\n",
|
|
|
|
" 0.11821865, 0.11941662, 0.12061459, 0.12181256, 0.12301053,\n",
|
|
|
|
" 0.12420851, 0.12540648, 0.12660445, 0.12780242, 0.12900039,\n",
|
|
|
|
" 0.13019836, 0.13139633, 0.13259431, 0.13379228, 0.13499025,\n",
|
|
|
|
" 0.13618822, 0.13738619, 0.13858416, 0.13978213, 0.14098011,\n",
|
|
|
|
" 0.14217808, 0.14337605, 0.14457402, 0.14577199, 0.14696996,\n",
|
|
|
|
" 0.14816793, 0.14936591, 0.15056388, 0.15176185, 0.15295982,\n",
|
|
|
|
" 0.15415779, 0.15535576, 0.15655373, 0.15775171, 0.15894968,\n",
|
|
|
|
" 0.16014765, 0.16134562, 0.16254359, 0.16374156, 0.16493953,\n",
|
|
|
|
" 0.16613751, 0.16733548, 0.16853345, 0.16973142, 0.17092939,\n",
|
|
|
|
" 0.17212736, 0.17332533, 0.17452331, 0.17572128, 0.17691925,\n",
|
|
|
|
" 0.17811722, 0.17931519, 0.18051316, 0.18171113, 0.18290911,\n",
|
|
|
|
" 0.18410708, 0.18530505, 0.18650302, 0.18770099, 0.18889896,\n",
|
|
|
|
" 0.19009693, 0.19129491, 0.19249288, 0.19369085, 0.19488882]),\n",
|
|
|
|
" array([7.76355388e+03, 7.45301172e+03, 7.14880716e+03, 6.85094020e+03,\n",
|
|
|
|
" 6.55941083e+03, 6.27421905e+03, 5.99536487e+03, 5.72284829e+03,\n",
|
|
|
|
" 5.45666930e+03, 5.19682790e+03, 4.94332410e+03, 4.69615790e+03,\n",
|
|
|
|
" 4.45532929e+03, 4.22083827e+03, 3.99268485e+03, 3.77086903e+03,\n",
|
|
|
|
" 3.55539080e+03, 3.34625016e+03, 3.14344712e+03, 2.94698168e+03,\n",
|
|
|
|
" 2.75685383e+03, 2.57306357e+03, 2.39561091e+03, 2.22449585e+03,\n",
|
|
|
|
" 2.05971838e+03, 1.90127850e+03, 1.74917622e+03, 1.60341154e+03,\n",
|
|
|
|
" 1.46398445e+03, 1.33089495e+03, 1.20414305e+03, 1.08372875e+03,\n",
|
|
|
|
" 9.69652035e+02, 8.61912920e+02, 7.60511400e+02, 6.65447475e+02,\n",
|
|
|
|
" 5.76721145e+02, 4.94332410e+02, 4.18281270e+02, 3.48567725e+02,\n",
|
|
|
|
" 2.85191775e+02, 2.28153420e+02, 1.77452660e+02, 1.33089495e+02,\n",
|
|
|
|
" 9.50639250e+01, 6.33759500e+01, 3.80255700e+01, 1.90127850e+01,\n",
|
|
|
|
" 6.33759500e+00, 8.32667268e-11, 0.00000000e+00, 6.33759500e+00,\n",
|
|
|
|
" 1.90127850e+01, 3.80255700e+01, 6.33759500e+01, 9.50639250e+01,\n",
|
|
|
|
" 1.33089495e+02, 1.77452660e+02, 2.28153420e+02, 2.85191775e+02,\n",
|
|
|
|
" 3.48567725e+02, 4.18281270e+02, 4.94332410e+02, 5.76721145e+02,\n",
|
|
|
|
" 6.65447475e+02, 7.60511400e+02, 8.61912920e+02, 9.69652035e+02,\n",
|
|
|
|
" 1.08372875e+03, 1.20414305e+03, 1.33089495e+03, 1.46398445e+03,\n",
|
|
|
|
" 1.60341154e+03, 1.74917622e+03, 1.90127850e+03, 2.05971838e+03,\n",
|
|
|
|
" 2.22449585e+03, 2.39561091e+03, 2.57306357e+03, 2.75685383e+03,\n",
|
|
|
|
" 2.94698168e+03, 3.14344712e+03, 3.34625016e+03, 3.55539080e+03,\n",
|
|
|
|
" 3.77086903e+03, 3.99268485e+03, 4.22083827e+03, 4.45532929e+03,\n",
|
|
|
|
" 4.69615790e+03, 4.94332410e+03, 5.19682790e+03, 5.45666930e+03,\n",
|
|
|
|
" 5.72284829e+03, 5.99536487e+03, 6.27421905e+03, 6.55941083e+03,\n",
|
|
|
|
" 6.85094020e+03, 7.14880716e+03, 7.45301172e+03, 7.76355388e+03]))"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 14,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlEAAAHFCAYAAADSY6wWAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAA9hAAAPYQGoP6dpAAB6+0lEQVR4n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ZbYt/l1ljXJkZmZCJpPBx8fnjr/rXo8va1QGsCUk48ePx7hx4/Dee++Vuv+LL76AEAITJkzA888/D7lcjtjYWAQFBeH333+3/9777SsApRLyhQsXYt26dVizZk2J4+Hh4Xd9nlv7IigoqMR9d+uLWx9f0deiEALPPfccli1bhiVLlpRIRgHb38pvv/2G2NhYDBgwAADg4eGBWbNm4b///S/q1q1bKv6BAweWeI6BAwdCJpOVqy+JyoNJFFEZli1bhqeffhqzZs0qcfz69etlfhD//vvvGD58OHr16oWffvoJarW6XL/nwoUL9/xAK7Zlyxb7CE9ZitefHD16FNHR0fbj6enpuH79OiIjI8v1eypLqVSiQ4cO+P777+3HylpfVEwIcc9RpbVr18JoNNr/HRoaese2jRs3hpubW6nF/4CtT5o0aQKtVnvHxxf3z9GjR0stXj569GiZ/bd48WI899xzGD16NL788ssyE2cPDw8sXboUn3zyCS5fvozQ0FAEBASgefPm6Nq1q30R+/32FQB07NixxL/XrVsHtVpd6vi93PpaKp5GA2wjtCdPnsQ
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
2023-04-05 16:48:43 +02:00
|
|
|
"source": [
|
|
|
|
"m.draw_profile(\"a2\",subtract_min=True)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 15,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
2023-04-11 18:27:30 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"-0.029647391105505568\n",
|
|
|
|
"0.029647391215961143\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
2023-04-05 16:48:43 +02:00
|
|
|
"source": [
|
|
|
|
"# access fit results by parameter name and get minos asymetric errors\n",
|
|
|
|
"print (m.merrors['a2'].lower)\n",
|
|
|
|
"print (m.merrors['a2'].upper)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 16,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
2023-04-11 18:27:30 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"<ValueView a0=1.884312126113227 a1=-0.555095569066645 a2=0.135589233702581 a3=-0.012129739293476468> <ErrorView a0=0.030846480016973075 a1=0.056345427583826234 a2=0.029649793193055433 a3=0.004578762777736633>\n",
|
|
|
|
"<ErrorView a0=0.030846480016973075 a1=0.056345427583826234 a2=0.029649793193055433 a3=0.004578762777736633>\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
2023-04-05 16:48:43 +02:00
|
|
|
"source": [
|
|
|
|
"# more print out\n",
|
|
|
|
"print (m.values,m.errors)\n",
|
|
|
|
"print (m.errors)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 17,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"# Access fit results\n",
|
|
|
|
"a0_fit = m.values[\"a0\"]\n",
|
|
|
|
"a1_fit = m.values[\"a1\"]\n",
|
|
|
|
"a2_fit = m.values[\"a2\"]\n",
|
|
|
|
"a3_fit = m.values[\"a3\"]"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 18,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"# display fitted function \n",
|
|
|
|
"x_plot = np.linspace( 0.1, 4.1 , 100 )\n",
|
|
|
|
"y_fit = a0_fit + a1_fit * x_plot + a2_fit * x_plot**2 + a3_fit * x_plot**3\n"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2023-04-11 18:27:30 +02:00
|
|
|
"execution_count": 19,
|
2023-04-05 16:48:43 +02:00
|
|
|
"metadata": {},
|
2023-04-11 18:27:30 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAHFCAYAAAAOmtghAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAA9hAAAPYQGoP6dpAABSVUlEQVR4nO3deVwW5f7/8dfNDioopgLuWrmEIi7kmruJRll2WsxcylK/bWabtLic0y+11Tqmnsr0lGsnl6PpIS0XtCxFxVzKNDFJQXPpBlFBYH5/3IKioDcI99z3zfv5eMzxnrmvGT7j+Ij3meuauSyGYRiIiIiIuAkPswsQERERKU0KNyIiIuJWFG5ERETErSjciIiIiFtRuBERERG3onAjIiIibkXhRkRERNyKwo2IiIi4FYUbERERcSsKNyJlbPbs2VgsFg4ePOjUxyzMkCFDqFevXoFtb7zxBkuXLi3Tn1teHDlyhPHjx5OYmHjFd+PHj8disZTouPbum9eusGXq1KmsW7cOi8XCunXr8vdZuXIl48ePL1FdIo7iZXYBIu6ub9++bNq0idDQUKc+ZmFee+01nnnmmQLb3njjDe6991769etXpj+7PDhy5AgTJkygXr16tGjRosB3w4YNo3fv3g6pIy4ujqCgoALb6tevj7+/P5s2baJp06b521euXMmHH36ogCNOTeFGpIxVq1aNatWqOf0xC9OwYcMy/xlSuFq1alGrVi2H/KxWrVpxww03FPpd27ZtHVKDSGlSt5RIGSusC6lLly6E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3h64mrxvu8hD1r3/9q9g/93oUp2YRs+jOjUg506ZNGxo1asTzzz9PdnY2VapUYcmSJYU+QVSYZs2asW7dOpYvX05oaCiVKlUqEFIu9cADDzB37lz69OnDM888Q1RUFN7e3vzxxx+sXbuWu+66i7vvvpuUlBQGDhxI586dGTduHB4eHixcuJDbbruNF198kSlTphQ47rFjx7j77rt57LHHsFqtjBs3Dj8/P2JjYwHw8PDgzTff5KGHHuKOO+5g+PDhZGZm8tZbb/HXX38xadKkYv+9dejQgccff5yhQ4eSkJDAbbfdRoUKFUhJSWHjxo00a9aMkSNHFuuYDRs2xN/fn7lz59KkSRMqVqxIWFhYgTFXedq3b0+VKlUYMWIE48aNw9vbm7lz5+Z3xTlKXoibPHky0dHReHp60rx58yK7HkXMoDs3IuWMp6cny5cvp3HjxowYMYJBgwbh6+vL1KlT7dr//fff56abbuKBBx6gTZs2DB8+/Ko/a9myZbz88sssXryYu+++m379+jFp0iT8/Pxo1qwZOTk5PPjgg1gsFubNm5c/ALht27a88cYbvP/++1dM9/DGG29Qt25dhg4dyiOPPEJoaChr164t8NLBAQMGsHTpUk6cOMH999/P0KFDCQwMZO3atXTs2LH4f3HY7pJMnTqV+Ph4HnjgAfr27cvYsWPJyMi4YvCwPQICAvj00085ceIEvXr1ok2bNnz00UeFtq1atSorVqwgICCAgQMH8sgjj1CxYkUWLlxYonMpqQEDBjBs2DCmTZtGu3btaNOmjV2vKRBxJItx6T1bEREntm7dOrp27cp//vOf/PetiIhcTnduRERExK0o3IiIiIhbUbeUiIiIuBXduRERERG3onAjIiIibkXhRkRERNxKuXuJX25uLkeOHKFSpUoFJt4TERER52UYBunp6YSFhRWYELcw5S7cHDlyhNq1a5tdhoiIiJRAcnIytWrVumqbchdu8ibqS05OJjAw0ORqRERExB5paWnUrl37igl3C1Puwk1eV1RgYKDCjYiIiIuxZ0iJBhSLiIiIW1G
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
2023-04-05 16:48:43 +02:00
|
|
|
"source": [
|
|
|
|
"plt.figure()\n",
|
|
|
|
"\n",
|
|
|
|
"plt.errorbar(x, y, dy , fmt=\"o\")\n",
|
|
|
|
"plt.plot(x_plot,y_fit ) \n",
|
|
|
|
"plt.xlabel('x')\n",
|
|
|
|
"plt.ylabel('f(x)')\n",
|
|
|
|
"plt.title('iminuit exponential Fit')\n",
|
|
|
|
"#plt.axis([0,30,-1.2,1.2])\n",
|
|
|
|
"\n",
|
|
|
|
"# show the plot\n",
|
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"kernelspec": {
|
2023-04-11 18:27:30 +02:00
|
|
|
"display_name": "Python 3 (ipykernel)",
|
2023-04-05 16:48:43 +02:00
|
|
|
"language": "python",
|
2023-04-11 18:27:30 +02:00
|
|
|
"name": "python3"
|
2023-04-05 16:48:43 +02:00
|
|
|
},
|
|
|
|
"language_info": {
|
|
|
|
"codemirror_mode": {
|
|
|
|
"name": "ipython",
|
|
|
|
"version": 3
|
|
|
|
},
|
|
|
|
"file_extension": ".py",
|
|
|
|
"mimetype": "text/x-python",
|
|
|
|
"name": "python",
|
|
|
|
"nbconvert_exporter": "python",
|
|
|
|
"pygments_lexer": "ipython3",
|
2023-04-11 18:27:30 +02:00
|
|
|
"version": "3.8.16"
|
2023-04-05 16:48:43 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 4
|
|
|
|
}
|