diff --git a/bootstrap/lecture/Makefile b/bootstrap/lecture/Makefile index f7f02ba..de4182d 100644 --- a/bootstrap/lecture/Makefile +++ b/bootstrap/lecture/Makefile @@ -1,22 +1,29 @@ BASENAME=bootstrap + PYFILES=$(wildcard *.py) PYPDFFILES=$(PYFILES:.py=.pdf) -pdf : $(BASENAME)-chapter.pdf $(PYPDFFILES) +all : pdf + +# script: +pdf : $(BASENAME)-chapter.pdf -$(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex +$(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(PYPDFFILES) pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true $(PYPDFFILES) : %.pdf : %.py python $< clean : - rm -f *~ $(BASENAME)-chapter.aux $(BASENAME)-chapter.log $(BASENAME)-chapter.out $(BASENAME).aux $(BASENAME).log + rm -f *~ + rm -f $(BASENAME).aux $(BASENAME).log + rm -f $(BASENAME)-chapter.aux $(BASENAME)-chapter.log $(BASENAME)-chapter.out + rm -f $(PYPDFFILES) $(GPTTEXFILES) cleanall : clean rm -f $(BASENAME)-chapter.pdf -watch : +watchpdf : while true; do ! make -q pdf && make pdf; sleep 0.5; done diff --git a/likelihood/lecture/Makefile b/likelihood/lecture/Makefile index 4e6367b..42b8e3d 100644 --- a/likelihood/lecture/Makefile +++ b/likelihood/lecture/Makefile @@ -1,22 +1,29 @@ BASENAME=likelihood + PYFILES=$(wildcard *.py) PYPDFFILES=$(PYFILES:.py=.pdf) -pdf : $(BASENAME)-chapter.pdf $(PYPDFFILES) +all : pdf + +# script: +pdf : $(BASENAME)-chapter.pdf -$(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex +$(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(PYPDFFILES) pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true $(PYPDFFILES) : %.pdf : %.py python $< clean : - rm -f *~ $(BASENAME)-chapter.aux $(BASENAME)-chapter.log $(BASENAME)-chapter.out $(BASENAME).aux $(BASENAME).log + rm -f *~ + rm -f $(BASENAME).aux $(BASENAME).log + rm -f $(BASENAME)-chapter.aux $(BASENAME)-chapter.log $(BASENAME)-chapter.out + rm -f $(PYPDFFILES) $(GPTTEXFILES) cleanall : clean rm -f $(BASENAME)-chapter.pdf -watch : +watchpdf : while true; do ! make -q pdf && make pdf; sleep 0.5; done diff --git a/pointprocesses/exercises/Makefile b/pointprocesses/exercises/Makefile new file mode 100644 index 0000000..0b63fb9 --- /dev/null +++ b/pointprocesses/exercises/Makefile @@ -0,0 +1,35 @@ +BASENAME=pointprocesses +TEXFILES=$(wildcard $(BASENAME)??.tex) +EXERCISES=$(TEXFILES:.tex=.pdf) +SOLUTIONS=$(EXERCISES:pointprocesses%=pointprocesses-solutions%) + +.PHONY: pdf exercises solutions watch watchexercises watchsolutions clean + +pdf : $(SOLUTIONS) $(EXERCISES) + +exercises : $(EXERCISES) + +solutions : $(SOLUTIONS) + +$(SOLUTIONS) : pointprocesses-solutions%.pdf : pointprocesses%.tex instructions.tex + { echo "\\documentclass[answers,12pt,a4paper,pdftex]{exam}"; sed -e '1d' $<; } > $(patsubst %.pdf,%.tex,$@) + pdflatex -interaction=scrollmode $(patsubst %.pdf,%.tex,$@) | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $(patsubst %.pdf,%.tex,$@) || true + rm $(patsubst %.pdf,%,$@).[!p]* + +$(EXERCISES) : %.pdf : %.tex instructions.tex + pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true + +watch : + while true; do ! make -q pdf && make pdf; sleep 0.5; done + +watchexercises : + while true; do ! make -q exercises && make exercises; sleep 0.5; done + +watchsolutions : + while true; do ! make -q solutions && make solutions; sleep 0.5; done + +clean : + rm -f *~ *.aux *.log *.out + +cleanup : clean + rm -f $(SOLUTIONS) $(EXERCISES) diff --git a/pointprocesses/exercises/instructions.tex b/pointprocesses/exercises/instructions.tex new file mode 100644 index 0000000..96ac4bc --- /dev/null +++ b/pointprocesses/exercises/instructions.tex @@ -0,0 +1,11 @@ +\vspace*{-6.5ex} +\begin{center} +\textbf{\Large Einf\"uhrung in die wissenschaftliche Datenverarbeitung}\\[1ex] +{\large Jan Grewe, Jan Benda}\\[-3ex] +Abteilung Neuroethologie \hfill --- \hfill Institut f\"ur Neurobiologie \hfill --- \hfill \includegraphics[width=0.28\textwidth]{UT_WBMW_Black_RGB} \\ +\end{center} + +\ifprintanswers% +\else + +\fi diff --git a/pointprocesses/exercises/pointprocesses01.tex b/pointprocesses/exercises/pointprocesses01.tex new file mode 100644 index 0000000..b4d927c --- /dev/null +++ b/pointprocesses/exercises/pointprocesses01.tex @@ -0,0 +1,202 @@ +\documentclass[12pt,a4paper,pdftex]{exam} + +\usepackage[german]{babel} +\usepackage{pslatex} +\usepackage[mediumspace,mediumqspace,Gray]{SIunits} % \ohm, \micro +\usepackage{xcolor} +\usepackage{graphicx} +\usepackage[breaklinks=true,bookmarks=true,bookmarksopen=true,pdfpagemode=UseNone,pdfstartview=FitH,colorlinks=true,citecolor=blue]{hyperref} + +%%%%% layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry} +\pagestyle{headandfoot} +\ifprintanswers +\newcommand{\stitle}{: L\"osungen} +\else +\newcommand{\stitle}{} +\fi +\header{{\bfseries\large \"Ubung 6\stitle}}{{\bfseries\large Statistik}}{{\bfseries\large 27. Oktober, 2015}} +\firstpagefooter{Prof. Dr. Jan Benda}{Phone: 29 74573}{Email: +jan.benda@uni-tuebingen.de} +\runningfooter{}{\thepage}{} + +\setlength{\baselineskip}{15pt} +\setlength{\parindent}{0.0cm} +\setlength{\parskip}{0.3cm} +\renewcommand{\baselinestretch}{1.15} + +%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{listings} +\lstset{ + language=Matlab, + basicstyle=\ttfamily\footnotesize, + numbers=left, + numberstyle=\tiny, + title=\lstname, + showstringspaces=false, + commentstyle=\itshape\color{darkgray}, + breaklines=true, + breakautoindent=true, + columns=flexible, + frame=single, + xleftmargin=1em, + xrightmargin=1em, + aboveskip=10pt +} + +%%%%% math stuff: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{amsmath} +\usepackage{amssymb} +\usepackage{bm} +\usepackage{dsfont} +\newcommand{\naZ}{\mathds{N}} +\newcommand{\gaZ}{\mathds{Z}} +\newcommand{\raZ}{\mathds{Q}} +\newcommand{\reZ}{\mathds{R}} +\newcommand{\reZp}{\mathds{R^+}} +\newcommand{\reZpN}{\mathds{R^+_0}} +\newcommand{\koZ}{\mathds{C}} + +%%%%% page breaks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\continue}{\ifprintanswers% +\else +\vfill\hspace*{\fill}$\rightarrow$\newpage% +\fi} +\newcommand{\continuepage}{\ifprintanswers% +\newpage +\else +\vfill\hspace*{\fill}$\rightarrow$\newpage% +\fi} +\newcommand{\newsolutionpage}{\ifprintanswers% +\newpage% +\else +\fi} + +%%%%% new commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\qt}[1]{\textbf{#1}\\} +\newcommand{\pref}[1]{(\ref{#1})} +\newcommand{\extra}{--- Zusatzaufgabe ---\ \mbox{}} +\newcommand{\code}[1]{\texttt{#1}} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +\input{instructions} + + +\begin{questions} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\question \qt{Homogeneous Poisson process} +We use the Poisson process to generate spike trains on which we can test and imrpove some +standard analysis functions. + +A homogeneous Poisson process of rate $\lambda$ (measured in Hertz) is a point process +where the probability of an event is independent of time $t$ and independent of previous events. +The probability $P$ of an event within a bin of width $\Delta t$ is +\[ P = \lambda \cdot \Delta t \] +for sufficiently small $\Delta t$. +\begin{parts} + + \part Write a function that generates $n$ homogeneous Poisson spike trains of a given duration $T_{max}$ + with rate $\lambda$. + \begin{solution} + \lstinputlisting{hompoissonspikes.m} + \end{solution} + + \part Using this function, generate a few trials and display them in a raster plot. + \begin{solution} + \lstinputlisting{../code/spikeraster.m} + \begin{lstlisting} + spikes = hompoissonspikes( 10, 100.0, 0.5 ); + spikeraster( spikes ) + \end{lstlisting} + \mbox{}\\[-3ex] + \colorbox{white}{\includegraphics[width=0.7\textwidth]{poissonraster100hz}} + \end{solution} + + \part Write a function that extracts a single vector of interspike intervals + from the spike times returned by the first function. + \begin{solution} + \lstinputlisting{../code/isis.m} + \end{solution} + + \part Write a function that plots the interspike-interval histogram + from a vector of interspike intervals. The function should also + compute the mean, the standard deviation, and the CV of the intervals + and display the values in the plot. + \begin{solution} + \lstinputlisting{../code/isihist.m} + \end{solution} + + \part Compute histograms for Poisson spike trains with rate + $\lambda=100$\,Hz. Play around with $T_{max}$ and $n$ and the bin width + (start with 1\,ms) of the histogram. + How many + interspike intervals do you approximately need to get a ``nice'' + histogram? How long do you need to record from the neuron? + \begin{solution} + About 5000 intervals for 25 bins. This corresponds to a $5000 / 100\,\hertz = 50\,\second$ recording + of a neuron firing with 100\,\hertz. + \end{solution} + + \part Compare the histogram with the true distribution of intervals $T$ of the Poisson process + \[ p(T) = \lambda e^{-\lambda T} \] + for various rates $\lambda$. + \begin{solution} + \lstinputlisting{hompoissonisih.m} + \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissonisih100hz}} + \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissonisih20hz}} + \end{solution} + + \part What happens if you make the bin width of the histogram smaller than $\Delta t$ + used for generating the Poisson spikes? + \begin{solution} + The bins between the discretization have zero entries. Therefore + the other ones become higher than they should be. + \end{solution} + + \part Plot the mean interspike interval, the corresponding standard deviation, and the CV + as a function of the rate $\lambda$ of the Poisson process. + Compare the ../code with the theoretical expectations for the dependence on $\lambda$. + \begin{solution} + \lstinputlisting{hompoissonisistats.m} + \colorbox{white}{\includegraphics[width=0.98\textwidth]{poissonisistats}} + \end{solution} + + \part Write a function that computes serial correlations for the interspike intervals + for a range of lags. + The serial correlations $\rho_k$ at lag $k$ are defined as + \[ \rho_k = \frac{\langle (T_{i+k} - \langle T \rangle)(T_i - \langle T \rangle) \rangle}{\langle (T_i - \langle T \rangle)^2\rangle} = \frac{{\rm cov}(T_{i+k}, T_i)}{{\rm var}(T_i)} \] + Use this function to show that interspike intervals of Poisson spikes are independent. + \begin{solution} + \lstinputlisting{../code/isiserialcorr.m} + \colorbox{white}{\includegraphics[width=0.98\textwidth]{poissonserial100hz}} + \end{solution} + + \part Write a function that generates from spike times + a histogram of spike counts in a count window of given duration $W$. + The function should also plot the Poisson distribution + \[ P(k) = \frac{(\lambda W)^ke^{\lambda W}}{k!} \] + for the rate $\lambda$ determined from the spike trains. + \begin{solution} + \lstinputlisting{../code/counthist.m} + \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz10ms}} + \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz100ms}} + \end{solution} + + \part Write a function that computes mean count, variance of count and the corresponding Fano factor + for a range of count window durations. The function should generate tow plots: one plotting + the count variance against the mean, the other one the Fano factor as a function of the window duration. + \begin{solution} + \lstinputlisting{../code/fano.m} + \colorbox{white}{\includegraphics[width=0.98\textwidth]{poissonfano100hz}} + \end{solution} + +\end{parts} + +\end{questions} + +\end{document} \ No newline at end of file diff --git a/pointprocesses/exercises/poisson.pdf b/pointprocesses/exercises/poisson.pdf deleted file mode 100644 index aa1756e..0000000 Binary files a/pointprocesses/exercises/poisson.pdf and /dev/null differ diff --git a/pointprocesses/exercises/poisson.tex b/pointprocesses/exercises/poisson.tex deleted file mode 100644 index 4b8f0f0..0000000 --- a/pointprocesses/exercises/poisson.tex +++ /dev/null @@ -1,160 +0,0 @@ -\documentclass[addpoints,10pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} -\usepackage{graphicx} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule - -\firstpageheader{Scientific Computing}{Homogeneous Poisson process}{Oct 27, 2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -\shadedsolutions - -\usepackage[mediumspace,mediumqspace,Gray]{SIunits} % \ohm, \micro - -%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage{listings} -\lstset{ - basicstyle=\ttfamily, - numbers=left, - showstringspaces=false, - language=Matlab, - breaklines=true, - breakautoindent=true, - columns=flexible, - frame=single, - captionpos=t, - xleftmargin=2em, - xrightmargin=1em, - aboveskip=10pt, - %title=\lstname, - title={\protect\filename@parse{\lstname}\protect\filename@base.\protect\filename@ext} - } - - -\begin{document} - -\sffamily -%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% - -\begin{questions} - \question \textbf{Homogeneous Poisson process} - We use the Poisson process to generate spike trains on which we can test and imrpove some - standard analysis functions. - - A homogeneous Poisson process of rate $\lambda$ (measured in Hertz) is a point process - where the probability of an event is independent of time $t$ and independent of previous events. - The probability $P$ of an event within a bin of width $\Delta t$ is - \[ P = \lambda \cdot \Delta t \] - for sufficiently small $\Delta t$. - \begin{parts} - - \part Write a function that generates $n$ homogeneous Poisson spike trains of a given duration $T_{max}$ - with rate $\lambda$. - \begin{solution} - \lstinputlisting{hompoissonspikes.m} - \end{solution} - - \part Using this function, generate a few trials and display them in a raster plot. - \begin{solution} - \lstinputlisting{simulations/spikeraster.m} - \begin{lstlisting} -spikes = hompoissonspikes( 10, 100.0, 0.5 ); -spikeraster( spikes ) - \end{lstlisting} - \mbox{}\\[-3ex] - \colorbox{white}{\includegraphics[width=0.7\textwidth]{poissonraster100hz}} - \end{solution} - - \part Write a function that extracts a single vector of interspike intervals - from the spike times returned by the first function. - \begin{solution} - \lstinputlisting{simulations/isis.m} - \end{solution} - - \part Write a function that plots the interspike-interval histogram - from a vector of interspike intervals. The function should also - compute the mean, the standard deviation, and the CV of the intervals - and display the values in the plot. - \begin{solution} - \lstinputlisting{simulations/isihist.m} - \end{solution} - - \part Compute histograms for Poisson spike trains with rate - $\lambda=100$\,Hz. Play around with $T_{max}$ and $n$ and the bin width - (start with 1\,ms) of the histogram. - How many - interspike intervals do you approximately need to get a ``nice'' - histogram? How long do you need to record from the neuron? - \begin{solution} - About 5000 intervals for 25 bins. This corresponds to a $5000 / 100\,\hertz = 50\,\second$ recording - of a neuron firing with 100\,\hertz. - \end{solution} - - \part Compare the histogram with the true distribution of intervals $T$ of the Poisson process - \[ p(T) = \lambda e^{-\lambda T} \] - for various rates $\lambda$. - \begin{solution} - \lstinputlisting{hompoissonisih.m} - \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissonisih100hz}} - \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissonisih20hz}} - \end{solution} - - \part What happens if you make the bin width of the histogram smaller than $\Delta t$ - used for generating the Poisson spikes? - \begin{solution} - The bins between the discretization have zero entries. Therefore - the other ones become higher than they should be. - \end{solution} - - \part Plot the mean interspike interval, the corresponding standard deviation, and the CV - as a function of the rate $\lambda$ of the Poisson process. - Compare the simulations with the theoretical expectations for the dependence on $\lambda$. - \begin{solution} - \lstinputlisting{hompoissonisistats.m} - \colorbox{white}{\includegraphics[width=0.98\textwidth]{poissonisistats}} - \end{solution} - - \part Write a function that computes serial correlations for the interspike intervals - for a range of lags. - The serial correlations $\rho_k$ at lag $k$ are defined as - \[ \rho_k = \frac{\langle (T_{i+k} - \langle T \rangle)(T_i - \langle T \rangle) \rangle}{\langle (T_i - \langle T \rangle)^2\rangle} = \frac{{\rm cov}(T_{i+k}, T_i)}{{\rm var}(T_i)} \] - Use this function to show that interspike intervals of Poisson spikes are independent. - \begin{solution} - \lstinputlisting{simulations/isiserialcorr.m} - \colorbox{white}{\includegraphics[width=0.98\textwidth]{poissonserial100hz}} - \end{solution} - - \part Write a function that generates from spike times - a histogram of spike counts in a count window of given duration $W$. - The function should also plot the Poisson distribution - \[ P(k) = \frac{(\lambda W)^ke^{\lambda W}}{k!} \] - for the rate $\lambda$ determined from the spike trains. - \begin{solution} - \lstinputlisting{simulations/counthist.m} - \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz10ms}} - \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz100ms}} - \end{solution} - - \part Write a function that computes mean count, variance of count and the corresponding Fano factor - for a range of count window durations. The function should generate tow plots: one plotting - the count variance against the mean, the other one the Fano factor as a function of the window duration. - \begin{solution} - \lstinputlisting{simulations/fano.m} - \colorbox{white}{\includegraphics[width=0.98\textwidth]{poissonfano100hz}} - \end{solution} - - \end{parts} - -\end{questions} - - -\end{document} diff --git a/pointprocesses/lecture/Makefile b/pointprocesses/lecture/Makefile index 7a243a5..4ac656e 100644 --- a/pointprocesses/lecture/Makefile +++ b/pointprocesses/lecture/Makefile @@ -1,142 +1,70 @@ BASENAME=pointprocesses -TEXFILE=$(BASENAME).tex -DVIFILE=$(BASENAME).dvi -PSFILE=$(BASENAME).ps -PDFFILE=$(BASENAME).pdf - -FOILSFILE=foils.pdf -THUMBNAILSFILE=thumbnails.pdf - -HTMLBASENAME=$(BASENAME)h -HTMLTEXFILE=$(BASENAME)h.tex -HTMLDIR=$(BASENAME)h +PYFILES=$(wildcard *.py) +PYPDFFILES=$(PYFILES:.py=.pdf) GPTFILES=$(wildcard *.gpt) GPTTEXFILES=$(GPTFILES:.gpt=.tex) -all: ps pdf talk again watchps watchpdf foils thumbs html html1 epsfigs clean cleanup cleanplots help -.PHONY: epsfigs +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: $(THUMBNAILSFILE) -$(THUMBNAILSFILE): $(TEXFILE) $(GPTTEXFILES) +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' + pdfnup --nup 2x4 --no-landscape --paper a4paper --trim "-1cm -1cm -1cm -1cm" --outfile $@ thumbsfoils.pdf # 1-19 rm thumbsfoils.* -# transparencies: -foils: $(FOILSFILE) -$(FOILSFILE): $(TEXFILE) $(GPTTEXFILES) - sed -e 's/setboolean{presentation}{true}/setboolean{presentation}{false}/' $< > tfoils.tex - pdflatex tfoils | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex tfoils || true - pdfnup --nup 1x2 --orient portrait --trim "-1mm -1mm -1mm -1mm" --frame true --delta "1cm 1cm" --paper a4paper --outfile tfoils2.pdf tfoils.pdf - pdfnup --nup 1x1 --orient portrait --trim "-2cm -2cm -2cm -2cm" --paper a4paper --outfile $@ tfoils2.pdf - rm tfoils.* tfoils2.pdf - -# talk: -talk: $(PDFFILE) -pdf: $(PDFFILE) -$(PDFFILE): $(TEXFILE) $(GPTTEXFILES) - pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true -# batchmode (no output, no stop on error) -# nonstopmode / scrollmode (no stop on error) -# errorstopmode (stop on error) - - -again : - pdflatex $(TEXFILE) - watchpdf : while true; do ! make -q pdf && make pdf; sleep 0.5; done -# html -html : $(HTMLTEXFILE) $(GPTTEXFILES) - rm -f $(HTMLDIR)/* - htlatex $< - mkdir -p $(HTMLDIR) - mv $(HTMLBASENAME).html $(HTMLDIR) - mv $(HTMLBASENAME)*.* $(HTMLDIR) - mv z*.gif $(HTMLDIR) - cd $(HTMLDIR); for i in *.gif; do convert -page +0+0 $$i tmp.gif; mv tmp.gif $$i; done; rmtex $(HTMLBASENAME) - -#$(HTMLTEXFILE) : $(TEXFILE) Makefile -# sed 's/setboolean{html}{false}/setboolean{html}{true}/; s/\\colorbox{white}{\(.*\)}/\1/g' $< > $@ - -html1 : $(HTMLTEXFILE) $(GPTTEXFILES) - latex2html -dir $(HTMLDIR) -mkdir -subdir -nonavigation -noinfo -image_type png -notransparent -white -split 0 $< - sed 's-Date:--' $(HTMLDIR)/$(HTMLDIR).html > tmp.html - cp tmp.html $(HTMLDIR)/index.html - mv tmp.html $(HTMLDIR)/$(HTMLDIR).html - -$(HTMLTEXFILE) : $(TEXFILE) - sed '/^%nohtml/,/^%endnohtml/d; s/\\colorbox{white}{\(.*\)}/\1/g' $< > $@ - - -# eps of all figures: -epsfigs: - mkdir -p epsfigs; \ - for i in $(GPTFILES); do \ - { sed -n -e '1,/\\begin{document}/p' $(TEXFILE); echo "\texpicture{$${i%%.*}}"; echo "\end{document}"; } > tmp.tex; \ - latex tmp.tex; \ - dvips tmp.dvi; \ - ps2eps tmp.ps; \ - mv tmp.eps epsfigs/$${i%%.*}.eps; \ - rm tmp.*; \ - done - - -# plots: -%.tex: %.gpt whitestyles.gp +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 *~ - rmtex $(BASENAME) - rm -f $(GPTTEXFILES) - -cleanup : - rm -f *~ - rmtex $(BASENAME) - rm -f $(PSFILE) $(PDFFILE) $(FOILSFILE) $(THUMBNAILSFILE) - rm -f $(GPTTEXFILES) - rm -f -r $(HTMLDIR) - - -cleanplots : - sed -n -e '/\\begin{document}/,/\\end{document}/p' $(TEXFILE) | fgrep '\input{' | grep -v '^%' | sed 's/.*input{\(.*\).tex}.*/\1.gpt/' > plot.fls - mkdir -p unusedplots - for i in *.gp*; do \ - grep -q $$i plot.fls || { grep -q $$i $$(> plot.fls - for i in $$( dat.fls - mkdir -p unuseddata - for i in *.dat; do \ - grep -q $$i dat.fls || mv $$i unuseddata; \ - done - rm dat.fls plot.fls + 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 talk.\n"\ - "make foils: make black&white postscript foils of the talk.\n"\ - "make thumbs: make color thumbnails of the talk.\n"\ - "make again: run latex and make the pdf file of the talk,\n"\ - " no matter whether you changed the .tex file or not.\n\n"\ - "make watchpdf: make the pdf file of the talk\n"\ + "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 html: make a html version of the paper (in $(HTMLDIR)).\n\n"\ "make clean: remove all intermediate files,\n"\ - " just leave the source files and the final .ps and .pdf 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 .ps and .pdf files.\n"\ - "make cleanplots: move all unused .gpt and .dat files\n"\ - " into unusedplots/ and unuseddata/, respectively." + " the final .pdf files.\n"\ diff --git a/pointprocesses/lecture/pointprocesses-slides.tex b/pointprocesses/lecture/pointprocesses-slides.tex new file mode 100644 index 0000000..ff49cb2 --- /dev/null +++ b/pointprocesses/lecture/pointprocesses-slides.tex @@ -0,0 +1,412 @@ +\documentclass{beamer} + +%%%%% title %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\title[]{Scientific Computing --- Point Processes} +\author[]{Jan Benda} +\institute[]{Neuroethology} +\date[]{WS 14/15} +\titlegraphic{\includegraphics[width=0.3\textwidth]{UT_WBMW_Rot_RGB}} + +%%%%% beamer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\mode +{ + \usetheme{Singapore} + \setbeamercovered{opaque} + \usecolortheme{tuebingen} + \setbeamertemplate{navigation symbols}{} + \usefonttheme{default} + \useoutertheme{infolines} + % \useoutertheme{miniframes} +} + +%\AtBeginSection[] +%{ +% \begin{frame} +% \begin{center} +% \Huge \insertsectionhead +% \end{center} +% \end{frame} +%} + +\setbeamertemplate{blocks}[rounded][shadow=true] +\setcounter{tocdepth}{1} + +%%%%% packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage[english]{babel} +\usepackage{amsmath} +\usepackage{bm} +\usepackage{pslatex} % nice font for pdf file +%\usepackage{multimedia} + +\usepackage{dsfont} +\newcommand{\naZ}{\mathds{N}} +\newcommand{\gaZ}{\mathds{Z}} +\newcommand{\raZ}{\mathds{Q}} +\newcommand{\reZ}{\mathds{R}} +\newcommand{\reZp}{\mathds{R^+}} +\newcommand{\reZpN}{\mathds{R^+_0}} +\newcommand{\koZ}{\mathds{C}} + +%%%% graphics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{graphicx} +\newcommand{\texpicture}[1]{{\sffamily\small\input{#1.tex}}} + +%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{listings} +\lstset{ + basicstyle=\ttfamily, + numbers=left, + showstringspaces=false, + language=Matlab, + commentstyle=\itshape\color{darkgray}, + keywordstyle=\color{blue}, + stringstyle=\color{green}, + backgroundcolor=\color{blue!10}, + breaklines=true, + breakautoindent=true, + columns=flexible, + frame=single, + captionpos=b, + xleftmargin=1em, + xrightmargin=1em, + aboveskip=10pt + } + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +\begin{frame}[plain] + \frametitle{} + \vspace{-1cm} + \titlepage % erzeugt Titelseite +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame} + \frametitle{Content} + \tableofcontents +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Point processes} + +\begin{frame} + \frametitle{Point process} + \vspace{-3ex} + \texpicture{pointprocessscetchA} + + A point process is a stochastic (or random) process that generates a sequence of events + at times $\{t_i\}$, $t_i \in \reZ$. + + For each point process there is an underlying continuous-valued + process evolving in time. The associated point process occurs when + the underlying continuous process crosses a threshold. + Examples: + \begin{itemize} + \item Spikes/heartbeat: generated by the dynamics of the membrane potential of neurons/heart cells. + \item Earth quakes: generated by the pressure dynamics between the tectonic plates on either side of a geological fault line. + \item Onset of cricket/frogs/birds/... songs: generated by the dynamics of the state of a nervous system. + \end{itemize} +\end{frame} + +\begin{frame} + \frametitle{Point process} + \texpicture{pointprocessscetchB} +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Homogeneous Poisson process} + +\begin{frame} + \frametitle{Homogeneous Poisson process} + The probability $p(t)\delta t$ of an event occuring at time $t$ + is independent of $t$ and independent of any previous event + (independent of event history). + + The probability $P$ for an event occuring within a time bin of width $\Delta t$ + is + \[ P=\lambda \cdot \Delta t \] + for a Poisson process with rate $\lambda$. + \includegraphics[width=1\textwidth]{poissonraster100hz} +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Interval statistics} + +\begin{frame} + \frametitle{Rate} + Rate of events $r$ (``spikes per time'') measured in Hertz. + \begin{itemize} + \item Number of events $N$ per observation time $W$: $r = \frac{N}{W}$ + \item Without boundary effects: $r = \frac{N-1}{t_N-t_1}$ + \item Inverse interval: $r = \frac{1}{\mu_{ISI}}$ + \end{itemize} +\end{frame} + +\begin{frame} + \frametitle{(Interspike) interval statistics} + \begin{itemize} + \item Histogram $p(T)$ of intervals $T$. Normalized to $\int_0^{\infty} p(T) \; dT = 1$ + \item Mean interval $\mu_{ISI} = \langle T \rangle = \frac{1}{n}\sum\limits_{i=1}^n T_i$ + \item Variance of intervals $\sigma_{ISI}^2 = \langle (T - \langle T \rangle)^2 \rangle$\vspace{1ex} + \item Coefficient of variation $CV_{ISI} = \frac{\sigma_{ISI}}{\mu_{ISI}}$ + \item Diffusion coefficient $D_{ISI} = \frac{\sigma_{ISI}^2}{2\mu_{ISI}^3}$ + \vfill + \end{itemize} + \includegraphics[width=0.45\textwidth]{poissonisih100hz}\hfill + \includegraphics[width=0.45\textwidth]{lifisih16} +\end{frame} + +\begin{frame} + \frametitle{Interval statistics of homogeneous Poisson process} + \begin{itemize} + \item Exponential distribution of intervals $T$: $p(T) = \lambda e^{-\lambda T}$ + \item Mean interval $\mu_{ISI} = \frac{1}{\lambda}$ + \item Variance of intervals $\sigma_{ISI}^2 = \frac{1}{\lambda^2}$ + \item Coefficient of variation $CV_{ISI} = 1$ + \end{itemize} + \vfill + \includegraphics[width=0.45\textwidth]{poissonisihexp20hz}\hfill + \includegraphics[width=0.45\textwidth]{poissonisihexp100hz} +\end{frame} + +\begin{frame} + \frametitle{Interval return maps} + Scatter plot between succeeding intervals separated by lag $k$. + \vfill + Poisson process $\lambda=100$\,Hz: + \includegraphics[width=1\textwidth]{poissonreturnmap100hz}\hfill +\end{frame} + +\begin{frame} + \frametitle{Serial interval correlations} + Correlation coefficients between succeeding intervals separated by lag $k$: + \[ \rho_k = \frac{\langle (T_{i+k} - \langle T \rangle)(T_i - \langle T \rangle) \rangle}{\langle (T_i - \langle T \rangle)^2\rangle} = \frac{{\rm cov}(T_{i+k}, T_i)}{{\rm var}(T_i)} \] + \begin{itemize} + \item $\rho_0=1$ (correlation of each interval with itself). + \item Poisson process: $\rho_k =0$ for $k>0$ (renewal process!) + \end{itemize} + \vfill + \includegraphics[width=0.7\textwidth]{poissonserial100hz} +\end{frame} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Count statistics} + +\begin{frame} + \frametitle{Count statistics} + Histogram of number of events $N$ (counts) within observation window of duration $W$. + + \vfill + \includegraphics[width=0.48\textwidth]{poissoncounthist100hz10ms}\hfill + \includegraphics[width=0.48\textwidth]{poissoncounthist100hz100ms} +\end{frame} + +\begin{frame} + \frametitle{Count statistics of Poisson process} + Poisson distribution: + \[ P(k) = \frac{(\lambda W)^ke^{\lambda W}}{k!} \] + + \vfill + \includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz10ms}\hfill + \includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz100ms} +\end{frame} + +\begin{frame} + \frametitle{Count statistics --- Fano factor} + Statistics of number of events $N$ within observation window of duration $W$. + \begin{itemize} + \item Mean count: $\mu_N = \langle N \rangle$ + \item Count variance: $\sigma_N^2 = \langle (N - \langle N \rangle)^2 \rangle$ + \item Fano factor (variance divided by mean): $F = \frac{\sigma_N^2}{\mu_N}$ + \item Poisson process: $F=1$ + \end{itemize} + \vfill + Poisson process $\lambda=100$\,Hz: + \includegraphics[width=1\textwidth]{poissonfano100hz} +\end{frame} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Integrate-and-fire models} + +\begin{frame} + \frametitle{Integrate-and-fire models} + Leaky integrate-and-fire model (LIF): + \[ \tau \frac{dV}{dt} = -V + RI + D\xi \] + Whenever membrane potential $V(t)$ crosses the firing threshold $\theta$, a spike is emitted and + $V(t)$ is reset to $V_{reset}$. + \begin{itemize} + \item $\tau$: membrane time constant (typically 10\,ms) + \item $R$: input resistance (here 1\,mV (!)) + \item $D\xi$: additive Gaussian white noise of strength $D$ + \item $\theta$: firing threshold (here 10\,mV) + \item $V_{reset}$: reset potential (here 0\,mV) + \end{itemize} +\end{frame} + +\begin{frame} + \frametitle{Integrate-and-fire models} + Discretization with time step $\Delta t$: $V(t) \rightarrow V_i,\;t_i = i \Delta t$.\\ + Euler integration: + \begin{eqnarray*} + \frac{dV}{dt} & \approx & \frac{V_{i+1} - V_i}{\Delta t} \\ + \Rightarrow \quad V_{i+1} & = & V_i + \Delta t \frac{-V_i+RI_i+\sqrt{2D\Delta t}N_i}{\tau} + \end{eqnarray*} + $N_i$ are normally distributed random numbers (Gaussian with zero mean and unit variance) + --- the $\sqrt{\Delta t}$ is for white noise. + + \includegraphics[width=0.82\textwidth]{lifraster16} +\end{frame} + +\begin{frame} + \frametitle{Interval statistics of LIF} + Interval distribution approaches Inverse Gaussian for large $I$: + \[ p(T) = \frac{1}{\sqrt{4\pi D T^3}}\exp\left[-\frac{(T-\langle T \rangle)^2}{4DT\langle T \rangle^2}\right] \] + where $\langle T \rangle$ is the mean interspike interval and $D$ + is the diffusion coefficient. + \vfill + \includegraphics[width=0.45\textwidth]{lifisihdistr08}\hfill + \includegraphics[width=0.45\textwidth]{lifisihdistr16} +\end{frame} + +\begin{frame} + \frametitle{Interval statistics of PIF} + For the perfect integrate-and-fire (PIF) + \[ \tau \frac{dV}{dt} = RI + D\xi \] + (the canonical model or supra-threshold firing on a limit cycle)\\ + the Inverse Gaussian describes exactly the interspike interval distribution. + \vfill + \includegraphics[width=0.45\textwidth]{pifisihdistr01}\hfill + \includegraphics[width=0.45\textwidth]{pifisihdistr10} +\end{frame} + +\begin{frame} + \frametitle{Interval return map of LIF} + LIF $I=15.7$: + \includegraphics[width=1\textwidth]{lifreturnmap16} +\end{frame} + +\begin{frame} + \frametitle{Serial correlations of LIF} + LIF $I=15.7$: + \includegraphics[width=1\textwidth]{lifserial16}\\ + Integrate-and-fire driven with white noise are still renewal processes! +\end{frame} + +\begin{frame} + \frametitle{Count statistics of LIF} + LIF $I=15.7$: + \includegraphics[width=1\textwidth]{liffano16}\\ + Fano factor is not one! +\end{frame} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame} + \frametitle{Interval statistics of LIF with OU noise} + \begin{eqnarray*} + \tau \frac{dV}{dt} & = & -V + RI + U \\ + \tau_{OU} \frac{dU}{dt} & = & - U + D\xi + \end{eqnarray*} + Ohrnstein-Uhlenbeck noise is lowpass filtered white noise. + \includegraphics[width=0.45\textwidth]{lifouisihdistr08-100ms}\hfill + \includegraphics[width=0.45\textwidth]{lifouisihdistr16-100ms}\\ + More peaky than the inverse Gaussian! +\end{frame} + +\begin{frame} + \frametitle{Interval return map of LIF with OU noise} + LIF $I=15.7$, $\tau_{OU}=100$\,ms: + \includegraphics[width=1\textwidth]{lifoureturnmap16-100ms} +\end{frame} + +\begin{frame} + \frametitle{Serial correlations of LIF with OU noise} + LIF $I=15.7$, $\tau_{OU}=100$\,ms: + \includegraphics[width=1\textwidth]{lifouserial16-100ms}\\ + OU-noise introduces positive interval correlations! +\end{frame} + +\begin{frame} + \frametitle{Count statistics of LIF with OU noise} + LIF $I=15.7$, $\tau_{OU}=100$\,ms: + \includegraphics[width=1\textwidth]{lifoufano16-100ms}\\ + Fano factor increases with count window duration. +\end{frame} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame} + \frametitle{Interval statistics of LIF with adaptation} + \begin{eqnarray*} + \tau \frac{dV}{dt} & = & -V - A + RI + D\xi \\ + \tau_{adapt} \frac{dA}{dt} & = & - A + \end{eqnarray*} + Adaptation $A$ with time constant $\tau_{adapt}$ and increment $\Delta A$ at spike. + \includegraphics[width=0.45\textwidth]{lifadaptisihdistr08-100ms}\hfill + \includegraphics[width=0.45\textwidth]{lifadaptisihdistr65-100ms}\\ + Similar to LIF with white noise. +\end{frame} + +\begin{frame} + \frametitle{Interval return map of LIF with adaptation} + LIF $I=10$, $\tau_{adapt}=100$\,ms: + \includegraphics[width=1\textwidth]{lifadaptreturnmap10-100ms}\\ + Negative correlation at lag one. +\end{frame} + +\begin{frame} + \frametitle{Serial correlations of LIF with adaptation} + LIF $I=10$, $\tau_{adapt}=100$\,ms: + \includegraphics[width=1\textwidth]{lifadaptserial10-100ms}\\ + Adaptation with white noise introduces negative interval correlations! +\end{frame} + +\begin{frame} + \frametitle{Count statistics of LIF with adaptation} + LIF $I=10$, $\tau_{adapt}=100$\,ms: + \includegraphics[width=1\textwidth]{lifadaptfano10-100ms}\\ + Fano factor decreases with count window duration. +\end{frame} + + +\end{document} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Non stationary} +\subsection{Inhomogeneous Poisson process} +\subsection{Firing rate} +\subsection{Instantaneous rate} +\subsection{Autocorrelation} +\subsection{Crosscorrelation} +\subsection{Joint PSTH} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Renewal process} +\subsection{Superthreshold firing} +\subsection{Subthreshold firing} +\section{Non-renewal processes} +\subsection{Bursting} +\subsection{Resonator} + + +\subsection{Standard distributions} +\subsubsection{Gamma} +\subsubsection{How to read ISI histograms} +refractoriness, poisson tail, sub-, supra-threshold, missed spikes + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Correlation with stimulus} +\subsection{Tuning curve} +\subsection{Linear filter} +\subsection{Spatiotemporal receptive field} +\subsection{Generalized linear model} + +\begin{frame} +\end{frame} diff --git a/pointprocesses/lecture/pointprocesses.tex b/pointprocesses/lecture/pointprocesses.tex index ff49cb2..58f3cd1 100644 --- a/pointprocesses/lecture/pointprocesses.tex +++ b/pointprocesses/lecture/pointprocesses.tex @@ -1,412 +1,168 @@ -\documentclass{beamer} - -%%%%% title %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\title[]{Scientific Computing --- Point Processes} -\author[]{Jan Benda} -\institute[]{Neuroethology} -\date[]{WS 14/15} -\titlegraphic{\includegraphics[width=0.3\textwidth]{UT_WBMW_Rot_RGB}} - -%%%%% beamer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\mode -{ - \usetheme{Singapore} - \setbeamercovered{opaque} - \usecolortheme{tuebingen} - \setbeamertemplate{navigation symbols}{} - \usefonttheme{default} - \useoutertheme{infolines} - % \useoutertheme{miniframes} -} - -%\AtBeginSection[] -%{ -% \begin{frame} -% \begin{center} -% \Huge \insertsectionhead -% \end{center} -% \end{frame} -%} - -\setbeamertemplate{blocks}[rounded][shadow=true] -\setcounter{tocdepth}{1} - -%%%%% packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage[english]{babel} -\usepackage{amsmath} -\usepackage{bm} -\usepackage{pslatex} % nice font for pdf file -%\usepackage{multimedia} - -\usepackage{dsfont} -\newcommand{\naZ}{\mathds{N}} -\newcommand{\gaZ}{\mathds{Z}} -\newcommand{\raZ}{\mathds{Q}} -\newcommand{\reZ}{\mathds{R}} -\newcommand{\reZp}{\mathds{R^+}} -\newcommand{\reZpN}{\mathds{R^+_0}} -\newcommand{\koZ}{\mathds{C}} - -%%%% graphics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage{graphicx} -\newcommand{\texpicture}[1]{{\sffamily\small\input{#1.tex}}} - -%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage{listings} -\lstset{ - basicstyle=\ttfamily, - numbers=left, - showstringspaces=false, - language=Matlab, - commentstyle=\itshape\color{darkgray}, - keywordstyle=\color{blue}, - stringstyle=\color{green}, - backgroundcolor=\color{blue!10}, - breaklines=true, - breakautoindent=true, - columns=flexible, - frame=single, - captionpos=b, - xleftmargin=1em, - xrightmargin=1em, - aboveskip=10pt - } - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{document} - -\begin{frame}[plain] - \frametitle{} - \vspace{-1cm} - \titlepage % erzeugt Titelseite -\end{frame} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{frame} - \frametitle{Content} - \tableofcontents -\end{frame} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Point processes} - -\begin{frame} - \frametitle{Point process} - \vspace{-3ex} - \texpicture{pointprocessscetchA} - - A point process is a stochastic (or random) process that generates a sequence of events - at times $\{t_i\}$, $t_i \in \reZ$. - - For each point process there is an underlying continuous-valued - process evolving in time. The associated point process occurs when - the underlying continuous process crosses a threshold. - Examples: - \begin{itemize} - \item Spikes/heartbeat: generated by the dynamics of the membrane potential of neurons/heart cells. - \item Earth quakes: generated by the pressure dynamics between the tectonic plates on either side of a geological fault line. - \item Onset of cricket/frogs/birds/... songs: generated by the dynamics of the state of a nervous system. - \end{itemize} -\end{frame} +\chapter{\tr{Point processes}{Punktprozesse}} -\begin{frame} - \frametitle{Point process} +\begin{figure}[t] \texpicture{pointprocessscetchB} -\end{frame} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Homogeneous Poisson process} - -\begin{frame} - \frametitle{Homogeneous Poisson process} - The probability $p(t)\delta t$ of an event occuring at time $t$ - is independent of $t$ and independent of any previous event - (independent of event history). - - The probability $P$ for an event occuring within a time bin of width $\Delta t$ - is - \[ P=\lambda \cdot \Delta t \] - for a Poisson process with rate $\lambda$. - \includegraphics[width=1\textwidth]{poissonraster100hz} -\end{frame} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Interval statistics} - -\begin{frame} - \frametitle{Rate} - Rate of events $r$ (``spikes per time'') measured in Hertz. - \begin{itemize} - \item Number of events $N$ per observation time $W$: $r = \frac{N}{W}$ - \item Without boundary effects: $r = \frac{N-1}{t_N-t_1}$ - \item Inverse interval: $r = \frac{1}{\mu_{ISI}}$ - \end{itemize} -\end{frame} - -\begin{frame} - \frametitle{(Interspike) interval statistics} - \begin{itemize} - \item Histogram $p(T)$ of intervals $T$. Normalized to $\int_0^{\infty} p(T) \; dT = 1$ - \item Mean interval $\mu_{ISI} = \langle T \rangle = \frac{1}{n}\sum\limits_{i=1}^n T_i$ - \item Variance of intervals $\sigma_{ISI}^2 = \langle (T - \langle T \rangle)^2 \rangle$\vspace{1ex} - \item Coefficient of variation $CV_{ISI} = \frac{\sigma_{ISI}}{\mu_{ISI}}$ - \item Diffusion coefficient $D_{ISI} = \frac{\sigma_{ISI}^2}{2\mu_{ISI}^3}$ - \vfill - \end{itemize} + \caption{\label{pointprocessscetchfig}Ein Punktprozess ist eine + Abfolge von Zeitpunkten $t_i$ die auch durch die Intervalle + $T_i=t_{i+1}-t_i$ oder die Anzahl der Ereignisse $n_i$ beschrieben + werden kann. } +\end{figure} + +Ein zeitlicher Punktprozess ist ein stochastischer Prozess der eine Abfolge von Ereignissen zu den Zeiten $\{t_i\}$, $t_i \in \reZ$ generiert. + +Jeder Punktprozess wird durch einen sich in der Zeit kontinuierlichen +entwickelnden Prozess generiert. Wann immer dieser Prozess eine Schwelle \"uberschreitet +wird ein Ereigniss des Punktprozesses erzeugt. Zum Beispiel: +\begin{itemize} +\item Aktionspotentiale/Herzschlag: wird durch die Dynamik des + Membranpotentials eines Neurons/Herzzelle erzeugt. +\item Erdbeben: wird durch die Dynamik des Druckes zwischen + tektonischen Platten auf beiden Seiten einer geologischen Verwerfung + erzeugt. +\item Zeitpunkt eines Grillen/Frosch/Vogelgesangs: wird durch die + Dynamic des Nervensystems und des Muskelapparates erzeugt. +\end{itemize} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Rate eines Punktprozesses} +Rate of events $r$ (``spikes per time'') measured in Hertz. +\begin{itemize} +\item Number of events $N$ per observation time $W$: $r = \frac{N}{W}$ +\item Without boundary effects: $r = \frac{N-1}{t_N-t_1}$ +\item Inverse interval: $r = \frac{1}{\mu_{ISI}}$ +\end{itemize} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Intervall Statistiken} + +\begin{figure}[t] \includegraphics[width=0.45\textwidth]{poissonisih100hz}\hfill \includegraphics[width=0.45\textwidth]{lifisih16} -\end{frame} - -\begin{frame} - \frametitle{Interval statistics of homogeneous Poisson process} - \begin{itemize} - \item Exponential distribution of intervals $T$: $p(T) = \lambda e^{-\lambda T}$ - \item Mean interval $\mu_{ISI} = \frac{1}{\lambda}$ - \item Variance of intervals $\sigma_{ISI}^2 = \frac{1}{\lambda^2}$ - \item Coefficient of variation $CV_{ISI} = 1$ - \end{itemize} - \vfill - \includegraphics[width=0.45\textwidth]{poissonisihexp20hz}\hfill - \includegraphics[width=0.45\textwidth]{poissonisihexp100hz} -\end{frame} - -\begin{frame} - \frametitle{Interval return maps} - Scatter plot between succeeding intervals separated by lag $k$. - \vfill - Poisson process $\lambda=100$\,Hz: - \includegraphics[width=1\textwidth]{poissonreturnmap100hz}\hfill -\end{frame} - -\begin{frame} - \frametitle{Serial interval correlations} - Correlation coefficients between succeeding intervals separated by lag $k$: - \[ \rho_k = \frac{\langle (T_{i+k} - \langle T \rangle)(T_i - \langle T \rangle) \rangle}{\langle (T_i - \langle T \rangle)^2\rangle} = \frac{{\rm cov}(T_{i+k}, T_i)}{{\rm var}(T_i)} \] - \begin{itemize} - \item $\rho_0=1$ (correlation of each interval with itself). - \item Poisson process: $\rho_k =0$ for $k>0$ (renewal process!) - \end{itemize} - \vfill - \includegraphics[width=0.7\textwidth]{poissonserial100hz} -\end{frame} + \caption{\label{isihfig}Interspike-Intervall Histogramme von einem Poisson Prozess (links) + und einem Integrate-and-Fire Neuron (rechts).} +\end{figure} + +\subsection{First order (Interspike) interval statistics} +\begin{itemize} +\item Histogram $p(T)$ of intervals $T$. Normalized to $\int_0^{\infty} p(T) \; dT = 1$ +\item Mean interval $\mu_{ISI} = \langle T \rangle = \frac{1}{n}\sum\limits_{i=1}^n T_i$ +\item Variance of intervals $\sigma_{ISI}^2 = \langle (T - \langle T \rangle)^2 \rangle$\vspace{1ex} +\item Coefficient of variation $CV_{ISI} = \frac{\sigma_{ISI}}{\mu_{ISI}}$ +\item Diffusion coefficient $D_{ISI} = \frac{\sigma_{ISI}^2}{2\mu_{ISI}^3}$ +\end{itemize} + +\subsection{Interval return maps} +Scatter plot between succeeding intervals separated by lag $k$. + +\begin{figure}[t] + \begin{minipage}[t]{0.49\textwidth} + LIF $I=10$, $\tau_{adapt}=100$\,ms:\\ + \includegraphics[width=1\textwidth]{lifadaptreturnmap10-100ms} + \end{minipage} + \hfill + \begin{minipage}[t]{0.49\textwidth} + LIF $I=15.7$, $\tau_{OU}=100$\,ms:\\ + \includegraphics[width=1\textwidth]{lifoureturnmap16-100ms} + \end{minipage} + \caption{\label{returnmapfig}Interspike-Intervall return maps.} +\end{figure} + +\subsection{Serial correlations of the intervals} +Correlation coefficients between succeeding intervals separated by lag $k$: +\[ \rho_k = \frac{\langle (T_{i+k} - \langle T \rangle)(T_i - \langle T \rangle) \rangle}{\langle (T_i - \langle T \rangle)^2\rangle} = \frac{{\rm cov}(T_{i+k}, T_i)}{{\rm var}(T_i)} \] +$\rho_0=1$ (correlation of each interval with itself). + +\begin{figure}[t] + \begin{minipage}[t]{0.49\textwidth} + LIF $I=10$, $\tau_{adapt}=100$\,ms:\\ + \includegraphics[width=1\textwidth]{lifadaptserial10-100ms} + \end{minipage} + \hfill + \begin{minipage}[t]{0.49\textwidth} + LIF $I=15.7$, $\tau_{OU}=100$\,ms:\\ + \includegraphics[width=1\textwidth]{lifouserial16-100ms} + \end{minipage} + \caption{\label{serialcorrfig}Serial correlations.} +\end{figure} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Count statistics} -\begin{frame} - \frametitle{Count statistics} - Histogram of number of events $N$ (counts) within observation window of duration $W$. - - \vfill +\begin{figure}[t] \includegraphics[width=0.48\textwidth]{poissoncounthist100hz10ms}\hfill \includegraphics[width=0.48\textwidth]{poissoncounthist100hz100ms} -\end{frame} - -\begin{frame} - \frametitle{Count statistics of Poisson process} - Poisson distribution: - \[ P(k) = \frac{(\lambda W)^ke^{\lambda W}}{k!} \] - - \vfill - \includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz10ms}\hfill - \includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz100ms} -\end{frame} - -\begin{frame} - \frametitle{Count statistics --- Fano factor} - Statistics of number of events $N$ within observation window of duration $W$. - \begin{itemize} - \item Mean count: $\mu_N = \langle N \rangle$ - \item Count variance: $\sigma_N^2 = \langle (N - \langle N \rangle)^2 \rangle$ - \item Fano factor (variance divided by mean): $F = \frac{\sigma_N^2}{\mu_N}$ - \item Poisson process: $F=1$ - \end{itemize} - \vfill - Poisson process $\lambda=100$\,Hz: - \includegraphics[width=1\textwidth]{poissonfano100hz} -\end{frame} + \caption{\label{countstatsfig}Count Statistik.} +\end{figure} + +Histogram of number of events $N$ (counts) within observation window of duration $W$. + +\subsection{Fano factor} + +\begin{figure}[t] + \begin{minipage}[t]{0.49\textwidth} + Poisson process $\lambda=100$\,Hz:\\ + \includegraphics[width=1\textwidth]{poissonfano100hz} + \end{minipage} + \hfill + \begin{minipage}[t]{0.49\textwidth} + LIF $I=10$, $\tau_{adapt}=100$\,ms:\\ + \includegraphics[width=1\textwidth]{lifadaptfano10-100ms} + \end{minipage} + \caption{\label{fanofig}Fano factor.} +\end{figure} + +Statistics of number of events $N$ within observation window of duration $W$. +\begin{itemize} +\item Mean count: $\mu_N = \langle N \rangle$ +\item Count variance: $\sigma_N^2 = \langle (N - \langle N \rangle)^2 \rangle$ +\item Fano factor (variance divided by mean): $F = \frac{\sigma_N^2}{\mu_N}$ +\end{itemize} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Integrate-and-fire models} - -\begin{frame} - \frametitle{Integrate-and-fire models} - Leaky integrate-and-fire model (LIF): - \[ \tau \frac{dV}{dt} = -V + RI + D\xi \] - Whenever membrane potential $V(t)$ crosses the firing threshold $\theta$, a spike is emitted and - $V(t)$ is reset to $V_{reset}$. - \begin{itemize} - \item $\tau$: membrane time constant (typically 10\,ms) - \item $R$: input resistance (here 1\,mV (!)) - \item $D\xi$: additive Gaussian white noise of strength $D$ - \item $\theta$: firing threshold (here 10\,mV) - \item $V_{reset}$: reset potential (here 0\,mV) - \end{itemize} -\end{frame} - -\begin{frame} - \frametitle{Integrate-and-fire models} - Discretization with time step $\Delta t$: $V(t) \rightarrow V_i,\;t_i = i \Delta t$.\\ - Euler integration: - \begin{eqnarray*} - \frac{dV}{dt} & \approx & \frac{V_{i+1} - V_i}{\Delta t} \\ - \Rightarrow \quad V_{i+1} & = & V_i + \Delta t \frac{-V_i+RI_i+\sqrt{2D\Delta t}N_i}{\tau} - \end{eqnarray*} - $N_i$ are normally distributed random numbers (Gaussian with zero mean and unit variance) - --- the $\sqrt{\Delta t}$ is for white noise. - - \includegraphics[width=0.82\textwidth]{lifraster16} -\end{frame} - -\begin{frame} - \frametitle{Interval statistics of LIF} - Interval distribution approaches Inverse Gaussian for large $I$: - \[ p(T) = \frac{1}{\sqrt{4\pi D T^3}}\exp\left[-\frac{(T-\langle T \rangle)^2}{4DT\langle T \rangle^2}\right] \] - where $\langle T \rangle$ is the mean interspike interval and $D$ - is the diffusion coefficient. - \vfill - \includegraphics[width=0.45\textwidth]{lifisihdistr08}\hfill - \includegraphics[width=0.45\textwidth]{lifisihdistr16} -\end{frame} - -\begin{frame} - \frametitle{Interval statistics of PIF} - For the perfect integrate-and-fire (PIF) - \[ \tau \frac{dV}{dt} = RI + D\xi \] - (the canonical model or supra-threshold firing on a limit cycle)\\ - the Inverse Gaussian describes exactly the interspike interval distribution. - \vfill - \includegraphics[width=0.45\textwidth]{pifisihdistr01}\hfill - \includegraphics[width=0.45\textwidth]{pifisihdistr10} -\end{frame} - -\begin{frame} - \frametitle{Interval return map of LIF} - LIF $I=15.7$: - \includegraphics[width=1\textwidth]{lifreturnmap16} -\end{frame} - -\begin{frame} - \frametitle{Serial correlations of LIF} - LIF $I=15.7$: - \includegraphics[width=1\textwidth]{lifserial16}\\ - Integrate-and-fire driven with white noise are still renewal processes! -\end{frame} - -\begin{frame} - \frametitle{Count statistics of LIF} - LIF $I=15.7$: - \includegraphics[width=1\textwidth]{liffano16}\\ - Fano factor is not one! -\end{frame} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{frame} - \frametitle{Interval statistics of LIF with OU noise} - \begin{eqnarray*} - \tau \frac{dV}{dt} & = & -V + RI + U \\ - \tau_{OU} \frac{dU}{dt} & = & - U + D\xi - \end{eqnarray*} - Ohrnstein-Uhlenbeck noise is lowpass filtered white noise. - \includegraphics[width=0.45\textwidth]{lifouisihdistr08-100ms}\hfill - \includegraphics[width=0.45\textwidth]{lifouisihdistr16-100ms}\\ - More peaky than the inverse Gaussian! -\end{frame} - -\begin{frame} - \frametitle{Interval return map of LIF with OU noise} - LIF $I=15.7$, $\tau_{OU}=100$\,ms: - \includegraphics[width=1\textwidth]{lifoureturnmap16-100ms} -\end{frame} - -\begin{frame} - \frametitle{Serial correlations of LIF with OU noise} - LIF $I=15.7$, $\tau_{OU}=100$\,ms: - \includegraphics[width=1\textwidth]{lifouserial16-100ms}\\ - OU-noise introduces positive interval correlations! -\end{frame} +\section{\tr{Homogeneous Poisson process}{Homogener Poisson Prozess}} -\begin{frame} - \frametitle{Count statistics of LIF with OU noise} - LIF $I=15.7$, $\tau_{OU}=100$\,ms: - \includegraphics[width=1\textwidth]{lifoufano16-100ms}\\ - Fano factor increases with count window duration. -\end{frame} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{frame} - \frametitle{Interval statistics of LIF with adaptation} - \begin{eqnarray*} - \tau \frac{dV}{dt} & = & -V - A + RI + D\xi \\ - \tau_{adapt} \frac{dA}{dt} & = & - A - \end{eqnarray*} - Adaptation $A$ with time constant $\tau_{adapt}$ and increment $\Delta A$ at spike. - \includegraphics[width=0.45\textwidth]{lifadaptisihdistr08-100ms}\hfill - \includegraphics[width=0.45\textwidth]{lifadaptisihdistr65-100ms}\\ - Similar to LIF with white noise. -\end{frame} - -\begin{frame} - \frametitle{Interval return map of LIF with adaptation} - LIF $I=10$, $\tau_{adapt}=100$\,ms: - \includegraphics[width=1\textwidth]{lifadaptreturnmap10-100ms}\\ - Negative correlation at lag one. -\end{frame} - -\begin{frame} - \frametitle{Serial correlations of LIF with adaptation} - LIF $I=10$, $\tau_{adapt}=100$\,ms: - \includegraphics[width=1\textwidth]{lifadaptserial10-100ms}\\ - Adaptation with white noise introduces negative interval correlations! -\end{frame} - -\begin{frame} - \frametitle{Count statistics of LIF with adaptation} - LIF $I=10$, $\tau_{adapt}=100$\,ms: - \includegraphics[width=1\textwidth]{lifadaptfano10-100ms}\\ - Fano factor decreases with count window duration. -\end{frame} - - -\end{document} +\begin{figure}[t] + \includegraphics[width=1\textwidth]{poissonraster100hz} + \caption{\label{hompoissonfig}Rasterplot von Poisson-Spikes.} +\end{figure} +The probability $p(t)\delta t$ of an event occuring at time $t$ +is independent of $t$ and independent of any previous event +(independent of event history). -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Non stationary} -\subsection{Inhomogeneous Poisson process} -\subsection{Firing rate} -\subsection{Instantaneous rate} -\subsection{Autocorrelation} -\subsection{Crosscorrelation} -\subsection{Joint PSTH} +The probability $P$ for an event occuring within a time bin of width $\Delta t$ +is +\[ P=\lambda \cdot \Delta t \] +for a Poisson process with rate $\lambda$. -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Renewal process} -\subsection{Superthreshold firing} -\subsection{Subthreshold firing} -\section{Non-renewal processes} -\subsection{Bursting} -\subsection{Resonator} +\subsection{Statistics of homogeneous Poisson process} +\begin{figure}[t] + \includegraphics[width=0.45\textwidth]{poissonisihexp20hz}\hfill + \includegraphics[width=0.45\textwidth]{poissonisihexp100hz} + \caption{\label{hompoissonisihfig}Interspike interval histograms of poisson spike train.} +\end{figure} -\subsection{Standard distributions} -\subsubsection{Gamma} -\subsubsection{How to read ISI histograms} -refractoriness, poisson tail, sub-, supra-threshold, missed spikes +\begin{itemize} +\item Exponential distribution of intervals $T$: $p(T) = \lambda e^{-\lambda T}$ +\item Mean interval $\mu_{ISI} = \frac{1}{\lambda}$ +\item Variance of intervals $\sigma_{ISI}^2 = \frac{1}{\lambda^2}$ +\item Coefficient of variation $CV_{ISI} = 1$ +\item Serial correlation $\rho_k =0$ for $k>0$ (renewal process!) +\item Fano factor $F=1$ +\end{itemize} +\subsection{Count statistics of Poisson process} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Correlation with stimulus} -\subsection{Tuning curve} -\subsection{Linear filter} -\subsection{Spatiotemporal receptive field} -\subsection{Generalized linear model} +\begin{figure}[t] + \includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz10ms}\hfill + \includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz100ms} + \caption{\label{hompoissoncountfig}Count statistics of poisson spike train.} +\end{figure} -\begin{frame} -\end{frame} +Poisson distribution: +\[ P(k) = \frac{(\lambda W)^ke^{\lambda W}}{k!} \] \ No newline at end of file diff --git a/pointprocesses/lecture/pointprocessscetchA.eps b/pointprocesses/lecture/pointprocessscetchA.eps index 95a12ae..83dc344 100644 --- a/pointprocesses/lecture/pointprocessscetchA.eps +++ b/pointprocesses/lecture/pointprocessscetchA.eps @@ -1,7 +1,7 @@ %!PS-Adobe-2.0 EPSF-2.0 %%Title: pointprocessscetchA.tex %%Creator: gnuplot 4.6 patchlevel 4 -%%CreationDate: Sun Oct 26 14:09:12 2014 +%%CreationDate: Sun Oct 25 21:47:09 2015 %%DocumentFonts: %%BoundingBox: 50 50 373 135 %%EndComments @@ -433,7 +433,7 @@ SDict begin [ /Author (jan) % /Producer (gnuplot) % /Keywords () - /CreationDate (Sun Oct 26 14:09:12 2014) + /CreationDate (Sun Oct 25 21:47:09 2015) /DOCINFO pdfmark end } ifelse diff --git a/pointprocesses/lecture/pointprocessscetchA.pdf b/pointprocesses/lecture/pointprocessscetchA.pdf index dcc5228..145657e 100644 Binary files a/pointprocesses/lecture/pointprocessscetchA.pdf and b/pointprocesses/lecture/pointprocessscetchA.pdf differ diff --git a/pointprocesses/lecture/pointprocessscetchB.eps b/pointprocesses/lecture/pointprocessscetchB.eps index d204109..a1e7442 100644 --- a/pointprocesses/lecture/pointprocessscetchB.eps +++ b/pointprocesses/lecture/pointprocessscetchB.eps @@ -1,7 +1,7 @@ %!PS-Adobe-2.0 EPSF-2.0 %%Title: pointprocessscetchB.tex %%Creator: gnuplot 4.6 patchlevel 4 -%%CreationDate: Sun Oct 26 17:34:18 2014 +%%CreationDate: Sun Oct 25 21:47:09 2015 %%DocumentFonts: %%BoundingBox: 50 50 373 237 %%EndComments @@ -433,7 +433,7 @@ SDict begin [ /Author (jan) % /Producer (gnuplot) % /Keywords () - /CreationDate (Sun Oct 26 17:34:18 2014) + /CreationDate (Sun Oct 25 21:47:09 2015) /DOCINFO pdfmark end } ifelse diff --git a/pointprocesses/lecture/pointprocessscetchB.pdf b/pointprocesses/lecture/pointprocessscetchB.pdf index a4c7e8c..ce8a1f1 100644 Binary files a/pointprocesses/lecture/pointprocessscetchB.pdf and b/pointprocesses/lecture/pointprocessscetchB.pdf differ diff --git a/scientificcomputing-script.tex b/scientificcomputing-script.tex index 306a84a..8cbde10 100644 --- a/scientificcomputing-script.tex +++ b/scientificcomputing-script.tex @@ -59,7 +59,8 @@ % figures: \setlength{\fboxsep}{0pt} -\newcommand{\texpicture}[1]{{\sffamily\footnotesize\input{#1.tex}}} +\newcommand{\texinputpath}{} +\newcommand{\texpicture}[1]{{\sffamily\footnotesize\input{\texinputpath#1.tex}}} %\newcommand{\texpicture}[1]{\fbox{\sffamily\footnotesize\input{#1.tex}}} %\newcommand{\texpicture}[1]{\setlength{\fboxsep}{2mm}\fbox{#1}} %\newcommand{\texpicture}[1]{} @@ -213,7 +214,7 @@ \arabic{theexercise}:}\newline \newcommand{\exercisesource}{#1}}% {\ifthenelse{\equal{\exercisesource}{}}{}{\ifthenelse{\value{theexercise}>\value{maxexercise}}{}{\medskip\lstinputlisting{\codepath\exercisesource}}}\medskip\stepcounter{theexercise}} -\graphicspath{{statistics/lecture/}{statistics/lecture/figures/}{bootstrap/lecture/}{bootstrap/lecture/figures/}{likelihood/lecture/}{likelihood/lecture/figures/}} +\graphicspath{{statistics/lecture/}{statistics/lecture/figures/}{bootstrap/lecture/}{bootstrap/lecture/figures/}{likelihood/lecture/}{likelihood/lecture/figures/}{pointprocesses/lecture/}{pointprocesses/lecture/figures/}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -233,4 +234,8 @@ \renewcommand{\codepath}{likelihood/code/} \include{likelihood/lecture/likelihood} +\renewcommand{\codepath}{pointprocesses/code/} +\renewcommand{\texinputpath}{pointprocesses/lecture/} +\include{pointprocesses/lecture/pointprocesses} + \end{document} diff --git a/statistics/lecture/Makefile b/statistics/lecture/Makefile index 445913e..ec84405 100644 --- a/statistics/lecture/Makefile +++ b/statistics/lecture/Makefile @@ -1,22 +1,29 @@ BASENAME=statistics + PYFILES=$(wildcard *.py) PYPDFFILES=$(PYFILES:.py=.pdf) -pdf : $(BASENAME)-chapter.pdf $(PYPDFFILES) +all : pdf + +# script: +pdf : $(BASENAME)-chapter.pdf -$(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex +$(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(PYPDFFILES) pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true $(PYPDFFILES) : %.pdf : %.py python $< clean : - rm -f *~ $(BASENAME)-chapter.aux $(BASENAME)-chapter.log $(BASENAME)-chapter.out $(BASENAME).aux $(BASENAME).log + rm -f *~ + rm -f $(BASENAME).aux $(BASENAME).log + rm -f $(BASENAME)-chapter.aux $(BASENAME)-chapter.log $(BASENAME)-chapter.out + rm -f $(PYPDFFILES) $(GPTTEXFILES) cleanall : clean rm -f $(BASENAME)-chapter.pdf -watch : +watchpdf : while true; do ! make -q pdf && make pdf; sleep 0.5; done diff --git a/statistics/lecture/boxwhisker.py b/statistics/lecture/boxwhisker.py index 1209f7e..38a0dcb 100644 --- a/statistics/lecture/boxwhisker.py +++ b/statistics/lecture/boxwhisker.py @@ -43,5 +43,5 @@ ax.annotate('maximum', ax.boxplot( x, whis=100.0 ) plt.tight_layout() plt.savefig('boxwhisker.pdf') -plt.show() +#plt.show() diff --git a/statistics/lecture/correlation.py b/statistics/lecture/correlation.py index db317c7..2fa85d4 100644 --- a/statistics/lecture/correlation.py +++ b/statistics/lecture/correlation.py @@ -5,7 +5,6 @@ plt.xkcd() fig = plt.figure( figsize=(6,5) ) n = 200 for k, r in enumerate( [ 1.0, 0.6, 0.0, -0.9 ] ) : - print r x = np.random.randn( n ) y = r*x + np.sqrt(1.0-r*r)*np.random.randn( n ) ax = fig.add_subplot( 2, 2, k+1 ) @@ -30,5 +29,4 @@ for k, r in enumerate( [ 1.0, 0.6, 0.0, -0.9 ] ) : plt.tight_layout() plt.savefig('correlation.pdf') -plt.show() - +#plt.show() diff --git a/statistics/lecture/diehistograms.py b/statistics/lecture/diehistograms.py index d5e0380..a8832e0 100644 --- a/statistics/lecture/diehistograms.py +++ b/statistics/lecture/diehistograms.py @@ -28,5 +28,4 @@ ax.set_ylabel( 'Probability' ) ax.hist([x2, x1], bins, normed=True, color=['#FFCC00', '#FFFF66' ]) plt.tight_layout() fig.savefig( 'diehistograms.pdf' ) -plt.show() - +#plt.show() diff --git a/statistics/lecture/median.py b/statistics/lecture/median.py index 2bf420c..a1231f9 100644 --- a/statistics/lecture/median.py +++ b/statistics/lecture/median.py @@ -29,5 +29,4 @@ ax.plot(x,g, 'b', lw=4) ax.plot([0.0, 0.0], [0.0, 0.45], 'k', lw=2 ) plt.tight_layout() fig.savefig( 'median.pdf' ) -plt.show() - +#plt.show() diff --git a/statistics/lecture/nonlincorrelation.py b/statistics/lecture/nonlincorrelation.py index c0ca723..498d985 100644 --- a/statistics/lecture/nonlincorrelation.py +++ b/statistics/lecture/nonlincorrelation.py @@ -39,4 +39,4 @@ ax.scatter( x, z ) plt.tight_layout() plt.savefig('nonlincorrelation.pdf') -plt.show() +#plt.show() diff --git a/statistics/lecture/pdfhistogram.py b/statistics/lecture/pdfhistogram.py index 039b524..a61460e 100644 --- a/statistics/lecture/pdfhistogram.py +++ b/statistics/lecture/pdfhistogram.py @@ -35,5 +35,5 @@ ax.hist(r, 20, normed=True, color='#FFCC00') plt.tight_layout() fig.savefig( 'pdfhistogram.pdf' ) -plt.show() +#plt.show() diff --git a/statistics/lecture/pdfprobabilities.py b/statistics/lecture/pdfprobabilities.py index 6481da1..bcbaa09 100644 --- a/statistics/lecture/pdfprobabilities.py +++ b/statistics/lecture/pdfprobabilities.py @@ -32,5 +32,4 @@ ax.fill_between( x[(x>x1)&(xx1)&(x