Merge branch 'master' of raven.am28.uni-tuebingen.de:scientificComputing

This commit is contained in:
Jan Grewe 2014-11-02 14:16:59 +01:00
commit 0fdcf2f82e
29 changed files with 922 additions and 7 deletions

View File

@ -5,7 +5,7 @@
Each project has three elements that are graded: (i) the code,
(ii) the slides/figures, and (iii) the presentation.
\vspace{.5cm}
\vspace{1ex}
The {\bf code} and the {\bf presentation} should be uploaded to
ILIAS at latest on Thursday, November 6th, 12:00h.
@ -13,7 +13,7 @@
your presentation as a pdf file. Bundle everything into a
{\em single} zip-file.
\vspace{.5cm}
\vspace{1ex}
The {\bf code} should be exectuable without any further
adjustments from us. This means that you need to include all
@ -25,11 +25,11 @@
and comprehensible by third persons (use proper and consistent
variable names).
\vspace{.5cm} \textbf{Please write your name and matriculation
\vspace{1ex} \textbf{Please write your name and matriculation
number as a comment at the top of a script called \texttt{main.m}!}
The \texttt{main.m} script then should call all your scripts.
\vspace{.5cm}
\vspace{1ex}
The {\bf presentation} should be {\em at most} 10min long and be
held in English. In the presentation you should (i) briefly
@ -38,4 +38,4 @@
figures showing your results. We will store all presentations on
one computer to allow fast transitions between talks.
}}
}}

0
projects/project_adaptation_fit/adaptation_fit.tex Executable file → Normal file
View File

0
projects/project_eod/eod.tex Executable file → Normal file
View File

0
projects/project_eyetracker/eyetracker.tex Executable file → Normal file
View File

View File

@ -7,4 +7,4 @@ clean:
rm -f `basename *.tex .tex`.pdf
zip: latex
zip `basename *.tex .tex`.zip *.pdf *.dat *.mat
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

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,119 @@
\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
duration $W$ of the observation time? 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{lifadaptspikes.m}.
Call it with the following parameters:
\begin{lstlisting}
trials = 10;
tmax = 50.0;
input = 65.0;
Dnoise = 0.1;
adapttau = 0.2;
adaptincr = 0.5;
spikes = lifadaptspikes( trials, input, tmax, Dnoise, adapttau, adaptincr );
\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.
For the two inputs $I_1$ and $I_2$ use
\begin{lstlisting}
input = 65.0; % I_1
input = 75.0; % I_2
\end{lstlisting}
Show two raster plots for the responses to the two differrent stimuli.
\part Generate histograms of the spike counts within $W$ of the
responses to the two differrent stimuli. How do they depend on the observation time $W$
(use values between 1\,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 $W$.
For which observation times 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? For a given $W$ find the threshold $n_{thresh}$ that
results in the best discrimination performance.
\part Also plot the Fano factor as a function of $W$. How is it related to the discriminability?
\uplevel{If you still have time you can continue with the following question:}
\part You may change the two stimuli $I_1$ and $I_2$ and 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.
\end{parts}
\end{questions}
\end{document}

View File

@ -0,0 +1,53 @@
function spikes = lifadaptspikes( trials, input, tmaxdt, D, tauadapt, adaptincr )
% Generate spike times of a leaky integrate-and-fire neuron
% with an adaptation current
% 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
% tauadapt: adaptation time constant
% adaptincr: adaptation strength
tau = 0.01;
if nargin < 4
D = 1e0;
end
if nargin < 5
tauadapt = 0.1;
end
if nargin < 6
adaptincr = 1.0;
end
vreset = 0.0;
vthresh = 10.0;
dt = 1e-4;
if max( size( input ) ) == 1
input = input * ones( ceil( tmaxdt/dt ), 1 );
else
dt = tmaxdt;
end
spikes = cell( trials, 1 );
for k=1:trials
times = [];
j = 1;
v = vreset;
a = 0.0;
noise = sqrt(2.0*D)*randn( length( input ), 1 )/sqrt(dt);
for i=1:length( noise )
v = v + ( - v - a + noise(i) + input(i))*dt/tau;
a = a + ( - a )*dt/tauadapt;
if v >= vthresh
v = vreset;
a = a + adaptincr/tauadapt;
spiketime = i*dt;
if spiketime > 4.0*tauadapt
times(j) = spiketime - 4.0*tauadapt;
j = j + 1;
end
end
end
spikes{k} = times;
end
end

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,109 @@
\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
constant stimuli of intensity $I$ (think of that, for example,
of sound waves with intensities $I$). The neuron has an adaptatation
current that adapts the firing rate with a slow time constant down.
Explore the dependence of interspike interval correlations on the firing rate,
adaptation time constant and noise level.
\begin{parts}
\part The neuron is a neuron with an adaptation current.
It is implemented in the file \texttt{lifadaptspikes.m}. Call it
with the following parameters:
\begin{lstlisting}
trials = 10;
tmax = 50.0;
input = 10.0; % the input I
Dnoise = 1e-2; % noise strength
adapttau = 0.1; % adaptation time constant in seconds
adaptincr = 0.5; % adaptation strength
spikes = lifadaptspikes( trials, input, tmax, Dnoise, adapttau, adaptincr );
\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, the noise strength via \texttt{Dnoise},
and the adaptation time constant via \texttt{adapttau}.
\part Measure the intensity-response curve of the neuron, that is the mean firing rate
as a function of the input for a range of inputs from 0 to 120.
\part Compute the correlations between each interspike interval $T_i$ and the next one $T_{i+1}$
(serial interspike interval correlation at lag 1). Plot this correlation as a function of the
firing rate by varying the input as in (a).
\part How does this dependence change for different values of the adaptation
time constant \texttt{adapttau}? Use values between 10\,ms and
1\,s for \texttt{adapttau}.
\part Determine the firing rate at which the minimum interspike interval correlation
occurs. How does the minimum correlation and this firing rate
depend on the adaptation time constant \texttt{adapttau}?
\part How do the results change if the level of the intrinsic noise \texttt{Dnoise} is modified?
Use values of 1e-4, 1e-3, 1e-2, 1e-1, and 1 for \texttt{Dnoise}.
\uplevel{If you still have time you can continue with the following question:}
\part How do the interspike interval distributions look like for the different noise levels
at some example values for the input and the adaptation time constant?
\end{parts}
\end{questions}
\end{document}

View File

@ -0,0 +1,53 @@
function spikes = lifadaptspikes( trials, input, tmaxdt, D, tauadapt, adaptincr )
% Generate spike times of a leaky integrate-and-fire neuron
% with an adaptation current
% 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
% tauadapt: adaptation time constant
% adaptincr: adaptation strength
tau = 0.01;
if nargin < 4
D = 1e0;
end
if nargin < 5
tauadapt = 0.1;
end
if nargin < 6
adaptincr = 1.0;
end
vreset = 0.0;
vthresh = 10.0;
dt = 1e-4;
if max( size( input ) ) == 1
input = input * ones( ceil( tmaxdt/dt ), 1 );
else
dt = tmaxdt;
end
spikes = cell( trials, 1 );
for k=1:trials
times = [];
j = 1;
v = vreset;
a = 0.0;
noise = sqrt(2.0*D)*randn( length( input ), 1 )/sqrt(dt);
for i=1:length( noise )
v = v + ( - v - a + noise(i) + input(i))*dt/tau;
a = a + ( - a )*dt/tauadapt;
if v >= vthresh
v = vreset;
a = a + adaptincr/tauadapt;
spiketime = i*dt;
if spiketime > 4.0*tauadapt
times(j) = spiketime - 4.0*tauadapt;
j = j + 1;
end
end
end
spikes{k} = times;
end
end

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,140 @@
\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 two neurons in response to
a constant stimulus $I$ (think of it, for example,
of a sound wave with intensity $I$).
For different inputs $I$ the interspike interval ($T$) distribution looks
quite different. You want to compare these distributions to
the following three standard distributions.
The first is the exponential distribution of a Poisson spike train:
\begin{equation}
\label{exppdf}
p_{exp}(T) = \lambda e^{-\lambda T}
\end{equation}
where $\lambda$ is the mean firing rate of the response.
The second distribution is the inverse Gaussian:
\begin{equation}
\label{invgauss}
p_\mathrm{ig}(T) = \frac{1}{\sqrt{4 \pi D T^{3}}} \exp \left[ - \frac{(T - \mu)^{2} }{4 D T \mu^{2}} \right]
\end{equation}
where $\mu$ is the mean interspike interval and
$D=\textrm{var}(T)/(2\mu^3)$ is the so called diffusion coefficient.
The third one was derived for neurons driven with colored noise:
\begin{equation}\label{pcn}
p_\mathrm{cn}(T)=\frac{1}{2\tau\sqrt{4\pi\epsilon\gamma_1^3}}\exp\left[-\frac{(T-\mu)^2}{4\epsilon\tau^2\gamma_1}\right]\left\{\frac{[(\mu-T)\gamma_2+2\gamma_1\tau]^2}{2\gamma_1\tau^2}-\epsilon(\gamma_2^2-2\gamma_1e^{-T/\tau})\right\}
\end{equation}
with $\gamma_1(T)=T/\tau+e^{-T/\tau}-1$, $\gamma_2(T)=1-e^{-T/\tau}$
and correlation time of the colored noise $\tau$.
Eq.~(\ref{pcn}) thus has the three parameter $\mu$, $\epsilon>0$, and $\tau$.
The squared coefficient of variation (standard deviation of the
interspike intervals divided by their mean) of the density
eq.~(\ref{pcn}) is given by
\begin{equation}
\label{cvpcn}
C_V^2=\frac{2}{\delta}\left[\epsilon\left(1-\frac{1-e^{-\delta}}{\delta}\right)+\epsilon^2\left(e^{-\delta}+\frac{(1-e^{-\delta})(1-2e^{-\delta})}{\delta}\right)\right]
\end{equation}
with $\delta=\mu/\tau$.
\begin{parts}
\part The two neurons are implemented in the files \texttt{pifouspikes.m}
and \texttt{lifouspikes.m}.
Call them with the following parameters:
\begin{lstlisting}
trials = 10;
tmax = 50.0;
input = 10.0; % the input I
Dnoise = 1.0; % noise strength
outau = 1.0; % correlation time of the noise in seconds
spikes = pifouspikes( trials, input, tmax, Dnoise, outau );
\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.
\part Find for both model neurons the inputs $I_i$ required to make the fire with a mean rate
of 10, 20, 50, and 100\,Hz.
\part Compute interspike interval distributions of the two model neurons for these inputs $I_i$.
\part Compare the interspike interval distributions with the exponential
distribution eq.~(\ref{exppdf}) and the inverse Gaussian
eq.~(\ref{invgauss}) by measuring their parameters from the
interspike intervals. How well do theu describe the real
distributions for the different conditions?
\part Also fit eq.~(\ref{pcn}) to the data. Here you need to apply a non-linear fit algorithm.
How well does this function describe the data?
Compare the fitted value for $\tau$ with the one used for the model (\texttt{outau}).
\uplevel{If you still have time you can continue with the following question:}
\part Compare the measured coefficient of variation with eq.~(\ref{cvpcn}).
\part Repeat your analysis for different values of the intrinsic noise strengh of the neurons
\texttt{Dnoise}. Increase or decrease it in factors of ten.
\end{parts}
\end{questions}
\end{document}

View File

@ -0,0 +1,44 @@
function spikes = lifouspikes( trials, input, tmaxdt, D, outau )
% 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
% outau: time constant of the colored noise
tau = 0.01;
if nargin < 4
D = 1e0;
end
if nargin < 5
outau = 1.0;
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
spikes = cell( trials, 1 );
for k=1:trials
times = [];
j = 1;
n = 0.0;
v = vreset;
noise = sqrt(2.0*D)*randn( length( input ), 1 )/sqrt(dt);
for i=1:length( noise )
n = n + ( - n + noise(i))*dt/outau;
v = v + ( - v + n + input(i))*dt/tau;
if v >= vthresh
v = vreset;
times(j) = i*dt;
j = j + 1;
end
end
spikes{k} = times;
end
end

View File

@ -0,0 +1,44 @@
function spikes = pifouspikes( trials, input, tmaxdt, D, outau )
% Generate spike times of a perfect 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
% outau: time constant of the colored noise
tau = 0.01;
if nargin < 4
D = 1e0;
end
if nargin < 5
outau = 1.0;
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
spikes = cell( trials, 1 );
for k=1:trials
times = [];
j = 1;
n = 0.0;
v = vreset;
noise = sqrt(2.0*D)*randn( length( input ), 1 )/sqrt(dt);
for i=1:length( noise )
n = n + ( - n + noise(i))*dt/outau;
v = v + ( n + input(i))*dt/tau;
if v >= vthresh
v = vreset;
times(j) = i*dt;
j = j + 1;
end
end
spikes{k} = times;
end
end

0
projects/project_mutualinfo/mutualinfo.tex Executable file → Normal file
View File

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,38 @@
function spikes = lifspikes( trials, input, tmaxdt, D )
% 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
tau = 0.01;
if nargin < 4
D = 1e0;
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
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) + input(i))*dt/tau;
if v >= vthresh
v = vreset;
times(j) = i*dt;
j = j + 1;
end
end
spikes{k} = times;
end
end

View File

@ -0,0 +1,91 @@
\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
constant stimuli of intensity $I$ (think of that, for example,
of sound waves with intensities $I$).
Measure the tuning curve (also called the intensity-response curve) of the
neuron. That is, what is the firing rate of the neuron's response
as a function of the input $I$. How does this depend on the level of
the intrinsic noise of the neuron?
\begin{parts}
\part The neuron is implemented in the file \texttt{lifspikes.m}.
Call it with the following parameters:
\begin{lstlisting}
trials = 10;
tmax = 50.0;
input = 10.0; % the input I
Dnoise = 1.0; % noise strength
spikes = lifspikes( trials, input, tmax, Dnoise );
\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, the noise strength via \texttt{Dnoise}.
\part First set the noise \texttt{Dnoise=0} (no noise). Compute and plot the firing rate
as a function of the input for inputs ranging from 0 to 20.
\part Do the same for various noise strength \texttt{Dnoise}. Use $D_{noise} = 1e-3$,
1e-2, and 1e-1. How does the intrinsic noise influence the response curve?
\part Show some interspike interval histograms for some interesting values of the input
and the noise strength.
\end{parts}
\end{questions}
\end{document}

0
projects/project_numbers/numbers.tex Executable file → Normal file
View File

0
projects/project_onset_fi/onset_fi.tex Executable file → Normal file
View File

0
projects/project_q-values/qvalues.tex Executable file → Normal file
View File

0
projects/project_spectra/spectra.tex Executable file → Normal file
View File

0
projects/project_steady_fi/steady_state_fi.tex Executable file → Normal file
View File

View File

View File

@ -7,4 +7,4 @@ clean:
rm -f `basename *.tex .tex`.pdf
zip: latex
zip `basename *.tex .tex`.zip *.pdf *.dat *.mat
zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m

0
projects/project_template/template.tex Executable file → Normal file
View File