Jan Bs projects

This commit is contained in:
2014-11-02 13:35:52 +01:00
parent 123442932f
commit 896c6d858e
29 changed files with 922 additions and 7 deletions

View File

@@ -0,0 +1,10 @@
latex:
pdflatex *.tex > /dev/null
pdflatex *.tex > /dev/null
clean:
rm -rf *.log *.aux *.zip *.out auto
rm -f `basename *.tex .tex`.pdf
zip: latex
zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m

View File

@@ -0,0 +1,133 @@
\documentclass[addpoints,10pt]{exam}
\usepackage{url}
\usepackage{color}
\usepackage{hyperref}
\pagestyle{headandfoot}
\runningheadrule
\firstpageheadrule
\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014
-- 11/06/2014}
%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014}
\firstpagefooter{}{}{}
\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=10pt,
%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 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 sound waves with different intensities $I_1$ and
$I_2$). Within an observation time of duration $W$ the neuron
responds stochastically with $n_i$ spikes.
How well can an upstream neuron discriminate the two stimuli based
on the spike counts $n_i$? How does this depend on the slope of the
tuning curve of the neural responses? How is this related to the
fano factor (the ratio between the variance and the mean of the
spike counts)?
\begin{parts}
\part The neuron is implemented in the file \texttt{lifboltzmanspikes.m}.
Call it with the following parameters:
\begin{lstlisting}
trials = 10;
tmax = 50.0;
Dnoise = 1.0;
imax = 25.0;
ithresh = 10.0;
slope=0.2;
input = 10.0;
spikes = lifboltzmanspikes( trials, input, tmax, Dnoise, imax, ithresh, slope );
\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 input is set via the \texttt{input} variable.
For the two inputs use $I_1=10$ and $I_2=I_1 + 1$.
First, show two raster plots for the responses to the two differrent stimuli.
\part Measure the tuning curve of the neuron with respect to the input. That is,
compute the mean firing rate as a function of the input
strength. Find an appropriate range of input values. Do this for
different values of the \texttt{slope} parameter (values between
0.1 and 2.0).
\part Generate histograms of the spike counts within $W=200$\,ms of the
responses to the two differrent stimuli $I_1$ and $I_2$. How do they depend on the slope
of the tuning curve of the neuron?
\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 $W$.
For which slopes can the two stimuli perfectly discriminated?
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$. What is the
probability that the stimulus was indeed $I_1$ or $I_2$,
respectively? Find the threshold $n_{thresh}$ that
results in the best discrimination performance.
\part Also plot the Fano factor as a function of the slope. How is it related to the discriminability?
\uplevel{If you still have time you can continue with the following questions:}
\part You may change the difference between the two stimuli $I_1$ and $I_2$
as well as the intrinsic noise of the neuron via \texttt{Dnoise}
(change it in factors of ten, higher values will make the
responses more variable) and repeat your analysis.
\part For $I_1=10$ the mean firing is about $80$\,Hz. When changing the slope of the tuning curve
this firing rate may also change. Improve your analysis by finding for each slope the input
that results exactly in a firing rate of $80$\,Hz. Set $I_2$ on unit above $I_1$.
\part How does the dependence of the stimulus discrimination performance on the slope change
when you set both $I_1$ and $I_2$ such that they evoke $80$ and
$100$\,Hz firing rate, respectively?
\end{parts}
\end{questions}
\end{document}

View File

@@ -0,0 +1,51 @@
function spikes = lifboltzmanspikes( trials, input, tmaxdt, D, imax, ithresh, slope )
% Generate spike times of a leaky integrate-and-fire neuron
% trials: the number of trials to be generated
% input: the stimulus either as a single value or as a vector
% tmaxdt: in case of a single value stimulus the duration of a trial
% in case of a vector as a stimulus the time step
% D: the strength of additive white noise
% imax: maximum output of boltzman
% ithresh: threshold of boltzman input
% slope: slope factor of boltzman input
tau = 0.01;
if nargin < 4
D = 1e0;
end
if nargin < 5
imax = 20;
end
if nargin < 6
ithresh = 10;
end
if nargin < 7
slope = 1;
end
vreset = 0.0;
vthresh = 10.0;
dt = 1e-4;
if length( input ) == 1
input = input * ones( ceil( tmaxdt/dt ), 1 );
else
dt = tmaxdt;
end
inb = imax./(1.0+exp(-slope.*(input - ithresh)));
spikes = cell( trials, 1 );
for k=1:trials
times = [];
j = 1;
v = vreset;
noise = sqrt(2.0*D)*randn( length( input ), 1 )/sqrt(dt);
for i=1:length( noise )
v = v + ( - v + noise(i) + inb(i))*dt/tau;
if v >= vthresh
v = vreset;
times(j) = i*dt;
j = j + 1;
end
end
spikes{k} = times;
end
end