Skip to content

Instantly share code, notes, and snippets.

@wollmich
Created September 9, 2022 09:04
Show Gist options
  • Save wollmich/e294d9850924552546038bfacf8f5c0e to your computer and use it in GitHub Desktop.
Save wollmich/e294d9850924552546038bfacf8f5c0e to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Erdbeschleunigung mittels mathematischen Pendel\n",
"\n",
"Michael Wollensack METAS 09.09.2022"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from metas_unclib import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Eingangsgössen"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"tau_gemessen = ufloat(1.2453, 0.0036 / np.sqrt(10), desc='Zeit Gemessen / s')\n",
"dtau_reaktion = ufloat(0.0, 0.1 / np.sqrt(3) / 20, desc='Zeit Operator Reaktion / s')\n",
"dtau_ablesung = ufloat(0.0, 0.005 / np.sqrt(3) / 20, desc='Zeit Operator Ablesung Uhr / s')\n",
"\n",
"L_gemessen = ufloat(0.33316, 0.00029 / np.sqrt(3), desc='Länge Gemessen / m')\n",
"dL_meter = ufloat(0.0, 0.0005 / np.sqrt(3), desc='Länge Meter / m')\n",
"dL_ablesung = ufloat(0.0, 0.0005 / np.sqrt(6), desc='Länge Ablesen / m')\n",
"\n",
"D_gemessen = ufloat(0.1005, 0.000071 / np.sqrt(2), desc='Durchmesser Gemessen / m')\n",
"dD_meter = ufloat(0.0, 0.001 / np.sqrt(3), desc='Durchmesser Meter / m')\n",
"dD_ablesung = ufloat(0.0, 0.0005 / np.sqrt(6), desc='Durchmesser Ablesen / m')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Messmodel"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"tau = tau_gemessen + dtau_ablesung + dtau_reaktion\n",
"L = L_gemessen + dL_meter + dL_ablesung\n",
"D = D_gemessen + dD_meter + dD_ablesung\n",
"\n",
"g = 4 * np.pi**2 / tau**2 * (L + D / 2 + (D **2 / (5 * (2 * L + D))))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Ausgangsgrösse"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"9.827632967475104 ± 0.05075049836807857\n"
]
}
],
"source": [
"print(g)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Unsicherheitsbudget"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"def print_budget(output, inputs):\n",
" jacobi = get_jacobi2(output, inputs)\n",
" unccomponent = get_unc_component(output, inputs) \n",
" print(\"Eingangsgrösse Wert Standard Sensitivität Unsicherheits Index \")\n",
" print(\" Unsicherheit Koeffizient Beitrag \")\n",
" print(\"------------------------------------------------------------------------------------------------------------\")\n",
" for i in range(len(inputs)):\n",
" print('%(inputname)-32s %(inputval)15.6f %(inputstd)15.6f %(jacobi)15.6f %(unccomponent)15.6f %(index)10.3f%%' % {\n",
" 'inputname' : inputs[i].net_object.Dependencies[0].Input.Description,\n",
" 'inputval' : get_value(inputs[i]),\n",
" 'inputstd' : get_stdunc(inputs[i]),\n",
" 'jacobi' : jacobi[0][i],\n",
" 'unccomponent' : np.abs(unccomponent[0][i]),\n",
" 'index' : 100.0 * unccomponent[0][i]**2 / get_stdunc(output)**2\n",
" })\n",
" print(\"------------------------------------------------------------------------------------------------------------\")\n",
" print()\n",
" print('%(outputname)-32s %(outputval)15.6f %(info)34s %(outputstd)12.6f' % {\n",
" 'outputname' : \"Ausgangsgrösse\",\n",
" 'info' : \"Kombinierte Standardunsicherheit\",\n",
" 'outputval' : get_value(output),\n",
" 'outputstd' : get_stdunc(output)\n",
" })\n",
" print('%(dummy)-48s %(info)34s %(outputstd2)12.6f' % {\n",
" 'dummy' : \"\",\n",
" 'info' : \"Erweiterte Messunsicherheit\",\n",
" 'outputstd2' : get_stdunc(output) * 2\n",
" })"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Eingangsgrösse Wert Standard Sensitivität Unsicherheits Index \n",
" Unsicherheit Koeffizient Beitrag \n",
"------------------------------------------------------------------------------------------------------------\n",
"Zeit Gemessen / s 1.245300 0.001138 -15.783559 0.017968 12.535%\n",
"Zeit Operator Reaktion / s 0.000000 0.002887 -15.783559 0.045563 80.602%\n",
"Zeit Operator Ablesung Uhr / s 0.000000 0.000144 -15.783559 0.002278 0.202%\n",
"Länge Gemessen / m 0.333160 0.000167 25.282355 0.004233 0.696%\n",
"Länge Meter / m 0.000000 0.000289 25.282355 0.007298 2.068%\n",
"Länge Ablesen / m 0.000000 0.000204 25.282355 0.005161 1.034%\n",
"Durchmesser Gemessen / m 0.100500 0.000050 13.975757 0.000702 0.019%\n",
"Durchmesser Meter / m 0.000000 0.000577 13.975757 0.008069 2.528%\n",
"Durchmesser Ablesen / m 0.000000 0.000204 13.975757 0.002853 0.316%\n",
"------------------------------------------------------------------------------------------------------------\n",
"\n",
"Ausgangsgrösse 9.827633 Kombinierte Standardunsicherheit 0.050750\n",
" Erweiterte Messunsicherheit 0.101501\n"
]
}
],
"source": [
"inputs = [tau_gemessen, dtau_reaktion, dtau_ablesung, L_gemessen, dL_meter, dL_ablesung, D_gemessen, dD_meter, dD_ablesung]\n",
"print_budget(g, inputs)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.6.6 64-bit",
"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.6.6"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "8a9681e39844f652d5b4b9546f20ca4205a8167fe914e7d0f37c2626a073f228"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment