\documentclass[a4paper,12pt,pdftex]{exam}

\newcommand{\ptitle}{Reverse reconstruction}
\input{../header.tex}
\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}%
{email: jan.grewe@uni-tuebingen.de}

\begin{document}

\input{../instructions.tex}

%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Reverse reconstruction of the stimulus that evoked a neuronal response.}
When analyzing neuronal responses we want to figure out which aspects of the stimulus are actually encoded in the neuronal response.
One way to do this is to calculate the
Spike-Triggered-Average (STA) and use it to reversely estimate which aspects of the stimulus are encoded in the resopnse.

The STA is the average stimulus that
led to a spike in the neuron:
\[ STA(\tau) = \frac{1}{n} \displaystyle\sum_{i=1}^{n}{s(t_i - \tau)} \]
where $n$ is the number of spikes and $t_i$ is the time of the
$i_{th}$ spike. $\tau$ is a temporal shift relative to the spike
time. 

Another approach to understand the equation is to cut out snippets from the
stimulus that are centered on the respective spike time and by
subsequently averaging these stimulus snippets.



\begin{questions}
  \question In the accompanying data files you find the spike
  responses of a p-type electroreceptor afferent (P-unit) and a
  pyramidal neuron recorded in the hindbrain of the weakly electric
  fish \textit{Apteronotus leptorhynchus}. The respective stimuli are
  stored in separate files. The neuron is stimulated with an amplitude
  modulation of the fish's own electric field. The stored stimulus
  trace is the modulator that is applied to the field and is
  dimensionless, i.e. it has no unit. The data is sampled with
  20\,kHz temporal resolution and spike times are given in
  seconds. Start with the P-unit and, in the end, apply the same
  analyzes/functions to the pyramidal cell.
  \begin{parts}
    \part Familiarize yourself with the cellular responses and the stimulus. 
    \part Estimate the STA and plot it. For the beginning let $\tau$ assume values in the range 
    $\pm50$\,ms. What does it tell? 
  \end{parts}
  \question The STA can be used to reconstruct the stimulus from the neuronal response (reverse
  reconstruction) by convolution of the spiking response with the STA. The reconstructed stimulus can then be compared to
  the original stimulus and provides a good impression about the
  features that are encoded in the neuronal response.
  \begin{parts}
    \part Implement a function that does the reverse reconstruction and uses the STA to reconstruct the stimulus.
    \part Implement a function that estimates the reconstruction quality.
    \part Test the robustness of the reconstruction: Estimate 
    the STA with less and less data and estimate the reconstruction
    error.
    \part Plot the reconstruction error as a function of the amount of data 
    used to estimate the STA and apply a statistical test to test if
    estimating the STA from more data improves the reconstruction.
    \part Repeat the above steps for the pyramidal neuron, what do you
    observe?
  \end{parts}
\end{questions}

\end{document}
