diff --git a/plotting/lecture/Makefile b/plotting/lecture/Makefile new file mode 100644 index 0000000..9c5c90f --- /dev/null +++ b/plotting/lecture/Makefile @@ -0,0 +1,70 @@ +BASENAME=plotting + +PYFILES=$(wildcard *.py) +PYPDFFILES=$(PYFILES:.py=.pdf) + +GPTFILES=$(wildcard *.gpt) +GPTTEXFILES=$(GPTFILES:.gpt=.tex) + + +all: pdf slides thumbs + +# script: +pdf : $(BASENAME)-chapter.pdf +$(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(GPTTEXFILES) $(PYPDFFILES) + pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true + + +# slides: +slides: $(BASENAME)-slides.pdf +$(BASENAME)-slides.pdf : $(BASENAME)-slides.tex $(GPTTEXFILES) $(PYPDFFILES) + pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true + +# thumbnails: +thumbs: $(BASENAME)-handout.pdf +$(BASENAME)-handout.pdf: $(BASENAME)-slides.tex $(GPTTEXFILES) + sed -e 's/setboolean{presentation}{true}/setboolean{presentation}{false}/; s/usepackage{crop}/usepackage[frame]{crop}/' $< > thumbsfoils.tex + pdflatex thumbsfoils | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex thumbsfoils || true + pdfnup --nup 2x4 --no-landscape --paper a4paper --trim "-1cm -1cm -1cm -1cm" --outfile $@ thumbsfoils.pdf # 1-19 + rm thumbsfoils.* + +watchpdf : + while true; do ! make -q pdf && make pdf; sleep 0.5; done + +watchslides : + while true; do ! make -q slides && make slides; sleep 0.5; done + +# python plots: +$(PYPDFFILES) : %.pdf: %.py + python $< + +# gnuplot plots: +$(GPTTEXFILES) : %.tex: %.gpt whitestyles.gp + gnuplot whitestyles.gp $< + epstopdf $*.eps + + +clean : + rm -f *~ + rm -f $(BASENAME).aux $(BASENAME).log + rm -f $(BASENAME)-chapter.aux $(BASENAME)-chapter.log $(BASENAME)-chapter.out + rm -f $(BASENAME)-slides.aux $(BASENAME)-slides.log $(BASENAME)-slides.out $(BASENAME)-slides.toc $(BASENAME)-slides.nav $(BASENAME)-slides.snm $(BASENAME)-slides.vrb + rm -f $(PYPDFFILES) $(GPTTEXFILES) + +cleanall : clean + rm -f $(BASENAME)-chapter.pdf $(BASENAME)-slides.pdf $(BASENAME)-handout.pdf + + +help : + @echo -e \ + "make pdf: make the pdf file of the script.\n"\ + "make slides: make the pdf file of the slides.\n"\ + "make thumbs: make color thumbnails of the talk.\n"\ + "make watchpdf: make the pdf file of the script\n"\ + " whenever the tex file is modified.\n"\ + "make watchpdf: make the pdf file of the slides\n"\ + " whenever the tex file is modified.\n"\ + "make clean: remove all intermediate files,\n"\ + " just leave the source files and the final .pdf files.\n"\ + "make cleanup: remove all intermediate files as well as\n"\ + " the final .pdf files.\n"\ diff --git a/plotting/lecture/beamercolorthemetuebingen.sty b/plotting/lecture/beamercolorthemetuebingen.sty new file mode 100644 index 0000000..c4a5da6 --- /dev/null +++ b/plotting/lecture/beamercolorthemetuebingen.sty @@ -0,0 +1,61 @@ +% Copyright 2007 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/licenses/LICENSE for more details. + +\usepackage{color} +\definecolor{karminrot}{RGB}{165,30,55} +\definecolor{gold}{RGB}{180,160,105} +\definecolor{anthrazit}{RGB}{50 ,65 ,75 } + +\mode + +\setbeamercolor*{normal text}{fg=anthrazit,bg=white} +\setbeamercolor*{alerted text}{fg=anthrazit} +\setbeamercolor*{example text}{fg=anthrazit} +\setbeamercolor*{structure}{fg=gold,bg=karminrot} + +\providecommand*{\beamer@bftext@only}{% + \relax + \ifmmode + \expandafter\beamer@bftext@warning + \else + \expandafter\bfseries + \fi +} +\providecommand*{\beamer@bftext@warning}{% + \ClassWarning{beamer} + {Cannot use bold for alerted text in math mode}% +} + +\setbeamerfont{alerted text}{series=\beamer@bftext@only} + +\setbeamercolor{palette primary}{fg=karminrot,bg=white} +\setbeamercolor{palette secondary}{fg=gold,bg=white} +\setbeamercolor{palette tertiary}{fg=anthrazit,bg=white} +\setbeamercolor{palette quaternary}{fg=black,bg=white} + +\setbeamercolor{sidebar}{bg=karminrot!100} + +\setbeamercolor{palette sidebar primary}{fg=karminrot} +\setbeamercolor{palette sidebar secondary}{fg=karminrot} +\setbeamercolor{palette sidebar tertiary}{fg=karminrot} +\setbeamercolor{palette sidebar quaternary}{fg=karminrot} + +\setbeamercolor{item projected}{fg=black,bg=black!20} + +\setbeamercolor*{block body}{} +\setbeamercolor*{block body alerted}{} +\setbeamercolor*{block body example}{} +\setbeamercolor*{block title}{parent=structure} +\setbeamercolor*{block title alerted}{parent=alerted text} +\setbeamercolor*{block title example}{parent=example text} + +\setbeamercolor*{titlelike}{parent=structure} + +\mode + diff --git a/programming/lectures/images/badbarleft.png b/plotting/lecture/images/badbarleft.png similarity index 100% rename from programming/lectures/images/badbarleft.png rename to plotting/lecture/images/badbarleft.png diff --git a/programming/lectures/images/badbarplot.jpg b/plotting/lecture/images/badbarplot.jpg similarity index 100% rename from programming/lectures/images/badbarplot.jpg rename to plotting/lecture/images/badbarplot.jpg diff --git a/programming/lectures/images/badbarright.png b/plotting/lecture/images/badbarright.png similarity index 100% rename from programming/lectures/images/badbarright.png rename to plotting/lecture/images/badbarright.png diff --git a/programming/lectures/images/comparison_properly_improperly_graph.png b/plotting/lecture/images/comparison_properly_improperly_graph.png similarity index 100% rename from programming/lectures/images/comparison_properly_improperly_graph.png rename to plotting/lecture/images/comparison_properly_improperly_graph.png diff --git a/programming/lectures/images/convincing.png b/plotting/lecture/images/convincing.png similarity index 100% rename from programming/lectures/images/convincing.png rename to plotting/lecture/images/convincing.png diff --git a/programming/lectures/images/improperly_scaled_graph.png b/plotting/lecture/images/improperly_scaled_graph.png similarity index 100% rename from programming/lectures/images/improperly_scaled_graph.png rename to plotting/lecture/images/improperly_scaled_graph.png diff --git a/programming/lectures/images/line_graph1.png b/plotting/lecture/images/line_graph1.png similarity index 100% rename from programming/lectures/images/line_graph1.png rename to plotting/lecture/images/line_graph1.png diff --git a/programming/lectures/images/line_graph1_3.png b/plotting/lecture/images/line_graph1_3.png similarity index 100% rename from programming/lectures/images/line_graph1_3.png rename to plotting/lecture/images/line_graph1_3.png diff --git a/programming/lectures/images/line_graph1_4.png b/plotting/lecture/images/line_graph1_4.png similarity index 100% rename from programming/lectures/images/line_graph1_4.png rename to plotting/lecture/images/line_graph1_4.png diff --git a/programming/lectures/images/misleading_pie.png b/plotting/lecture/images/misleading_pie.png similarity index 100% rename from programming/lectures/images/misleading_pie.png rename to plotting/lecture/images/misleading_pie.png diff --git a/programming/lectures/images/nobelbad.png b/plotting/lecture/images/nobelbad.png similarity index 100% rename from programming/lectures/images/nobelbad.png rename to plotting/lecture/images/nobelbad.png diff --git a/programming/lectures/images/one_d_problem_c.pdf b/plotting/lecture/images/one_d_problem_c.pdf similarity index 100% rename from programming/lectures/images/one_d_problem_c.pdf rename to plotting/lecture/images/one_d_problem_c.pdf diff --git a/programming/lectures/images/properly_scaled_graph.png b/plotting/lecture/images/properly_scaled_graph.png similarity index 100% rename from programming/lectures/images/properly_scaled_graph.png rename to plotting/lecture/images/properly_scaled_graph.png diff --git a/programming/lectures/images/sample_pie.png b/plotting/lecture/images/sample_pie.png similarity index 100% rename from programming/lectures/images/sample_pie.png rename to plotting/lecture/images/sample_pie.png diff --git a/programming/lectures/images/spike_detection.pdf b/plotting/lecture/images/spike_detection.pdf similarity index 100% rename from programming/lectures/images/spike_detection.pdf rename to plotting/lecture/images/spike_detection.pdf diff --git a/plotting/lecture/plotting-chapter.tex b/plotting/lecture/plotting-chapter.tex new file mode 100644 index 0000000..323d374 --- /dev/null +++ b/plotting/lecture/plotting-chapter.tex @@ -0,0 +1,17 @@ +\documentclass[12pt]{report} + +\input{../../header} + +\lstset{inputpath=../code} + +\graphicspath{{images/}} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +\include{psth_sta} + +\end{document} + diff --git a/programming/lectures/plotting-slides.tex b/plotting/lecture/plotting-slides.tex similarity index 100% rename from programming/lectures/plotting-slides.tex rename to plotting/lecture/plotting-slides.tex diff --git a/plotting/lecture/plotting.tex b/plotting/lecture/plotting.tex new file mode 100644 index 0000000..81c6bf5 --- /dev/null +++ b/plotting/lecture/plotting.tex @@ -0,0 +1,11 @@ +\chapter{\tr{Data plotting}{Graphische Darstellung von Daten}} + +\section{Graphische Darstellung von Daten} + + + +\begin{figure} + \includegraphics[width=0.9\columnwidth]{convincing} + \caption{Die Folgen schlecht annotierter + Plots. \url{www.xkcd.com}} \label{xkcdplotting} +\end{figure} \ No newline at end of file diff --git a/programming/code/simplerandomwalk.m b/programming/code/simplerandomwalk.m new file mode 100644 index 0000000..865693f --- /dev/null +++ b/programming/code/simplerandomwalk.m @@ -0,0 +1,26 @@ +num_runs = 10; +max_steps = 1000; + +positions = zeros(max_steps, num_runs); + +for run = 1:num_runs + for step = 2:max_steps + x = randn(1); + if x < 0 + positions(step, run) = positions(step-1, run) + 1; + elseif x > 0 + positions(step, run) = positions(step-1, run) - 1; + end + end +end + +figure() +hold on +for run = 1:num_runs + plot(1:max_steps, positions(:, run)) +end +xlabel('Number of steps') +ylabel('Position') +box off + + diff --git a/programming/lectures/images/logicalIndexing_time.png b/programming/lectures/images/logicalIndexing_time.png deleted file mode 100644 index d709140..0000000 Binary files a/programming/lectures/images/logicalIndexing_time.png and /dev/null differ diff --git a/programming/lectures/logicalIndexingTime.py b/programming/lectures/logicalIndexingTime.py new file mode 100644 index 0000000..ef553de --- /dev/null +++ b/programming/lectures/logicalIndexingTime.py @@ -0,0 +1,29 @@ +import matplotlib.pyplot as plt +import numpy as np +from IPython import embed +time = np.arange(0.,10., 0.001) +x = np.random.randn(len(time)) +selection = x[(time > 5.) & (time < 6.)] + +fig = plt.figure() +fig.set_facecolor("white") +fig.set_size_inches(5.5, 2.5) + +ax = fig.add_subplot(111) +ax.plot(time, x, label="data", lw=.5) +ax.plot(time[(time > 5.) & (time < 6.)], selection, color='r', lw=0.5, label="selection") +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("time [s]") +ax.set_ylabel("intensity") +ax.legend(fontsize=8) +fig.tight_layout() +fig.savefig("images/logicalIndexingTime.pdf") + +