\documentclass[addpoints,11pt]{exam}
\usepackage{url}
\usepackage{color}
\usepackage{hyperref}

\pagestyle{headandfoot}
\runningheadrule
\firstpageheadrule
\firstpageheader{Scientific Computing}{Project Assignment}{11/02/2014
  -- 11/05/2014}
%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014}
\firstpagefooter{}{}{{\bf Supervisor:} Jan Benda}
\runningfooter{}{}{}
\pointsinmargin
\bracketedpoints

%\printanswers
%\shadedsolutions

%%%%% 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=11pt,
 %title=\lstname,
% title={\protect\filename@parse{\lstname}\protect\filename@base.\protect\filename@ext}
 }


\begin{document}
%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%%
\sffamily
% \begin{flushright}
% \gradetable[h][questions]
% \end{flushright}

\begin{center}
  \input{../disclaimer.tex}
\end{center}

%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%

\begin{questions}
  \question 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:
  \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{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 $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).

    \part 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. Plot the dependence of this measure as
    a function of the gain of the neuron.

    For which gains can the two stimuli perfectly discriminated?

    \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 a given $T$ find the threshold $n_{thresh}$ that
    results in the best discrimination performance. How can you
    quantify ``best discrimination'' performance?

 \end{parts}

\end{questions}

\end{document}
