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

\newcommand{\ptitle}{Adaptation time-constant}
\input{../header.tex}
\firstpagefooter{Supervisor: Lukas Sonnenberg}{phone:}%
{email: lukas.sonnenberg@uni-tuebingen.de}

\begin{document}

\input{../instructions.tex}
Sensory adaptation is a process that results in a reduced sensitivity of the sensory system to a stimulus. One of the best known examples might be the light adaptation of the eye to constant illumination. The light adaptation that we all know depends on a multitude of processes that regulate the eye sensitivity. Adaptation is not limited to the visual system but is observed even in the responses of individual neurons.  
Stimulating a neuron with a constant stimulus for an extended period
of time often results in a decay of an initially strong response. Your task here is to analyze the spike-frequency adaptation observed in the p-type electroreceptor afferents (aka. P-units) in the electrosensory periphery of the 
of the weakly electric fish \textit{Apteronotus leptorhynchus}. P-units are driven by the fish's own electric field and changes of field's amplitude leads to a modulation of the cell's firing rate. Extended stimulation with an increased field amplitude allows to observe the exponentially decaying firing rate. While the light adaptation of the human eye is relatively slow, the firing rate adaptation observed in P-units is quite fast. It is your task to estimate how fast it is.

\begin{questions}
  \question In the accompanying datasets you find the
  \textit{spike\_times} of an P-unit electroreceptor to a stimulus of
  a certain intensity, i.e. the \textit{contrast} which is also stored
  in the file. The contrast of the stimulus is a measure relative to
  the amplitude of fish's own field amplitude and is given in percent. The data is sampled
  with 20\,kHz sampling frequency and spike times are given in
  milliseconds (not seconds!) relative to stimulus onset.
  \begin{parts}
    \part Plot spike rasters of the data.
    
    \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
    $f_{A,\tau,y_0}(t)$ to appropriate regions of the data:
    \begin{equation}
       f_{A,\tau,y_0}(t) = A \cdot e^{-\frac{t}{\tau}} + y_0,
    \end{equation}
    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}

\end{document}
