Merge branch 'master' of raven.am28.uni-tuebingen.de:scientificComputing
Well, I just fiddeled around in fano.tex and forgot to make a git pull before....
This commit is contained in:
commit
fac4ed2d48
@ -99,14 +99,6 @@ Cross-Correlation, Spike--Triggered--Average and Reverse Reconstruction}
|
|||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}[plain]
|
|
||||||
\frametitle{Rekapitulation}
|
|
||||||
\begin{enumerate}
|
|
||||||
\item PSTH\pause
|
|
||||||
\end{enumerate}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}
|
\begin{frame}
|
||||||
\frametitle{Introduction to scientific computing}
|
\frametitle{Introduction to scientific computing}
|
||||||
\frametitle{Menue}
|
\frametitle{Menue}
|
||||||
@ -119,7 +111,7 @@ Cross-Correlation, Spike--Triggered--Average and Reverse Reconstruction}
|
|||||||
|
|
||||||
|
|
||||||
\begin{frame}[plain]
|
\begin{frame}[plain]
|
||||||
\huge{1. Recapitulation: PSTH}
|
\huge{1. Recapitulation: Plotting neuronal activity as a function of time.}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
@ -142,6 +134,17 @@ Cross-Correlation, Spike--Triggered--Average and Reverse Reconstruction}
|
|||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}
|
||||||
|
\frametitle{Relating stimulus and response}
|
||||||
|
\framesubtitle{Displaying the neuronal response over time - PSTH}
|
||||||
|
\begin{itemize}
|
||||||
|
\item What does this tell us? \pause
|
||||||
|
\item Wouldn't it be more interesting to relate the response to the stimulus?!
|
||||||
|
\end{itemize}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}[plain]
|
\begin{frame}[plain]
|
||||||
\huge{2. Relating stimulus and response}
|
\huge{2. Relating stimulus and response}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
@ -152,7 +155,7 @@ Cross-Correlation, Spike--Triggered--Average and Reverse Reconstruction}
|
|||||||
\framesubtitle{How can we relate the response to the stimulus?}
|
\framesubtitle{How can we relate the response to the stimulus?}
|
||||||
\begin{figure}
|
\begin{figure}
|
||||||
\centering
|
\centering
|
||||||
\includegraphics[height=0.9\textheight]{images/conv_stim}
|
\includegraphics[height=0.75\textheight]{images/conv_stim}
|
||||||
\end{figure}
|
\end{figure}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
@ -201,20 +204,34 @@ ylabel('correlation')
|
|||||||
\frametitle{Relating stimulus and response}
|
\frametitle{Relating stimulus and response}
|
||||||
\framesubtitle{Cross--correlation - Exercises}
|
\framesubtitle{Cross--correlation - Exercises}
|
||||||
\begin{enumerate}
|
\begin{enumerate}
|
||||||
\item calculate the cross-correlation between two vectors of random
|
\item Calculate the cross-correlation between two vectors of random
|
||||||
numbers.
|
numbers.
|
||||||
\item Calculate the cross-correlation between one of these vectors
|
\item Calculate the cross-correlation between one of these vectors
|
||||||
and itself (auto-correlation).
|
and itself (auto-correlation).
|
||||||
\item Calculate the cross-correlation between one vector and a
|
\item Calculate the cross-correlation between one vector and a
|
||||||
time-shifted version of itself (use \verb+circshift+ to do this).
|
time-shifted version of itself (use \verb+circshift+ to do this).
|
||||||
|
\item Generate two vectors of random numbers, one having a (slight)
|
||||||
|
correlation with the other.
|
||||||
|
\item Calculate the correlation coefficient (\verb+corrcoef+).
|
||||||
|
\item Calculate the cross-correlation.
|
||||||
|
\item Calculate the the correlation coefficient between the one
|
||||||
|
vector and a \verb+circshif+ted version of the other.
|
||||||
|
\item Calculate the cross-correlation of these.
|
||||||
|
\item Find out the maximum correlation and its position.
|
||||||
\end{enumerate}
|
\end{enumerate}
|
||||||
\textbf{Note:} Select max\_lag to be less than 10\% of the length of
|
\textbf{Note:} Select max\_lag to be less than 10\% of the length of
|
||||||
your vectors!
|
your vectors!
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}[fagile]
|
||||||
|
\frametitle{Relating stimulus and response}
|
||||||
|
\framesubtitle{Cross--correlation - Exercises}
|
||||||
\begin{enumerate}
|
\begin{enumerate}
|
||||||
\item Create the cross correlation of the p-unit data and stimulus.
|
\item Create the cross correlation of the p-unit data and stimulus.
|
||||||
\item \textbf{Note:} you have to convert the spike\_times to a PSTH!
|
\item \textbf{Note:} you have to convert the spike\_times to a PSTH!
|
||||||
\item Find out the position of the correlation peak.
|
\item Find out the position of the correlation peak.
|
||||||
\item What does this tell you?
|
\item What does it tell you?
|
||||||
\end{enumerate}
|
\end{enumerate}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
@ -273,8 +290,8 @@ ylabel('correlation')
|
|||||||
\begin{enumerate}
|
\begin{enumerate}
|
||||||
\item Write a function \verb+sta(x, y, count, sample_rate)+ that
|
\item Write a function \verb+sta(x, y, count, sample_rate)+ that
|
||||||
takes the stimulus (x), the response (y, as spike times), the
|
takes the stimulus (x), the response (y, as spike times), the
|
||||||
number (count) of sampling points it should cut out from the
|
number (count) of sample points it should cut out from the
|
||||||
stimulus and the sampling\_rate to convert from times to
|
stimulus and the sample\_rate to convert from times to
|
||||||
indices.
|
indices.
|
||||||
\item \textbf{Beware:} sometimes the spike\_time may be too close
|
\item \textbf{Beware:} sometimes the spike\_time may be too close
|
||||||
to the beginning or the end of the stimulus to cut out enough
|
to the beginning or the end of the stimulus to cut out enough
|
||||||
@ -284,23 +301,6 @@ ylabel('correlation')
|
|||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}[fragile]
|
|
||||||
\frametitle{Relating stimulus and response}
|
|
||||||
\framesubtitle{Spike--Triggered--Average -- STA}
|
|
||||||
What does the \textbf{STA} tell us?
|
|
||||||
\begin{figure}
|
|
||||||
\centering
|
|
||||||
\includegraphics[width=0.25\columnwidth]{images/sta}
|
|
||||||
\end{figure}
|
|
||||||
\begin{enumerate}
|
|
||||||
\item Is there a relation between stimulus and response?\pause
|
|
||||||
\item Is there a lag between them and how large is it?\pause
|
|
||||||
\item How far in the past does a neuron encode?\pause
|
|
||||||
\item Can it see into the future?
|
|
||||||
\end{enumerate}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}[plain]
|
\begin{frame}[plain]
|
||||||
\huge{3. Reverse reconstruction using the \textbf{STA}}
|
\huge{3. Reverse reconstruction using the \textbf{STA}}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
10
projects/project_numbers/Makefile
Normal file
10
projects/project_numbers/Makefile
Normal 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
|
BIN
projects/project_numbers/Neuron22.mat
Normal file
BIN
projects/project_numbers/Neuron22.mat
Normal file
Binary file not shown.
60
projects/project_numbers/numbers.tex
Executable file
60
projects/project_numbers/numbers.tex
Executable file
@ -0,0 +1,60 @@
|
|||||||
|
\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
|
||||||
|
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
\sffamily
|
||||||
|
% \begin{flushright}
|
||||||
|
% \gradetable[h][questions]
|
||||||
|
% \end{flushright}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\input{../disclaimer.tex}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
\begin{questions}
|
||||||
|
\question The accompanying data {\tt Neuron22.mat} stores a single
|
||||||
|
data matrix {\tt data\_unsorted} containing spike from a neuron in
|
||||||
|
macaque prefrontal cortex. The task of the monkey was to
|
||||||
|
discriminate point sets with 1 to 4 points. The first column
|
||||||
|
contains the number of points shown plus one. The remaining columns
|
||||||
|
contain the spike response across 1300ms. During the first 500ms the
|
||||||
|
monkey was fixating a target. The next 800ms the stimulus was
|
||||||
|
shown. This was followed by 1000ms delay time before the monkey was
|
||||||
|
allowed to respond.
|
||||||
|
|
||||||
|
\begin{parts}
|
||||||
|
\part Plot the data in an appropriate way.
|
||||||
|
\part Sort the trials according to the stimulus presented and
|
||||||
|
compute the firing rate (in Hz) in the time interval
|
||||||
|
500-1300ms. Plot the firing rate in an appropriate way.
|
||||||
|
\part Use an appropriate test to determine whether the firing rate
|
||||||
|
in that interval is significantly different for 1 vs. 4 points
|
||||||
|
shown.
|
||||||
|
\end{parts}
|
||||||
|
\end{questions}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\end{document}
|
BIN
projects/project_spectra/2014-06-06-ad_p-unit.mat
Normal file
BIN
projects/project_spectra/2014-06-06-ad_p-unit.mat
Normal file
Binary file not shown.
10
projects/project_spectra/Makefile
Normal file
10
projects/project_spectra/Makefile
Normal 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
|
61
projects/project_spectra/spectra.tex
Executable file
61
projects/project_spectra/spectra.tex
Executable file
@ -0,0 +1,61 @@
|
|||||||
|
\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
|
||||||
|
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
\sffamily
|
||||||
|
% \begin{flushright}
|
||||||
|
% \gradetable[h][questions]
|
||||||
|
% \end{flushright}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\input{../disclaimer.tex}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
\begin{questions}
|
||||||
|
\question The accompanying file contains ten stimulus and response
|
||||||
|
sequences of a P-Unit of a weakly electric fish {\em Apteronotus
|
||||||
|
leptorhynchus}. Another matrix contains the corresponding {\em
|
||||||
|
electric organ discharge (EOD)} of the fish. The sampling rate is
|
||||||
|
100kHz.
|
||||||
|
\begin{parts}
|
||||||
|
\part Split the data in non-overlapping 200ms windows and plot
|
||||||
|
them in an appropriate way.
|
||||||
|
\part Compute the autocorrelation of the spike response as well as
|
||||||
|
the cross-correlation between stimulus and spike response.
|
||||||
|
\part Determine the fundamental stimulus frequency and the EOD
|
||||||
|
frequency using a Fourier transform.
|
||||||
|
\part Convolve the spike responses (windows) with a Gaussian of
|
||||||
|
appropriate size and compute the average Fourier amplitude
|
||||||
|
spectrum of the spike response. Plot the result in an appropriate
|
||||||
|
way.
|
||||||
|
\part Determine whether you can find peas in the amplitude
|
||||||
|
spectrum at the fundamental frequency of the EOD and/or the
|
||||||
|
stimulus and/or their difference.
|
||||||
|
\end{parts}
|
||||||
|
\end{questions}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\end{document}
|
@ -369,12 +369,12 @@ incubation. The following plot depicts the mean thymus gland weights in (mg):
|
|||||||
the the first $80$ datapoints, and repeat the following steps
|
the the first $80$ datapoints, and repeat the following steps
|
||||||
$m=500$ times:
|
$m=500$ times:
|
||||||
\begin{enumerate}
|
\begin{enumerate}
|
||||||
\item draw $50$ data points from $x$ with replacement
|
\item draw $80$ data points from $x$ with replacement
|
||||||
\item compute their mean and store it
|
\item compute their mean and store it
|
||||||
\end{enumerate}
|
\end{enumerate}
|
||||||
Look at the standard deviation of the computed means.
|
Look at the standard deviation of the computed means.
|
||||||
\item Compare the result to the standard deviation of the original
|
\item Compare the result to the standard deviation of the original
|
||||||
$50$ data points and the standard error.
|
$80$ data points and the standard error.
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
\end{task}
|
\end{task}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
function ll = invg_loglikelihood(x, p)
|
function ll = invg_loglikelihood(x, p)
|
||||||
mu = p(1);
|
mu = p(1);
|
||||||
lambda = p(2);
|
lambda = p(2);
|
||||||
ll = mean(.5*(log(lambda) - log(2*pi) - 3*log(x)) - lambda*(x-mu).^2./(2*mu^2*x));
|
ll = .5*(log(lambda) - log(2*pi) - 3*log(x)) - ...
|
||||||
|
lambda*(x-mu).^2./(2*mu^2*x);
|
@ -1,4 +1,4 @@
|
|||||||
function [err, grad] = lserr(param, x, y)
|
function [err, grad] = lserr(x, y, param)
|
||||||
err = mean( (param(1)*x + param(2) - y).^2 );
|
err = mean( (param(1)*x + param(2) - y).^2 );
|
||||||
|
|
||||||
if nargout == 2
|
if nargout == 2
|
||||||
|
Reference in New Issue
Block a user