Initial commit

This commit is contained in:
rosa 2025-10-23 20:10:38 +02:00
commit f0610d41da
7 changed files with 282 additions and 0 deletions

12
.gitignore vendored Normal file
View file

@ -0,0 +1,12 @@
protokoll.aux
protokoll.pdf
protokoll.bbl
protokoll.run.xml
protokoll.synctex.gz
protokoll.blg
protokoll-blx.bib
protokoll.log
.DS_Store
protokoll.fls
protokoll.fdb_latexmk
res/graphs/__pycache__

0
protokoll.bib Normal file
View file

62
protokoll.tex Normal file
View file

@ -0,0 +1,62 @@
% !TeX spellcheck = en_US
\documentclass[11pt]{article}
\usepackage[
backend=bibtex,
style=numeric,
sorting=ynt
]{biblatex}
\addbibresource{protokoll.bib}
\usepackage{lipsum,caption,graphicx,subcaption}
\usepackage{multicol}
\usepackage{listings}
\usepackage{amsmath}
\usepackage[noabbrev, nameinlink]{cleveref}
\usepackage{array,tabularx,calc}
\usepackage{enumitem}
\usepackage{amsfonts}
\usepackage{pdfpages}
\usepackage{fancyhdr}
\usepackage[ngerman]{babel}
\graphicspath{ {res/} }
\usepackage[absolute,overlay]{textpos}
\newlength{\conditionwd}
\newenvironment{conditions}[1][where:\\]
{%
#1\tabularx{\textwidth-\widthof{#1}}[t]{
>{$}l<{$} @{${}...{}$} X@{}
}%
}
{\endtabularx\\[\belowdisplayskip]}
\input{titlepage.tex}
\begin{document}
\deckblatt{Titel}{Koch, Markus}{7}{Rosa Posch}{Sally Marcher}{12403619}{12412869}{Datum}{Kennzahl}
\section{Aufgabenstellung}
\section{Voraussetzungen und Grundlagen}
\section{Beschreibung der Versuchsanordnung}
\section{Geräteliste}
\section{Versuchsdurchführung und Messergebnisse}
\section{Auswertung}
\section{Diskussion}
\section{Zusammenfassung}
\section{Literatur}
\printbibliography
\end{document}

BIN
res/deckblatt.pdf Normal file

Binary file not shown.

53
res/graphs/example.py Normal file
View file

@ -0,0 +1,53 @@
from saplotlib import match_t, eval_uncert, symbolize, plot_dataset
import numpy as np
from sympy import sqrt, pi
from sympy import *
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
# => Value Prep:
# Time for 10 Periods, [s]
m_t = [13.49, 13.42, 13.51, 13.42, 13.45]
t = np.mean(m_t) / 10 # convert to period time
dt = (np.std(m_t, ddof=1)*match_t(m_t, 1) + 0.01) / 10
# (Type A uncert + type B uncert)
# Len of the pendulum
d = (560 - 9.5)*1e-3
dd = (2 + 0.5)*1e-3
# Ablese- + Eichuncert.
# Defining function
def g(d, t):
return d / (t/(2*np.pi))**2
# Define params
args = {"d":(d, dd), "t":(t, dt)}
# Result
print(eval_uncert(g, args))
# Plotting Example:
d = np.array([56, 50, 45, 40, 35, 30, 25, 20, 15, 10])*1e-2
t = np.array([13.49, 13.33, 12.68, 11.91, 11.31, 10.32, 9.23, 8.36, 7.16, 5.73])/10
def calc_dt(t):
# Fixed from prev. example
global dt
return dt
def calc_dd(d):
# Ablese- + Eichuncert.
return (2 + 0.5)*1e-3
def T(l, g):
return 2*pi*sqrt(l/g)
plot_dataset(d,t,calc_dd(t),calc_dt(d),T,"Rohdaten")
plt.title("Periodendauer eines Pendels")
plt.ylabel("Periodendauer $T$ [s]")
plt.xlabel("Länge $l$ [m]")
plt.legend()
plt.show()

87
res/graphs/saplotlib.py Normal file
View file

@ -0,0 +1,87 @@
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
from sympy import *
plt.rcParams['text.usetex'] = True
# student_t_dict, values from [1]
# keys are N-samples and entrys are for [sigma, 2*sigma, 3*sigma] => [68.3%, 95.5%, 99.7%]
student_t_dict = {
2:[1.84, 13.97, 235.8],
3:[1.32, 4.53, 19.21],
4:[1.20, 3.31, 9.22],
5:[1.15, 2.87, 6.62],
6:[1.11, 2.65, 5.51],
8:[1.08, 2.43, 4.53],
10:[1.06, 2.32, 4.09],
20:[1.03, 2.14, 3.45],
30:[1.02, 2.09, 3.28],
50:[1.01, 2.05, 3.16],
100:[1.00, 2.03, 3.08],
200:[1.00, 2.01, 3.04]
}
def match_t(arr, sigma_mult):
t = sigma_mult
for i in range(0, len(student_t_dict)-1):
if (list(student_t_dict.keys())[i] <= len(arr) < list(student_t_dict.keys())[i+1]):
t = student_t_dict[list(student_t_dict.keys())[i]][sigma_mult-1]
print(f"Matched Student t multiplier: {t}! Using {sigma_mult} Sigma width!")
return t
def symbolize(func):
"""
Arguments:
func - function to symbolize
Returns:
sympy symbolized function
"""
return func(*[Symbol(label) for label in func.__code__.co_varnames])
def conv_to_f_args(args):
f_args = {}
for key in args.keys():
f_args[key] = args[key][0]
return f_args
def calc_uncert(symf, args, typ):
if not (typ in ("A", "B")):
raise ValueError('typ can only be "A" or "B"')
symbols = symf.free_symbols
f_args = conv_to_f_args(args)
parts = {}
sum = 0
for s in symbols:
part = abs(diff(symf, s).evalf(subs=f_args)) * args[str(s)][1]
parts[str(s)] = part
if(typ == "B"):
sum += part
else:
sum += part**2
return sum if(typ == "B") else sqrt(sum), parts
def eval_uncert(f, args, typ="B"):
symf = symbolize(f)
uncert, _ = calc_uncert(symf, args, typ)
f_args = conv_to_f_args(args)
result = symf.evalf(subs=f_args)
return result, uncert
def plot_dataset(x, y, xerr, yerr, func, label, n=100, log=0):
symfunc = symbolize(func)
plt.errorbar(x, y, yerr=yerr, xerr=xerr, marker="o", ls="", capsize=5, label=label)
if log:
fitx = np.logspace(min(x), max(x), n)
else:
fitx = np.linspace(min(x), max(x), n)
symbols = func.__code__.co_varnames
npfunc = lambdify(symbols, symfunc, "numpy")
popt, pcov = curve_fit(npfunc, x, y)
plt.plot(fitx, npfunc(fitx, *popt), label="Fit: $"+latex(symfunc)+"$")
print(f"Optimized {symbols[1:]} with values {popt}")
"""
Sources:
[1] Skriptum zu "Einfuehrung in die physikalischen Messmethoden", Institut fuer Experimentalphysik, Graz, Maerz 2025
"""

68
titlepage.tex Normal file
View file

@ -0,0 +1,68 @@
\pagestyle{fancy}
\newcommand{\deckblatt}[9]{
\lhead{Gruppe #3, #4 \& #5}
\rhead{#8}
% Übungstitel
\begin{textblock*}{12.4cm}[0,1](5.7cm,16.3cm)
\centering
\LARGE
#1
\end{textblock*}
% Betreuer
\begin{textblock*}{12.4cm}[0,1](5.7cm,17.35cm)
\centering
\LARGE
#2
\end{textblock*}
% Gruppennummer
\begin{textblock*}{2.3cm}[0,1](7.35cm,19.75cm)
\centering
\Huge
#3
\end{textblock*}
% Name 1
\begin{textblock*}{4.6cm}[0,1](5.3cm,22.2cm)
\centering
\Large
#4
\end{textblock*}
% Name 2
\begin{textblock*}{4.6cm}[0,1](12.25cm,22.2cm)
\centering
\Large
#5
\end{textblock*}
% Kennzahl
\begin{textblock*}{7.7cm}[0,1](3.2cm,23.8cm)
\centering
\Large
#9
\end{textblock*}
% MtrNr 1
\begin{textblock*}{3cm}[0,1](12.5cm,23.8cm)
\centering
\Large
#6
\end{textblock*}
% MtrNr 2
\begin{textblock*}{3.9cm}[0,1](15cm,23.8cm)
\centering
\Large
#7
\end{textblock*}
% Datum
\begin{textblock*}{7.7cm}[0,1](3.2cm,25.4cm)
\centering
\Large
#8
\end{textblock*}
% Jahr
\begin{textblock*}{3.35cm}[0,1](10.5cm,25.4cm)
\centering
\Large
2025
\end{textblock*}
\includepdf{res/deckblatt.pdf}
}