1
0
Fork 0
mirror of https://gitlab.rlp.net/pgp/pgp1-python-einfuehrung synced 2024-11-16 13:48:11 +00:00
pgp1-python-einfuehrung/Einfuehrung_iminuit.ipynb

2858 lines
268 KiB
Text
Raw Normal View History

2024-10-22 07:18:36 +00:00
{
"cells": [
{
"cell_type": "markdown",
"id": "c9a4045f-f389-40f5-9f19-32f8bbebc75d",
"metadata": {},
"source": [
"# Methode der kleinsten Quadrate\n",
"\n",
"Im folgenden wollen wir die **Methode der kleinsten Quadrate (Least Squares)** näher beleuchten. Diese Methode wird oft benutzt, um eine Funktion $\\lambda(x; \\ $**$\\phi$**$)$ mit den Funktionsparametern $\\mathbf{\\phi}$ an die gemessenen Punkte **$(x,y)$** anzupassen. Um jedoch die **Methode der kleinsten Quadrate** zu verstehen, wollen wir sie erst einmal anschaulich und halb-mathematisch herleiten. Dabei stüzen wir uns im Folgenden auf eine Herleitung aus dem Buch **\"Statistical Data Analysis\"** von **Glen Cowan**."
]
},
{
"cell_type": "markdown",
"id": "5a8f4ef9-222c-440f-8621-e612a8988fd0",
"metadata": {},
"source": [
"Bevor wir dies jedoch tun, schauen wir uns das Problem des Fittens doch erst einmal anschaulich an. \n",
"\n",
"<figure class=\"image\">\n",
"<img src=\"images/SketchLeastSquares.png\" alt=\"{{ Beispiel PDF }}\" width=70%>\n",
"</figure>\n",
"\n",
"Beim Fitten, zum Beispiel einer Geraden (lila) an eine Reihe von Messpunkten (schwarz), wollen wir den Abstand zwischen den einzelnen Messpunkten und der Geraden (orange) möglichst klein halten. Sprich die Summe über alle $\\Delta Y_i$ \n",
"\n",
"$$\\sum_i \\Delta Y_i $$\n",
"\n",
"sollte möglichst klein sein, wobei $\\Delta Y_i$ durch \n",
"\n",
"$$ \\Delta Y_i = y_i f(x_i, \\vec{\\theta})$$\n",
"\n",
"gegeben ist und $f(x, \\vec{\\theta})$ unsere Fitfunktion repräsentiert. Hierbei symbolisiert $\\vec{\\theta}$ die Parameter unserer Funktion. Sprich im Fall einer Geraden die Steigung $m$ und den Offset $y_0$ ($\\vec{\\theta}=(m, y_0)$). \n",
"\n",
"Darüber hinaus sollte die Richtung des Abstandes, sprich ob ein Messpunkt unterhalb oder oberhalb der Fitfunktion liegt, keine Rolle spielen. Daher quadrieren wir das Ganze und erhalten somit\n",
"\n",
"$$ LS = \\sum_i = (y_i f(x_i, \\theta))^2$$\n",
"\n",
"Dies ist die allgemeinste Form der Methode der kleinsten Quadrate. Sie besagt, dass die Funktion, welche die Messpunkte am besten beschreibt, sprich die optimalen Werte für $\\vec{\\theta}$ aufweist, den Ausdruck LS minimiert. \n",
"\n",
"Nun weisen unsere Messpunkte nicht nur Werte für X und Y aus, sondern sind noch zusätzlich durch einen Messunsicherheit (Messfehler) charakterisiert. Diese sollten wir natürlich bei der Bestimmung unserer Parameter $\\vec{\\theta}$ berücksichtigen. Sprich Messwerte mit einer großen Unsicherheit sollten weniger stark berücksichtigt werden wie Messwerte mit einer kleinen Unsicherheit. Dies können wir gewährleisten, sofern wir die Distanzen $\\Delta Y_i$ mit den jeweiligen Unsicherheiten $\\Delta y_i$ gewichten, sprich \n",
"\n",
"$$ \\chi^2 = \\sum_i =\\frac{(y_i f(x_i, \\theta))^2}{\\Delta y_i^2}$$\n",
"\n",
"berechnen. Das Quadrieren der Unsicherheiten sorgt dafür, dass der Ausdruck dimensionslos wird. Diese besondere Form der kleinsten Quadrate nennt man auch oft $\\chi^2$-Fit. Wir werden später noch einmal genauer beleuchten warum. "
]
},
{
"cell_type": "markdown",
"id": "1153a474-8afe-44ae-8511-b403a4ad861d",
"metadata": {},
"source": [
"Nun wollen wir uns erst einmal ein Beispiel anschauen, wie dies in der Praxis aussieht. In der nachfolgenden Animation wird ein Ohmschwer Widerstand an eine Reihe von Spannungs- und Strommessungen gefittet. Dies entspricht unserem obigen Geradenbeispiel. \n",
"<figure class=\"image\">\n",
"<img src=\"images/MaterialPythonkurs092018/Fitting_gif.gif\" alt=\"{{ Least Square Beispiel }}\" width=100%>\n",
"</figure>\n",
"\n",
"Wie die Animation zeigt, werden so lange verschiedene Widerstände ausprobiert, bis ein Wert gefunden wurde, bei dem das $\\chi^2$ minimal wird. Dieses Variieren der Widerstandswerte passiert nicht zufällig, sondern basiert auf einem Algorithmus für Optimierungsverfahren. \n",
"\n",
"Es gibt verschiedene Arten von Algorithmen, um Minimierungsprobleme zu lösen. Wie diese genau aufgebaut sind, lernen Sie in anderen Programmierveranstaltungen, wie zum Beispiel *Programmieren für Physiker* oder *Computer in der Wissenschaft*. Zum Glück haben uns in Python bereits andere Menschen diese Arbeit abgenommen. Im folgenden wollen wir uns das package `iminuit` etwas genauer anschauen, welches bereits ein sehr umfangreiches und mächtiges Fittingtool darstellt. \n",
"\n",
"[iminuit](https://iminuit.readthedocs.io/en/stable/tutorials.html) verfügt auch über eine exzellente Dokumentation, mit Hilfe derer Sie auch komplexere Probleme lösen können."
]
},
{
"cell_type": "markdown",
"id": "702b9a12-539d-43b5-8314-7f8dcdf93cda",
"metadata": {},
"source": [
"Um mit Hilfe von `imnuit` etwas zu fitten brauchen wir zunächst einmal ein paar Messdaten und ein Fitmodel. Im Folgenden wollen wir die Entladekurve eines Kondensators mit der Kapazität $C$ über einen Widerstand $R$ bestimmen. Die Entladekurve ist durch eine einfache Exponentialfunktion der Form \n",
"\n",
"$$ I = I_0 \\exp\\{-t/RC\\}$$\n",
"\n",
"gegeben. Die Messdaten befinden sich in einer CSV-Datei im Ordner `data`. Die CSV-Datei kann mit Hilfe des `pandas` package eingelesen werden. [pandas](https://pandas.pydata.org/) ist ähnlich wie `numpy` ein package welches eine Fülle an Funktionen zum Verarbeiten und Verwalten von Daten bereitstellt. Es gehört ähnlich wie auch `numpy`, `scipy` und `matplotlib` zu den Standardbibliotheken, welche sehr häufig in der Wissenschaft verwendet werden. Aufgrund der zeitlichen Limitierung des Versuchstages können wir leider nicht auf alle Funktionen von `pandas` eingehen und wollen uns im Folgenden lediglich auf die Grundlagen beschränken. Für ihre zukünftigen Praktika lohnt es sich jedoch, noch mehr über `pandas` in Ihrer Eigenstudienzeit zu lernen."
]
},
{
"cell_type": "markdown",
"id": "5215840a-1276-49c1-9181-274cd8a2b4bf",
"metadata": {},
"source": [
"CSV-Datein können wie folgt eingelesen werden"
]
},
{
"cell_type": "code",
"execution_count": 485,
"id": "f8ef1be0-a42d-4a11-b674-c2ed099fefcb",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"data_frame = pd.read_csv('data/discharge_data.csv')"
]
},
{
"cell_type": "markdown",
"id": "15800aa8-8a7f-4d59-ab06-3edc6bb1e443",
"metadata": {},
"source": [
"Dabei gibt pandas die Daten als so genannten DataFrames zurück. Dies sind Objekte, welche ähnlich wie strukturierte `numpy.arrays` zu behandeln sind. DataFrames werden allgemein als Tabellen dargestellt."
]
},
{
"cell_type": "code",
"execution_count": 486,
"id": "f14ca80f-e0d7-4447-9335-b3744f7a028f",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Unnamed: 0</th>\n",
" <th>time</th>\n",
" <th>current</th>\n",
" <th>delta_current</th>\n",
" <th>delta_time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>0.000637</td>\n",
" <td>1.066538</td>\n",
" <td>0.05</td>\n",
" <td>0.000637</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1</td>\n",
" <td>0.088553</td>\n",
" <td>0.406316</td>\n",
" <td>0.05</td>\n",
" <td>0.011447</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2</td>\n",
" <td>0.194773</td>\n",
" <td>0.143093</td>\n",
" <td>0.05</td>\n",
" <td>0.005227</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>3</td>\n",
" <td>0.306413</td>\n",
" <td>0.078141</td>\n",
" <td>0.05</td>\n",
" <td>0.006413</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>4</td>\n",
" <td>0.405285</td>\n",
" <td>0.065042</td>\n",
" <td>0.05</td>\n",
" <td>0.005285</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>5</td>\n",
" <td>0.507390</td>\n",
" <td>0.011885</td>\n",
" <td>0.05</td>\n",
" <td>0.007390</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>6</td>\n",
" <td>0.613279</td>\n",
" <td>-0.018824</td>\n",
" <td>0.05</td>\n",
" <td>0.013279</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>7</td>\n",
" <td>0.707501</td>\n",
" <td>0.044513</td>\n",
" <td>0.05</td>\n",
" <td>0.007501</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>8</td>\n",
" <td>0.790479</td>\n",
" <td>0.006881</td>\n",
" <td>0.05</td>\n",
" <td>0.009521</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>9</td>\n",
" <td>0.883672</td>\n",
" <td>-0.019052</td>\n",
" <td>0.05</td>\n",
" <td>0.016328</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Unnamed: 0 time current delta_current delta_time\n",
"0 0 0.000637 1.066538 0.05 0.000637\n",
"1 1 0.088553 0.406316 0.05 0.011447\n",
"2 2 0.194773 0.143093 0.05 0.005227\n",
"3 3 0.306413 0.078141 0.05 0.006413\n",
"4 4 0.405285 0.065042 0.05 0.005285\n",
"5 5 0.507390 0.011885 0.05 0.007390\n",
"6 6 0.613279 -0.018824 0.05 0.013279\n",
"7 7 0.707501 0.044513 0.05 0.007501\n",
"8 8 0.790479 0.006881 0.05 0.009521\n",
"9 9 0.883672 -0.019052 0.05 0.016328"
]
},
"execution_count": 486,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_frame"
]
},
{
"cell_type": "markdown",
"id": "fc24d5fa-d3c0-4866-b18a-9dd07768a222",
"metadata": {},
"source": [
"Um die Daten aus einer bestimmente Spalte zu bekommen, können diese einfach mit dem Spaltennamen aufgerufen werden:"
]
},
{
"cell_type": "code",
"execution_count": 487,
"id": "93b7cbb1-1095-4a53-83d9-7b32f068daea",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 0.000637\n",
"1 0.088553\n",
"2 0.194773\n",
"3 0.306413\n",
"4 0.405285\n",
"5 0.507390\n",
"6 0.613279\n",
"7 0.707501\n",
"8 0.790479\n",
"9 0.883672\n",
"Name: time, dtype: float64"
]
},
"execution_count": 487,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_frame['time']"
]
},
{
"cell_type": "markdown",
"id": "4476302c-eb65-409a-b1aa-2342ecbd9c88",
"metadata": {},
"source": [
"oder"
]
},
{
"cell_type": "code",
"execution_count": 488,
"id": "969d8afa-5d52-4e01-8b64-ddab090891b8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 1.066538\n",
"1 0.406316\n",
"2 0.143093\n",
"3 0.078141\n",
"4 0.065042\n",
"5 0.011885\n",
"6 -0.018824\n",
"7 0.044513\n",
"8 0.006881\n",
"9 -0.019052\n",
"Name: current, dtype: float64"
]
},
"execution_count": 488,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_frame['current']"
]
},
{
"cell_type": "markdown",
"id": "32249263-ec9f-44de-81b7-7a6c69e23332",
"metadata": {},
"source": [
"Einzelne Messwerte lassen sich mit Hilfe von `.loc` bestimmen."
]
},
{
"cell_type": "code",
"execution_count": 489,
"id": "e4b44637-8e25-46c1-863d-3cd7604f52dd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0118852615051639"
]
},
"execution_count": 489,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_frame.loc[5, 'current']"
]
},
{
"cell_type": "markdown",
"id": "a2c0c04b-be37-482d-aabc-802bfa2965d2",
"metadata": {},
"source": [
"Sollten Sie eine Spalte von Messdaten in ein `numpy.array` umwandeln wollen, so können Sie dies wie folgt erreichen"
]
},
{
"cell_type": "code",
"execution_count": 490,
"id": "f246f55e-5fc8-427c-990d-3e97799b5aeb",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 1.06653795, 0.40631626, 0.1430927 , 0.07814083, 0.06504185,\n",
" 0.01188526, -0.01882397, 0.04451315, 0.00688072, -0.01905164])"
]
},
"execution_count": 490,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_frame['current'].values"
]
},
{
"cell_type": "markdown",
"id": "3d2bd9ed-852d-4448-a051-a6f677ea891d",
"metadata": {},
"source": [
"Die Messdaten können Sie auch wie gewohnt mit Hilfe von `matplotlib` darstellen."
]
},
{
"cell_type": "code",
"execution_count": 491,
"id": "e3898686-3926-48a0-be4c-4d460a1792f3",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAGwCAYAAABVdURTAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAooUlEQVR4nO3dfXTU1Z3H8c/MkEyUkICNTEISifIgqDw/ZINSH5oSxaXl7NmVI12gWcQnyilku4UokiItoVQpXYgFKRzYc+qC7Vq3p7BBjXBaNXtQMCJVguGhPEgGqJKBQQnM/PYPl6kjAWaGmfkld96vc+aczJ37m/kOd8J8cuf+7jgsy7IEAABgCKfdBQAAAMQT4QYAABiFcAMAAIxCuAEAAEYh3AAAAKMQbgAAgFEINwAAwCid7C4g2YLBoD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kLNmDFDc+bMuaj/ihUr9LOf/Uy7d+9WWlpaRLWcPXs2LGj5fD4VFhay5gYAgA4k7qeC79+/P+oiCgoKLnt7a2urtm/frsrKylCb0+lUaWmp6uvr2zzm97//vUpKSjR9+nT993//t66//npNnDhRs2fPvuQePNXV1Zo/f37U9QMAgI4ponDTs2fPuD/wiRMnFAgE5PF4wto9Ho92797d5jH79u3T66+/ru985zvatGmTmpqa9Pjjj+vcuXOqqqpq85jKykpVVFSErl+YuQEAAGaKeBO/9iAYDKp79+56/vnn5XK5NGzYMB0
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"plt.errorbar(\n",
" data_frame['time'], \n",
" data_frame['current'], \n",
" data_frame['delta_current'], \n",
" ls='', \n",
" marker='.', \n",
" color='k'\n",
")\n",
"plt.xlabel('Time []')\n",
"plt.ylabel('Current []')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "100a4fe4-a5c4-4be3-a7f7-13337b97a194",
"metadata": {},
"source": [
"Nun wollen wir die Messdaten mit Hilfe von `iminuit` fitten. Hierzu müssen wir zunächste zwei Module des packages importieren und eine Funktion für die Entladekurve des Kondensators definieren:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "520f4973",
"metadata": {},
"outputs": [],
"source": [
"# Diese Zelle nur auf JupyterHub des ZDV ausführen um `iminuit` zu installieren!\n",
"# import sys\n",
"# import subprocess\n",
"# subprocess.check_call([\n",
"# sys.executable, \n",
"# '-m',\n",
"# 'pip',\n",
"# 'install',\n",
"# '--proxy',\n",
"# 'http://webproxy.zdv.uni-mainz.de:3128',\n",
"# 'iminuit'\n",
"# ])"
]
},
{
"cell_type": "code",
"execution_count": 492,
"id": "2ffe340b-cd0f-45ec-b5b8-42e7a0349d4c",
"metadata": {},
"outputs": [],
"source": [
"\n",
"from iminuit import Minuit, cost\n",
"import numpy as np\n",
"\n",
"def discharge_current(t, I0, R, C):\n",
" return I0 * np.exp(-t/(R*C))"
]
},
{
"cell_type": "markdown",
"id": "ef87da8f-7af9-4e3f-af63-c28a2e1d9830",
"metadata": {},
"source": [
"Nun können wir den Fit selbst durchführen. Hierzu muss zuerst mittels dem `cost` Modul eine sogenannte Kostenfunktion erstellt werden. Die Kostenfunktion ist im Grunde unsere $\\chi^2$ Funktion\n",
"\n",
"$$ \\chi^2 = \\sum_i =\\frac{(y_i f(x_i, \\theta))^2}{\\Delta y_i^2}$$\n",
"\n",
"welche minimiert werden soll. Dies ist bereits bei `iminuit` für uns vordefiniert. Anschließend können wir die genutzt Kostenfunktion über `Minuit` minimieren lassen. Hierzu müssen wir zunächst geeignete Startwerte für den Minimierungsprozess vorgeben. Diese sollten im Idealfall nicht allzu weit von den wahren Werten entfernt liegen. Wir werden an einem späteren Beispiel noch einmal genauer zeigen, wie man hier vorgehen kann. Um den Minimierungsprozess zu starten muss noch am Ende `migrad()` aufgerufen werden."
]
},
{
"cell_type": "code",
"execution_count": 493,
"id": "bf36b7b9-fb20-47b7-8538-479026b48fb2",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
" <tr>\n",
" <th colspan=\"2\" style=\"text-align:center\" title=\"Minimizer\"> Migrad </th>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:left\" title=\"Minimum value of function\"> FCN = 2.707 (χ²/ndof = 0.4) </td>\n",
" <td style=\"text-align:center\" title=\"Total number of function and (optional) gradient evaluations\"> Nfcn = 103 </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:left\" title=\"Estimated distance to minimum and goal\"> EDM = 2.18e-10 (Goal: 0.0002) </td>\n",
" <td style=\"text-align:center\" title=\"Total run time of algorithms\"> </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> Valid Minimum </td>\n",
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> Below EDM threshold (goal x 10) </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> No parameters at limit </td>\n",
" <td 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:#FFF79A;color:black\"> Hesse ok </td>\n",
" <td style=\"text-align:center;background-color:#FFF79A;color:black\"> Covariance FORCED pos. def. </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> I0 </td>\n",
" <td> 1.07 </td>\n",
" <td> 0.05 </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> R </td>\n",
" <td> 0.03e6 </td>\n",
" <td> 0.05e6 </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> C </td>\n",
" <td> 3e-6 </td>\n",
" <td> 5e-6 </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> I0 </th>\n",
" <th> R </th>\n",
" <th> C </th>\n",
" </tr>\n",
" <tr>\n",
" <th> I0 </th>\n",
" <td> 0.00253 </td>\n",
" <td style=\"background-color:rgb(248,248,250);color:black\"> -34.4329 <strong>(-0.014)</strong> </td>\n",
" <td style=\"background-color:rgb(248,248,250);color:black\"> -3.448e-9 <strong>(-0.014)</strong> </td>\n",
" </tr>\n",
" <tr>\n",
" <th> R </th>\n",
" <td style=\"background-color:rgb(248,248,250);color:black\"> -34.4329 <strong>(-0.014)</strong> </td>\n",
" <td> 2.25e+09 </td>\n",
" <td style=\"background-color:rgb(120,120,250);color:black\"> -224.599380820e-3 <strong>(-0.997)</strong> </td>\n",
" </tr>\n",
" <tr>\n",
" <th> C </th>\n",
" <td style=\"background-color:rgb(248,248,250);color:black\"> -3.448e-9 <strong>(-0.014)</strong> </td>\n",
" <td style=\"background-color:rgb(120,120,250);color:black\"> -224.599380820e-3 <strong>(-0.997)</strong> </td>\n",
" <td> 2.25e-11 </td>\n",
" </tr>\n",
"</table><?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"360pt\" height=\"288pt\" viewBox=\"0 0 360 288\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
" <metadata>\n",
" <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
" <cc:Work>\n",
" <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
" <dc:date>2024-10-16T21:40:45.613232</dc:date>\n",
" <dc:format>image/svg+xml</dc:format>\n",
" <dc:creator>\n",
" <cc:Agent>\n",
" <dc:title>Matplotlib v3.8.2, https://matplotlib.org/</dc:title>\n",
" </cc:Agent>\n",
" </dc:creator>\n",
" </cc:Work>\n",
" </rdf:RDF>\n",
" </metadata>\n",
" <defs>\n",
" <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
" </defs>\n",
" <g id=\"figure_1\">\n",
" <g id=\"patch_1\">\n",
" <path d=\"M 0 288 \n",
"L 360 288 \n",
"L 360 0 \n",
"L 0 0 \n",
"z\n",
"\" style=\"fill: #ffffff\"/>\n",
" </g>\n",
" <g id=\"axes_1\">\n",
" <g id=\"patch_2\">\n",
" <path d=\"M 25.903365 268.321635 \n",
"L 356.99976 268.321635 \n",
"L 356.99976 3.00024 \n",
"L 25.903365 3.00024 \n",
"z\n",
"\" style=\"fill: #ffffff\"/>\n",
" </g>\n",
" <g id=\"matplotlib.axis_1\">\n",
" <g id=\"xtick_1\">\n",
" <g id=\"line2d_1\">\n",
" <defs>\n",
" <path id=\"m0bba8716d9\" d=\"M 0 0 \n",
"L 0 3.5 \n",
"\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </defs>\n",
" <g>\n",
" <use xlink:href=\"#m0bba8716d9\" x=\"40.73593\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_1\">\n",
" <!-- 0.0 -->\n",
" <g transform=\"translate(32.784367 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
"Q 1547 4250 1301 3770 \n",
"Q 1056 3291 1056 2328 \n",
"Q 1056 1369 1301 889 \n",
"Q 1547 409 2034 409 \n",
"Q 2525 409 2770 889 \n",
"Q 3016 1369 3016 2328 \n",
"Q 3016 3291 2770 3770 \n",
"Q 2525 4250 2034 4250 \n",
"z\n",
"M 2034 4750 \n",
"Q 2819 4750 3233 4129 \n",
"Q 3647 3509 3647 2328 \n",
"Q 3647 1150 3233 529 \n",
"Q 2819 -91 2034 -91 \n",
"Q 1250 -91 836 529 \n",
"Q 422 1150 422 2328 \n",
"Q 422 3509 836 4129 \n",
"Q 1250 4750 2034 4750 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" <path id=\"DejaVuSans-2e\" d=\"M 684 794 \n",
"L 1344 794 \n",
"L 1344 0 \n",
"L 684 0 \n",
"L 684 794 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_2\">\n",
" <g id=\"line2d_2\">\n",
" <g>\n",
" <use xlink:href=\"#m0bba8716d9\" x=\"108.909177\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_2\">\n",
" <!-- 0.2 -->\n",
" <g transform=\"translate(100.957614 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
"L 3431 531 \n",
"L 3431 0 \n",
"L 469 0 \n",
"L 469 531 \n",
"Q 828 903 1448 1529 \n",
"Q 2069 2156 2228 2338 \n",
"Q 2531 2678 2651 2914 \n",
"Q 2772 3150 2772 3378 \n",
"Q 2772 3750 2511 3984 \n",
"Q 2250 4219 1831 4219 \n",
"Q 1534 4219 1204 4116 \n",
"Q 875 4013 500 3803 \n",
"L 500 4441 \n",
"Q 881 4594 1212 4672 \n",
"Q 1544 4750 1819 4750 \n",
"Q 2544 4750 2975 4387 \n",
"Q 3406 4025 3406 3419 \n",
"Q 3406 3131 3298 2873 \n",
"Q 3191 2616 2906 2266 \n",
"Q 2828 2175 2409 1742 \n",
"Q 1991 1309 1228 531 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_3\">\n",
" <g id=\"line2d_3\">\n",
" <g>\n",
" <use xlink:href=\"#m0bba8716d9\" x=\"177.082424\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_3\">\n",
" <!-- 0.4 -->\n",
" <g transform=\"translate(169.130861 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \n",
"L 825 1625 \n",
"L 2419 1625 \n",
"L 2419 4116 \n",
"z\n",
"M 2253 4666 \n",
"L 3047 4666 \n",
"L 3047 1625 \n",
"L 3713 1625 \n",
"L 3713 1100 \n",
"L 3047 1100 \n",
"L 3047 0 \n",
"L 2419 0 \n",
"L 2419 1100 \n",
"L 313 1100 \n",
"L 313 1709 \n",
"L 2253 4666 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-34\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_4\">\n",
" <g id=\"line2d_4\">\n",
" <g>\n",
" <use xlink:href=\"#m0bba8716d9\" x=\"245.255671\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_4\">\n",
" <!-- 0.6 -->\n",
" <g transform=\"translate(237.304108 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-36\" d=\"M 2113 2584 \n",
"Q 1688 2584 1439 2293 \n",
"Q 1191 2003 1191 1497 \n",
"Q 1191 994 1439 701 \n",
"Q 1688 409 2113 409 \n",
"Q 2538 409 2786 701 \n",
"Q 3034 994 3034 1497 \n",
"Q 3034 2003 2786 2293 \n",
"Q 2538 2584 2113 2584 \n",
"z\n",
"M 3366 4563 \n",
"L 3366 3988 \n",
"Q 3128 4100 2886 4159 \n",
"Q 2644 4219 2406 4219 \n",
"Q 1781 4219 1451 3797 \n",
"Q 1122 3375 1075 2522 \n",
"Q 1259 2794 1537 2939 \n",
"Q 1816 3084 2150 3084 \n",
"Q 2853 3084 3261 2657 \n",
"Q 3669 2231 3669 1497 \n",
"Q 3669 778 3244 343 \n",
"Q 2819 -91 2113 -91 \n",
"Q 1303 -91 875 529 \n",
"Q 447 1150 447 2328 \n",
"Q 447 3434 972 4092 \n",
"Q 1497 4750 2381 4750 \n",
"Q 2619 4750 2861 4703 \n",
"Q 3103 4656 3366 4563 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-36\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_5\">\n",
" <g id=\"line2d_5\">\n",
" <g>\n",
" <use xlink:href=\"#m0bba8716d9\" x=\"313.428917\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_5\">\n",
" <!-- 0.8 -->\n",
" <g transform=\"translate(305.477355 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-38\" d=\"M 2034 2216 \n",
"Q 1584 2216 1326 1975 \n",
"Q 1069 1734 1069 1313 \n",
"Q 1069 891 1326 650 \n",
"Q 1584 409 2034 409 \n",
"Q 2484 409 2743 651 \n",
"Q 3003 894 3003 1313 \n",
"Q 3003 1734 2745 1975 \n",
"Q 2488 2216 2034 2216 \n",
"z\n",
"M 1403 2484 \n",
"Q 997 2584 770 2862 \n",
"Q 544 3141 544 3541 \n",
"Q 544 4100 942 4425 \n",
"Q 1341 4750 2034 4750 \n",
"Q 2731 4750 3128 4425 \n",
"Q 3525 4100 3525 3541 \n",
"Q 3525 3141 3298 2862 \n",
"Q 3072 2584 2669 2484 \n",
"Q 3125 2378 3379 2068 \n",
"Q 3634 1759 3634 1313 \n",
"Q 3634 634 3220 271 \n",
"Q 2806 -91 2034 -91 \n",
"Q 1263 -91 848 271 \n",
"Q 434 634 434 1313 \n",
"Q 434 1759 690 2068 \n",
"Q 947 2378 1403 2484 \n",
"z\n",
"M 1172 3481 \n",
"Q 1172 3119 1398 2916 \n",
"Q 1625 2713 2034 2713 \n",
"Q 2441 2713 2670 2916 \n",
"Q 2900 3119 2900 3481 \n",
"Q 2900 3844 2670 4047 \n",
"Q 2441 4250 2034 4250 \n",
"Q 1625 4250 1398 4047 \n",
"Q 1172 3844 1172 3481 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-38\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"matplotlib.axis_2\">\n",
" <g id=\"ytick_1\">\n",
" <g id=\"line2d_6\">\n",
" <defs>\n",
" <path id=\"m172d480371\" d=\"M 0 0 \n",
"L -3.5 0 \n",
"\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </defs>\n",
" <g>\n",
" <use xlink:href=\"#m172d480371\" x=\"25.903365\" y=\"242.213419\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_6\">\n",
" <!-- 0.0 -->\n",
" <g transform=\"translate(3.00024 246.012638) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_2\">\n",
" <g id=\"line2d_7\">\n",
" <g>\n",
" <use xlink:href=\"#m172d480371\" x=\"25.903365\" y=\"201.524588\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_7\">\n",
" <!-- 0.2 -->\n",
" <g transform=\"translate(3.00024 205.323807) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_3\">\n",
" <g id=\"line2d_8\">\n",
" <g>\n",
" <use xlink:href=\"#m172d480371\" x=\"25.903365\" y=\"160.835758\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_8\">\n",
" <!-- 0.4 -->\n",
" <g transform=\"translate(3.00024 164.634977) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-34\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_4\">\n",
" <g id=\"line2d_9\">\n",
" <g>\n",
" <use xlink:href=\"#m172d480371\" x=\"25.903365\" y=\"120.146928\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_9\">\n",
" <!-- 0.6 -->\n",
" <g transform=\"translate(3.00024 123.946147) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-36\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_5\">\n",
" <g id=\"line2d_10\">\n",
" <g>\n",
" <use xlink:href=\"#m172d480371\" x=\"25.903365\" y=\"79.458098\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_10\">\n",
" <!-- 0.8 -->\n",
" <g transform=\"translate(3.00024 83.257316) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-38\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_6\">\n",
" <g id=\"line2d_11\">\n",
" <g>\n",
" <use xlink:href=\"#m172d480371\" x=\"25.903365\" y=\"38.769267\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_11\">\n",
" <!-- 1.0 -->\n",
" <g transform=\"translate(3.00024 42.568486) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
"L 1825 531 \n",
"L 1825 4091 \n",
"L 703 3866 \n",
"L 703 4441 \n",
"L 1819 4666 \n",
"L 2450 4666 \n",
"L 2450 531 \n",
"L 3481 531 \n",
"L 3481 0 \n",
"L 794 0 \n",
"L 794 531 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-31\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"LineCollection_1\">\n",
" <path d=\"M 40.953201 35.404719 \n",
"L 40.953201 15.060303 \n",
"\" clip-path=\"url(#p986066e0bb)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 70.920558 169.72296 \n",
"L 70.920558 149.378545 \n",
"\" clip-path=\"url(#p986066e0bb)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 107.127612 223.274253 \n",
"L 107.127612 202.929838 \n",
"\" clip-path=\"url(#p986066e0bb)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 145.181886 236.488332 \n",
"L 145.181886 216.143917 \n",
"\" clip-path=\"url(#p986066e0bb)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 178.883846 239.153243 \n",
"L 178.883846 218.808828 \n",
"\" clip-path=\"url(#p986066e0bb)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 213.688041 249.967639 \n",
"L 213.688041 229.623224 \n",
"\" clip-path=\"url(#p986066e0bb)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 249.782105 256.215254 \n",
"L 249.782105 235.870839 \n",
"\" clip-path=\"url(#p986066e0bb)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 281.899185 243.329687 \n",
"L 281.899185 222.985272 \n",
"\" clip-path=\"url(#p986066e0bb)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 310.183387 250.985784 \n",
"L 310.183387 230.641369 \n",
"\" clip-path=\"url(#p986066e0bb)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 341.949924 256.261572 \n",
"L 341.949924 235.917156 \n",
"\" clip-path=\"url(#p986066e0bb)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" </g>\n",
" <g id=\"line2d_12\">\n",
" <path d=\"M 40.953201 26.528678 \n",
"L 43.304738 41.360806 \n",
"L 45.656275 55.172963 \n",
"L 48.007812 68.035291 \n",
"L 50.359349 80.013108 \n",
"L 52.710886 91.167238 \n",
"L 55.062423 101.554326 \n",
"L 57.413959 111.227118 \n",
"L 59.765496 120.234735 \n",
"L 64.46857 136.434268 \n",
"L 69.171644 150.482402 \n",
"L 73.874718 162.664856 \n",
"L 78.577791 173.229404 \n",
"L 83.280865 182.390913 \n",
"L 87.983939 190.335717 \n",
"L 92.687013 197.225401 \n",
"L 97.390087 203.200092 \n",
"L 102.09316 208.381306 \n",
"L 106.796234 212.874423 \n",
"L 111.499308 216.770825 \n",
"L 116.202382 220.149761 \n",
"L 125.608529 225.620997 \n",
"L 135.014677 229.735503 \n",
"L 144.420825 232.829715 \n",
"L 153.826972 235.156639 \n",
"L 172.639267 238.222517 \n",
"L 191.451562 239.956398 \n",
"L 229.076153 241.491539 \n",
"L 266.700743 241.982535 \n",
"L 304.325334 242.139573 \n",
"L 341.949924 242.1898 \n",
"\" clip-path=\"url(#p986066e0bb)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"line2d_13\">\n",
" <defs>\n",
" <path id=\"m60538184e2\" d=\"M 0 3 \n",
"C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \n",
"C 2.683901 1.55874 3 0.795609 3 0 \n",
"C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \n",
"C 1.55874 -2.683901 0.795609 -3 0 -3 \n",
"C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \n",
"C -2.683901 -1.55874 -3 -0.795609 -3 0 \n",
"C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \n",
"C -1.55874 2.683901 -0.795609 3 0 3 \n",
"z\n",
"\" style=\"stroke: #000000\"/>\n",
" </defs>\n",
" <g clip-path=\"url(#p986066e0bb)\">\n",
" <use xlink:href=\"#m60538184e2\" x=\"40.953201\" y=\"25.232511\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m60538184e2\" x=\"70.920558\" y=\"159.550753\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m60538184e2\" x=\"107.127612\" y=\"213.102046\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m60538184e2\" x=\"145.181886\" y=\"226.316124\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m60538184e2\" x=\"178.883846\" y=\"228.981035\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m60538184e2\" x=\"213.688041\" y=\"239.795432\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m60538184e2\" x=\"249.782105\" y=\"246.043046\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m60538184e2\" x=\"281.899185\" y=\"233.157479\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m60538184e2\" x=\"310.183387\" y=\"240.813577\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m60538184e2\" x=\"341.949924\" y=\"246.089364\" style=\"stroke: #000000\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"patch_3\">\n",
" <path d=\"M 25.903365 268.321635 \n",
"L 25.903365 3.00024 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"patch_4\">\n",
" <path d=\"M 356.99976 268.321635 \n",
"L 356.99976 3.00024 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"patch_5\">\n",
" <path d=\"M 25.903365 268.321635 \n",
"L 356.99976 268.321635 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"patch_6\">\n",
" <path d=\"M 25.903365 3.00024 \n",
"L 356.99976 3.00024 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <defs>\n",
" <clipPath id=\"p986066e0bb\">\n",
" <rect x=\"25.903365\" y=\"3.00024\" width=\"331.096395\" height=\"265.321395\"/>\n",
" </clipPath>\n",
" </defs>\n",
"</svg>\n"
],
"text/plain": [
"┌─────────────────────────────────────────────────────────────────────────┐\n",
"│ Migrad │\n",
"├──────────────────────────────────┬──────────────────────────────────────┤\n",
"│ FCN = 2.707 (χ²/ndof = 0.4) │ Nfcn = 103 │\n",
"│ EDM = 2.18e-10 (Goal: 0.0002) │ │\n",
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
"│ Valid Minimum │ Below EDM threshold (goal x 10) │\n",
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
"│ No parameters at limit │ Below call limit │\n",
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
"│ Hesse ok │ Covariance FORCED pos. def. │\n",
"└──────────────────────────────────┴──────────────────────────────────────┘\n",
"┌───┬──────┬───────────┬───────────┬────────────┬────────────┬─────────┬─────────┬───────┐\n",
"│ │ Name │ Value │ Hesse Err │ Minos Err- │ Minos Err+ │ Limit- │ Limit+ │ Fixed │\n",
"├───┼──────┼───────────┼───────────┼────────────┼────────────┼─────────┼─────────┼───────┤\n",
"│ 0 │ I0 │ 1.07 │ 0.05 │ │ │ │ │ │\n",
"│ 1 │ R │ 0.03e6 │ 0.05e6 │ │ │ │ │ │\n",
"│ 2 │ C │ 3e-6 │ 5e-6 │ │ │ │ │ │\n",
"└───┴──────┴───────────┴───────────┴────────────┴────────────┴─────────┴─────────┴───────┘\n",
"┌────┬───────────────────────────────────────────────────────┐\n",
"│ │ I0 R C │\n",
"├────┼───────────────────────────────────────────────────────┤\n",
"│ I0 │ 0.00253 -34.4329 -3.448e-9 │\n",
"│ R │ -34.4329 2.25e+09 -224.599380820e-3 │\n",
"│ C │ -3.448e-9 -224.599380820e-3 2.25e-11 │\n",
"└────┴───────────────────────────────────────────────────────┘"
]
},
"execution_count": 493,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Kostenfunktion:\n",
"ls = cost.LeastSquares(\n",
" data_frame['time'],\n",
" data_frame['current'], \n",
" data_frame['delta_current'], \n",
" discharge_current,\n",
")\n",
"\n",
"# Minimierung\n",
"mi = Minuit(ls, # Kostenfunktion \n",
" I0=0.9, # Startwerte\n",
" R=10*10**3, \n",
" C=10**-6\n",
" )\n",
"mi.migrad()\n",
"mi.hesse()"
]
},
{
"cell_type": "markdown",
"id": "b5df2d60-8284-4757-96c8-7f26afc17942",
"metadata": {},
"source": [
"Wie ihr seht gibt euch minuit euch vier verschiedene Objekte zurück. Für euch am wichtigsten ist die erste Tabelle, welche euch zeigt, ob euer Fit funktioniert hat. Im Allgemeinen gilt sind hier alle Felder grün hat euer Fit funktioniert, gelbe Felder können ein Problem andeuten müssen sie aber nicht und lila Felder bedeuten, dass etwas mit eurem Fit nicht in Ordnung ist. Die Bedeutungen der einzelnen Felder für unseren obigen Fit sind auch nochmal in der nachfolgenden Abbildung einzeln erklärt. Die Bedeutung der meisten Felder werden wir noch im laufe des Kurses kennen lernen. \n",
"\n",
"<figure class=\"image\">\n",
"<img src=\"images/FitPerformance.png\" alt=\"{{Fit Performance }}\" width=100%>\n",
"</figure>\n",
"\n",
"Wie wir unserer Tabelle entnehmen können, gibt es also ein Problem mit unserem Fit. Um besser verstehen zu können, was das Problem sein könnte, wollen wir uns auch noch die anderen Outputs ansehen.\n",
"\n",
"Die zweite Tabelle zeigt uns die bestimmten Werte für die Parameter in der Spalte `Value` und deren Unsicherheiten in der Spalte `Hess error`. Hierbei fällt auf, dass für unseren obigen Fit die Unsicherheiten der Parameter $R$ und $C$ größer sind als die bestimmten Werte selbst. \n",
"\n",
"Die dritte Tabelle ist die sogennnante **Kovarianzmatrix**. Die Kovarianzmatrix hat als Einträge auf ihrer **Hauptdiagonalen** die **Varianzen der entsprechenden Parameter** auf der **Nebendiagonalen** stehen die **Kovarianzen**. Der Wert in Klammern gibt die **Korrelation** zwischen den entspechenden Parametern an. Sind zwei Parameter stark **korreliert**, wird das entsprechende Feld **blau** dargestellt, bei einer **Antikorrelation** ist das Feld **rot**. \n",
"\n",
"Die letzte Ausgabe ist ein Plot unserer Messwerte zusammen mit der Fitfunktion basierend auf den Parametern des besten Fits. (Nur für neuere Version von `iminuit`)"
]
},
{
"cell_type": "markdown",
"id": "72665daa-1d74-41da-8b9a-1e4c427eed07",
"metadata": {},
"source": [
"Obwohl underser Fit unsere Messdaten gut widerspiegelt, scheint es ein Problem mit der Bestimmung einiger Parameter zu geben. Die große Unsicherheit in $R$ und $C$ deutet an, dass hier das Problem liegt. Um dies zu bestätigen, können wir uns einmal das reduzierte $\\chi^2(x, I_0, R, C)$ als Funktion des entsprechenden Parameters von `iminuit` plotten lassen, während wir die anderen Parameter, so wie die x-Werte, konstant lassen. \n",
"\n",
"Für $I_0$ sieht das entsprechende Profil so aus:"
]
},
{
"cell_type": "code",
"execution_count": 494,
"id": "d3230cb6-fbe3-4093-ba09-5271dc168a4d",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\Matthias\\.venv\\jupyter\\lib\\site-packages\\iminuit\\minuit.py:2579: IMinuitWarning: Specified nsigma bound, but error matrix is not accurate\n",
" warnings.warn(\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAj8AAAHHCAYAAABQhTneAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAABsj0lEQVR4nO3dd3hT9f4H8Hd2uvekpbRlFCirBcoqQ8oGwQGoqKAI6oUr4FVRf1dBvQoqKg5URBEnMhwoKgrIEspoKbNsCi0dlNI90qbJ9/dHaLRSRtu0J+P9ep4+lJOTk/fJSZpPzvkOmRBCgIiIiMhByKUOQERERNScWPwQERGRQ2HxQ0RERA6FxQ8RERE5FBY/RERE5FBY/BAREZFDYfFDREREDoXFDxERETkUFj9ERETkUFj8EBERkUNh8UMOZcWKFZDJZEhKSqq1vLCwENOnT4efnx9cXFwwaNAg7N+/v9nznThxAnPmzEGfPn2g1Wohk8lw7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C0trZWlRs04P88991x9ngqiRmPxQw6lruKnurpa9OrVS7i6uooXXnhBLFmyRHTs2FG4ubmJ48ePN2u+wsJC8dJLL4mXXnpJDB8+XAAQ//nPf8RLL70k3n333VrrhoWFibCwsFrL0tPThY+Pj4iMjBTvvPOOeOWVV4SXl5fo1KnTVR9oQgjx008/CQDiww8/bMrdEuPHjxdKpVI8+eSTYunSpaJPnz5CqVSKbdu21VpvwIAB4p/fyWoKGH9/f/Haa6+Jt956S4SGhorg4OBaBc+8efN
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"mi.draw_profile('I0')\n",
"plt.ylabel('$\\chi^2(I_0, x, R, C)/ndof$')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "b837e542-d3c9-4f61-a8d1-4f22db7d5137",
"metadata": {},
"source": [
"Bei den anderen beiden Parametern ist dies nicht der Fall:"
]
},
{
"cell_type": "code",
"execution_count": 495,
"id": "af339c6e-f0e7-40cd-a2cf-61aaaa4df1e4",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHHCAYAAABKudlQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAABSF0lEQVR4nO3deVxUVRsH8N/MADMogguikIiIuOKKQuSWiSmipZVaWUKaS1Fq+rpQufYqam69ZaamkOaSVtqmlZqmlhsomaKm5r5kqSwqM8DMef+ouTKxCDOXuTPw+34+8/HOnXPvPHcGLw/nnOdelRBCgIiIiMhJqZUOgIiIiMgWTGaIiIjIqTGZISIiIqfGZIaIiIicGpMZIiIicmpMZoiIiMipMZkhIiIip8ZkhoiIiJwakxkiIiJyakxmiIiIyKkxmSGrJSUlQaVSSQ8XFxc88MADiI2NxeXLl+0ez7Fjx9CvXz/Ur18flSpV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u3bthMlkKvE295sAnF9xE4Dd3d0FgCIf8+fPl9oGBAQU29b8yD/BMS4uTmg0mkLfu2bNmuLpp58WQgiRm5srQkJCxKBBgyzaoIQTgG/cuCGuXr0qPdLT04tsm5GRIWrVqiUmT54srbNlAuigQYOERqMR165dK/E2Dz74oAgKCpKeR0VFFfuZPvbYY1LbmJiYEn0PnTt3lrYx/7zs2rWrQCz9+vUTtWvXlp6PGDFCNGjQQBgMBmldaSYAT5k
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjEAAAHHCAYAAABOTAltAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAABUsklEQVR4nO3deXgTVdsG8DtdkhRoC4VCWymlhbKWshSo7Mgia1H0FVGUsgiCKMUNqMomQgsConyIwssiyiKoiIigwMsuO1SWshULZSmgQFe6Juf7AzMSumemmaS9f9eVi2RyMvNMpglPzjnPjEYIIUBERERkZxzUDoCIiIjIEkxiiIiIyC4xiSEiIiK7xCSGiIiI7BKTGCIiIrJLTGKIiIjILjGJISIiIrvEJIaIiIjsEpMYIiIisktMYoiIiMguMYkhq7t06RJeffVVBAQEQK/Xw83NDe3atcOnn36KjIwMq8WxZ88e9OvXD76+vtDr9fDy8kLPnj2xf//+Yr3+/PnzePPNN9G2bVvo9XpoNBpcvnw537bffvstXnrpJQQGBkKj0aBz587K7cgjjEYjZs+eDX9/f+j1egQHB2PNmjUFtl20aBGaNWsGFxcXVK1aFV26dMEff/xRavElJSWhevXq0Gg0+O6774psv2LFCmg0mgJvq1atktpOnTo13zZ6vb5U9uWnn35CixYtoNfrUatWLUyZMgW5ubn5tt2+fTu6dOkCd3d3uLq6IiQkBN9++22pxFVc3bt3h0ajweuvv15k28uXLxd6HEaM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1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"mi.draw_profile('R')\n",
"plt.ylabel('$\\chi^2(R, x, I_0, C)/ndof$')\n",
"plt.show()\n",
"\n",
"mi.draw_profile('C')\n",
"plt.ylabel('$\\chi^2(C, x, I_0 R)/ndof$')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "499ffb9a-00a7-4c06-ada4-1d3a41a7f1d4",
"metadata": {},
"source": [
"Das liegt daran, dass $R$ und $C$ vollständig korreliert sind. Reduziert `iminuit` $C$ um ein Faktor zwei, so wird dies dadurch kompensiert, dass das optimale Minimum verlangt, dass $R$ um einen Faktor zwei größer sein muss. Das heißt, es ist ohne weitere Information nicht möglich, $R$ und $C$ näher zu bestimmen, sondern lediglich das Produkt der beiden Größen.\n",
"\n",
"Deshalb müssen wir in unserer Fitfunktion $R$ und $C$ durch die Zeitkonstante $\\tau$ ersetzen und schreiben\n",
"\n",
"$$ I = I_0 \\exp\\{-t/\\tau\\}$$\n",
"\n",
"mit $\\tau = R \\cdot C$.\n",
"\n",
"Führen wir nun erneut den Fit durch, so erhalten wir ein fehlerfreies Ergebnis..."
]
},
{
"cell_type": "code",
"execution_count": 496,
"id": "847419a7-d77b-4207-8607-44af9d615ffc",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
" <tr>\n",
" <th colspan=\"2\" style=\"text-align:center\" title=\"Minimizer\"> Migrad </th>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:left\" title=\"Minimum value of function\"> FCN = 2.707 (χ²/ndof = 0.3) </td>\n",
" <td style=\"text-align:center\" title=\"Total number of function and (optional) gradient evaluations\"> Nfcn = 97 </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:left\" title=\"Estimated distance to minimum and goal\"> EDM = 1.11e-05 (Goal: 0.0002) </td>\n",
" <td style=\"text-align:center\" title=\"Total run time of algorithms\"> </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> Valid Minimum </td>\n",
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> Below EDM threshold (goal x 10) </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> No parameters at limit </td>\n",
" <td 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\"> Hesse ok </td>\n",
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> Covariance accurate </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> I0 </td>\n",
" <td> 1.07 </td>\n",
" <td> 0.05 </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> tau </td>\n",
" <td> 0.097 </td>\n",
" <td> 0.011 </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> I0 </th>\n",
" <th> tau </th>\n",
" </tr>\n",
" <tr>\n",
" <th> I0 </th>\n",
" <td> 0.00254 </td>\n",
" <td style=\"background-color:rgb(198,198,250);color:black\"> -0.22e-3 <strong>(-0.396)</strong> </td>\n",
" </tr>\n",
" <tr>\n",
" <th> tau </th>\n",
" <td style=\"background-color:rgb(198,198,250);color:black\"> -0.22e-3 <strong>(-0.396)</strong> </td>\n",
" <td> 0.000116 </td>\n",
" </tr>\n",
"</table><?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"360pt\" height=\"288pt\" viewBox=\"0 0 360 288\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
" <metadata>\n",
" <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
" <cc:Work>\n",
" <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
" <dc:date>2024-10-16T21:40:48.103966</dc:date>\n",
" <dc:format>image/svg+xml</dc:format>\n",
" <dc:creator>\n",
" <cc:Agent>\n",
" <dc:title>Matplotlib v3.8.2, https://matplotlib.org/</dc:title>\n",
" </cc:Agent>\n",
" </dc:creator>\n",
" </cc:Work>\n",
" </rdf:RDF>\n",
" </metadata>\n",
" <defs>\n",
" <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
" </defs>\n",
" <g id=\"figure_1\">\n",
" <g id=\"patch_1\">\n",
" <path d=\"M 0 288 \n",
"L 360 288 \n",
"L 360 0 \n",
"L 0 0 \n",
"z\n",
"\" style=\"fill: #ffffff\"/>\n",
" </g>\n",
" <g id=\"axes_1\">\n",
" <g id=\"patch_2\">\n",
" <path d=\"M 25.903365 268.321635 \n",
"L 356.99976 268.321635 \n",
"L 356.99976 3.00024 \n",
"L 25.903365 3.00024 \n",
"z\n",
"\" style=\"fill: #ffffff\"/>\n",
" </g>\n",
" <g id=\"matplotlib.axis_1\">\n",
" <g id=\"xtick_1\">\n",
" <g id=\"line2d_1\">\n",
" <defs>\n",
" <path id=\"m2c3bb6f7c9\" d=\"M 0 0 \n",
"L 0 3.5 \n",
"\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </defs>\n",
" <g>\n",
" <use xlink:href=\"#m2c3bb6f7c9\" x=\"40.73593\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_1\">\n",
" <!-- 0.0 -->\n",
" <g transform=\"translate(32.784367 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
"Q 1547 4250 1301 3770 \n",
"Q 1056 3291 1056 2328 \n",
"Q 1056 1369 1301 889 \n",
"Q 1547 409 2034 409 \n",
"Q 2525 409 2770 889 \n",
"Q 3016 1369 3016 2328 \n",
"Q 3016 3291 2770 3770 \n",
"Q 2525 4250 2034 4250 \n",
"z\n",
"M 2034 4750 \n",
"Q 2819 4750 3233 4129 \n",
"Q 3647 3509 3647 2328 \n",
"Q 3647 1150 3233 529 \n",
"Q 2819 -91 2034 -91 \n",
"Q 1250 -91 836 529 \n",
"Q 422 1150 422 2328 \n",
"Q 422 3509 836 4129 \n",
"Q 1250 4750 2034 4750 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" <path id=\"DejaVuSans-2e\" d=\"M 684 794 \n",
"L 1344 794 \n",
"L 1344 0 \n",
"L 684 0 \n",
"L 684 794 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_2\">\n",
" <g id=\"line2d_2\">\n",
" <g>\n",
" <use xlink:href=\"#m2c3bb6f7c9\" x=\"108.909177\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_2\">\n",
" <!-- 0.2 -->\n",
" <g transform=\"translate(100.957614 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
"L 3431 531 \n",
"L 3431 0 \n",
"L 469 0 \n",
"L 469 531 \n",
"Q 828 903 1448 1529 \n",
"Q 2069 2156 2228 2338 \n",
"Q 2531 2678 2651 2914 \n",
"Q 2772 3150 2772 3378 \n",
"Q 2772 3750 2511 3984 \n",
"Q 2250 4219 1831 4219 \n",
"Q 1534 4219 1204 4116 \n",
"Q 875 4013 500 3803 \n",
"L 500 4441 \n",
"Q 881 4594 1212 4672 \n",
"Q 1544 4750 1819 4750 \n",
"Q 2544 4750 2975 4387 \n",
"Q 3406 4025 3406 3419 \n",
"Q 3406 3131 3298 2873 \n",
"Q 3191 2616 2906 2266 \n",
"Q 2828 2175 2409 1742 \n",
"Q 1991 1309 1228 531 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_3\">\n",
" <g id=\"line2d_3\">\n",
" <g>\n",
" <use xlink:href=\"#m2c3bb6f7c9\" x=\"177.082424\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_3\">\n",
" <!-- 0.4 -->\n",
" <g transform=\"translate(169.130861 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \n",
"L 825 1625 \n",
"L 2419 1625 \n",
"L 2419 4116 \n",
"z\n",
"M 2253 4666 \n",
"L 3047 4666 \n",
"L 3047 1625 \n",
"L 3713 1625 \n",
"L 3713 1100 \n",
"L 3047 1100 \n",
"L 3047 0 \n",
"L 2419 0 \n",
"L 2419 1100 \n",
"L 313 1100 \n",
"L 313 1709 \n",
"L 2253 4666 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-34\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_4\">\n",
" <g id=\"line2d_4\">\n",
" <g>\n",
" <use xlink:href=\"#m2c3bb6f7c9\" x=\"245.255671\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_4\">\n",
" <!-- 0.6 -->\n",
" <g transform=\"translate(237.304108 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-36\" d=\"M 2113 2584 \n",
"Q 1688 2584 1439 2293 \n",
"Q 1191 2003 1191 1497 \n",
"Q 1191 994 1439 701 \n",
"Q 1688 409 2113 409 \n",
"Q 2538 409 2786 701 \n",
"Q 3034 994 3034 1497 \n",
"Q 3034 2003 2786 2293 \n",
"Q 2538 2584 2113 2584 \n",
"z\n",
"M 3366 4563 \n",
"L 3366 3988 \n",
"Q 3128 4100 2886 4159 \n",
"Q 2644 4219 2406 4219 \n",
"Q 1781 4219 1451 3797 \n",
"Q 1122 3375 1075 2522 \n",
"Q 1259 2794 1537 2939 \n",
"Q 1816 3084 2150 3084 \n",
"Q 2853 3084 3261 2657 \n",
"Q 3669 2231 3669 1497 \n",
"Q 3669 778 3244 343 \n",
"Q 2819 -91 2113 -91 \n",
"Q 1303 -91 875 529 \n",
"Q 447 1150 447 2328 \n",
"Q 447 3434 972 4092 \n",
"Q 1497 4750 2381 4750 \n",
"Q 2619 4750 2861 4703 \n",
"Q 3103 4656 3366 4563 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-36\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_5\">\n",
" <g id=\"line2d_5\">\n",
" <g>\n",
" <use xlink:href=\"#m2c3bb6f7c9\" x=\"313.428917\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_5\">\n",
" <!-- 0.8 -->\n",
" <g transform=\"translate(305.477355 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-38\" d=\"M 2034 2216 \n",
"Q 1584 2216 1326 1975 \n",
"Q 1069 1734 1069 1313 \n",
"Q 1069 891 1326 650 \n",
"Q 1584 409 2034 409 \n",
"Q 2484 409 2743 651 \n",
"Q 3003 894 3003 1313 \n",
"Q 3003 1734 2745 1975 \n",
"Q 2488 2216 2034 2216 \n",
"z\n",
"M 1403 2484 \n",
"Q 997 2584 770 2862 \n",
"Q 544 3141 544 3541 \n",
"Q 544 4100 942 4425 \n",
"Q 1341 4750 2034 4750 \n",
"Q 2731 4750 3128 4425 \n",
"Q 3525 4100 3525 3541 \n",
"Q 3525 3141 3298 2862 \n",
"Q 3072 2584 2669 2484 \n",
"Q 3125 2378 3379 2068 \n",
"Q 3634 1759 3634 1313 \n",
"Q 3634 634 3220 271 \n",
"Q 2806 -91 2034 -91 \n",
"Q 1263 -91 848 271 \n",
"Q 434 634 434 1313 \n",
"Q 434 1759 690 2068 \n",
"Q 947 2378 1403 2484 \n",
"z\n",
"M 1172 3481 \n",
"Q 1172 3119 1398 2916 \n",
"Q 1625 2713 2034 2713 \n",
"Q 2441 2713 2670 2916 \n",
"Q 2900 3119 2900 3481 \n",
"Q 2900 3844 2670 4047 \n",
"Q 2441 4250 2034 4250 \n",
"Q 1625 4250 1398 4047 \n",
"Q 1172 3844 1172 3481 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-38\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"matplotlib.axis_2\">\n",
" <g id=\"ytick_1\">\n",
" <g id=\"line2d_6\">\n",
" <defs>\n",
" <path id=\"m8a24e3d225\" d=\"M 0 0 \n",
"L -3.5 0 \n",
"\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </defs>\n",
" <g>\n",
" <use xlink:href=\"#m8a24e3d225\" x=\"25.903365\" y=\"242.213419\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_6\">\n",
" <!-- 0.0 -->\n",
" <g transform=\"translate(3.00024 246.012638) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_2\">\n",
" <g id=\"line2d_7\">\n",
" <g>\n",
" <use xlink:href=\"#m8a24e3d225\" x=\"25.903365\" y=\"201.524588\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_7\">\n",
" <!-- 0.2 -->\n",
" <g transform=\"translate(3.00024 205.323807) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_3\">\n",
" <g id=\"line2d_8\">\n",
" <g>\n",
" <use xlink:href=\"#m8a24e3d225\" x=\"25.903365\" y=\"160.835758\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_8\">\n",
" <!-- 0.4 -->\n",
" <g transform=\"translate(3.00024 164.634977) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-34\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_4\">\n",
" <g id=\"line2d_9\">\n",
" <g>\n",
" <use xlink:href=\"#m8a24e3d225\" x=\"25.903365\" y=\"120.146928\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_9\">\n",
" <!-- 0.6 -->\n",
" <g transform=\"translate(3.00024 123.946147) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-36\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_5\">\n",
" <g id=\"line2d_10\">\n",
" <g>\n",
" <use xlink:href=\"#m8a24e3d225\" x=\"25.903365\" y=\"79.458098\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_10\">\n",
" <!-- 0.8 -->\n",
" <g transform=\"translate(3.00024 83.257316) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-38\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_6\">\n",
" <g id=\"line2d_11\">\n",
" <g>\n",
" <use xlink:href=\"#m8a24e3d225\" x=\"25.903365\" y=\"38.769267\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_11\">\n",
" <!-- 1.0 -->\n",
" <g transform=\"translate(3.00024 42.568486) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
"L 1825 531 \n",
"L 1825 4091 \n",
"L 703 3866 \n",
"L 703 4441 \n",
"L 1819 4666 \n",
"L 2450 4666 \n",
"L 2450 531 \n",
"L 3481 531 \n",
"L 3481 0 \n",
"L 794 0 \n",
"L 794 531 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-31\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"LineCollection_1\">\n",
" <path d=\"M 40.953201 35.404719 \n",
"L 40.953201 15.060303 \n",
"\" clip-path=\"url(#pc398dd072a)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 70.920558 169.72296 \n",
"L 70.920558 149.378545 \n",
"\" clip-path=\"url(#pc398dd072a)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 107.127612 223.274253 \n",
"L 107.127612 202.929838 \n",
"\" clip-path=\"url(#pc398dd072a)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 145.181886 236.488332 \n",
"L 145.181886 216.143917 \n",
"\" clip-path=\"url(#pc398dd072a)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 178.883846 239.153243 \n",
"L 178.883846 218.808828 \n",
"\" clip-path=\"url(#pc398dd072a)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 213.688041 249.967639 \n",
"L 213.688041 229.623224 \n",
"\" clip-path=\"url(#pc398dd072a)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 249.782105 256.215254 \n",
"L 249.782105 235.870839 \n",
"\" clip-path=\"url(#pc398dd072a)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 281.899185 243.329687 \n",
"L 281.899185 222.985272 \n",
"\" clip-path=\"url(#pc398dd072a)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 310.183387 250.985784 \n",
"L 310.183387 230.641369 \n",
"\" clip-path=\"url(#pc398dd072a)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 341.949924 256.261572 \n",
"L 341.949924 235.917156 \n",
"\" clip-path=\"url(#pc398dd072a)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" </g>\n",
" <g id=\"line2d_12\">\n",
" <path d=\"M 40.953201 26.554276 \n",
"L 43.304738 41.379933 \n",
"L 45.656275 55.186389 \n",
"L 48.007812 68.043709 \n",
"L 50.359349 80.017142 \n",
"L 52.710886 91.167452 \n",
"L 55.062423 101.551226 \n",
"L 57.413959 111.221159 \n",
"L 59.765496 120.226325 \n",
"L 64.46857 136.422013 \n",
"L 69.171644 150.467471 \n",
"L 73.874718 162.648175 \n",
"L 78.577791 173.211702 \n",
"L 83.280865 182.372755 \n",
"L 87.983939 190.317536 \n",
"L 92.687013 197.207523 \n",
"L 97.390087 203.182757 \n",
"L 102.09316 208.364686 \n",
"L 106.796234 212.858633 \n",
"L 111.499308 216.755938 \n",
"L 116.202382 220.135816 \n",
"L 125.608529 225.608952 \n",
"L 135.014677 229.725274 \n",
"L 144.420825 232.821141 \n",
"L 153.826972 235.149528 \n",
"L 172.639267 238.217746 \n",
"L 191.451562 239.953275 \n",
"L 229.076153 241.490269 \n",
"L 266.700743 241.982042 \n",
"L 304.325334 242.139388 \n",
"L 341.949924 242.189732 \n",
"\" clip-path=\"url(#pc398dd072a)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"line2d_13\">\n",
" <defs>\n",
" <path id=\"m06f6400577\" d=\"M 0 3 \n",
"C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \n",
"C 2.683901 1.55874 3 0.795609 3 0 \n",
"C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \n",
"C 1.55874 -2.683901 0.795609 -3 0 -3 \n",
"C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \n",
"C -2.683901 -1.55874 -3 -0.795609 -3 0 \n",
"C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \n",
"C -1.55874 2.683901 -0.795609 3 0 3 \n",
"z\n",
"\" style=\"stroke: #000000\"/>\n",
" </defs>\n",
" <g clip-path=\"url(#pc398dd072a)\">\n",
" <use xlink:href=\"#m06f6400577\" x=\"40.953201\" y=\"25.232511\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m06f6400577\" x=\"70.920558\" y=\"159.550753\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m06f6400577\" x=\"107.127612\" y=\"213.102046\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m06f6400577\" x=\"145.181886\" y=\"226.316124\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m06f6400577\" x=\"178.883846\" y=\"228.981035\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m06f6400577\" x=\"213.688041\" y=\"239.795432\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m06f6400577\" x=\"249.782105\" y=\"246.043046\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m06f6400577\" x=\"281.899185\" y=\"233.157479\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m06f6400577\" x=\"310.183387\" y=\"240.813577\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m06f6400577\" x=\"341.949924\" y=\"246.089364\" style=\"stroke: #000000\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"patch_3\">\n",
" <path d=\"M 25.903365 268.321635 \n",
"L 25.903365 3.00024 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"patch_4\">\n",
" <path d=\"M 356.99976 268.321635 \n",
"L 356.99976 3.00024 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"patch_5\">\n",
" <path d=\"M 25.903365 268.321635 \n",
"L 356.99976 268.321635 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"patch_6\">\n",
" <path d=\"M 25.903365 3.00024 \n",
"L 356.99976 3.00024 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <defs>\n",
" <clipPath id=\"pc398dd072a\">\n",
" <rect x=\"25.903365\" y=\"3.00024\" width=\"331.096395\" height=\"265.321395\"/>\n",
" </clipPath>\n",
" </defs>\n",
"</svg>\n"
],
"text/plain": [
"┌─────────────────────────────────────────────────────────────────────────┐\n",
"│ Migrad │\n",
"├──────────────────────────────────┬──────────────────────────────────────┤\n",
"│ FCN = 2.707 (χ²/ndof = 0.3) │ Nfcn = 97 │\n",
"│ EDM = 1.11e-05 (Goal: 0.0002) │ │\n",
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
"│ Valid Minimum │ Below EDM threshold (goal x 10) │\n",
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
"│ No parameters at limit │ Below call limit │\n",
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
"│ Hesse ok │ Covariance accurate │\n",
"└──────────────────────────────────┴──────────────────────────────────────┘\n",
"┌───┬──────┬───────────┬───────────┬────────────┬────────────┬─────────┬─────────┬───────┐\n",
"│ │ Name │ Value │ Hesse Err │ Minos Err- │ Minos Err+ │ Limit- │ Limit+ │ Fixed │\n",
"├───┼──────┼───────────┼───────────┼────────────┼────────────┼─────────┼─────────┼───────┤\n",
"│ 0 │ I0 │ 1.07 │ 0.05 │ │ │ │ │ │\n",
"│ 1 │ tau │ 0.097 │ 0.011 │ │ │ │ │ │\n",
"└───┴──────┴───────────┴───────────┴────────────┴────────────┴─────────┴─────────┴───────┘\n",
"┌─────┬───────────────────┐\n",
"│ │ I0 tau │\n",
"├─────┼───────────────────┤\n",
"│ I0 │ 0.00254 -0.22e-3 │\n",
"│ tau │ -0.22e-3 0.000116 │\n",
"└─────┴───────────────────┘"
]
},
"execution_count": 496,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#from iminuit import Minuit, cost\n",
"\n",
"def discharge_current2(t, I0, tau):\n",
" return I0 * np.exp(-t/tau)\n",
"\n",
"ls = cost.LeastSquares(\n",
" data_frame['time'],\n",
" data_frame['current'], \n",
" data_frame['delta_current'], \n",
" discharge_current2\n",
")\n",
"mi = Minuit(ls, I0=0.9, tau=0.3)\n",
"mi.migrad()\n",
"mi.hesse()"
]
},
{
"cell_type": "markdown",
"id": "a46c76ec-5b00-48f4-9a46-2ea083ca5dba",
"metadata": {},
"source": [
"... und die Werte und Fehler lassen sich über ..."
]
},
{
"cell_type": "code",
"execution_count": 497,
"id": "69f540a5-e89b-4c24-aa7e-b03eaedb28d1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.0670397937137222"
]
},
"execution_count": 497,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mi.values['I0']"
]
},
{
"cell_type": "markdown",
"id": "66733c05-692d-46e3-ae82-6f84d66ef28c",
"metadata": {},
"source": [
"... bzw. ..."
]
},
{
"cell_type": "code",
"execution_count": 498,
"id": "66e6da5b-ff32-4982-a3aa-5b9b93262073",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.050401508019580855"
]
},
"execution_count": 498,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mi.errors['I0']"
]
},
{
"cell_type": "markdown",
"id": "c670cd3f-fcfb-4cfc-a8d4-eded75e9a669",
"metadata": {},
"source": [
"... für jeden Parameter auslesen. Dies lässt sich nun auch nutzen, um unsere Messwerte samt Fit in einem etwas schöneren Plot mit Achsenbeschriftungen darzustellen. Hierbei können wir ausnutzen, dass `iminuit` die Parameter in der Reihenfolge der Argumente unser definierten Fitfunktion speichert."
]
},
{
"cell_type": "code",
"execution_count": 499,
"id": "45fcf856-c58e-424d-8fd7-15037cb6698e",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAGwCAYAAABVdURTAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAABgZElEQVR4nO3deVhUZf8G8HtmYFhkE9kVRFTcBURF1HIjcUNLK1JzyzLNTKNSKIXMXjQrX01Ny1R8yy3f1MoFF9yyVNxwF0VBSAHFFGSHmfP7wx/zOrI4AzNzYLg/13UumDNn+Z4z5Nw95znPkQiCIICIiIjISEjFLoCIiIhIlxhuiIiIyKgw3BAREZFRYbghIiIio8JwQ0REREaF4YaIiIiMCsMNERERGRUTsQswNKVSiTt37sDa2hoSiUTscoiIiEgDgiDg0aNHcHNzg1RaddtMvQs3d+7cgbu7u9hlEBERUTWkpaWhSZMmVS5T78KNtbU1gMcnx8bGRuRqiIiISBM5OTlwd3dXfY9Xpd6Fm7JLUTY2Ngw3REREdYwmXUrYoZiIiIiMCsMNERERGRWGGyIiIjIq9a7PDRERVUypVKK4uFjsMqgek8vlz7zNWxMMN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aTmo+XQERUW4WHhyMvLw/Lli1Dw4YN0bRpUyxevBh37tzRaP2ePXti5MiRWu2zZ8+e2L59O4qLi5GRkYGDBw+q5m/duhVFRUV48OABDhw4gK5du2p9TLVVdc4
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.errorbar(data_frame['time'], \n",
" data_frame['current'], \n",
" xerr=data_frame['delta_time'], \n",
" yerr=data_frame['delta_current'], \n",
" ls='', \n",
" marker='.',\n",
" label='Data'\n",
" )\n",
"x = np.arange(0, 1, 0.01)\n",
"plt.plot(x, \n",
" discharge_current2(x, *mi.values), # Sternchen operator zum entpacken der Werte\n",
" color='k',\n",
" label='Best fit'\n",
" )\n",
"fit_info = [\n",
" f\"$\\\\chi^2$/$n_\\\\mathrm{{dof}}$ = {mi.fval:.1f} / {mi.ndof:.0f} = {mi.fmin.reduced_chi2:.1f}\",\n",
"]\n",
"for p, v, e in zip(mi.parameters, mi.values, mi.errors):\n",
" fit_info.append(f\"{p} = ${v:.3f} \\pm {e:.3f}$\")\n",
"\n",
"plt.legend(title=\"\\n\".join(fit_info))\n",
"plt.ylabel('Current [mA]')\n",
"plt.xlabel('Time [s]')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "1cd73609-8593-4725-a7c4-317d6a48a72f",
"metadata": {},
"source": [
"# Mathematisch motivierte Herleitung des $\\chi^2$-Fits:\n",
"\n",
"Nach diesen anfänglichen Beispielen wollen wir uns eine semi-mathematische Herleitung des $\\chi^2$-Fits angucken um etwas besser zu verstehen, warum diese Methode für uns in der Physik so wichtig ist. In unserem Grundpraktikum haben wir bereits gelernt, dass Messwerte durch Zufallszahlen $x_i$ repräsentiert werden und einer gewissen **Wahrscheinlichkeitsdichtefunktion (probability density function)** $f(x)$ unterliegen.\n",
"\n",
"<figure class=\"image\">\n",
"<img src=\"images/MaterialPythonkurs092018/PorbDensFun.png\" alt=\"{{ Beispiel PDF }}\" width=70%>\n",
"</figure>\n",
"\n",
"\n",
"Eine **pdf** gibt an, mit welcher **Wahrscheinlichkeit ein Wert $x_i$** innerhalb eines **infinitesimalen Intervals $\\text{d}x_i$** zu finden ist. Des Weiteren gilt, dass die Gesamtwahrscheinlichkeit gegeben ist durch $\\int_S f(x) dx = 1$. \n",
"\n",
"Nun betrachten wir folgendes Beispiel: In unserem Labor messen wir genau drei mal die Raumtemperartur T. Auch hier gilt, dass unsere Messungen der einzelnen $T_i$ einer gewissen **Wahrscheinlichkeitsdichtefunktion** folgen. Betrachten Sie nun das folgende Bild; Welche **Wahrscheinlichkeitsdichtefunktion** passt besser zu den gezeigten Daten und **Warum?**\n",
"\n",
"<figure class=\"image\">\n",
"<img src=\"images/MaterialPythonkurs092018/ProbMaxTemp.png\" alt=\"{{ Beispiel PDF }}\" width=100%>\n",
"</figure>\n",
"\n",
"Die rechte Verteilung spiegelt unsere Messdaten besser wider. Dies können wir auch mathematisch ausdrücken. Für $N$ voreinander unabhängige Zufallszahlen bzw. Messpunkte (in unserem Beispiel $N = 3$) ist die Gesamtwahrscheinlichkeit gegeben durch das Produkt der einzelnen Wahrscheinlichkeitsdichten $f(x_i, \\theta)$ multipliziert mit dem jeweiligen infinitesimalen Element $dx_i$\n",
"\n",
"$$\\prod_{i = 1}^{N} f(x_i,\\theta) \\ dx_i \\text{ für alle } x_i \\text{ in } [x_i, x_i + dx_i]$$\n",
"\n",
"wobei $x_i$ in unserem Beispiel den Messpunkten $T_i$ und $f(x_i,\\theta)$ unserer Gaussverteilung mit $\\theta = (\\mu, \\sigma)$ entspricht. Sofern unsere Werte gut von der jeweiligen **Wahrscheinlichkeitsdichtefunktion** repräsentiert werden, d.h. wir die richtigen Parameter $\\theta$ gewählt haben (wie im rechten oberen Plot), gilt \n",
"\n",
"$$ \\prod_{i = 1}^{N} f(x_i,\\theta) dx_i \\ \\ \\text{ist} \\ \\textbf{maximal.}$$\n",
"\n",
"Da die einzelnen $dx_i$ von unseren Parametern $\\theta$ unabhängig sind, gilt die gleiche Argumentation auch für \n",
"\n",
"$$ \\mathcal{L}(x_1 ... x_N; \\theta_1 ... \\theta_N) = \\prod_{i = 1}^{N} f(x_i,\\theta)$$ \n",
"\n",
"wobei $\\mathcal{L}(x_1 ... x_N; \\theta_1 ... \\theta_N)$ die sogenannte **\"likelihood\"** function darstellt.\n",
"\n",
"Wie kommen wir nun von der **likelihood function** auf unsere **Methode der kleinsten Quadrate** und das Fitten einer Funktion $\\lambda(x; \\ $**$\\phi$**$)$ an die gemessenen Punkte **$(x,y)$**? Dazu brauchen wir noch einen Zwischenschritt. Oftmals ist es einfacher, statt die **likelihood function** zu maximieren, die so genannte **log likelihood function**\n",
"\n",
"$$ \\log( \\mathcal{L}(x_1 ... x_N; \\theta_1 ... \\theta_N)) = \\sum_{i = 1}^{N} \\log(f(x_i,\\theta))$$\n",
"\n",
"zu maximieren. Dies ist im Grunde das Gleiche, da der Logarithmus eine monoton-steigende Funktion ist. Auch in unserem Fall der **Methode der kleinsten Quadrate** benötigen wir die **log likelihood function**. \n",
"\n",
"Stellen Sie sich nun vor, wir haben eine Messung mit $N$ voneinander unabhängigen Messpunkten (x,y). Des Weiteren nehmen wir an, dass alle $x_i$ ohne Fehler sind und dass unsere $y_i$ gaußförmig um einen unbekannten wahren Wert $\\lambda_i$ (sprich $\\lambda_i$ entspricht dem Erwartungswert $\\mu_i$ unserer Gaußverteilung) mit einer bekannten Varianz $\\Delta y_i^2$ verteilt sind (Diese Annahme lässt sich mit dem zentralen Grenzwertsatz begründen, so lange der Fehler sich aus der Summe kleiner Fehler zusammensetzt). Die dazugehörige **likelihood function** ist dann gegeben durch:\n",
"\n",
"$$ \\mathcal{L}(y_1 ... y_N; \\lambda_1 ... \\lambda_N, \\Delta y_1 ... \\Delta y_N)) = \\prod_{i = 1}^{N}\\frac{1}{\\sqrt{2 \\pi \\Delta y_i^2}} \\cdot \\exp \\bigg( \\frac{ -(y_i - \\lambda_i)^2}{2 \\cdot \\Delta y_i^2}\\bigg)$$\n",
"\n",
"Beziehungsweise die **log likelihood function** mit $\\lambda_i = \\lambda(x_i; \\phi)$ ergibt sich zu\n",
"\n",
"$$ \\log(\\mathcal{L}(y, \\theta)) \\approx -\\frac{1}{2} \\sum_{i = 1}^{N}\\bigg( \\frac{ (y_i - \\lambda(x_i; \\phi))^2}{\\Delta y_i^2}\\bigg)$$\n",
"\n",
"wobei die konstanten Terme, welche nicht von unserer Funktion $\\lambda(x_i; \\phi)$ abhängen, vernachlässigt worden sind. Durch den Faktor $-\\frac{1}{2}$ ist das Maximieren dieser **log likelihood function** gleich dem Minimieren von\n",
"\n",
"$$ \\chi(\\phi_1 ... \\phi_N)^2 = \\sum_{i = 1}^{N} \\frac{ (y_i - \\lambda(x_i; \\phi))^2}{\\Delta y_i^2}$$\n",
"\n",
"Diese Funktion ist unsere gesuchte **Methode der kleinsten Quadrate**. Mit ihrer Hilfe kann eine beliebige Funktion $\\lambda(x; \\phi)$, welche linear in ihren Parametern $\\phi$ ist, an unsere Messdaten $(x,y\\pm\\Delta y)$ gefittet werden. Dabei stellt der Fitprozess selbst lediglich ein Minimierungsproblem dar. Im Folgenden sind unsere Annahmen noch einmal grafisch in einem Beispiel dargestellt.\n",
"\n",
"<figure class=\"image\">\n",
"<img src=\"images/MaterialPythonkurs092018/LeastSquare.png\" alt=\"{{ Least Square Beispiel }}\" width=100%>\n",
"</figure>"
]
},
{
"cell_type": "markdown",
"id": "be4a8d21-29db-4866-9117-8746b80d5945",
"metadata": {},
"source": [
"Wie ein Algorithmus bei der Minimierung vorgeht, sprengt den Rahmen dieses Vorversuchs. Hier sei auf entsprechende Vorlesungen verwiesen. Aber um einen kleinen Einblick zu erhalten, kann man sich die Werte der Parameter und von $\\chi^2$ für jeden Schritt ausgeben lassen. Dazu wird der Parameter `verbose` auf 1 gesetzt.\n",
"\n",
"Man erkannt, dass für jeden Parameter zunächst separat geprüft wird, welche Änderung (größer oder kleiner) die Kostenfunktion minimiert. Danach beginnt die eigentliche Minimierung der Kostenfunktion durch den Algorithmus."
]
},
{
"cell_type": "code",
"execution_count": 500,
"id": "43bfd15e-7b68-4b70-bc06-0b23f89f7bff",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(0.9, 10000.0, 1e-06) -> 99.20912665811522\n",
"(0.9000900000000001, 10000.0, 1e-06) -> 99.19412063461034\n",
"(0.89991, 10000.0, 1e-06) -> 99.22413838602546\n",
"(0.9002604809700815, 10000.0, 1e-06) -> 99.16571136645308\n",
"(0.8997395190299186, 10000.0, 1e-06) -> 99.25258973321158\n",
"(0.9, 10001.0, 1e-06) -> 99.2081333982375\n",
"(0.9, 9999.0, 1e-06) -> 99.21012010104333\n",
"(0.9, 10010.0, 1e-06) -> 99.19920228362008\n",
"(0.9, 9990.0, 1e-06) -> 99.21906933767059\n",
"(0.9, 10000.0, 1.0001e-06) -> 99.2081333982375\n",
"(0.9, 10000.0, 9.999e-07) -> 99.21012010104333\n",
"(0.9, 10000.0, 1.001e-06) -> 99.19920228362008\n",
"(0.9, 10000.0, 9.989999999999999e-07) -> 99.21906933767059\n",
"(1.1367992341436675, 15426.65629293471, 1.5426656292934658e-06) -> 71.48428998018905\n",
"(1.1639942960414291, 16049.877285679564, 1.6049877285679507e-06) -> 69.75101904460233\n",
"(1.308096945474447, 19352.234036123315, 1.9352234036123227e-06) -> 64.0373348681763\n",
"(1.377047580024234, 20932.354834379075, 2.093235483437897e-06) -> 65.47264288596953\n",
"(1.3083067929414927, 19352.234036123315, 1.9352234036123227e-06) -> 64.06897571595725\n",
"(1.3078870980074015, 19352.234036123315, 1.9352234036123227e-06) -> 64.00572838249478\n",
"(1.308096945474447, 19363.537683275055, 1.9352234036123227e-06) -> 63.99858990110189\n",
"(1.308096945474447, 19340.930388971574, 1.9352234036123227e-06) -> 64.0760877366588\n",
"(1.308096945474447, 19352.234036123315, 1.9365250134806992e-06) -> 63.99272090590841\n",
"(1.308096945474447, 19352.234036123315, 1.933921793743946e-06) -> 64.08195930724722\n",
"(1.308096945474447, 19352.234036123315, 1.9374628097120974e-06) -> 63.96058355345421\n",
"(1.308096945474447, 19352.234036123315, 1.932983997512548e-06) -> 64.11411719500667\n",
"(1.4518988196469205, 28189.753065444456, 2.8189750163700463e-06) -> 61.272614820982845\n",
"(1.385496103118641, 24108.893380587735, 2.4108891818768406e-06) -> 49.65617486041412\n",
"(1.385672043336562, 24108.893380587735, 2.4108891818768406e-06) -> 49.694760759553645\n",
"(1.3853201629007201, 24108.893380587735, 2.4108891818768406e-06) -> 49.61761439538809\n",
"(1.385496103118641, 24122.984567537602, 2.4108891818768406e-06) -> 49.6271750967005\n",
"(1.385496103118641, 24094.80219363787, 2.4108891818768406e-06) -> 49.6852350578246\n",
"(1.385496103118641, 24117.03763372327, 2.4108891818768406e-06) -> 49.63940655944544\n",
"(1.385496103118641, 24100.7491274522, 2.4108891818768406e-06) -> 49.67296334907033\n",
"(1.385496103118641, 24108.893380587735, 2.4128655527857186e-06) -> 49.61551806057589\n",
"(1.385496103118641, 24108.893380587735, 2.4089128109679626e-06) -> 49.69695054357015\n",
"(1.385496103118641, 24108.893380587735, 2.411780041418529e-06) -> 49.63783388084468\n",
"(1.385496103118641, 24108.893380587735, 2.409998322335152e-06) -> 49.67453999473487\n",
"(1.3346958218375284, 26342.987535930857, 2.6342989994964907e-06) -> 32.40412806990936\n",
"(1.218308580069807, 31461.464245752708, 3.146147591686242e-06) -> 14.072342058026457\n",
"(1.2041974408796614, 32082.043754269307, 3.2082056542278777e-06) -> 13.53676656364805\n",
"(1.1905385220654157, 32682.73552056781, 3.2682749389683696e-06) -> 13.309190968111414\n",
"(1.1906296495547257, 32682.73552056781, 3.2682749389683696e-06) -> 13.321746128711856\n",
"(1.1904473945761056, 32682.73552056781, 3.2682749389683696e-06) -> 13.296643836281426\n",
"(1.1905385220654157, 32687.064556715202, 3.2682749389683696e-06) -> 13.31564880356511\n",
"(1.1905385220654157, 32678.40648442042, 3.2682749389683696e-06) -> 13.302737182521517\n",
"(1.1905385220654157, 32682.73552056781, 3.2687484177659625e-06) -> 13.316254288012424\n",
"(1.1905385220654157, 32682.73552056781, 3.2678014601707767e-06) -> 13.30213249281902\n",
"(0.9801502312575129, 30448.619847559406, 3.0448628816425382e-06) -> 6.96972301330329\n",
"(1.0625849715773497, 31323.995300450377, 3.1324006189341594e-06) -> 2.723232319724203\n",
"(1.0626278234687758, 31323.995300450377, 3.1324006189341594e-06) -> 2.723145418857497\n",
"(1.0625421196859235, 31323.995300450377, 3.1324006189341594e-06) -> 2.723320943276277\n",
"(1.0625849715773497, 31326.53248355612, 3.1324006189341594e-06) -> 2.7233762521216955\n",
"(1.0625849715773497, 31321.458117344635, 3.1324006189341594e-06) -> 2.7230896436266336\n",
"(1.0625849715773497, 31323.995300450377, 3.132687245408039e-06) -> 2.7233950126392372\n",
"(1.0625849715773497, 31323.995300450377, 3.13211399246028e-06) -> 2.72307123013582\n",
"(1.0663872573694309, 31176.616934344333, 3.117662764856898e-06) -> 2.707996462603649\n",
"(1.0676346425311973, 31128.267705196715, 3.112827836211991e-06) -> 2.7070251240566323\n",
"(1.0676780500361664, 31128.267705196715, 3.112827836211991e-06) -> 2.70705000293859\n",
"(1.0675912350262282, 31128.267705196715, 3.112827836211991e-06) -> 2.707002005340193\n",
"(1.0676346425311973, 31130.901765918446, 3.112827836211991e-06) -> 2.707043830842127\n",
"(1.0676346425311973, 31125.633644474983, 3.112827836211991e-06) -> 2.7070077881609484\n",
"(1.0676346425311973, 31128.267705196715, 3.113128792280756e-06) -> 2.7070466092241365\n",
"(1.0676346425311973, 31128.267705196715, 3.112526880143226e-06) -> 2.7070054284929457\n",
"(1.067212269933915, 31118.34694378787, 3.1118357598238063e-06) -> 2.706823247817995\n",
"(1.067168761630552, 31117.325013151873, 3.1117335667347323e-06) -> 2.706821465977302\n",
"(1.0672122600973335, 31117.325013151873, 3.1117335667347323e-06) -> 2.7068223416968538\n",
"(1.0671252631637707, 31117.325013151873, 3.1117335667347323e-06) -> 2.706822357390249\n",
"(1.067168761630552, 31119.94657401041, 3.1117335667347323e-06) -> 2.706822163448656\n",
"(1.067168761630552, 31114.703452293335, 3.1117335667347323e-06) -> 2.7068221260943885\n",
"(1.067168761630552, 31117.325013151873, 3.112032662687679e-06) -> 2.7068223708425214\n",
"(1.067168761630552, 31117.325013151873, 3.1114344707817854e-06) -> 2.7068223282441966\n",
"(1.067168761630552, 31117.325013151873, 3.1117335667347323e-06) -> 2.706821465977302\n",
"(1.0672122600973335, 31117.325013151873, 3.1117335667347323e-06) -> 2.7068223416968538\n",
"(1.0671252631637707, 31117.325013151873, 3.1117335667347323e-06) -> 2.706822357390249\n",
"(1.067168761630552, 31119.94657401041, 3.1117335667347323e-06) -> 2.706822163448656\n",
"(1.067168761630552, 31114.703452293335, 3.1117335667347323e-06) -> 2.7068221260943885\n",
"(1.067168761630552, 31117.325013151873, 3.112032662687679e-06) -> 2.7068223708425214\n",
"(1.067168761630552, 31117.325013151873, 3.1114344707817854e-06) -> 2.7068223282441966\n",
"(1.0671774613239084, 31117.325013151873, 3.1117335667347323e-06) -> 2.706821499750613\n",
"(1.0671600619371957, 31117.325013151873, 3.1117335667347323e-06) -> 2.706821502889292\n",
"(1.067168761630552, 31117.84932532358, 3.1117335667347323e-06) -> 2.7068214968699196\n",
"(1.067168761630552, 31116.800700980166, 3.1117335667347323e-06) -> 2.7068214893882208\n",
"(1.067168761630552, 31117.325013151873, 3.1117933859253217e-06) -> 2.7068215055878295\n",
"(1.067168761630552, 31117.325013151873, 3.111673747544143e-06) -> 2.7068214970520583\n",
"(1.0672122600973335, 31119.94657401041, 3.1117335667347323e-06) -> 2.70682365283658\n",
"(1.0672122600973335, 31117.325013151873, 3.112032662687679e-06) -> 2.7068239467067996\n",
"(1.067168761630552, 31119.94657401041, 3.112032662687679e-06) -> 2.7068246172709194\n"
]
},
{
"data": {
"text/html": [
"<table>\n",
" <tr>\n",
" <th colspan=\"2\" style=\"text-align:center\" title=\"Minimizer\"> Migrad </th>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:left\" title=\"Minimum value of function\"> FCN = 2.707 (χ²/ndof = 0.4) </td>\n",
" <td style=\"text-align:center\" title=\"Total number of function and (optional) gradient evaluations\"> Nfcn = 87 </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:left\" title=\"Estimated distance to minimum and goal\"> EDM = 2.18e-10 (Goal: 0.0002) </td>\n",
" <td style=\"text-align:center\" title=\"Total run time of algorithms\"> </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> Valid Minimum </td>\n",
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> Below EDM threshold (goal x 10) </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align:center;background-color:#92CCA6;color:black\"> No parameters at limit </td>\n",
" <td 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:#FFF79A;color:black\"> Hesse ok </td>\n",
" <td style=\"text-align:center;background-color:#FFF79A;color:black\"> Covariance FORCED pos. def. </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> I0 </td>\n",
" <td> 1.07 </td>\n",
" <td> 0.05 </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> R </td>\n",
" <td> 0.03e6 </td>\n",
" <td> 0.05e6 </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> C </td>\n",
" <td> 3e-6 </td>\n",
" <td> 5e-6 </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> I0 </th>\n",
" <th> R </th>\n",
" <th> C </th>\n",
" </tr>\n",
" <tr>\n",
" <th> I0 </th>\n",
" <td> 0.00253 </td>\n",
" <td style=\"background-color:rgb(248,248,250);color:black\"> -34.3309 <strong>(-0.014)</strong> </td>\n",
" <td style=\"background-color:rgb(248,248,250);color:black\"> -3.459e-9 <strong>(-0.014)</strong> </td>\n",
" </tr>\n",
" <tr>\n",
" <th> R </th>\n",
" <td style=\"background-color:rgb(248,248,250);color:black\"> -34.3309 <strong>(-0.014)</strong> </td>\n",
" <td> 2.25e+09 </td>\n",
" <td style=\"background-color:rgb(120,120,250);color:black\"> -224.592785048e-3 <strong>(-0.997)</strong> </td>\n",
" </tr>\n",
" <tr>\n",
" <th> C </th>\n",
" <td style=\"background-color:rgb(248,248,250);color:black\"> -3.459e-9 <strong>(-0.014)</strong> </td>\n",
" <td style=\"background-color:rgb(120,120,250);color:black\"> -224.592785048e-3 <strong>(-0.997)</strong> </td>\n",
" <td> 2.25e-11 </td>\n",
" </tr>\n",
"</table><?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"360pt\" height=\"288pt\" viewBox=\"0 0 360 288\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
" <metadata>\n",
" <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
" <cc:Work>\n",
" <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
" <dc:date>2024-10-16T21:40:48.677208</dc:date>\n",
" <dc:format>image/svg+xml</dc:format>\n",
" <dc:creator>\n",
" <cc:Agent>\n",
" <dc:title>Matplotlib v3.8.2, https://matplotlib.org/</dc:title>\n",
" </cc:Agent>\n",
" </dc:creator>\n",
" </cc:Work>\n",
" </rdf:RDF>\n",
" </metadata>\n",
" <defs>\n",
" <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
" </defs>\n",
" <g id=\"figure_1\">\n",
" <g id=\"patch_1\">\n",
" <path d=\"M 0 288 \n",
"L 360 288 \n",
"L 360 0 \n",
"L 0 0 \n",
"z\n",
"\" style=\"fill: #ffffff\"/>\n",
" </g>\n",
" <g id=\"axes_1\">\n",
" <g id=\"patch_2\">\n",
" <path d=\"M 25.903365 268.321635 \n",
"L 356.99976 268.321635 \n",
"L 356.99976 3.00024 \n",
"L 25.903365 3.00024 \n",
"z\n",
"\" style=\"fill: #ffffff\"/>\n",
" </g>\n",
" <g id=\"matplotlib.axis_1\">\n",
" <g id=\"xtick_1\">\n",
" <g id=\"line2d_1\">\n",
" <defs>\n",
" <path id=\"m037cbcc230\" d=\"M 0 0 \n",
"L 0 3.5 \n",
"\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </defs>\n",
" <g>\n",
" <use xlink:href=\"#m037cbcc230\" x=\"40.73593\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_1\">\n",
" <!-- 0.0 -->\n",
" <g transform=\"translate(32.784367 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
"Q 1547 4250 1301 3770 \n",
"Q 1056 3291 1056 2328 \n",
"Q 1056 1369 1301 889 \n",
"Q 1547 409 2034 409 \n",
"Q 2525 409 2770 889 \n",
"Q 3016 1369 3016 2328 \n",
"Q 3016 3291 2770 3770 \n",
"Q 2525 4250 2034 4250 \n",
"z\n",
"M 2034 4750 \n",
"Q 2819 4750 3233 4129 \n",
"Q 3647 3509 3647 2328 \n",
"Q 3647 1150 3233 529 \n",
"Q 2819 -91 2034 -91 \n",
"Q 1250 -91 836 529 \n",
"Q 422 1150 422 2328 \n",
"Q 422 3509 836 4129 \n",
"Q 1250 4750 2034 4750 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" <path id=\"DejaVuSans-2e\" d=\"M 684 794 \n",
"L 1344 794 \n",
"L 1344 0 \n",
"L 684 0 \n",
"L 684 794 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_2\">\n",
" <g id=\"line2d_2\">\n",
" <g>\n",
" <use xlink:href=\"#m037cbcc230\" x=\"108.909177\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_2\">\n",
" <!-- 0.2 -->\n",
" <g transform=\"translate(100.957614 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
"L 3431 531 \n",
"L 3431 0 \n",
"L 469 0 \n",
"L 469 531 \n",
"Q 828 903 1448 1529 \n",
"Q 2069 2156 2228 2338 \n",
"Q 2531 2678 2651 2914 \n",
"Q 2772 3150 2772 3378 \n",
"Q 2772 3750 2511 3984 \n",
"Q 2250 4219 1831 4219 \n",
"Q 1534 4219 1204 4116 \n",
"Q 875 4013 500 3803 \n",
"L 500 4441 \n",
"Q 881 4594 1212 4672 \n",
"Q 1544 4750 1819 4750 \n",
"Q 2544 4750 2975 4387 \n",
"Q 3406 4025 3406 3419 \n",
"Q 3406 3131 3298 2873 \n",
"Q 3191 2616 2906 2266 \n",
"Q 2828 2175 2409 1742 \n",
"Q 1991 1309 1228 531 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_3\">\n",
" <g id=\"line2d_3\">\n",
" <g>\n",
" <use xlink:href=\"#m037cbcc230\" x=\"177.082424\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_3\">\n",
" <!-- 0.4 -->\n",
" <g transform=\"translate(169.130861 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \n",
"L 825 1625 \n",
"L 2419 1625 \n",
"L 2419 4116 \n",
"z\n",
"M 2253 4666 \n",
"L 3047 4666 \n",
"L 3047 1625 \n",
"L 3713 1625 \n",
"L 3713 1100 \n",
"L 3047 1100 \n",
"L 3047 0 \n",
"L 2419 0 \n",
"L 2419 1100 \n",
"L 313 1100 \n",
"L 313 1709 \n",
"L 2253 4666 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-34\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_4\">\n",
" <g id=\"line2d_4\">\n",
" <g>\n",
" <use xlink:href=\"#m037cbcc230\" x=\"245.255671\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_4\">\n",
" <!-- 0.6 -->\n",
" <g transform=\"translate(237.304108 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-36\" d=\"M 2113 2584 \n",
"Q 1688 2584 1439 2293 \n",
"Q 1191 2003 1191 1497 \n",
"Q 1191 994 1439 701 \n",
"Q 1688 409 2113 409 \n",
"Q 2538 409 2786 701 \n",
"Q 3034 994 3034 1497 \n",
"Q 3034 2003 2786 2293 \n",
"Q 2538 2584 2113 2584 \n",
"z\n",
"M 3366 4563 \n",
"L 3366 3988 \n",
"Q 3128 4100 2886 4159 \n",
"Q 2644 4219 2406 4219 \n",
"Q 1781 4219 1451 3797 \n",
"Q 1122 3375 1075 2522 \n",
"Q 1259 2794 1537 2939 \n",
"Q 1816 3084 2150 3084 \n",
"Q 2853 3084 3261 2657 \n",
"Q 3669 2231 3669 1497 \n",
"Q 3669 778 3244 343 \n",
"Q 2819 -91 2113 -91 \n",
"Q 1303 -91 875 529 \n",
"Q 447 1150 447 2328 \n",
"Q 447 3434 972 4092 \n",
"Q 1497 4750 2381 4750 \n",
"Q 2619 4750 2861 4703 \n",
"Q 3103 4656 3366 4563 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-36\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_5\">\n",
" <g id=\"line2d_5\">\n",
" <g>\n",
" <use xlink:href=\"#m037cbcc230\" x=\"313.428917\" y=\"268.321635\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_5\">\n",
" <!-- 0.8 -->\n",
" <g transform=\"translate(305.477355 282.920073) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-38\" d=\"M 2034 2216 \n",
"Q 1584 2216 1326 1975 \n",
"Q 1069 1734 1069 1313 \n",
"Q 1069 891 1326 650 \n",
"Q 1584 409 2034 409 \n",
"Q 2484 409 2743 651 \n",
"Q 3003 894 3003 1313 \n",
"Q 3003 1734 2745 1975 \n",
"Q 2488 2216 2034 2216 \n",
"z\n",
"M 1403 2484 \n",
"Q 997 2584 770 2862 \n",
"Q 544 3141 544 3541 \n",
"Q 544 4100 942 4425 \n",
"Q 1341 4750 2034 4750 \n",
"Q 2731 4750 3128 4425 \n",
"Q 3525 4100 3525 3541 \n",
"Q 3525 3141 3298 2862 \n",
"Q 3072 2584 2669 2484 \n",
"Q 3125 2378 3379 2068 \n",
"Q 3634 1759 3634 1313 \n",
"Q 3634 634 3220 271 \n",
"Q 2806 -91 2034 -91 \n",
"Q 1263 -91 848 271 \n",
"Q 434 634 434 1313 \n",
"Q 434 1759 690 2068 \n",
"Q 947 2378 1403 2484 \n",
"z\n",
"M 1172 3481 \n",
"Q 1172 3119 1398 2916 \n",
"Q 1625 2713 2034 2713 \n",
"Q 2441 2713 2670 2916 \n",
"Q 2900 3119 2900 3481 \n",
"Q 2900 3844 2670 4047 \n",
"Q 2441 4250 2034 4250 \n",
"Q 1625 4250 1398 4047 \n",
"Q 1172 3844 1172 3481 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-38\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"matplotlib.axis_2\">\n",
" <g id=\"ytick_1\">\n",
" <g id=\"line2d_6\">\n",
" <defs>\n",
" <path id=\"mf0d1a5b6c1\" d=\"M 0 0 \n",
"L -3.5 0 \n",
"\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </defs>\n",
" <g>\n",
" <use xlink:href=\"#mf0d1a5b6c1\" x=\"25.903365\" y=\"242.213419\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_6\">\n",
" <!-- 0.0 -->\n",
" <g transform=\"translate(3.00024 246.012638) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_2\">\n",
" <g id=\"line2d_7\">\n",
" <g>\n",
" <use xlink:href=\"#mf0d1a5b6c1\" x=\"25.903365\" y=\"201.524588\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_7\">\n",
" <!-- 0.2 -->\n",
" <g transform=\"translate(3.00024 205.323807) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_3\">\n",
" <g id=\"line2d_8\">\n",
" <g>\n",
" <use xlink:href=\"#mf0d1a5b6c1\" x=\"25.903365\" y=\"160.835758\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_8\">\n",
" <!-- 0.4 -->\n",
" <g transform=\"translate(3.00024 164.634977) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-34\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_4\">\n",
" <g id=\"line2d_9\">\n",
" <g>\n",
" <use xlink:href=\"#mf0d1a5b6c1\" x=\"25.903365\" y=\"120.146928\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_9\">\n",
" <!-- 0.6 -->\n",
" <g transform=\"translate(3.00024 123.946147) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-36\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_5\">\n",
" <g id=\"line2d_10\">\n",
" <g>\n",
" <use xlink:href=\"#mf0d1a5b6c1\" x=\"25.903365\" y=\"79.458098\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_10\">\n",
" <!-- 0.8 -->\n",
" <g transform=\"translate(3.00024 83.257316) scale(0.1 -0.1)\">\n",
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-38\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_6\">\n",
" <g id=\"line2d_11\">\n",
" <g>\n",
" <use xlink:href=\"#mf0d1a5b6c1\" x=\"25.903365\" y=\"38.769267\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_11\">\n",
" <!-- 1.0 -->\n",
" <g transform=\"translate(3.00024 42.568486) scale(0.1 -0.1)\">\n",
" <defs>\n",
" <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
"L 1825 531 \n",
"L 1825 4091 \n",
"L 703 3866 \n",
"L 703 4441 \n",
"L 1819 4666 \n",
"L 2450 4666 \n",
"L 2450 531 \n",
"L 3481 531 \n",
"L 3481 0 \n",
"L 794 0 \n",
"L 794 531 \n",
"z\n",
"\" transform=\"scale(0.015625)\"/>\n",
" </defs>\n",
" <use xlink:href=\"#DejaVuSans-31\"/>\n",
" <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
" <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"LineCollection_1\">\n",
" <path d=\"M 40.953201 35.404719 \n",
"L 40.953201 15.060303 \n",
"\" clip-path=\"url(#pdd62e56208)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 70.920558 169.72296 \n",
"L 70.920558 149.378545 \n",
"\" clip-path=\"url(#pdd62e56208)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 107.127612 223.274253 \n",
"L 107.127612 202.929838 \n",
"\" clip-path=\"url(#pdd62e56208)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 145.181886 236.488332 \n",
"L 145.181886 216.143917 \n",
"\" clip-path=\"url(#pdd62e56208)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 178.883846 239.153243 \n",
"L 178.883846 218.808828 \n",
"\" clip-path=\"url(#pdd62e56208)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 213.688041 249.967639 \n",
"L 213.688041 229.623224 \n",
"\" clip-path=\"url(#pdd62e56208)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 249.782105 256.215254 \n",
"L 249.782105 235.870839 \n",
"\" clip-path=\"url(#pdd62e56208)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 281.899185 243.329687 \n",
"L 281.899185 222.985272 \n",
"\" clip-path=\"url(#pdd62e56208)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 310.183387 250.985784 \n",
"L 310.183387 230.641369 \n",
"\" clip-path=\"url(#pdd62e56208)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" <path d=\"M 341.949924 256.261572 \n",
"L 341.949924 235.917156 \n",
"\" clip-path=\"url(#pdd62e56208)\" style=\"fill: none; stroke: #000000; stroke-width: 1.5\"/>\n",
" </g>\n",
" <g id=\"line2d_12\">\n",
" <path d=\"M 40.953201 26.528678 \n",
"L 43.304738 41.360806 \n",
"L 45.656275 55.172963 \n",
"L 48.007812 68.035291 \n",
"L 50.359349 80.013108 \n",
"L 52.710886 91.167238 \n",
"L 55.062423 101.554326 \n",
"L 57.413959 111.227118 \n",
"L 59.765496 120.234735 \n",
"L 64.46857 136.434268 \n",
"L 69.171644 150.482402 \n",
"L 73.874718 162.664856 \n",
"L 78.577791 173.229404 \n",
"L 83.280865 182.390913 \n",
"L 87.983939 190.335717 \n",
"L 92.687013 197.225401 \n",
"L 97.390087 203.200092 \n",
"L 102.09316 208.381306 \n",
"L 106.796234 212.874423 \n",
"L 111.499308 216.770825 \n",
"L 116.202382 220.149761 \n",
"L 125.608529 225.620997 \n",
"L 135.014677 229.735503 \n",
"L 144.420825 232.829715 \n",
"L 153.826972 235.156639 \n",
"L 172.639267 238.222517 \n",
"L 191.451562 239.956398 \n",
"L 229.076153 241.491539 \n",
"L 266.700743 241.982535 \n",
"L 304.325334 242.139573 \n",
"L 341.949924 242.1898 \n",
"\" clip-path=\"url(#pdd62e56208)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"line2d_13\">\n",
" <defs>\n",
" <path id=\"m38c2e5238b\" d=\"M 0 3 \n",
"C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \n",
"C 2.683901 1.55874 3 0.795609 3 0 \n",
"C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \n",
"C 1.55874 -2.683901 0.795609 -3 0 -3 \n",
"C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \n",
"C -2.683901 -1.55874 -3 -0.795609 -3 0 \n",
"C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \n",
"C -1.55874 2.683901 -0.795609 3 0 3 \n",
"z\n",
"\" style=\"stroke: #000000\"/>\n",
" </defs>\n",
" <g clip-path=\"url(#pdd62e56208)\">\n",
" <use xlink:href=\"#m38c2e5238b\" x=\"40.953201\" y=\"25.232511\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m38c2e5238b\" x=\"70.920558\" y=\"159.550753\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m38c2e5238b\" x=\"107.127612\" y=\"213.102046\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m38c2e5238b\" x=\"145.181886\" y=\"226.316124\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m38c2e5238b\" x=\"178.883846\" y=\"228.981035\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m38c2e5238b\" x=\"213.688041\" y=\"239.795432\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m38c2e5238b\" x=\"249.782105\" y=\"246.043046\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m38c2e5238b\" x=\"281.899185\" y=\"233.157479\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m38c2e5238b\" x=\"310.183387\" y=\"240.813577\" style=\"stroke: #000000\"/>\n",
" <use xlink:href=\"#m38c2e5238b\" x=\"341.949924\" y=\"246.089364\" style=\"stroke: #000000\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"patch_3\">\n",
" <path d=\"M 25.903365 268.321635 \n",
"L 25.903365 3.00024 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"patch_4\">\n",
" <path d=\"M 356.99976 268.321635 \n",
"L 356.99976 3.00024 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"patch_5\">\n",
" <path d=\"M 25.903365 268.321635 \n",
"L 356.99976 268.321635 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" <g id=\"patch_6\">\n",
" <path d=\"M 25.903365 3.00024 \n",
"L 356.99976 3.00024 \n",
"\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <defs>\n",
" <clipPath id=\"pdd62e56208\">\n",
" <rect x=\"25.903365\" y=\"3.00024\" width=\"331.096395\" height=\"265.321395\"/>\n",
" </clipPath>\n",
" </defs>\n",
"</svg>\n"
],
"text/plain": [
"┌─────────────────────────────────────────────────────────────────────────┐\n",
"│ Migrad │\n",
"├──────────────────────────────────┬──────────────────────────────────────┤\n",
"│ FCN = 2.707 (χ²/ndof = 0.4) │ Nfcn = 87 │\n",
"│ EDM = 2.18e-10 (Goal: 0.0002) │ │\n",
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
"│ Valid Minimum │ Below EDM threshold (goal x 10) │\n",
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
"│ No parameters at limit │ Below call limit │\n",
"├──────────────────────────────────┼──────────────────────────────────────┤\n",
"│ Hesse ok │ Covariance FORCED pos. def. │\n",
"└──────────────────────────────────┴──────────────────────────────────────┘\n",
"┌───┬──────┬───────────┬───────────┬────────────┬────────────┬─────────┬─────────┬───────┐\n",
"│ │ Name │ Value │ Hesse Err │ Minos Err- │ Minos Err+ │ Limit- │ Limit+ │ Fixed │\n",
"├───┼──────┼───────────┼───────────┼────────────┼────────────┼─────────┼─────────┼───────┤\n",
"│ 0 │ I0 │ 1.07 │ 0.05 │ │ │ │ │ │\n",
"│ 1 │ R │ 0.03e6 │ 0.05e6 │ │ │ │ │ │\n",
"│ 2 │ C │ 3e-6 │ 5e-6 │ │ │ │ │ │\n",
"└───┴──────┴───────────┴───────────┴────────────┴────────────┴─────────┴─────────┴───────┘\n",
"┌────┬───────────────────────────────────────────────────────┐\n",
"│ │ I0 R C │\n",
"├────┼───────────────────────────────────────────────────────┤\n",
"│ I0 │ 0.00253 -34.3309 -3.459e-9 │\n",
"│ R │ -34.3309 2.25e+09 -224.592785048e-3 │\n",
"│ C │ -3.459e-9 -224.592785048e-3 2.25e-11 │\n",
"└────┴───────────────────────────────────────────────────────┘"
]
},
"execution_count": 500,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ls = cost.LeastSquares(data_frame['time'], data_frame['current'], data_frame['delta_current'], discharge_current, verbose=1)\n",
"\n",
"mi = Minuit(ls, I0=0.9, R=10*10**3, C=10**-6)\n",
"mi.migrad()"
]
},
{
"cell_type": "markdown",
"id": "c664e4f0-0226-4be0-91f4-7c28aee16a4a",
"metadata": {},
"source": [
"__Zur Erinnerung__: die Methode der kleinsten Quadrate berücksichtigt nur Fehler in `y` aber nicht in `x`. Hierfür sind komplexere Methoden notwendig, die wir hier nicht betrachten wollen.\n",
"Ebenfalls wichtig ist, die Statusmeldungen von `iminuit` zu prüfen, d.h. eine <span style=\"color:yellow\"> **gelbe** </span> Box zeigt an, das man sich Gedanken über das Ergebnis machen sollte (in unserem Fall, dass die Variablen $R$ und $C$ korreliert sind) und eine ,<span style=\"color:#7878FA\"> **violette** </span> Box, dass der Fit nicht konvergiert ist und das Ergebnis nicht verwendet werden kann."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "jupyter",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 5
}