Merge branch 'master' of whale.am28.uni-tuebingen.de:scientificComputing

This commit is contained in:
Jan Grewe 2018-02-06 23:21:53 +01:00
commit 02e9014c32
41 changed files with 173 additions and 152 deletions

View File

@ -28,6 +28,8 @@
\subsection{Polar plot}
\subsection{print instead of saveas????}
\subsection{Movies and animations}
\section{TODO}

View File

@ -7,7 +7,7 @@
%%%%% layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry}
\pagestyle{headandfoot}
\header{{\bfseries\large Scientific Computing}}{{\bfseries\large Project: \ptitle}}{{\bfseries\large Januar 18th, 2018}}
\header{\textbf{\large Scientific Computing Project: \ptitle}}{}{\textbf{\large January 18th, 2018}}
\runningfooter{}{\thepage}{}
\setlength{\baselineskip}{15pt}
@ -15,6 +15,8 @@
\setlength{\parskip}{0.3cm}
\renewcommand{\baselinestretch}{1.15}
\setcounter{secnumdepth}{-1}
%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{listings}
\lstset{

View File

@ -1,31 +1,31 @@
\setlength{\fboxsep}{2ex}
\fbox{\parbox{1\linewidth}{\small
\fbox{\parbox{0.95\linewidth}{\small
{\bf Evaluation criteria:}
\textbf{Evaluation criteria:}
Each project has three elements that are graded: (i) the code,
(ii) the slides/figures, and (iii) the presentation.
(ii) the quality of the figures, and (iii) the presentation (see below).
\vspace{1ex}
{\bf Dates:}
\textbf{Dates:}
The {\bf code} and the {\bf presentation} should be uploaded to
The code and the presentation should be uploaded to
ILIAS at latest on Sunday, February 4th, 23:59h. We will
store all presentations on one computer to allow fast
transitions between talks. The presentations start on Monday,
February 5th at 9:15h.
\vspace{1ex}
{\bf Files:}
\textbf{Files:}
Please hand in your presentation as a pdf file. Bundle
everything (the pdf, the code, and the data) into a {\em single}
zip-file.
\vspace{1ex}
{\bf Code:}
\textbf{Code:}
The {\bf code} should be executable without any further
The code should be executable without any further
adjustments from our side. A single \texttt{main.m} script
should coordinate the analysis by calling functions and
sub-scripts and should produce the {\em same} figures
@ -43,17 +43,15 @@
\vspace{1ex}
{\bf Presentation:}
\textbf{Presentation:}
The {\bf presentation} should be {\em at most} 10min long and be
held in English. In the presentation you should (i) briefly
describe the problem, (ii) present figures introducing, showing,
and discussing your results, and (iii) explain how you solved
the problem algorithmically (don't show your entire code). All
data-related figures you show in the presentation should be
produced by your program --- no editing or labeling by
PowerPoint or other software. It is always a good idea to
illustrate the problem with basic plots of the raw-data. Make
sure the axis labels are large enough!
The presentation should be {\em at most} 10min long and be held
in English. In the presentation you should present figures
introducing, explaining, showing, and discussing your data,
methods, and results. All data-related figures you show in the
presentation should be produced by your program --- no editing
or labeling by PowerPoint or other software. It is always a good
idea to illustrate the problem with basic plots of the
raw-data. Make sure the axis labels are large enough!
}}

View File

@ -11,10 +11,10 @@
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Estimating the adaptation time-constant.}
\section{Estimating the adaptation time-constant}
Stimulating a neuron with a constant stimulus for an extended period of time
often leads to a strong initial response that relaxes over time. This
process is called adaptation and is ubiquitous. Your task here is to
process is called adaptation. Your task here is to
estimate the time-constant of the firing-rate adaptation in P-unit
electroreceptors of the weakly electric fish \textit{Apteronotus
leptorhynchus}.
@ -26,27 +26,41 @@ electroreceptors of the weakly electric fish \textit{Apteronotus
in the file. The contrast of the stimulus is a measure relative to
the amplitude of fish's field, it has no unit. The data is sampled
with 20\,kHz sampling frequency and spike times are given in
milliseconds relative to the stimulus onset.
milliseconds (not seconds!) relative to the stimulus onset.
\begin{parts}
\part Estimate for each stimulus intensity the PSTH and plot
it. You will see that there are three parts. (i) The first
200\,ms is the baseline (no stimulus) activity. (ii) During the
next 1000\,ms the stimulus was switched on. (iii) After stimulus
offset the neuronal activity was recorded for further 825\,ms.
\part Estimate for each stimulus intensity the PSTH. You will see
that there are three parts: (i) The first 200\,ms is the baseline
(no stimulus) activity. (ii) During the next 1000\,ms the stimulus
was switched on. (iii) After stimulus offset the neuronal activity
was recorded for further 825\,ms. Find an appropriate bin-width
for the PSTH.
\part Estimate the adaptation time-constant for both the stimulus
on- and offset. To do this fit an exponential function to the
data. For the decay use:
\begin{equation}
f_{A,\tau,y_0}(t) = y_0 + A \cdot e^{-\frac{t}{\tau}},
\end{equation}
where $y_0$ the offset, $A$ the amplitude, $t$ the time, $\tau$
the time-constant.
For the increasing phases use an exponential of the form:
on- and offset. To do this fit an exponential function
$f_{A,\tau,y_0}(t)$ to appropriate regions of the data:
\begin{equation}
f_{A,\tau, y_0}(t) = y_0 + A \cdot \left(1 - e^{-\frac{t}{\tau}}\right ),
f_{A,\tau,y_0}(t) = A \cdot e^{-\frac{t}{\tau}} + y_0,
\end{equation}
\part Plot the best fits into the data.
\part Plot the estimated time-constants as a function of stimulus intensity.
where $t$ is time, $A$ the (positive or negative) amplitude of the
exponential decay, $\tau$ the adaptation time-constant, and $y_0$
an offset.
Before you do the fitting, familiarize yourself with the three
parameter of the exponential function. What is the value of
$f_{A,\tau,y_0}(t)$ at $t=0$? What is the value for large times? How does
$f_{A,\tau,y_0}(t)$ change if you change either of the parameter?
Which of the parameter could you directly estimate from the data
(without fitting)?
How could you get good estimates for the other parameter?
Do the fit and show the resulting exponential function together
with the data.
\part Do the estimated time-constants depend on stimulus intensity?
Use an appropriate statistical test to support your observation.
\end{parts}
\end{questions}

View File

@ -0,0 +1,73 @@
\documentclass[a4paper,12pt,pdftex]{exam}
\newcommand{\ptitle}{F-I curves}
\input{../header.tex}
\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}%
{email: jan.grewe@uni-tuebingen.de}
\begin{document}
\input{../instructions.tex}
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
\section{Quantifying the responsiveness of a neuron by its F-I curves}
The responsiveness of a neuron is often quantified using an F-I
curve. The F-I curve plots the \textbf{F}iring rate of the neuron as a
function of the stimulus \textbf{I}ntensity.
\begin{questions}
\question In the accompanying datasets you find the
\textit{spike\_times} of an P-unit electroreceptor of the weakly
electric fish \textit{Apteronotus leptorhynchus} to a stimulus of a
certain intensity, i.e. the \textit{contrast}. The spike times are
given in milliseconds relative to the stimulus onset.
\begin{parts}
\part For each stimulus intensity estimate the average response
(PSTH) and plot it. You will see that there are three parts. (i)
The first 200\,ms is the baseline (no stimulus) activity. (ii)
During the next 1000\,ms the stimulus was switched on. (iii) After
stimulus offset the neuronal activity was recorded for further
825\,ms.
\part Extract the neuron's activity for every 50\,ms after
stimulus onset and for one 50\,ms slice before stimulus onset.
For each time slice plot the resulting F-I curve by plotting the
computed firing rates against the corresponding stimulus
intensity, respectively the contrast.
\part Fit a Boltzmann function to each of the F-I-curves. The
Boltzmann function is a sigmoidal function and is defined as
\begin{equation}
f(x) = \frac{\alpha-\beta}{1+e^{-k(x-x_0)}}+\beta \; .
\end{equation}
$x$ is the stimulus intensity, $\alpha$ is the starting
firing rate, $\beta$ the saturation firing rate, $x_0$ defines the
position of the sigmoid, and $k$ (together with $\alpha-\beta$)
sets the slope.
Before you do the fitting, familiarize yourself with the four
parameter of the Boltzmann function. What is its value for very
large or very small stimulus intensities? How does the Boltzmann
function change if you change either of the parameter?
How could you get good initial estimates for the parameter?
Do the fits and show the resulting Boltzmann functions together
with the corresponding data.
\part Illustrate how the F-I curves change in time also by means
of the parameter you obtained from the fits with the Boltzmann
function.
Which parameter stay the same, which ones change with time?
Support your conclusion with appropriate statistical tests.
\part Discuss you results with respect to encoding of different
stimulus intensities.
\end{parts}
\end{questions}
\end{document}

View File

@ -19,26 +19,34 @@
object was reported by the subject.
\begin{parts}
\part Plot the data appropriately.
\part Plot the data appropriately.
\part Compute a 2-d histogram that shows how often different
combinations of reported and presented came up.
combinations of reported and presented came up.
\part Normalize the histogram such that it sums to one (i.e. make
it a probability distribution $P(x,y)$ where $x$ is the presented
object and $y$ is the reported object). Compute the probability
distributions $P(x)$ and $P(y)$ in the same way.
\part Use that probability distribution to compute the mutual
information $$I[x:y] = \sum_{x\in\{1,2\}}\sum_{y\in\{1,2\}} P(x,y)
\log_2\frac{P(x,y)}{P(x)P(y)}$$ that the answers provide about the
actually presented object.
information
\[ I[x:y] = \sum_{x\in\{1,2\}}\sum_{y\in\{1,2\}} P(x,y)
\log_2\frac{P(x,y)}{P(x)P(y)}\]
that the answers provide about the actually presented object.
The mutual information is a measure from information theory that is
used in neuroscience to quantify, for example, how much information
a spike train carries about a sensory stimulus.
\part What is the maximally achievable mutual information (try to
find out by generating your own dataset which naturally should
yield maximal information)?
\part Use bootstrapping to compute the $95\%$ confidence interval
for the mutual information estimate in that dataset.
\part Use bootstrapping (permutation test) to compute the $95\%$
confidence interval for the mutual information estimate in the
dataset from {\tt decisions.mat}.
\end{parts}
\end{questions}

View File

@ -1,47 +0,0 @@
\documentclass[a4paper,12pt,pdftex]{exam}
\newcommand{\ptitle}{Onset f-I curve}
\input{../header.tex}
\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}%
{email: jan.grewe@uni-tuebingen.de}
\begin{document}
\input{../instructions.tex}
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Quantifying the responsiveness of a neuron using the F-I curve.}
The responsiveness of a neuron is often quantified using an F-I
curve. The F-I curve plots the \textbf{F}iring rate of the neuron as a
function of the stimulus \textbf{I}ntensity.
\begin{questions}
\question In the accompanying datasets you find the
\textit{spike\_times} of an P-unit electroreceptor of the weakly
electric fish \textit{Apteronotus leptorhynchus} to a stimulus of a
certain intensity, i.e. the \textit{contrast}. The spike times are
given in milliseconds relative to the stimulus onset.
\begin{parts}
\part For each stimulus intensity estimate the average response
(PSTH) and plot it. You will see that there are three parts. (i)
The first 200\,ms is the baseline (no stimulus) activity. (ii)
During the next 1000\,ms the stimulus was switched on. (iii) After
stimulus offset the neuronal activity was recorded for further
825\,ms.
\part Extract the neuron's activity in the first 50\,ms after
stimulus onset and plot it against the stimulus intensity,
respectively the contrast, in an appropriate way.
\part Fit a Boltzmann function to the FI-curve. The Boltzmann function
is defined as:
\begin{equation}
y=\frac{\alpha-\beta}{1+e^{(x-x_0)/\Delta x}}+\beta,
\end{equation}
where $\alpha$ is the starting firing rate, $\beta$ the saturation
firing rate, $x$ the current stimulus intensity, $x_0$ starting
stimulus intensity, and $\Delta x$ a measure of the slope.
\part Plot the fit into the data.
\end{parts}
\end{questions}
\end{document}

View File

@ -16,10 +16,9 @@
\question P-unit electroreceptor afferents of the gymnotiform weakly
electric fish \textit{Apteronotus leptorhynchus} are spontaneously
active when the fish is not electrically stimulated.
\begin{itemize}
\item How do the firing rates and the serial correlations of the
interspike intervals vary between different cells?
\end{itemize}
How do the firing rates and the serial correlations of the
interspike intervals vary between different cells?
In the file \texttt{baselinespikes.mat} you find two variables:
\texttt{cells} is a cell-array with the names of the recorded cells
@ -34,7 +33,7 @@
this project.
By just looking on the spike rasters, what are the differences
betwen the cells?
between the cells?
\part Compute the firing rate of each cell, i.e. number of spikes per time.
@ -46,15 +45,18 @@
correlations similar betwen the cells? How do they differ?
\part Implement a permutation test for computing the significance
at a 1\,\% level of the serial correlations. Illustrate for a few
cells the computed serial correlations and the 1\,\% and 99\,\%
percentile from the permutation test. At which lag are the serial
correlations clearly significant?
at an appropriate significance level of the serial
correlations. Keep in mind that you test the correlations at 10
different lags. At which lags are the serial correlations
statistically significant?
\part Are the serial correlations somehow dependent on the firing rate?
Plot the significant correlations against the firing rate. Do you
observe any dependence?
Use an appropriate statistical test to support your observation.
\end{parts}
\end{questions}

View File

@ -1,3 +0,0 @@
ZIPFILES=
include ../project.mk

View File

@ -1,45 +0,0 @@
\documentclass[a4paper,12pt,pdftex]{exam}
\newcommand{\ptitle}{Steady-state f-I curve}
\input{../header.tex}
\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}%
{email: jan.grewe@uni-tuebingen.de}
\begin{document}
\input{../instructions.tex}
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Quantifying the responsiveness of a neuron using the F-I curve.}
The responsiveness of a neuron is often quantified using an F-I
curve. The F-I curve plots the \textbf{F}iring rate of the neuron as a function
of the stimulus \textbf{I}ntensity.
\begin{questions}
\question In the accompanying datasets you find the
\textit{spike\_times} of an P-unit electrorecptor of the weakly
electric fish \textit{Apteronotus leptorhynchus} to a stimulus of a
certain intensity, i.e. the \textit{contrast}. The contrast is also
part of the file name itself.
\begin{parts}
\part Estimate for each stimulus intensity the average response
(PSTH) and plot it. You will see that there are three parts. (i)
The first 200 ms is the baseline (no stimulus) activity. (ii) During
the next 1000 ms the stimulus was switched on. (iii) After stimulus
offset the neuronal activity was recorded for further 825 ms.
\part Extract the neuron's activity in the last 200 ms before
stimulus offset and plot it against the stimulus intensity or the
contrast, respectively.
\part Fit a Boltzmann function to the FI-curve. The Boltzmann function
is defined as:
\begin{equation}
y=\frac{\alpha-\beta}{1+e^{(x-x_0)/\Delta x}}+\beta,
\end{equation}
where $\alpha$ is the starting firing rate, $\beta$ the saturation
firing rate, $x$ the current stimulus intensity, $x_0$ starting
stimulus intensity, and $\Delta x$ a measure of the slope.
\end{parts}
\end{questions}
\end{document}

View File

@ -16,8 +16,25 @@
\input{regression}
Example for fit with matlab functions lsqcurvefit, polyfit
\section{Fitting in practice}
Fit with matlab functions lsqcurvefit, polyfit
\subsection{Non-linear fits}
\begin{itemize}
\item Example that illustrates the Nebenminima Problem (with error surface)
\item You need got initial values for the parameter!
\item Example that fitting gets harder the more parameter yuo have.
\item Try to fix as many parameter before doing the fit.
\item How to test the quality of a fit? Residuals. $\Chi^2$ test. Run-test.
\end{itemize}
\subsection{Linear fits}
\begin{itemize}
\item Polyfit is easy: unique solution!
\item Example for overfitting with polyfit of a high order (=number of data points)
\end{itemize}
Example for overfitting with polyfit of a high order (=number of data points)
\end{document}