Skip to content

Commit

Permalink
docs: improve fitting documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kmnhan committed Apr 12, 2024
1 parent 8875b74 commit 9e0a106
Showing 1 changed file with 27 additions and 24 deletions.
51 changes: 27 additions & 24 deletions docs/source/user-guide/curve-fitting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,27 @@
"_ = result.plot()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can also plot components."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"comps = result.eval_components()\n",
"plt.errorbar(x, y, yerr, fmt=\"o\", zorder=-1, alpha=0.3)\n",
"plt.plot(x, result.eval(), label=\"Best fit\")\n",
"plt.plot(x, comps[\"MultiPeakFunction_p0\"], \"--\", label=\"Peak\")\n",
"plt.plot(x, comps[\"MultiPeakFunction_bkg\"], \"--\", label=\"Background\")\n",
"plt.legend()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -354,7 +375,8 @@
"metadata": {},
"outputs": [],
"source": [
"cut = generate_data(bandshift=-0.2, count=30).T.qsel(ky=0.3)\n",
"data = generate_data(bandshift=-0.2, count=30).T\n",
"cut = data.qsel(ky=0.3)\n",
"cut.qplot(colorbar=True)"
]
},
Expand Down Expand Up @@ -523,28 +545,6 @@
"m.interactive()"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([589.79915088])"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from erlab.analysis.fit.functions import bcs_gap\n",
"\n",
"bcs_gap(np.asarray([1.6]), tc=4) * 1e+6"
]
},
{
"cell_type": "raw",
"metadata": {
Expand All @@ -562,7 +562,10 @@
"Fermi edge fitting\n",
"------------------\n",
"\n",
"Functions related to Fermi edge fitting are available in :mod:`erlab.analysis.gold`."
"Functions related to Fermi edge fitting are available in :mod:`erlab.analysis.gold`.\n",
"\n",
"Also check out the interactive Fermi edge fitting tool,\n",
":func:`erlab.interactive.goldtool`.\n"
]
},
{
Expand Down

0 comments on commit 9e0a106

Please sign in to comment.