diff --git a/GL/scripts/out/figlist.txt b/GL/scripts/out/figlist.txt index 75cd91e..9e1f941 100644 --- a/GL/scripts/out/figlist.txt +++ b/GL/scripts/out/figlist.txt @@ -22,4 +22,40 @@ \caption{} \label{fig:vortrag-stabdiag} \end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/kaustik/peakfit.pgf} + \caption{} + \label{fig:kaustik-peakfit} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/kaustik/peakfit.pgf} + \caption{} + \label{fig:kaustik-peakfit} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/kaustik/peakfit.pgf} + \caption{} + \label{fig:kaustik-peakfit} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/kaustik/peakfit.pgf} + \caption{} + \label{fig:kaustik-peakfit} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/kaustik/peakfit.pgf} + \caption{} + \label{fig:kaustik-peakfit} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/kaustik/kaust_red.pgf} + \caption{} + \label{fig:kaustik-kaust_red} +\end{figure} \ No newline at end of file diff --git a/GL/scripts/util.py b/GL/scripts/util.py index 7aa323d..6d9dcbf 100644 --- a/GL/scripts/util.py +++ b/GL/scripts/util.py @@ -3,6 +3,14 @@ import matplotlib import numpy as np import matplotlib.ticker as ticker import os +from SecondaryValue import SecondaryValue +from scipy.optimize import curve_fit +from mpl_toolkits.mplot3d import Axes3D +from matplotlib import cm +import scipy.ndimage as ndimage +from scipy.ndimage.measurements import label +from scipy.ndimage.filters import maximum_filter +from scipy.ndimage.morphology import generate_binary_structure, binary_erosion matplotlib.rcParams.update({ 'font.family': 'serif', 'text.usetex': False, @@ -49,3 +57,95 @@ def save_fig(fig, title, folder='unsorted', size=(5, 4)): \label{fig:''' + folder + '-' + title + '''} \end{figure} ''') + + +def coordinates_to_position(x, y=None, reco_raster=3.375, absolute=False): + pos = x*reco_raster + if not absolute: + pos += reco_raster/2 + + return (pos, coordinates_to_position(y, reco_raster=reco_raster, + absolute=absolute)) \ + if y is not None else pos + +def coordinates_error_to_position_error(x, y=None, reco_raster=3.375): + err = x*reco_raster + return (err, coordinates_error_to_position_error(y, reco_raster=reco_raster)) \ + if y is not None else err + +def plot_reconstruction(reconstruction, fig=None, subplot=111, title=None, + azim=-45, elev=50, save=None, **pyplot_args): + fig = fig if fig else plt.figure() + ax = fig.add_subplot(subplot, projection='3d') + + ax.view_init(azim=azim, elev=elev) + ax.set_xlabel('x') + ax.set_ylabel('y') + + if title: + ax.set_title(title) + + x, y = np.arange(0, reconstruction.shape[0]),np.arange(0, reconstruction.shape[1]) + x, y = np.meshgrid(x, y) + + ax.plot_surface(x, y, reconstruction, cmap=cm.plasma, + shade=True, **pyplot_args) + fig.tight_layout() + + if save: + save_fig(fig, *save) + return fig, ax + +def gauss2d(xy, A, mx, my, sigma): + x, y = xy + return np.ravel(A*np.exp(-((x-mx)**2 + (y-my)**2)/(2*sigma**2))) + +def normalize(array): + tmp = array.copy() + tmp = tmp - tmp.min() + return tmp/tmp.max() + + +def find_peak_positions(reconstruction, threshold=.1, save=None): + rec = reconstruction.copy() + + # normalize + rec_normalized = normalize(rec) + + # create grid with real coordinates + x, y = np.arange(0, rec.shape[0]), np.arange(0, rec.shape[1]) + x, y = np.meshgrid(x, y) + + # foodprint + neighborhood = generate_binary_structure(2,4) + local_max = maximum_filter(rec_normalized, footprint=neighborhood) > threshold + + # extract peaks + features, num_labels = label(local_max) + sliced = ndimage.find_objects(features) + + peaks = [] + + plotdim = 200 + num_labels*10 + fig = plt.figure() + + for i in range(1, num_labels + 1): + slc = sliced[i-1] + + # mask input to only show one peak + masked = rec*(features == i) + # guess the peak position + guess = [1, (slc[1].start + slc[1].stop)/2, (slc[0].start + slc[0].stop)/2, 1] + + # fit gauss + opt, cov = curve_fit(gauss2d, (x, y), np.ravel(masked), p0=guess) + cov = np.sqrt(np.diag(cov)) + plot_reconstruction(gauss2d((x, y), *opt).reshape(*rec.shape), + fig=fig, subplot=plotdim + i, elev=30, title=f"Fit Peak {i}") + plot_reconstruction(masked, fig=fig, subplot=plotdim + num_labels + i, elev=30, title=f"Peak {i}") + + peaks += [cov] + + if save: + save_fig(fig, save[0], save[1], size=(2,4)) + return peaks diff --git a/Lab_Report_LaTeX b/Lab_Report_LaTeX index 6f7da86..bc42f5f 160000 --- a/Lab_Report_LaTeX +++ b/Lab_Report_LaTeX @@ -1 +1 @@ -Subproject commit 6f7da8668c507f74760217c2e4c5f944f0d10b0d +Subproject commit bc42f5fa1d5bdeddbe983f0fd653a5e0843c0f8f diff --git a/PET/auswertung/out/figlist.txt b/PET/auswertung/out/figlist.txt index aafea05..46d4cea 100644 --- a/PET/auswertung/out/figlist.txt +++ b/PET/auswertung/out/figlist.txt @@ -1810,4 +1810,232 @@ \caption{} \label{fig:tom2-3dplot} \end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/source.pgf} + \caption{} + \label{fig:theory-source} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/projection.pgf} + \caption{} + \label{fig:theory-projection} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/convoluted.pgf} + \caption{} + \label{fig:theory-convoluted} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_simple.pgf} + \caption{} + \label{fig:theory-rec_simple} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_filtered.pgf} + \caption{} + \label{fig:theory-rec_filtered} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/source.pgf} + \caption{} + \label{fig:theory-source} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/projection.pgf} + \caption{} + \label{fig:theory-projection} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/convoluted.pgf} + \caption{} + \label{fig:theory-convoluted} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_simple.pgf} + \caption{} + \label{fig:theory-rec_simple} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_filtered.pgf} + \caption{} + \label{fig:theory-rec_filtered} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_simple.pgf} + \caption{} + \label{fig:theory-rec_simple} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_filtered.pgf} + \caption{} + \label{fig:theory-rec_filtered} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/source.pgf} + \caption{} + \label{fig:theory-source} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/projection.pgf} + \caption{} + \label{fig:theory-projection} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/convoluted.pgf} + \caption{} + \label{fig:theory-convoluted} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_simple.pgf} + \caption{} + \label{fig:theory-rec_simple} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_simple.pgf} + \caption{} + \label{fig:theory-rec_simple} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/source.pgf} + \caption{} + \label{fig:theory-source} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/projection.pgf} + \caption{} + \label{fig:theory-projection} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/convoluted.pgf} + \caption{} + \label{fig:theory-convoluted} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_simple.pgf} + \caption{} + \label{fig:theory-rec_simple} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_filtered.pgf} + \caption{} + \label{fig:theory-rec_filtered} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_filtered.pgf} + \caption{} + \label{fig:theory-rec_filtered} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/source.pgf} + \caption{} + \label{fig:theory-source} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/projection.pgf} + \caption{} + \label{fig:theory-projection} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/convoluted.pgf} + \caption{} + \label{fig:theory-convoluted} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_simple.pgf} + \caption{} + \label{fig:theory-rec_simple} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_filtered.pgf} + \caption{} + \label{fig:theory-rec_filtered} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/convoluted.pgf} + \caption{} + \label{fig:theory-convoluted} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/convoluted.pgf} + \caption{} + \label{fig:theory-convoluted} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/convoluted.pgf} + \caption{} + \label{fig:theory-convoluted} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_simple.pgf} + \caption{} + \label{fig:theory-rec_simple} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_filtered.pgf} + \caption{} + \label{fig:theory-rec_filtered} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/source.pgf} + \caption{} + \label{fig:theory-source} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/projection.pgf} + \caption{} + \label{fig:theory-projection} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/convoluted.pgf} + \caption{} + \label{fig:theory-convoluted} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_simple.pgf} + \caption{} + \label{fig:theory-rec_simple} +\end{figure} + +\begin{figure}[H]\centering + \input{../auswertung/figs/theory/rec_filtered.pgf} + \caption{} + \label{fig:theory-rec_filtered} +\end{figure} \ No newline at end of file diff --git a/Vortrag/Valenin/slides/figs/kaust_red.pdf b/Vortrag/Valenin/slides/figs/kaust_red.pdf new file mode 100644 index 0000000..0510c81 Binary files /dev/null and b/Vortrag/Valenin/slides/figs/kaust_red.pdf differ diff --git a/Vortrag/Valenin/slides/figs/kaustik.avi b/Vortrag/Valenin/slides/figs/kaustik.avi new file mode 100644 index 0000000..fc6d4df Binary files /dev/null and b/Vortrag/Valenin/slides/figs/kaustik.avi differ diff --git a/Vortrag/Valenin/slides/figs/kaustik.png b/Vortrag/Valenin/slides/figs/kaustik.png new file mode 100644 index 0000000..1c51f64 Binary files /dev/null and b/Vortrag/Valenin/slides/figs/kaustik.png differ diff --git a/Vortrag/Valenin/slides/figs/peakfit.pdf b/Vortrag/Valenin/slides/figs/peakfit.pdf new file mode 100644 index 0000000..f64ead8 Binary files /dev/null and b/Vortrag/Valenin/slides/figs/peakfit.pdf differ diff --git a/Vortrag/Valenin/slides/figs/propaganda.png b/Vortrag/Valenin/slides/figs/propaganda.png new file mode 100644 index 0000000..034b51a Binary files /dev/null and b/Vortrag/Valenin/slides/figs/propaganda.png differ