updates
This commit is contained in:
parent
85d1ea9747
commit
470ef7a432
@ -89,7 +89,9 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# run migrad for minimization\n",
|
||||
"m.migrad()"
|
||||
"m.migrad()\n",
|
||||
"chi2 = m.fval / (len(y) - len(m.values))\n",
|
||||
"print (\"Chi2/ndof =\" , chi2)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -231,9 +233,9 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"display_name": "Python [conda env:ML]",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
"name": "conda-env-ML-py"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
@ -245,7 +247,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.16"
|
||||
"version": "3.10.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -116,6 +116,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"m.fixed[\"c\"] = True\n",
|
||||
"m.migrad()"
|
||||
]
|
||||
},
|
||||
@ -154,13 +155,6 @@
|
||||
"m.covariance"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Copy covariance information to numpy arrays"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
@ -192,7 +186,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"m.draw_mncontour('a', 'b')"
|
||||
"m.draw_mncontour('a', 'b', cl=[1,2,3,4])"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -209,6 +203,9 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"print(m.values,m.errors)\n",
|
||||
"print (m.merrors['a'])\n",
|
||||
"print (m.merrors['a'].lower)\n",
|
||||
"print (m.merrors['a'].upper)\n",
|
||||
"a_fit = m.values[\"a\"]\n",
|
||||
"b_fit = m.values[\"b\"]\n",
|
||||
"c_fit = m.values[\"c\"]"
|
||||
@ -251,20 +248,13 @@
|
||||
"plt.xlim(-0.1, 4.1)\n",
|
||||
"plt.show()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"display_name": "Python [conda env:ML]",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
"name": "conda-env-ML-py"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
@ -276,7 +266,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.16"
|
||||
"version": "3.10.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -306,7 +306,7 @@ Fit process with the minuit package
|
||||
# limit the range of b and fix parameter c
|
||||
m = Minuit(fcn,a=1,b=-0.7,c=1)
|
||||
m.migrad() # run minimizer
|
||||
m.fixed["c"] = True # fix or release parameter c
|
||||
m.fixed["c"] = False / True # fix or release parameter c
|
||||
m.migrad() # rerun minimizer
|
||||
# Might be useful to fix parameters or limit the range for some applications
|
||||
|
||||
@ -341,10 +341,9 @@ Fit process with the minuit package
|
||||
......
|
||||
m.hesse() # run covariance estimator
|
||||
m.matrix() # get covariance matrix
|
||||
m.matrix(correlation=True) # get full correlation matrix
|
||||
cov = m.np_matrix() # save matrix to numpy
|
||||
cor = m.np_matrix(correlation=True)
|
||||
print(cor[0, 1]) # print correlation between parameter 1 and 2
|
||||
m.covariance # get full covariance matrix
|
||||
cov = m.covariance # save matrix to access by numpy
|
||||
print(cov[0, 1]) # print correlation between parameter 1 and 2
|
||||
```
|
||||
\normalsize
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user