diff --git a/projects/project_fano_slope/fano_slope.tex b/projects/project_fano_slope/fano_slope.tex index 1fdc0b4..477b770 100644 --- a/projects/project_fano_slope/fano_slope.tex +++ b/projects/project_fano_slope/fano_slope.tex @@ -51,102 +51,105 @@ %%%%%%%%%%%%%% 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$ and - you measure the activity of an auditory neuron). Within an - observation time of duration $W$ the neuron responds stochastically - with $n$ spikes. - - How well can an upstream neuron discriminate the two stimuli based - on the spike count $n$? 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)? - - The neuron is implemented in the file \texttt{lifboltzmanspikes.m}. + \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} + \begin{lstlisting} trials = 10; tmax = 50.0; -Dnoise = 1.0; -imax = 25.0; -ithresh = 10.0; -slope=0.2; +gain = 0.1; 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. - - Think of calling the \texttt{lifboltzmanspikes()} function as a - simple way of doing an electrophysiological experiment. You are - presenting a stimulus with a constant 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{lifboltzmanspikes()} function - returns. The advantage over real data is, that you have the - possibility to simply modify the properties of the neuron via the - \texttt{Dnoise}, \texttt{imax}, \texttt{ithresh}, and - \texttt{slope} parameter. - - For the two inputs use $I_1=10$ and $I_2=I_1 + 1$. +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 - 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 (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. Do this for - different values of the \texttt{slope} parameter (values between - 0.1 and 2.0). + 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 For the two differrent stimuli $I_1$ and $I_2$ generate - histograms of the spike counts of the evoked responses within all - windows of $W=200$\,ms width. How do the histograms of the spike - counts depend on the slope of the tuning curve of the neuron? + \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? - \part Think about a measure based on the spike count histograms + 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 observation time $W$ (width of the windows). + a function of the gain of the neuron. - For which slopes can the two stimuli be well discriminated? + 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$. 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? + $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} diff --git a/projects/project_fano_slope/lifboltzmanspikes.m b/projects/project_fano_slope/lifboltzmanspikes.m deleted file mode 100644 index 14640e4..0000000 --- a/projects/project_fano_slope/lifboltzmanspikes.m +++ /dev/null @@ -1,51 +0,0 @@ -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 diff --git a/projects/project_fano_slope/solution/counthist.m b/projects/project_fano_slope/solution/counthist.m new file mode 100644 index 0000000..6a51714 --- /dev/null +++ b/projects/project_fano_slope/solution/counthist.m @@ -0,0 +1,11 @@ +function [counts, cbins] = counthist(spikes, tmin, tmax, T, cmax) +tbins = tmin+T/2:T:tmax; +cbins = 0.5:cmax; +counts = zeros(1, length(cbins)); +for k = 1:length(spikes) + times = spikes{k}; + n = hist(times((times>=tmin)&(times<=tmax)), tbins); + counts = counts + hist(n, cbins); +end +counts = counts / sum(counts); +end diff --git a/projects/project_fano_slope/solution/discriminability.m b/projects/project_fano_slope/solution/discriminability.m new file mode 100644 index 0000000..b0da789 --- /dev/null +++ b/projects/project_fano_slope/solution/discriminability.m @@ -0,0 +1,23 @@ +function [d, thresholds, true1s, false1s, true2s, false2s, pratio] = discriminability(spikes1, spikes2, tmax, T, cmax) +[c1, b1] = counthist(spikes1, 0.0, tmax, T, cmax); +[c2, b2] = counthist(spikes2, 0.0, tmax, T, cmax); +thresholds = 0:cmax; +true1s = zeros(length(thresholds), 1); +true2s = zeros(length(thresholds), 1); +false1s = zeros(length(thresholds), 1); +false2s = zeros(length(thresholds), 1); +for k = 1:length(thresholds) + th = thresholds(k); + t1 = sum(c1(b1<=th)); + f1 = sum(c1(b1>th)); + t2 = sum(c2(b2>=th)); + f2 = sum(c2(b2