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

\newcommand{\ptitle}{Stimulus discrimination: gain}
\input{../header.tex}
\firstpagefooter{Supervisor: Jan Benda}{}{email: jan.benda@uni-tuebingen.de}

\begin{document}

\input{../instructions.tex}

An important property of sensory systems is their ability to
discriminate similar stimuli. For example, discrimination of two
colors, light intensities, pitch of two tones, sound intensities, etc.
Here we look at the level of a single neuron. What does it mean in
terms of the neuron's $f$-$I$ curve (firing rate versus stimulus
intensity) that two similar stimuli can be discriminated given the
spike train responses that have been evoked by the two stimuli?

You are recording the activity of a neuron in response to two
different stimuli $I_1$ and $I_2$ (think of them, for example, of two
different sound intensities, $I_1$ and $I_2$, and the spiking activity
of an auditory afferent). The neuron responds to a stimulus with a
number of spikes. You (an upstream neuron) can count the number of
spikes of this response within an observation time of duration
$T=100$\,ms. For perfect discrimination, the number of spikes evoked
by the stronger stimulus within $T$ is always larger than for the
smaller stimulus. The situation is more complicated, because the
number of spikes evoked by one stimulus is not fixed but varies, such
that the number of spikes evoked by the stronger stimulus could happen
to be lower than the number of spikes evoked by the smaller stimulus.

The central questions of this project are:
\begin{itemize}
\item How can an upstream neuron discriminate two stimuli based on the
  spike counts $n$?
\item How does this depend on the gain of the neuron?
\end{itemize}

The neuron is implemented in the file \texttt{lifboltzmannspikes.m}.
Call it with the following parameters:\vspace{-5ex}
\begin{lstlisting}
trials = 10;
tmax = 50.0;
gain = 0.1;
input = 10.0;
spikes = lifboltzmanspikes(trials, input, tmax, gain);
\end{lstlisting}
The returned \texttt{spikes} is a cell array with \texttt{trials}
elements, each being a vector of spike times (in seconds) computed for
a duration of \texttt{tmax} seconds.  The intensity of the stimulus is
set via the \texttt{input} variable.

Think of calling the \texttt{lifboltzmannspikes()} function as a
simple way of doing an electrophysiological experiment. You are
presenting a stimulus with an intensity $I$ that you set. The neuron
responds to this stimulus, and you record this response. After
detecting the timepoints of the spikes in your recordings you get what
the \texttt{lifboltzmannspikes()} function returns. In addition you
can record from different neurons with different properties by setting
the \texttt{gain} parameter to different values.

\begin{questions}
  \question Spike counts of the responses
  \begin{parts}
    \part Measure the tuning curve of the neuron with respect to the
    input. That is, compute the mean firing rate (number of spikes
    within the recording time \texttt{tmax} divided by \texttt{tmax}
    and averaged over trials) as a function of the input
    strength. Find an appropriate range of input values.  

    Plot the tuning curve for four different neurons that differ in
    their \texttt{gain} property. Use 0.1, 0.2, 0.5 and 1 as values
    for the \texttt{gain} parameter. Why is this parameter called 'gain'?

    \part Show two raster plots for the responses to two different
    stimuli with $I_1=10$ and $I_2=11$. Set the gain of the neuron to
    0.1.  Use an appropriate time window and an appropriate number of
    trials for illustrating the spike raster.

    Just by looking at the raster plots, can you discriminate the two
    stimuli? That is, do you see differences between the two
    responses?

    \part Generate properly normalized histograms of the spike counts
    within windows of duration $T$ (use $T=100$\,ms) of the spike
    responses to the two different stimuli.

    Do the two histograms overlap? What does this mean for the
    discriminability of the two stimuli?

    How do the histograms of the spike counts depend on the gain of
    the neuron? Plot them for the four different values of the gain
    used in (a).
  \end{parts}
  
  \question Discriminability of the responses
  \begin{parts}
    \part \label{discrmeasure} Think about a measure based on the
    spike-count histograms that quantifies how well the two stimuli
    can be distinguished based on the spike counts.

    \underline{Hint:} A possible readout is to set a threshold
    $n_{thresh}$ for the observed spike count.  Any response smaller
    than the threshold assumes that the stimulus was $I_1$, any
    response larger than the threshold assumes that the stimulus was
    $I_2$. For the given window $T$ find the threshold $n_{thresh}$ that
    results in the best discrimination performance. How can you
    quantify ``best discrimination'' performance?

    \part \label{gaindiscr} For which gains can the two stimuli perfectly discriminated?

    Plot the dependence of this measure as a function of the gain of
    the neuron.

    \part Another way to quantify the discriminability of the spike
    counts in response to the two stimuli is to apply an appropriate
    statistical test and check for significant differences. How does
    this compare to your findings from (\ref{gaindiscr})?

 \end{parts}

\end{questions}

\end{document}