diff --git a/projects/Makefile b/projects/Makefile index 155aa15..86bebbb 100644 --- a/projects/Makefile +++ b/projects/Makefile @@ -1,4 +1,4 @@ -all: projects evalutation +all: projects evaluation evaluation: evaluation.pdf evaluation.pdf: evaluation.tex diff --git a/projects/evaluation.tex b/projects/evaluation.tex index 00d2061..30ae766 100644 --- a/projects/evaluation.tex +++ b/projects/evaluation.tex @@ -15,7 +15,7 @@ \begin{document} \sffamily -\section*{Scientific computing WS16/17} +\section*{Scientific computing WS17/18} \begin{tabular}{|p{0.15\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|} \hline diff --git a/projects/project_noiseficurves/noiseficurves.tex b/projects/project_noiseficurves/noiseficurves.tex index 78da3ca..4894466 100644 --- a/projects/project_noiseficurves/noiseficurves.tex +++ b/projects/project_noiseficurves/noiseficurves.tex @@ -11,7 +11,7 @@ %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% -%\section{REPLACE BY SUBTHRESHOLD RESONANCE PROJECT!} +\section{REPLACE BY SUBTHRESHOLD RESONANCE PROJECT!} \begin{questions} \question You are recording the activity of a neuron in response to constant stimuli of intensity $I$ (think of that, for example, diff --git a/projects/project_populationvector/code/generatedata.py b/projects/project_populationvector/code/generatedata.py index dfe1829..6df3313 100644 --- a/projects/project_populationvector/code/generatedata.py +++ b/projects/project_populationvector/code/generatedata.py @@ -69,15 +69,15 @@ plt.show() # tuning curves: nunits = 6 -unitphases = np.linspace(0.0, 1.0, nunits) + 0.05*np.random.randn(nunits)/float(nunits) +unitphases = np.linspace(0.04, 0.96, nunits) + 0.05*np.random.randn(nunits)/float(nunits) unitgains = 15.0 + 5.0*(2.0*np.random.rand(nunits)-1.0) nangles = 12 angles = 180.0*np.arange(nangles)/nangles for unit, (phase, gain) in enumerate(zip(unitphases, unitgains)): - print '%.1f %.0f' % (gain, phase*180.0) + print 'gain=%.1f phase=%.0f' % (gain, phase*180.0) allspikes = [] for k, angle in enumerate(angles): - spikes = lifadaptspikes(0.5*(1.0-np.cos(2.0*np.pi*(angle/180.0-phase))), gain) + spikes = lifadaptspikes(0.5*(1.0+np.cos(2.0*np.pi*(angle/180.0-phase))), gain) allspikes.append(spikes) spikesobj = np.zeros((len(allspikes), len(allspikes[0])), dtype=np.object) for k in range(len(allspikes)): @@ -89,10 +89,10 @@ for unit, (phase, gain) in enumerate(zip(unitphases, unitgains)): nangles = 50 angles = 180.0*np.random.rand(nangles) for k, angle in enumerate(angles): - print '%.0f' % angle + print 'angle = %.0f' % angle allspikes = [] for unit, (phase, gain) in enumerate(zip(unitphases, unitgains)): - spikes = lifadaptspikes(0.5*(1.0-np.cos(2.0*np.pi*(angle/180.0-phase))), gain) + spikes = lifadaptspikes(0.5*(1.0+np.cos(2.0*np.pi*(angle/180.0-phase))), gain) allspikes.append(spikes) spikesobj = np.zeros((len(allspikes), len(allspikes[0])), dtype=np.object) for i in range(len(allspikes)): diff --git a/projects/project_populationvector/data/population01.mat b/projects/project_populationvector/data/population01.mat index 9a0f13d..dce47ee 100644 Binary files a/projects/project_populationvector/data/population01.mat and b/projects/project_populationvector/data/population01.mat differ diff --git a/projects/project_populationvector/data/population02.mat b/projects/project_populationvector/data/population02.mat index 296aa5b..9932db5 100644 Binary files a/projects/project_populationvector/data/population02.mat and b/projects/project_populationvector/data/population02.mat differ diff --git a/projects/project_populationvector/data/population03.mat b/projects/project_populationvector/data/population03.mat index 56dd9dd..00320f5 100644 Binary files a/projects/project_populationvector/data/population03.mat and b/projects/project_populationvector/data/population03.mat differ diff --git a/projects/project_populationvector/data/population04.mat b/projects/project_populationvector/data/population04.mat index c0c92ec..c22c6d9 100644 Binary files a/projects/project_populationvector/data/population04.mat and b/projects/project_populationvector/data/population04.mat differ diff --git a/projects/project_populationvector/data/population05.mat b/projects/project_populationvector/data/population05.mat index 63118d3..a550e2e 100644 Binary files a/projects/project_populationvector/data/population05.mat and b/projects/project_populationvector/data/population05.mat differ diff --git a/projects/project_populationvector/data/population06.mat b/projects/project_populationvector/data/population06.mat index 4700426..0a86b10 100644 Binary files a/projects/project_populationvector/data/population06.mat and b/projects/project_populationvector/data/population06.mat differ diff --git a/projects/project_populationvector/data/population07.mat b/projects/project_populationvector/data/population07.mat index 2724a28..48aa0be 100644 Binary files a/projects/project_populationvector/data/population07.mat and b/projects/project_populationvector/data/population07.mat differ diff --git a/projects/project_populationvector/data/population08.mat b/projects/project_populationvector/data/population08.mat index 2d3177c..e387a52 100644 Binary files a/projects/project_populationvector/data/population08.mat and b/projects/project_populationvector/data/population08.mat differ diff --git a/projects/project_populationvector/data/population09.mat b/projects/project_populationvector/data/population09.mat index 77430b2..124657a 100644 Binary files a/projects/project_populationvector/data/population09.mat and b/projects/project_populationvector/data/population09.mat differ diff --git a/projects/project_populationvector/data/population10.mat b/projects/project_populationvector/data/population10.mat index fcdc0ff..555dfdb 100644 Binary files a/projects/project_populationvector/data/population10.mat and b/projects/project_populationvector/data/population10.mat differ diff --git a/projects/project_populationvector/data/population11.mat b/projects/project_populationvector/data/population11.mat index 6ff0dfe..d11158d 100644 Binary files a/projects/project_populationvector/data/population11.mat and b/projects/project_populationvector/data/population11.mat differ diff --git a/projects/project_populationvector/data/population12.mat b/projects/project_populationvector/data/population12.mat index 43e27b6..9f171de 100644 Binary files a/projects/project_populationvector/data/population12.mat and b/projects/project_populationvector/data/population12.mat differ diff --git a/projects/project_populationvector/data/population13.mat b/projects/project_populationvector/data/population13.mat index ecb0f09..afcef0b 100644 Binary files a/projects/project_populationvector/data/population13.mat and b/projects/project_populationvector/data/population13.mat differ diff --git a/projects/project_populationvector/data/population14.mat b/projects/project_populationvector/data/population14.mat index 1a648d9..2079a81 100644 Binary files a/projects/project_populationvector/data/population14.mat and b/projects/project_populationvector/data/population14.mat differ diff --git a/projects/project_populationvector/data/population15.mat b/projects/project_populationvector/data/population15.mat index 1d9dfd7..1c0b137 100644 Binary files a/projects/project_populationvector/data/population15.mat and b/projects/project_populationvector/data/population15.mat differ diff --git a/projects/project_populationvector/data/population16.mat b/projects/project_populationvector/data/population16.mat index f91f0bc..cea1fc4 100644 Binary files a/projects/project_populationvector/data/population16.mat and b/projects/project_populationvector/data/population16.mat differ diff --git a/projects/project_populationvector/data/population17.mat b/projects/project_populationvector/data/population17.mat index 7b861b9..80b5b62 100644 Binary files a/projects/project_populationvector/data/population17.mat and b/projects/project_populationvector/data/population17.mat differ diff --git a/projects/project_populationvector/data/population18.mat b/projects/project_populationvector/data/population18.mat index 24b6789..948c4d1 100644 Binary files a/projects/project_populationvector/data/population18.mat and b/projects/project_populationvector/data/population18.mat differ diff --git a/projects/project_populationvector/data/population19.mat b/projects/project_populationvector/data/population19.mat index e377d6d..2feb233 100644 Binary files a/projects/project_populationvector/data/population19.mat and b/projects/project_populationvector/data/population19.mat differ diff --git a/projects/project_populationvector/data/population20.mat b/projects/project_populationvector/data/population20.mat index b8f030b..b57aaa7 100644 Binary files a/projects/project_populationvector/data/population20.mat and b/projects/project_populationvector/data/population20.mat differ diff --git a/projects/project_populationvector/data/population21.mat b/projects/project_populationvector/data/population21.mat index aee3a8e..030ec10 100644 Binary files a/projects/project_populationvector/data/population21.mat and b/projects/project_populationvector/data/population21.mat differ diff --git a/projects/project_populationvector/data/population22.mat b/projects/project_populationvector/data/population22.mat index 1d4e8a2..46155fc 100644 Binary files a/projects/project_populationvector/data/population22.mat and b/projects/project_populationvector/data/population22.mat differ diff --git a/projects/project_populationvector/data/population23.mat b/projects/project_populationvector/data/population23.mat index c495d7e..fdd1469 100644 Binary files a/projects/project_populationvector/data/population23.mat and b/projects/project_populationvector/data/population23.mat differ diff --git a/projects/project_populationvector/data/population24.mat b/projects/project_populationvector/data/population24.mat index 66ae79d..be74394 100644 Binary files a/projects/project_populationvector/data/population24.mat and b/projects/project_populationvector/data/population24.mat differ diff --git a/projects/project_populationvector/data/population25.mat b/projects/project_populationvector/data/population25.mat index 42d9628..5e0f482 100644 Binary files a/projects/project_populationvector/data/population25.mat and b/projects/project_populationvector/data/population25.mat differ diff --git a/projects/project_populationvector/data/population26.mat b/projects/project_populationvector/data/population26.mat index c55f7b7..38e80f7 100644 Binary files a/projects/project_populationvector/data/population26.mat and b/projects/project_populationvector/data/population26.mat differ diff --git a/projects/project_populationvector/data/population27.mat b/projects/project_populationvector/data/population27.mat index c7da744..36899ec 100644 Binary files a/projects/project_populationvector/data/population27.mat and b/projects/project_populationvector/data/population27.mat differ diff --git a/projects/project_populationvector/data/population28.mat b/projects/project_populationvector/data/population28.mat index 67a75dc..70102d3 100644 Binary files a/projects/project_populationvector/data/population28.mat and b/projects/project_populationvector/data/population28.mat differ diff --git a/projects/project_populationvector/data/population29.mat b/projects/project_populationvector/data/population29.mat index 985b69f..4fd8683 100644 Binary files a/projects/project_populationvector/data/population29.mat and b/projects/project_populationvector/data/population29.mat differ diff --git a/projects/project_populationvector/data/population30.mat b/projects/project_populationvector/data/population30.mat index a577ed0..9b5bb38 100644 Binary files a/projects/project_populationvector/data/population30.mat and b/projects/project_populationvector/data/population30.mat differ diff --git a/projects/project_populationvector/data/population31.mat b/projects/project_populationvector/data/population31.mat index a2b34d3..435a652 100644 Binary files a/projects/project_populationvector/data/population31.mat and b/projects/project_populationvector/data/population31.mat differ diff --git a/projects/project_populationvector/data/population32.mat b/projects/project_populationvector/data/population32.mat index ec19c8d..024aae0 100644 Binary files a/projects/project_populationvector/data/population32.mat and b/projects/project_populationvector/data/population32.mat differ diff --git a/projects/project_populationvector/data/population33.mat b/projects/project_populationvector/data/population33.mat index 89b4f5a..82daab0 100644 Binary files a/projects/project_populationvector/data/population33.mat and b/projects/project_populationvector/data/population33.mat differ diff --git a/projects/project_populationvector/data/population34.mat b/projects/project_populationvector/data/population34.mat index 02f71b2..0eb0912 100644 Binary files a/projects/project_populationvector/data/population34.mat and b/projects/project_populationvector/data/population34.mat differ diff --git a/projects/project_populationvector/data/population35.mat b/projects/project_populationvector/data/population35.mat index b808ade..1512d82 100644 Binary files a/projects/project_populationvector/data/population35.mat and b/projects/project_populationvector/data/population35.mat differ diff --git a/projects/project_populationvector/data/population36.mat b/projects/project_populationvector/data/population36.mat index e7002d2..d0b6416 100644 Binary files a/projects/project_populationvector/data/population36.mat and b/projects/project_populationvector/data/population36.mat differ diff --git a/projects/project_populationvector/data/population37.mat b/projects/project_populationvector/data/population37.mat index 134b039..f024f6d 100644 Binary files a/projects/project_populationvector/data/population37.mat and b/projects/project_populationvector/data/population37.mat differ diff --git a/projects/project_populationvector/data/population38.mat b/projects/project_populationvector/data/population38.mat index 6dd2440..eeeccdd 100644 Binary files a/projects/project_populationvector/data/population38.mat and b/projects/project_populationvector/data/population38.mat differ diff --git a/projects/project_populationvector/data/population39.mat b/projects/project_populationvector/data/population39.mat index 2da24a9..85a5442 100644 Binary files a/projects/project_populationvector/data/population39.mat and b/projects/project_populationvector/data/population39.mat differ diff --git a/projects/project_populationvector/data/population40.mat b/projects/project_populationvector/data/population40.mat index 5c8e851..72972b6 100644 Binary files a/projects/project_populationvector/data/population40.mat and b/projects/project_populationvector/data/population40.mat differ diff --git a/projects/project_populationvector/data/population41.mat b/projects/project_populationvector/data/population41.mat index 00113a6..e599068 100644 Binary files a/projects/project_populationvector/data/population41.mat and b/projects/project_populationvector/data/population41.mat differ diff --git a/projects/project_populationvector/data/population42.mat b/projects/project_populationvector/data/population42.mat index 7dcdc17..bd0908b 100644 Binary files a/projects/project_populationvector/data/population42.mat and b/projects/project_populationvector/data/population42.mat differ diff --git a/projects/project_populationvector/data/population43.mat b/projects/project_populationvector/data/population43.mat index 41bcbbf..33e46b6 100644 Binary files a/projects/project_populationvector/data/population43.mat and b/projects/project_populationvector/data/population43.mat differ diff --git a/projects/project_populationvector/data/population44.mat b/projects/project_populationvector/data/population44.mat index dccb595..c80fbc1 100644 Binary files a/projects/project_populationvector/data/population44.mat and b/projects/project_populationvector/data/population44.mat differ diff --git a/projects/project_populationvector/data/population45.mat b/projects/project_populationvector/data/population45.mat index 3adc406..dd3da13 100644 Binary files a/projects/project_populationvector/data/population45.mat and b/projects/project_populationvector/data/population45.mat differ diff --git a/projects/project_populationvector/data/population46.mat b/projects/project_populationvector/data/population46.mat index 28c0e86..f849272 100644 Binary files a/projects/project_populationvector/data/population46.mat and b/projects/project_populationvector/data/population46.mat differ diff --git a/projects/project_populationvector/data/population47.mat b/projects/project_populationvector/data/population47.mat index 7904341..f1987da 100644 Binary files a/projects/project_populationvector/data/population47.mat and b/projects/project_populationvector/data/population47.mat differ diff --git a/projects/project_populationvector/data/population48.mat b/projects/project_populationvector/data/population48.mat index bc226f6..d843a85 100644 Binary files a/projects/project_populationvector/data/population48.mat and b/projects/project_populationvector/data/population48.mat differ diff --git a/projects/project_populationvector/data/population49.mat b/projects/project_populationvector/data/population49.mat index 86c9094..d44c69d 100644 Binary files a/projects/project_populationvector/data/population49.mat and b/projects/project_populationvector/data/population49.mat differ diff --git a/projects/project_populationvector/data/population50.mat b/projects/project_populationvector/data/population50.mat index 1143e45..eaebdad 100644 Binary files a/projects/project_populationvector/data/population50.mat and b/projects/project_populationvector/data/population50.mat differ diff --git a/projects/project_populationvector/data/unit1.mat b/projects/project_populationvector/data/unit1.mat index 4964818..5688d7c 100644 Binary files a/projects/project_populationvector/data/unit1.mat and b/projects/project_populationvector/data/unit1.mat differ diff --git a/projects/project_populationvector/data/unit2.mat b/projects/project_populationvector/data/unit2.mat index 66cef43..2e07f80 100644 Binary files a/projects/project_populationvector/data/unit2.mat and b/projects/project_populationvector/data/unit2.mat differ diff --git a/projects/project_populationvector/data/unit3.mat b/projects/project_populationvector/data/unit3.mat index b2d77d9..888e938 100644 Binary files a/projects/project_populationvector/data/unit3.mat and b/projects/project_populationvector/data/unit3.mat differ diff --git a/projects/project_populationvector/data/unit4.mat b/projects/project_populationvector/data/unit4.mat index 722a17a..85425b6 100644 Binary files a/projects/project_populationvector/data/unit4.mat and b/projects/project_populationvector/data/unit4.mat differ diff --git a/projects/project_populationvector/data/unit5.mat b/projects/project_populationvector/data/unit5.mat index 630c0e2..a07c95f 100644 Binary files a/projects/project_populationvector/data/unit5.mat and b/projects/project_populationvector/data/unit5.mat differ diff --git a/projects/project_populationvector/data/unit6.mat b/projects/project_populationvector/data/unit6.mat index 242d5d3..bb98157 100644 Binary files a/projects/project_populationvector/data/unit6.mat and b/projects/project_populationvector/data/unit6.mat differ diff --git a/projects/project_populationvector/populationvector.tex b/projects/project_populationvector/populationvector.tex index 5524b56..d16bdaa 100644 --- a/projects/project_populationvector/populationvector.tex +++ b/projects/project_populationvector/populationvector.tex @@ -35,8 +35,6 @@ \texttt{spikes} variables of the \texttt{population*.mat} files. The \texttt{angle} variable holds the angle of the presented bar. -%NOTE: the orientation is angle plus 90 degree!!!!!! - \continue \begin{parts} \part Illustrate the spiking activity of the V1 cells in response @@ -50,13 +48,11 @@ of the neurons. \part Fit the function \[ r(\varphi) = - g(1-\cos(\varphi-\varphi_0))/2 \] to the measured tuning curves in + g(1+\cos(\varphi-\varphi_0))/2 \] to the measured tuning curves in order to estimated the orientation angle at which the neurons respond strongest. In this function $\varphi_0$ is the position of - the peak (really? How exactly is $\varphi_0$ related to the - position of the peak? Do you find a better function where - $\varphi_0$ is identical with the peak position?) and $g$ is a - gain factor that sets the maximum firing rate. + the peak and $g$ is a gain factor that sets the maximum firing + rate. \part How can the orientation angle of the presented bar be read out from one trial of the population activity of the 6 neurons? @@ -70,8 +66,8 @@ An alternative read out is maximum likelihood (see script). Load one of the \texttt{population*.mat} files, illustrate the - data, and estimate the orientation angle of the bar by the two - different methods. + data, and estimate the orientation angle of the bar from single + trial data by the two different methods. \part Compare, illustrate and discuss the performance of your two decoding methods by using all of the recorded responses (all @@ -81,16 +77,16 @@ \end{parts} \end{questions} -%NOTE: change data generation such that the phase variable is indeed -%the maximum response and not the minumum! - \end{document} + gains and angles of the 6 neurons: -14.6 0 -17.1 36 -17.6 72 -14.1 107 -10.7 144 -11.4 181 +gain=10.7 phase=5 +gain=18.0 phase=38 +gain=11.3 phase=71 +gain=14.1 phase=108 +gain=19.0 phase=138 +gain=16.4 phase=174 + + diff --git a/projects/project_populationvector/solution/populationvector.m b/projects/project_populationvector/solution/populationvector.m index 134b8ed..8a52803 100644 --- a/projects/project_populationvector/solution/populationvector.m +++ b/projects/project_populationvector/solution/populationvector.m @@ -1,7 +1,9 @@ close all -files = dir('../unit*.mat'); +datapath = '../'; +% datapath = '../code/'; +files = dir(strcat(datapath, 'unit*.mat')); for file = files' - a = load(strcat('../', file.name)); + a = load(strcat(datapath, file.name)); spikes = a.spikes; angles = a.angles; figure() @@ -14,13 +16,13 @@ end %% tuning curves: close all -cosine = @(p,xdata)0.5*p(1).*(1.0-cos(2.0*pi*(xdata/180.0-p(2)))); -files = dir('../unit*.mat'); +cosine = @(p,xdata)0.5*p(1).*(1.0+cos(2.0*pi*(xdata/180.0-p(2)))); +files = dir(strcat(datapath, 'unit*.mat')); phases = zeros(length(files), 1); figure() for j = 1:length(files) file = files(j); - a = load(strcat('../', file.name)); + a = load(strcat(datapath, file.name)); spikes = a.spikes; angles = a.angles; rates = zeros(size(spikes, 1), 1); @@ -32,10 +34,13 @@ for j = 1:length(files) p0 = [mr, angles(maxi)/180.0-0.5]; %p = p0; p = lsqcurvefit(cosine, p0, angles, rates'); - phase = p(2)*180.0 + 90.0; + phase = p(2)*180.0; if phase > 180.0 phase = phase - 180.0; end + if phase < 0.0 + phase = phase + 180.0; + end phases(j) = phase; subplot(2, 3, j); plot(angles, rates, 'b'); @@ -49,40 +54,45 @@ end %% read out: -a = load('../population04.mat'); +a = load(strcat(datapath, 'population04.mat')); spikes = a.spikes; angle = a.angle; -unitphases = a.phases*180.0 + 90.0; +unitphases = a.phases*180.0; unitphases(unitphases>180.0) = unitphases(unitphases>180.0) - 180.0; figure(); subplot(1, 3, 1); angleestimates1 = zeros(size(spikes, 2), 1); angleestimates2 = zeros(size(spikes, 2), 1); +[x, inx] = sort(phases); +% loop over trials: for j = 1:size(spikes, 2) rates = zeros(size(spikes, 1), 1); for k = 1:size(spikes, 1) r = firingrate(spikes(k, j), 0.0, 0.2); rates(k) = r; end - [x, inx] = sort(phases); plot(phases(inx), rates(inx), '-o'); hold on; angleestimates1(j) = popvecangle(phases, rates); [m, i] = max(rates); angleestimates2(j) = phases(i); end +xlabel('preferred angle') +ylabel('firing rate') hold off; subplot(1, 3, 2); hist(angleestimates1); +xlabel('stimulus angle') subplot(1, 3, 3); hist(angleestimates2); +xlabel('stimulus angle') angle mean(angleestimates1) mean(angleestimates2) %% read out robustness: -files = dir('../population*.mat'); +files = dir(strcat(datapath, 'population*.mat')); angles = zeros(length(files), 1); e1m = zeros(length(files), 1); e1s = zeros(length(files), 1); @@ -90,7 +100,7 @@ e2m = zeros(length(files), 1); e2s = zeros(length(files), 1); for i = 1:length(files) file = files(i); - a = load(strcat('../', file.name)); + a = load(strcat(datapath, file.name)); spikes = a.spikes; angle = a.angle; angleestimates1 = zeros(size(spikes, 2), 1); @@ -114,5 +124,9 @@ end figure(); subplot(1, 2, 1); scatter(angles, e1m); +xlabel('stimuluis angle') +ylabel('estimated angle') subplot(1, 2, 2); scatter(angles, e2m); +xlabel('stimuluis angle') +ylabel('estimated angle')