\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, to discriminate two
  colors, light intensities, pitch of two tones, sound intensity, etc.
  Here we look at the level of a single neuron. What does it mean 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 light intensities with different intensities $I_1$ and $I_2$ and
  the activity of a ganglion cell in the retina). 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$. For perfect discrimination, the number of
  spikes evoked by the stronger stimulus within $T$ is 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.

  How well can an upstream neuron discriminate the two
  stimuli based on the spike counts $n$? How does this depend on the
  duration $T$ of the observation time?

  The neuron is implemented in the file \texttt{lifspikes.m}.
  Call it like this:
    \begin{lstlisting}
trials = 10;
tmax = 50.0;
input = 15.0; 
spikes = lifspikes(trials, input, tmax);
    \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 given by \texttt{input}.

    Think of calling the \texttt{lifspikes()} 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 time points of the spikes in your
    recordings you get what the \texttt{lifspikes()} function
    returns.

    For the two inputs $I_1$ and $I_2$ use
    \begin{lstlisting}
input = 14.0; % I_1
input = 15.0; % I_2
    \end{lstlisting}

  \begin{parts}
    \part 
    Show two raster plots for the responses to the two different
    stimuli.  Find an appropriate time window and an appropriate
    number of trials for 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 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 depend on the observation time $T$ (use
    values of 10\,ms, 100\,ms, 300\,ms and 1\,s)?

    \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 observation time $T$.

    For which observation times 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}
