Fixed ibox caption and label.
Fixed python pathes.
This commit is contained in:
parent
fc8308110b
commit
9525d2995d
@ -238,11 +238,10 @@
|
||||
\newenvironment{ibox}[2][tp]
|
||||
{\SetupFloatingEnvironment{iboxf}{placement=#1}%
|
||||
\begin{iboxf}%
|
||||
\stepcounter{iboxf}%
|
||||
\captionof{iboxf}{#2}%
|
||||
\captionsetup{singlelinecheck=off,labelfont={large,sf,it,bf},font={large,sf,it,bf}}
|
||||
\begin{mdframed}[linecolor=yellow!40,linewidth=1ex,%
|
||||
backgroundcolor=yellow!15,font={\sffamily},%
|
||||
frametitle={Info Box \theiboxf: #2},frametitlefont={\large\sffamily\itshape\bfseries},%
|
||||
frametitle={\caption{#2}},frametitleaboveskip=-1ex,%
|
||||
frametitlebackgroundcolor=yellow!40]}%
|
||||
{\end{mdframed}%
|
||||
\end{iboxf}}
|
||||
|
@ -6,10 +6,11 @@ fig = plt.figure()
|
||||
ax = fig.add_subplot(111)
|
||||
y = np.asarray([-10, 10]) * 2.**16/20.
|
||||
ax.plot([-10, 10], y, color='dodgerblue', lw=1.5)
|
||||
ax.set_xlabel('measured voltage [V]')
|
||||
ax.set_ylabel('digitized value')
|
||||
ax.set_xlabel('Measured voltage [V]')
|
||||
ax.set_ylabel('Digitized value')
|
||||
ax.set_xlim([-10.05, 10.05])
|
||||
ax.set_ylim([-2**15, 2**15 + 1])
|
||||
ax.set_ylim([-2**15, 2**15-1])
|
||||
ax.set_yticks([-2**15, -2**14, 0, 2**14, 2**15-1])
|
||||
ax.spines["right"].set_visible(False)
|
||||
ax.spines["top"].set_visible(False)
|
||||
ax.yaxis.set_ticks_position('left')
|
||||
@ -20,8 +21,8 @@ ax.tick_params(direction="out", width=1.25)
|
||||
ax.tick_params(direction="out", width=1.25)
|
||||
ax.grid()
|
||||
fig.set_facecolor("white")
|
||||
fig.set_size_inches(5., 5.)
|
||||
fig.set_size_inches(4., 3.6)
|
||||
fig.tight_layout()
|
||||
fig.savefig("images/data_acquisition.pdf")
|
||||
fig.savefig("data_acquisition.pdf")
|
||||
|
||||
plt.close()
|
||||
|
@ -27,6 +27,6 @@ ax.set_xlabel("time [s]")
|
||||
ax.set_ylabel("intensity")
|
||||
ax.legend(fontsize=8)
|
||||
fig.tight_layout()
|
||||
fig.savefig("images/logicalIndexingTime.pdf")
|
||||
fig.savefig("logicalIndexingTime.pdf")
|
||||
|
||||
|
||||
|
@ -131,9 +131,9 @@ interpretiert werden. Die wichtigsten Datentpyen sind folgende:
|
||||
Unter den numerischen Datentypen gibt es verschiedene Arten mit
|
||||
unterschiedlichem Speicherbedarf und Wertebreich.
|
||||
|
||||
\begin{table}[]
|
||||
\begin{table}[!h]
|
||||
\centering
|
||||
\titlecaption{Grundlegende Datentypen und ihr Wertebereich.}
|
||||
\titlecaption{Grundlegende Datentypen und ihr Wertebereich.}{}
|
||||
\label{dtypestab}
|
||||
\begin{tabular}{llcl}\hline
|
||||
Datentyp & Speicherbedarf & Wertebereich & Beispiel \rule{0pt}{2.5ex} \\ \hline
|
||||
@ -147,7 +147,7 @@ unterschiedlichem Speicherbedarf und Wertebreich.
|
||||
Daten gespeichert werden. Dennoch lohnt es sich, sich ein wenig mit
|
||||
den Datentypen auseinanderzusetzen (Box \ref{daqbox}).
|
||||
|
||||
\begin{ibox}[tp]{Digitalisierung von Messdaten}\label{daqbox}
|
||||
\begin{ibox}[tp]{\label{daqbox}Digitalisierung von Messdaten}
|
||||
Szenario: Die elektrische Aktivit\"at (z.B. die Membranspannung)
|
||||
einer Nervenzelle wird gemessen. Die gemessene Spannung wird mittels
|
||||
Messkarte digitalisiert und auf dem Computer f\"ur weitere Analysen
|
||||
@ -159,14 +159,16 @@ den Datentypen auseinanderzusetzen (Box \ref{daqbox}).
|
||||
Werte abgebildet.\vspace{0.25cm}
|
||||
|
||||
\begin{minipage}{0.5\textwidth}
|
||||
\includegraphics[width=0.9\columnwidth]{images/data_acquisition}
|
||||
\includegraphics[width=0.9\columnwidth]{data_acquisition}
|
||||
\end{minipage}
|
||||
\begin{minipage}{0.5\textwidth}
|
||||
Um die Spannung auf den \code{int16} Datentyp abzubilden:
|
||||
\[ y = x \cdot 2^{16}/20\] mit $x$ der gemessenen Spannung und $y$
|
||||
dem digitalisierten Wert bei einem Spannungsbereich von
|
||||
$\pm10$\,V.\\
|
||||
Durch Umgekehrung kann der digitalisierte Wert wieder
|
||||
$\pm10$\,V. Das ergibt ganzzahlige Werte zwischen $-2^{15}=-32768$
|
||||
und $2^{15}-1 = 32767$.
|
||||
|
||||
Durch Umkehrung kann der digitalisierte Wert wieder
|
||||
in eine Spannung zur\"uckgewandelt werden:
|
||||
\[ x = y \cdot 20/2^{16} \]
|
||||
\end{minipage}\vspace{0.25cm}
|
||||
@ -174,8 +176,8 @@ den Datentypen auseinanderzusetzen (Box \ref{daqbox}).
|
||||
Um Speicherplatz zu sparen ist es sinnvoll, die gemessenen Daten als
|
||||
``int16'' anstelle der ``double'' Werte im Rechner abzulegen. Die
|
||||
Daten als ``echte'' Spannungen, also als Flie{\ss}kommawerte,
|
||||
abzulegen ben\"otigt den 4-fachen Speicherplatz und bietet keine
|
||||
zus\"atzliche Information.
|
||||
abzulegen ben\"otigt den 4-fachen Speicherplatz (8 statt 2 Bytes)
|
||||
und bietet keine zus\"atzliche Information.
|
||||
|
||||
\end{ibox}
|
||||
|
||||
@ -1316,7 +1318,7 @@ gemacht den Rahmen zu bilden und den Ablauf zu koordinieren (Abbildung
|
||||
nimmt R\"uckgabewerte entgegen.}\label{programlayoutfig}
|
||||
\end{figure}
|
||||
|
||||
|
||||
|
||||
\begin{ibox}[tp]{Python}
|
||||
The cooler programming language.
|
||||
\end{ibox}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from IPython import embed
|
||||
from matplotlib.transforms import Bbox
|
||||
|
||||
def create_data():
|
||||
m = 0.75
|
||||
n= -30
|
||||
x = np.arange(0.,101., 2.5)
|
||||
n= -40
|
||||
x = np.arange(5.,115., 2.5)
|
||||
y = m * x + n;
|
||||
noise = np.random.randn(len(x))*15
|
||||
y += noise
|
||||
@ -13,79 +13,85 @@ def create_data():
|
||||
|
||||
|
||||
def plot_data(x, y):
|
||||
plt.xkcd()
|
||||
plt.scatter(x, y, marker='o', color='dodgerblue', s=40)
|
||||
plt.xlabel("Input x")
|
||||
plt.ylabel("Output y")
|
||||
plt.xlim([-2.5, 102.5])
|
||||
ax = plt.gca()
|
||||
ax.spines["right"].set_visible(False)
|
||||
ax.spines["top"].set_visible(False)
|
||||
ax.yaxis.set_ticks_position('left')
|
||||
ax.xaxis.set_ticks_position('bottom')
|
||||
ax.xaxis.linewidth=1.5
|
||||
ax.yaxis.linewidth=1.5
|
||||
ax.tick_params(direction="out", width=1.25)
|
||||
ax.tick_params(direction="out", width=1.25)
|
||||
ax.set_xlabel('Input x')
|
||||
ax.set_ylabel('Output y')
|
||||
ax.set_xlim(0, 120)
|
||||
ax.set_ylim(-80, 80)
|
||||
ax.set_xticks(np.arange(0,121, 40))
|
||||
ax.set_yticks(np.arange(-80,81, 40))
|
||||
fig = plt.gcf()
|
||||
fig.set_facecolor("white")
|
||||
fig.set_size_inches(3., 3.)
|
||||
fig.savefig("figures/lin_regress.pdf")
|
||||
plt.tight_layout()
|
||||
fig.savefig("lin_regress.pdf")
|
||||
plt.close()
|
||||
|
||||
|
||||
def plot_data_slopes(x, y, m, n):
|
||||
plt.xkcd()
|
||||
plt.scatter(x, y, marker='o', color='dodgerblue', s=40)
|
||||
for i in np.linspace(m/4, m*1.5, 5):
|
||||
plt.plot(x, i*x+n, color="r", lw=2)
|
||||
|
||||
plt.xlabel("Input x")
|
||||
plt.ylabel("Output y")
|
||||
plt.xlim([-2.5, 102.5])
|
||||
ax = plt.gca()
|
||||
ax.spines["right"].set_visible(False)
|
||||
ax.spines["top"].set_visible(False)
|
||||
ax.yaxis.set_ticks_position('left')
|
||||
ax.xaxis.set_ticks_position('bottom')
|
||||
ax.xaxis.linewidth=1.5
|
||||
ax.yaxis.linewidth=1.5
|
||||
ax.tick_params(direction="out", width=1.25)
|
||||
ax.tick_params(direction="out", width=1.25)
|
||||
ax.set_xlabel('Input x')
|
||||
ax.set_ylabel('Output y')
|
||||
ax.set_xlim(0, 120)
|
||||
ax.set_ylim(-80, 80)
|
||||
ax.set_xticks(np.arange(0,121, 40))
|
||||
ax.set_yticks(np.arange(-80,81, 40))
|
||||
fig = plt.gcf()
|
||||
fig.set_facecolor("white")
|
||||
fig.set_size_inches(3., 3.)
|
||||
fig.savefig("figures/lin_regress_slope.pdf")
|
||||
plt.tight_layout()
|
||||
fig.savefig("lin_regress_slope.pdf")
|
||||
plt.close()
|
||||
|
||||
|
||||
def plot_data_intercepts(x, y, m, n):
|
||||
plt.xkcd()
|
||||
plt.scatter(x, y, marker='o', color='dodgerblue', s=40)
|
||||
for i in np.linspace(n-n/2, n+n/2, 5):
|
||||
plt.plot(x, m * x + i, color="r", lw=2)
|
||||
|
||||
plt.xlabel("Input x")
|
||||
plt.ylabel("Output y")
|
||||
plt.xlim([-2.5, 102.5])
|
||||
ax = plt.gca()
|
||||
ax.spines["right"].set_visible(False)
|
||||
ax.spines["top"].set_visible(False)
|
||||
ax.yaxis.set_ticks_position('left')
|
||||
ax.xaxis.set_ticks_position('bottom')
|
||||
ax.xaxis.linewidth=1.5
|
||||
ax.yaxis.linewidth=1.5
|
||||
ax.tick_params(direction="out", width=1.25)
|
||||
ax.tick_params(direction="out", width=1.25)
|
||||
ax.set_xlabel('Input x')
|
||||
ax.set_ylabel('Output y')
|
||||
ax.set_xlim(0, 120)
|
||||
ax.set_ylim(-80, 80)
|
||||
ax.set_xticks(np.arange(0,121, 40))
|
||||
ax.set_yticks(np.arange(-80,81, 40))
|
||||
fig = plt.gcf()
|
||||
fig.set_facecolor("white")
|
||||
fig.set_size_inches(3., 3.)
|
||||
fig.savefig("figures/lin_regress_intercept.pdf")
|
||||
plt.tight_layout()
|
||||
fig.savefig("lin_regress_intercept.pdf")
|
||||
plt.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
x, y, m, n = create_data()
|
||||
plt.xkcd()
|
||||
plot_data(x,y)
|
||||
plot_data_slopes(x,y,m,n)
|
||||
plot_data_intercepts(x,y,m,n)
|
||||
|
@ -10,9 +10,9 @@ ein Optimierungsproblem, der besser als Kurvenfit bekannt ist
|
||||
(\enterm{curve fitting}).
|
||||
|
||||
\begin{figure}[tp]
|
||||
\includegraphics[width=0.32\columnwidth]{lin_regress}\hfill
|
||||
\includegraphics[width=0.32\columnwidth]{lin_regress_slope}\hfill
|
||||
\includegraphics[width=0.32\columnwidth]{lin_regress_intercept}
|
||||
\includegraphics[width=0.33\columnwidth]{lin_regress}\hfill
|
||||
\includegraphics[width=0.33\columnwidth]{lin_regress_slope}\hfill
|
||||
\includegraphics[width=0.33\columnwidth]{lin_regress_intercept}
|
||||
\titlecaption{.}{F\"ur eine Reihe von Eingangswerten $x$,
|
||||
z.B. Stimulusintensit\"aten, wurden die Antworten $y$ eines
|
||||
Systems gemessen (links). Der postulierte lineare Zusammenhang hat
|
||||
|
Reference in New Issue
Block a user