{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Fixed fit parameters" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "from smpl import plot\n", "from smpl import io\n", "from smpl import functions as f\n", "import uncertainties.unumpy as unp\n", "import uncertainties as un\n", "import smpl\n", "smpl.__version__\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", "data = np.loadtxt(io.find_file('test_linear_data.txt',3))\n", "xdata = data[:,0]\n", "xerr = data[:,2]\n", "ydata = data[:,1]\n", "yerr = data[:,3]\n", "x = unp.uarray(xdata,xerr)\n", "y = unp.uarray(ydata,yerr)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", "\n", "ff = plot.fit(xdata, ydata, fmt='.', label='data', xaxis=\"x in a.u.\",yaxis=\"y in a.u.\",function=f.line, b=0)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ff = plot.fit(xdata, ydata, fmt='.', label='data', xaxis=\"x in a.u.\",yaxis=\"y in a.u.\",function=f.line, a=un.ufloat(1,0.1),sigmas=1)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.9.15" } }, "nbformat": 4, "nbformat_minor": 4 }