fixed fano slop eproject
This commit is contained in:
parent
1e2ce84104
commit
5d2beb12eb
@ -51,102 +51,105 @@
|
|||||||
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
\begin{questions}
|
\begin{questions}
|
||||||
\question You are recording the activity of a neuron in response to
|
\question An important property of sensory systems is their ability
|
||||||
two different stimuli $I_1$ and $I_2$ (think of them, for example,
|
to discriminate similar stimuli. For example, discrimination of two
|
||||||
of two sound waves with different intensities $I_1$ and $I_2$ and
|
colors, light intensities, pitch of two tones, sound intensities,
|
||||||
you measure the activity of an auditory neuron). Within an
|
etc. Here we look at the level of a single neuron. What does it
|
||||||
observation time of duration $W$ the neuron responds stochastically
|
mean in terms of the neuron's $f$-$I$ curve (firing rate versus
|
||||||
with $n$ spikes.
|
stimulus intensity) that two similar stimuli can be discriminated
|
||||||
|
given the spike train responses that have been evoked by the two
|
||||||
How well can an upstream neuron discriminate the two stimuli based
|
stimuli?
|
||||||
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
|
You are recording the activity of a neuron in response to two
|
||||||
fano factor (the ratio between the variance and the mean of the
|
different stimuli $I_1$ and $I_2$ (think of them, for example, of
|
||||||
spike counts)?
|
two different sound intensities, $I_1$ and $I_2$, and the spiking
|
||||||
|
activity of an auditory afferent). The neuron responds to a stimulus
|
||||||
The neuron is implemented in the file \texttt{lifboltzmanspikes.m}.
|
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:
|
Call it with the following parameters:
|
||||||
\begin{lstlisting}
|
\begin{lstlisting}
|
||||||
trials = 10;
|
trials = 10;
|
||||||
tmax = 50.0;
|
tmax = 50.0;
|
||||||
Dnoise = 1.0;
|
gain = 0.1;
|
||||||
imax = 25.0;
|
|
||||||
ithresh = 10.0;
|
|
||||||
slope=0.2;
|
|
||||||
input = 10.0;
|
input = 10.0;
|
||||||
|
spikes = lifboltzmanspikes(trials, input, tmax, gain);
|
||||||
spikes = lifboltzmanspikes( trials, input, tmax, Dnoise, imax, ithresh, slope );
|
\end{lstlisting}
|
||||||
\end{lstlisting}
|
The returned \texttt{spikes} is a cell array with \texttt{trials}
|
||||||
The returned \texttt{spikes} is a cell array with \texttt{trials}
|
elements, each being a vector of spike times (in seconds) computed
|
||||||
elements, each being a vector of spike times (in seconds) computed
|
for a duration of \texttt{tmax} seconds. The intensity of the
|
||||||
for a duration of \texttt{tmax} seconds. The input is set via the
|
stimulus is set via the \texttt{input} variable.
|
||||||
\texttt{input} variable.
|
|
||||||
|
Think of calling the \texttt{lifboltzmannspikes()} function as a
|
||||||
Think of calling the \texttt{lifboltzmanspikes()} function as a
|
simple way of doing an electrophysiological experiment. You are
|
||||||
simple way of doing an electrophysiological experiment. You are
|
presenting a stimulus with an intensity $I$ that you set. The neuron
|
||||||
presenting a stimulus with a constant intensity $I$ that you set. The
|
responds to this stimulus, and you record this response. After
|
||||||
neuron responds to this stimulus, and you record this
|
detecting the timepoints of the spikes in your recordings you get
|
||||||
response. After detecting the timepoints of the spikes in your
|
what the \texttt{lifboltzmannspikes()} function returns. In addition
|
||||||
recordings you get what the \texttt{lifboltzmanspikes()} function
|
you can record from different neurons with different properties
|
||||||
returns. The advantage over real data is, that you have the
|
by setting the \texttt{gain} parameter to different values.
|
||||||
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$.
|
|
||||||
|
|
||||||
\begin{parts}
|
\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
|
\part Measure the tuning curve of the neuron with respect to the
|
||||||
input. That is, compute the mean firing rate (number of spikes
|
input. That is, compute the mean firing rate (number of spikes
|
||||||
within the recording time \texttt{tmax} divided by \texttt{tmax}
|
within the recording time \texttt{tmax} divided by \texttt{tmax}
|
||||||
and averaged over trials) as a function of the input
|
and averaged over trials) as a function of the input
|
||||||
strength. Find an appropriate range of input values. Do this for
|
strength. Find an appropriate range of input values.
|
||||||
different values of the \texttt{slope} parameter (values between
|
|
||||||
0.1 and 2.0).
|
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
|
\part Generate properly normalized histograms of the spike counts
|
||||||
histograms of the spike counts of the evoked responses within all
|
within $T$ (use $T=100$\,ms) of the spike responses to the two
|
||||||
windows of $W=200$\,ms width. How do the histograms of the spike
|
different stimuli. Do the two histograms overlap? What does this
|
||||||
counts depend on the slope of the tuning curve of the neuron?
|
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
|
that quantifies how well the two stimuli can be distinguished
|
||||||
based on the spike counts. Plot the dependence of this measure as
|
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
|
\underline{Hint:} A possible readout is to set a threshold
|
||||||
$n_{thresh}$ for the observed spike count. Any response smaller
|
$n_{thresh}$ for the observed spike count. Any response smaller
|
||||||
than the threshold assumes that the stimulus was $I_1$, any
|
than the threshold assumes that the stimulus was $I_1$, any
|
||||||
response larger than the threshold assumes that the stimulus was
|
response larger than the threshold assumes that the stimulus was
|
||||||
$I_2$. Find the threshold $n_{thresh}$ that results in the best
|
$I_2$. For a given $T$ find the threshold $n_{thresh}$ that
|
||||||
discrimination performance.
|
results in the best discrimination performance. How can you
|
||||||
|
quantify ``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{parts}
|
||||||
|
|
||||||
|
@ -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
|
|
11
projects/project_fano_slope/solution/counthist.m
Normal file
11
projects/project_fano_slope/solution/counthist.m
Normal file
@ -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
|
23
projects/project_fano_slope/solution/discriminability.m
Normal file
23
projects/project_fano_slope/solution/discriminability.m
Normal file
@ -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<th));
|
||||||
|
true1s(k) = t1;
|
||||||
|
true2s(k) = t2;
|
||||||
|
false1s(k) = f1;
|
||||||
|
false2s(k) = f2;
|
||||||
|
end
|
||||||
|
%pratio = (true1s + true2s)./(false1s+false2s);
|
||||||
|
pratio = (true1s + true2s)/2;
|
||||||
|
d = max(pratio);
|
||||||
|
end
|
92
projects/project_fano_slope/solution/fanoslope.m
Normal file
92
projects/project_fano_slope/solution/fanoslope.m
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
%% general settings for the model neuron:
|
||||||
|
trials = 10;
|
||||||
|
tmax = 50.0;
|
||||||
|
|
||||||
|
%% f-I curves:
|
||||||
|
figure()
|
||||||
|
gains = [0.1, 0.2, 0.5, 1.0];
|
||||||
|
for j = 1:length(gains)
|
||||||
|
gain = gains(j);
|
||||||
|
inputs = 0.0:1.0:60.0;
|
||||||
|
rates = ficurve(trials, inputs, tmax, gain);
|
||||||
|
plot(inputs, rates);
|
||||||
|
hold on;
|
||||||
|
end
|
||||||
|
hold off;
|
||||||
|
|
||||||
|
%% generate and plot spiketrains for two inputs:
|
||||||
|
I1 = 10.0;
|
||||||
|
I2 = 11.0;
|
||||||
|
gain = 0.1;
|
||||||
|
spikes1 = lifboltzmannspikes(trials, I1, tmax, gain);
|
||||||
|
spikes2 = lifboltzmannspikes(trials, I2, tmax, gain);
|
||||||
|
subplot(1, 2, 1);
|
||||||
|
tmin = 10.0;
|
||||||
|
spikeraster(spikes1, tmin, tmin+2.0);
|
||||||
|
title(sprintf('I_1=%g', I1))
|
||||||
|
subplot(1, 2, 2);
|
||||||
|
spikeraster(spikes2, tmin, tmin+2.0);
|
||||||
|
title(sprintf('I_2=%g', I2))
|
||||||
|
%savefigpdf(gcf(), 'spikeraster.pdf')
|
||||||
|
|
||||||
|
%% spike count histograms:
|
||||||
|
cmax = 20;
|
||||||
|
T = 0.1;
|
||||||
|
figure()
|
||||||
|
for k = 1:length(gains)
|
||||||
|
gain = gains(k);
|
||||||
|
spikes1 = lifboltzmannspikes(trials, I1, tmax, gain);
|
||||||
|
spikes2 = lifboltzmannspikes(trials, I2, tmax, gain);
|
||||||
|
[c1, b1] = counthist(spikes1, 0.0, tmax, T, cmax);
|
||||||
|
[c2, b2] = counthist(spikes2, 0.0, tmax, T, cmax);
|
||||||
|
subplot(2, 2, k)
|
||||||
|
bar(b1, c1, 'r');
|
||||||
|
hold on;
|
||||||
|
bar(b2, c2, 'b');
|
||||||
|
xlim([0 cmax])
|
||||||
|
title(sprintf('gain=%g', gain))
|
||||||
|
hold off;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% discrimination measure:
|
||||||
|
T = 0.1;
|
||||||
|
gain = 0.1;
|
||||||
|
cmax = 15;
|
||||||
|
spikes1 = lifboltzmannspikes(trials, I1, tmax, gain);
|
||||||
|
spikes2 = lifboltzmannspikes(trials, I2, tmax, gain);
|
||||||
|
[d, thresholds, true1s, false1s, true2s, false2s, pratio] = discriminability(spikes1, spikes2, tmax, T, cmax);
|
||||||
|
figure()
|
||||||
|
subplot(1, 3, 1);
|
||||||
|
plot(thresholds, true1s, 'b');
|
||||||
|
hold on;
|
||||||
|
plot(thresholds, true2s, 'b');
|
||||||
|
plot(thresholds, false1s, 'r');
|
||||||
|
plot(thresholds, false2s, 'r');
|
||||||
|
xlim([0 cmax])
|
||||||
|
hold off;
|
||||||
|
% Ratio:
|
||||||
|
subplot(1, 3, 2);
|
||||||
|
fprintf('discriminability = %g\n', d);
|
||||||
|
plot(thresholds, pratio);
|
||||||
|
% ROC:
|
||||||
|
subplot(1, 3, 3);
|
||||||
|
plot(false2s, true1s);
|
||||||
|
|
||||||
|
%% discriminability:
|
||||||
|
T = 0.1;
|
||||||
|
gains = 0.01:0.01:1.0;
|
||||||
|
cmax = 100;
|
||||||
|
ds = zeros(length(gains), 1);
|
||||||
|
for k = 1:length(gains)
|
||||||
|
gain = gains(k);
|
||||||
|
spikes1 = lifboltzmannspikes(trials, I1, tmax, gain);
|
||||||
|
spikes2 = lifboltzmannspikes(trials, I2, tmax, gain);
|
||||||
|
[c1, b1] = counthist(spikes1, 0.0, tmax, T, cmax);
|
||||||
|
[c2, b2] = counthist(spikes2, 0.0, tmax, T, cmax);
|
||||||
|
[d, thresholds, true1s, false1s, true2s, false2s, pratio] = discriminability(spikes1, spikes2, tmax, T, cmax);
|
||||||
|
ds(k) = d;
|
||||||
|
end
|
||||||
|
figure()
|
||||||
|
plot(gains, ds)
|
||||||
|
|
||||||
|
|
8
projects/project_fano_slope/solution/ficurve.m
Normal file
8
projects/project_fano_slope/solution/ficurve.m
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
function rates = ficurve(trials, inputs, tmax, gain)
|
||||||
|
% compute f-I curve.
|
||||||
|
rates = zeros(length(inputs), 1);
|
||||||
|
for k=1:length(inputs)
|
||||||
|
spikes = lifboltzmannspikes(trials, inputs(k), tmax, gain);
|
||||||
|
rates(k) = firingrate(spikes, 0.0, tmax);
|
||||||
|
end
|
||||||
|
end
|
9
projects/project_fano_slope/solution/firingrate.m
Normal file
9
projects/project_fano_slope/solution/firingrate.m
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
function rate = firingrate(spikes, tmin, tmax)
|
||||||
|
% mean firing rate between tmin and tmax.
|
||||||
|
rates = zeros(length(spikes), 1);
|
||||||
|
for i = 1:length(spikes)
|
||||||
|
times= spikes{i};
|
||||||
|
rates(i) = length(times((times>=tmin)&(times<=tmax)))/(tmax-tmin);
|
||||||
|
end
|
||||||
|
rate = mean(rates);
|
||||||
|
end
|
35
projects/project_fano_slope/solution/lifboltzmannspikes.m
Normal file
35
projects/project_fano_slope/solution/lifboltzmannspikes.m
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
function spikes = lifboltzmannspikes(trials, input, tmax, gain)
|
||||||
|
% Generate spike times of a leaky integrate-and-fire neuron.
|
||||||
|
% trials: the number of trials to be generated.
|
||||||
|
% input: the stimulus intensity.
|
||||||
|
% tmax: the duration of a trial.
|
||||||
|
% gain: gain of the neuron, i.e. the slope factor of the boltzmann input.
|
||||||
|
|
||||||
|
tau = 0.01;
|
||||||
|
D = 1e-2;
|
||||||
|
imax = 25;
|
||||||
|
ithresh = 10;
|
||||||
|
slope = gain;
|
||||||
|
vreset = 0.0;
|
||||||
|
vthresh = 10.0;
|
||||||
|
dt = 1e-4;
|
||||||
|
|
||||||
|
n = ceil(tmax/dt);
|
||||||
|
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(n, 1)/sqrt(dt);
|
||||||
|
for i=1:n
|
||||||
|
v = v + (- v + noise(i) + inb)*dt/tau;
|
||||||
|
if v >= vthresh
|
||||||
|
v = vreset;
|
||||||
|
times(j) = i*dt;
|
||||||
|
j = j + 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
spikes{k} = times;
|
||||||
|
end
|
||||||
|
end
|
28
projects/project_fano_slope/solution/savefigpdf.m
Normal file
28
projects/project_fano_slope/solution/savefigpdf.m
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
function savefigpdf(fig, name, width, height)
|
||||||
|
% Saves figure fig in pdf file name.pdf with appropriately set page size
|
||||||
|
% and fonts
|
||||||
|
|
||||||
|
% default width:
|
||||||
|
if nargin < 3
|
||||||
|
width = 11.7;
|
||||||
|
end
|
||||||
|
% default height:
|
||||||
|
if nargin < 4
|
||||||
|
height = 9.0;
|
||||||
|
end
|
||||||
|
|
||||||
|
% paper:
|
||||||
|
set(fig, 'PaperUnits', 'centimeters');
|
||||||
|
set(fig, 'PaperSize', [width height]);
|
||||||
|
set(fig, 'PaperPosition', [0.0 0.0 width height]);
|
||||||
|
set(fig, 'Color', 'white')
|
||||||
|
|
||||||
|
% font:
|
||||||
|
set(findall(fig, 'type', 'axes'), 'FontSize', 12)
|
||||||
|
set(findall(fig, 'type', 'text'), 'FontSize', 12)
|
||||||
|
|
||||||
|
% save:
|
||||||
|
saveas(fig, name, 'pdf')
|
||||||
|
|
||||||
|
end
|
||||||
|
|
30
projects/project_fano_slope/solution/spikeraster.m
Normal file
30
projects/project_fano_slope/solution/spikeraster.m
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
function spikeraster(spikes, tmin, tmax)
|
||||||
|
% Display a spike raster of the spike times given in spikes.
|
||||||
|
%
|
||||||
|
% spikeraster(spikes, tmax)
|
||||||
|
% spikes: a cell array of vectors of spike times in seconds
|
||||||
|
% tmin: plot spike raster starting at tmin seconds
|
||||||
|
% tmax: plot spike raster upto tmax seconds
|
||||||
|
|
||||||
|
ntrials = length(spikes);
|
||||||
|
for k = 1:ntrials
|
||||||
|
times = spikes{k};
|
||||||
|
times = times((times>=tmin) & (times<=tmax));
|
||||||
|
if tmax < 1.5
|
||||||
|
times = 1000.0*times; % conversion to ms
|
||||||
|
end
|
||||||
|
for i = 1:length( times )
|
||||||
|
line([times(i) times(i)],[k-0.4 k+0.4], 'Color', 'k');
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (tmax-tmin) < 1.5
|
||||||
|
xlabel('Time [ms]');
|
||||||
|
xlim([1000.0*tmin 1000.0*tmax]);
|
||||||
|
else
|
||||||
|
xlabel('Time [s]');
|
||||||
|
xlim([tmin tmax]);
|
||||||
|
end
|
||||||
|
ylabel('Trials');
|
||||||
|
ylim([0.3 ntrials+0.7 ]);
|
||||||
|
end
|
||||||
|
|
@ -52,58 +52,64 @@
|
|||||||
|
|
||||||
\begin{questions}
|
\begin{questions}
|
||||||
\question An important property of sensory systems is their ability
|
\question An important property of sensory systems is their ability
|
||||||
to discriminate similar stimuli. For example, to discriminate two
|
to discriminate similar stimuli. For example, discrimination of two
|
||||||
colors, light intensities, pitch of two tones, sound intensity, etc.
|
colors, light intensities, pitch of two tones, sound intensities, etc.
|
||||||
Here we look at the level of a single neuron. What does it mean that
|
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
|
two similar stimuli can be discriminated given the spike train
|
||||||
responses that have been evoked by the two stimuli?
|
responses that have been evoked by the two stimuli?
|
||||||
|
|
||||||
You are recording the activity of a neuron in response to two
|
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
|
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
|
two different light intensities, $I_1$ and $I_2$, and the spiking
|
||||||
the activity of a ganglion cell in the retina). The neuron responds
|
activity of a ganglion cell in the retina). The neuron responds to a
|
||||||
to a stimulus with a number of spikes. You (an upstream neuron) can
|
stimulus with a number of spikes. You (an upstream neuron) can count
|
||||||
count the number of spikes of this response within an observation
|
the number of spikes of this response within an observation time of
|
||||||
time of duration $T$. For perfect discrimination, the number of
|
duration $T$. For perfect discrimination, the number of spikes
|
||||||
spikes evoked by the stronger stimulus within $T$ is larger than for
|
evoked by the stronger stimulus within $T$ is always larger than for
|
||||||
the smaller stimulus. The situation is more complicated, because the
|
the smaller stimulus. The situation is more complicated, because the
|
||||||
number of spikes evoked by one stimulus is not fixed but varies.
|
number of spikes evoked by one stimulus is not fixed but varies,
|
||||||
|
such that the number of spikes evoked by the stronger stimulus could
|
||||||
How well can an upstream neuron discriminate the two
|
happen to be lower than the number of spikes evoked by the smaller
|
||||||
stimuli based on the spike counts $n$? How does this depend on the
|
stimulus.
|
||||||
duration $T$ of the observation time?
|
|
||||||
|
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 duration $T$ of the observation
|
||||||
|
time?
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
The neuron is implemented in the file \texttt{lifspikes.m}.
|
The neuron is implemented in the file \texttt{lifspikes.m}.
|
||||||
Call it like this:
|
Call it like this:
|
||||||
\begin{lstlisting}
|
\begin{lstlisting}
|
||||||
trials = 10;
|
trials = 10;
|
||||||
tmax = 50.0;
|
tmax = 50.0;
|
||||||
input = 15.0;
|
input = 15.0;
|
||||||
spikes = lifspikes(trials, input, tmax);
|
spikes = lifspikes(trials, input, tmax);
|
||||||
\end{lstlisting}
|
\end{lstlisting}
|
||||||
The returned \texttt{spikes} is a cell array with \texttt{trials}
|
The returned \texttt{spikes} is a cell array with \texttt{trials}
|
||||||
elements, each being a vector of spike times (in seconds) computed
|
elements, each being a vector of spike times (in seconds) computed
|
||||||
for a duration of \texttt{tmax} seconds. The intensity of the stimulus
|
for a duration of \texttt{tmax} seconds. The intensity of the
|
||||||
is given by \texttt{input}.
|
stimulus is given by \texttt{input}.
|
||||||
|
|
||||||
Think of calling the \texttt{lifspikes()} function as a
|
Think of calling the \texttt{lifspikes()} function as a simple way
|
||||||
simple way of doing an electrophysiological experiment. You are
|
of doing an electrophysiological experiment. You are presenting a
|
||||||
presenting a stimulus with an intensity $I$ that you set. The
|
stimulus with an intensity $I$ that you set. The neuron responds to
|
||||||
neuron responds to this stimulus, and you record this
|
this stimulus, and you record this response. After detecting the
|
||||||
response. After detecting the time points of the spikes in your
|
time points of the spikes in your recordings you get what the
|
||||||
recordings you get what the \texttt{lifspikes()} function
|
\texttt{lifspikes()} function returns.
|
||||||
returns.
|
|
||||||
|
For the two inputs $I_1$ and $I_2$ to be discriminated use
|
||||||
For the two inputs $I_1$ and $I_2$ use
|
\begin{lstlisting}
|
||||||
\begin{lstlisting}
|
|
||||||
input = 14.0; % I_1
|
input = 14.0; % I_1
|
||||||
input = 15.0; % I_2
|
input = 15.0; % I_2
|
||||||
\end{lstlisting}
|
\end{lstlisting}
|
||||||
|
|
||||||
\begin{parts}
|
\begin{parts}
|
||||||
\part
|
\part
|
||||||
Show two raster plots for the responses to the two different
|
Show two raster plots for the responses to the two different
|
||||||
stimuli. Find an appropriate time window and an appropriate
|
stimuli. Use an appropriate time window and an appropriate
|
||||||
number of trials for the spike raster.
|
number of trials for the spike raster.
|
||||||
|
|
||||||
Just by looking at the raster plots, can you discriminate the two
|
Just by looking at the raster plots, can you discriminate the two
|
||||||
@ -111,12 +117,13 @@ input = 15.0; % I_2
|
|||||||
responses?
|
responses?
|
||||||
|
|
||||||
\part Generate properly normalized histograms of the spike counts
|
\part Generate properly normalized histograms of the spike counts
|
||||||
within $T$ (use $T=100$\,ms) of the responses to the two different
|
within $T$ (use $T=100$\,ms) of the spike responses to the two
|
||||||
stimuli. Do the two histograms overlap? What does this mean for
|
different stimuli. Do the two histograms overlap? What does this
|
||||||
the discriminability of the two stimuli?
|
mean for the discriminability of the two stimuli?
|
||||||
|
|
||||||
How do the histograms depend on the observation time $T$ (use
|
How do the histograms of the spike counts depend on the
|
||||||
values of 10\,ms, 100\,ms, 300\,ms and 1\,s)?
|
observation time $T$? Plot them for four different values of $T$
|
||||||
|
(use values of 10\,ms, 100\,ms, 300\,ms and 1\,s).
|
||||||
|
|
||||||
\part Think about a measure based on the spike-count histograms
|
\part Think about a measure based on the spike-count histograms
|
||||||
that quantifies how well the two stimuli can be distinguished
|
that quantifies how well the two stimuli can be distinguished
|
||||||
|
Reference in New Issue
Block a user