Changeset 355

Show
Ignore:
Timestamp:
06/12/08 11:21:16 (5 months ago)
Author:
apdavison
Message:

This version presented in Freiburg, June 12 2008

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/Freiburg2008/backends.tex

    r348 r355  
    4141\begin{block}{NEST 1.0} 
    4242\small 
     43(deprecated) 
     44 
    4345\url{http://www.nest-initiative.org/index.php/Software:Download} 
    4446 
     
    4850\begin{block}{NEST 2.0} 
    4951\small 
    50 available on request from Marc-Oliver Gewaltig (marc-oliver.gewaltig@honda-ri.de) 
    51  
     52available on request from Marc-Oliver Gewaltig (marc-oliver.gewaltig@honda-ri.de)\\ 
     53or Jochen Eppler.\\ 
    5254(PyNEST included). 
    5355\end{block} 
     
    6365 
    6466\begin{verbatim} 
    65 ./configure --enable-pynest --with-mpi 
     67./configure --with-mpi 
    6668make 
    6769make install 
     
    9799\framesubtitle{Example} 
    98100 
    99 \begin{verbatim} 
    100 import nest 
    101  
    102 neuron = nest.Create("iaf_neuron") 
     101\begin{semiverbatim} 
     102import nest\pause 
     103 
     104neuron = nest.Create("iaf_neuron")\pause 
    103105 
    104106input = nest.Create("dc_generator") 
    105 nest.SetStatus(input, {"amplitude": 550.0}) 
    106  
    107 vm = nest.Create("voltmeter") 
     107nest.SetStatus(input, {"amplitude": 550.0})\pause 
     108 
     109vm = nest.Create("voltmeter")\pause 
    108110 
    109111nest.Connect(input, neuron) 
    110 nest.Connect(vm, neuron) 
     112nest.Connect(vm, neuron)\pause 
    111113 
    112114nest.Simulate(100.0) 
    113 \end{verbatim} 
     115\end{semiverbatim} 
    114116 
    115117\end{frame} 
     
    195197\framesubtitle{Example} 
    196198 
    197 \begin{verbatim} 
    198 import neuron, nrn 
     199\begin{semiverbatim} 
     200import neuron, nrn\pause 
    199201 
    200202soma = nrn.Section() 
    201 soma.insert("hh") 
    202  
    203 input = neuron.IClamp(soma, 0.5) 
    204 input.dur = 100 
    205 input.amp = 0.1 
     203soma.insert("hh")\pause 
     204 
     205input = neuron.IClamp(soma, dur=100, amp=0.1)\pause 
     206 
     207vm = neuron.Vector() 
     208vm.record(soma, "v")\pause 
    206209 
    207210neuron.init() 
    208211neuron.run(100.0) 
    209 \end{verbatim} 
     212\end{semiverbatim} 
    210213\end{frame} 
    211214 
     
    284287\framesubtitle{Example} 
    285288 
    286 \begin{verbatim} 
    287 import pypcsim 
    288  
    289 net = pypcsim.SingleThreadNetwork() 
    290  
    291 neuron = net.create(pypcsim.LifNeuron(Iinject=1e-8)) 
    292  
    293 vm = net.record(neuron, "Vm", pypcsim.AnalogRecorder()) 
     289\begin{semiverbatim} 
     290import pypcsim\pause 
     291 
     292net = pypcsim.SingleThreadNetwork()\pause 
     293 
     294neuron = net.create(pypcsim.LifNeuron(Iinject=1e-8))\pause 
     295 
     296vm = net.record(neuron, "Vm", pypcsim.AnalogRecorder())\pause 
    294297 
    295298net.simulate(0.1) 
    296 \end{verbatim} 
     299\end{semiverbatim} 
    297300 
    298301\end{frame} 
     
    365368\end{frame} 
    366369 
    367 \begin{frame} % -------------------------------------------------------------------- 
    368 \frametitle{Brian} 
    369 \framesubtitle{Example} 
    370  
    371  
    372  
    373 \end{frame} 
    374  
     370%\begin{frame} % -------------------------------------------------------------------- 
     371%\frametitle{Brian} 
     372%\framesubtitle{Example} 
     373 
     374 
     375 
     376%\end{frame} 
     377 
  • doc/Freiburg2008/contributing.tex

    r321 r355  
    55\frametitle{Reporting a bug} 
    66 
    7 screenshot of homepage with arrow pointing to New Ticket button 
    8  
     7\begin{center} 
     8\includegraphics[height=0.8\textheight]{figures/pynn_website_screenshot_newticket1} 
     9\url{http://neuralensemble.org/trac/PyNN/newticket} 
     10\end{center} 
    911\end{frame} 
    1012 
     
    1214\frametitle{Reporting a bug} 
    1315 
    14 screenshot of New Ticket page 
     16\begin{center} 
     17\includegraphics[height=0.8\textheight]{figures/pynn_website_screenshot_newticket2} 
     18\end{center} 
    1519 
    1620\end{frame} 
     
    1923\frametitle{Asking a question} 
    2024 
    21 screenshot of Google groups 
     25\begin{center} 
     26\includegraphics[height=0.8\textheight]{figures/neuralensemble_community_screenshot} 
     27\url{http://groups.google.com/group/neuralensemble} 
     28\end{center} 
    2229 
    2330\end{frame} 
    2431 
    25 \begin{frame} % -------------------------------------------------------------------- 
    26 \frametitle{svn commit
     32\begin{frame}[fragile] % -------------------------------------------------------------------- 
     33\frametitle{Contributing code
    2734 
    28 STOP! First, run the test suite. 
    29  
    30 Show how to do this. 
    31  
    32 STOP! Now write an informative commit message (using Trac syntax if possible) 
    33  
     35\begin{itemize} 
     36\item Check out the latest version from svn: 
     37\begin{footnotesize} 
     38\begin{verbatim} 
     39$ svn co https://neuralensemble.org/svn/PyNN/trunk pyNN_trunk 
     40\end{verbatim} 
     41\end{footnotesize} 
     42\item When you are ready to commit your changes, run the test suite: 
     43\begin{small} 
     44  \begin{verbatim} 
     45$ cd test 
     46$ python neurontests.py; python nest2tests.py; etc 
     47$ python generictests.py neuron; etc 
     48$ ./runtests.py 
     49$ cd ../doc 
     50$ for file in *.txt; do ./testdocs.py $file; done\end{verbatim} 
     51\end{small} 
     52\item Now write an informative commit message (using Trac syntax if possible) 
     53\end{itemize} 
    3454 
    3555\end{frame} 
  • doc/Freiburg2008/exercises/pyNN_exercises.tex

    r353 r355  
    22 
    33\usepackage[utf8x]{inputenc} 
    4 \usepackage[left=3cm, right=3cm, top=4cm, bottom=4cm]{geometry}  
     4\usepackage[left=2cm, right=2cm, top=1.5cm, bottom=2cm]{geometry}  
    55\usepackage{graphicx} 
    66\usepackage{natbib} 
     
    1313%\author{Jochen Martin Eppler, eppler@biologie.uni-freiburg.de\\ 
    1414  %Jens Kremkow, kremkow@incm.cnrs-mrs.fr} 
    15 %\date{
     15\date{FACETS/BCCN Python Workshop, 9th-13th June 2008
    1616\maketitle 
    1717 
    18 \section{Objectives} 
    19 This exercises make you familiar with the basic commands of PyNN. 
     18\section*{Single neurons} 
    2019 
    21 %\begin{itemize} 
    22 %\item understand the mechanism of spike generation in 
    23 %  integrate-and-fire neuron models 
    24 %\item understand temporal summation in a single neuron 
    25 %\item understand temporal summation in a synfire chain 
    26 %\end{itemize} 
     20\subsection*{Exercise 1: basic properties of integrate-and-fire neurons} 
    2721 
    28  
    29 %\section{NEST, PyNEST and PyNN} 
    30  
    31 %The Neural Simulation Tool NEST is a simulator for \emph{large} 
    32 %biological neural networks with more than $10^4$ neurons and $10^9$ 
    33 %synapses. It supports multithreaded and distributed simulation to 
    34 %utilize the computing power of modern multicore computers and clusters 
    35 %of such machines. NEST is written as C++ library that is interfaced by 
    36 %a simulation language interpreter (SLI) for the setup and control of 
    37 %the simulations. For more information, see the homepage of the NEST 
    38 %Initiative at \url{http://www.nest-initiative.org}. You will also find 
    39 %the source code there. 
    40  
    41 %PyNEST is an extension to NEST that provides Python bindings for the 
    42 %simulation kernel. These bindings can be used to set up simulations 
    43 %instead of the built in language interpreter. Because PyNEST is used 
    44 %from within Python, it is possible to directly plot the data from the 
    45 %networks simulated within NEST. 
    46  
    47 %PyNN is a Python package for simulator-independent specification of 
    48 %neuronal network models. In other words, you can write the code for a 
    49 %model once, using the PyNN API, and then run it without modification 
    50 %on any simulator that PyNN supports (currently NEURON, NEST and 
    51 %PCSIM). PyNN is avalable at \url{http://neuralensemble.org/trac/PyNN}. 
    52  
    53 % 
    54 %\section{Exercises} 
    55  
    56 %The exercises in this tutorial are built on top of the PyNN API. 
    57 %Therefore, the most frequently used classes and functions are 
    58 %explained in the following list. For a detailed user manual, see the 
    59 %PyNN homepage or call \texttt{help(\emph{function})} in IPython. 
    60  
    61 %\begin{description} 
    62 %\item{\texttt{Population()}:} Takes a tuple for the dimensions of the 
    63 %  population, a node type and a parameter dictionary. It creates the 
    64 %  elements and returns a handle to the population. 
    65 %\item{\texttt{Projection()}:} Takes two populations and a connection 
    66 %  method (pattern). Possible values for the method are, among others, 
    67 %  \emph{allToAll} or \emph{oneToOne}. The function connects the 
    68 %  populations with the given pattern. A handle to the projections is 
    69 %  returned. 
    70 %\item{\texttt{Population.record()}:} Activate spike recording for the 
    71 %  population. The data will be stored in a temporary file. 
    72 %\item{\texttt{Population.record\_v()}:} Same for membrane potential. 
    73 %\item{\texttt{Population.print\_spike()}:} Close the spike file and 
    74 %  move it to its final path. 
    75 %\item{\texttt{Population.print\_v()}:} Same for potentials. 
    76 %\end{description} 
    77 % 
    78 %During the exercise, we will use \emph{IPython}, an enhanced 
    79 %interpreter for Python. This allows to easily change parameters and 
    80 %explore the effects in a convenient and interactive way. All 
    81 %simulation scripts are built from the same building blocks, 
    82 %encapsulated in the following functions: 
    83 %\begin{description} 
    84 %\item{\texttt{get\_params()}:} This function is used to obtain a 
    85 %  dictionary with the standard parameters for all experiments. During 
    86 %  the exercises, this dictionary can be modified to explore the effect 
    87 %  of the parameters of the simulation. 
    88 %\item{\texttt{get\_experiment\_dict(params)\footnote{Contained in the 
    89 %  tools.py module}}:} This function returns a dictionary of 
    90 %  dictionaries that contains all possible combinations of the given 
    91 %  parameters. Each entry is an experiment that can be passed to 
    92 %  \texttt{sim()}. 
    93 %\item{\texttt{sim(experiment)}:} This function runs the simulation for 
    94 %  one specific set of parameters. The results from the simulation are 
    95 %  stored in the \texttt{results/} directory. 
    96 %\item{\texttt{show(experiments)}:} This function produces nice plots 
    97 %  from the data from the simulation runs. Figures are stored in 
    98 %  \texttt{figures/} 
    99 %\end{description} 
    100 \section{Single neurons} 
    101 \subsection{The Integrate-and-Fire Neuron} 
    102  
    103 In single-compartment models, the whole membrane is collapsed into a 
    104 single point, which is why they are also called point neurons. Thus 
    105 the membrane potential $V$ is only a function of time and not of 
    106 space. The most frequently used model of this kind is the "leaky 
    107 integrate-and-fire" model, which was already described 1907 by 
    108 Lapicque. It acts as a low-pass-filter below threshold and will evoke 
    109 a spike when the threshold ($V_{Th}$) is crossed. In 
    110 principle it is possible to include active mechanisms that give rise 
    111 to i.e. realistic spikes, adaptive firing, afterhyperpolarization 
    112 etc., for details refer to \cite{Gerstner02}. The spike is imitated by 
    113 a reset of the membrane potential followed by a clamping to the 
    114 resting value for the length of the refractory period 
    115 $\tau_\mathrm{ref}$. After the refractory period, the integration 
    116 process continues. The subthreshold dynamics is described by 
    117 \[ 
    118    \tau_m \frac{dV}{dt} = E_L-V-r_m\overline{g_s}P_s(V-E_s)+R_m I_e 
    119 \] 
    120 $\tau_m$ is the membrane time constant, $E_L$ the reversal potential 
    121 of the leak, $V$ the membrane potential, $r_m$ the specific membrane 
    122 resistance ($1/\overline{g_L}$), $P_s$ the alpha function of the 
    123 synaptic conductances, $R_m$ the total membrane resistance and $I_e$ 
    124 the applied current. 
    125  
    126  
    127 \subsection{Basic Properties of the IAF Neuron} 
    12822The setup for the first exercise is very simple 
    12923(figure~\ref{fig:ex1_setup}): A current is injected into a single 
    13024integrate-and-fire neuron. By adjusting the amplitude of the current 
    131 and the parameters of the neuron, the spike-rate of the neuron can be 
    132 modulated. Please construct a model of figure~\ref{fig:ex1_setup} with the help of pyNN. Use ParameterSet to organize the model parameters (it will help you in the next exercises). 
    133 \paragraph{PyNN functions for this exercise} 
    134 \begin{itemize} 
    135 \item setup 
    136 \item Population 
    137 \item Population.record 
    138 \item Population.record\_v 
    139 \item set 
    140 \item connect 
    141 \item run 
    142 \item Population.printSpikes 
    143 \item Population.print\_v 
    144 \end{itemize} 
     25and the parameters of the neuron, the firing rate of the neuron can be 
     26modulated. Please construct a model of figure~\ref{fig:ex1_setup} using the PyNN low-level, procedural API, with whichever backend (NEURON, NEST,...) you wish, and record and plot the membrane potential for different parameter values, as in fig.~\ref{fig:dc_mempot}. (Note: use the \verb|setup()| function to reset the simulator for a new run). 
    14527 
    146 \begin{figure}[ht] 
     28\begin{figure}[hbt] 
    14729  \begin{center} 
    14830    \includegraphics[width=.65\linewidth]{ex1_setup} 
     
    15436\end{figure} 
    15537 
    156 \subsection{Membrane Potential and Spikes} 
    15738 
    158 The membrane potential ($V$) trace of the IAF neuron does not show 
    159 spikes. Instead, $V$ is directly reset to the resting potential when 
    160 the threshold is reached and a spike is generated, which 
    161 is sent to all targets of the neuron. $V$ then remains clamped to the 
    162 resting potential for $\tau_\mathrm{ref}$ ms. Please record the membrane potential of the neuron and plot it as a function of time, similar to figure \ref{fig:dc_mempot}. In addition you can look at the membrane potential distribution, use the numpy.histogram function for that. 
     39\paragraph{PyNN functions/classes for this exercise:} 
     40\verb|setup()|, 
     41\verb|create()|, 
     42\verb|IF_cond_exp| (\textit{or another standard IF neuron}), 
     43\verb|record_v()|, 
     44\verb|connect()|, 
     45\verb|run()|, 
     46\verb|end()|. 
    16347 
    164 \begin{figure}[!ht] 
     48 
     49\begin{itemize} 
     50\item Now rewrite the model using the high-level, object-oriented API (using the \verb|Population|, \verb|Projection| and \verb|OneToOneConnector| classes). 
     51\item Rewrite the model to use the \verb|ParameterSet| class from NeuroTools (this will help in the next exercise). 
     52\item Plot the membrane potential distribution (use the \verb|numpy.histogram()| function). 
     53\end{itemize} 
     54 
     55 
     56\begin{figure}[tb] 
    16557  \begin{center} 
    16658    \includegraphics[width=\linewidth]{dc_input_membrane_traces} 
     
    17163\end{figure} 
    17264 
    173 The traces of $V$ are shown in fig.~\ref{fig:dc_mempot} for different 
    174 amplitudes of the DC. In the absence of noise, the neuron will fire 
    175 regularly like a clock. 
    17665 
    177 \paragraph{Parameters for this Exercise} 
    178 \begin{description} 
    179 \item{tau\_refrac:} Change the refractory period of the neuron. Given in ms. 
    180 \item{i\_offset:} Change the amplitude of the injected current. Given in nA. 
    181 \end{description} 
     66\subsection*{Exercise 2: refractory period} 
    18267 
    183  
    184 \subsection{Refractory Period} 
    185  
    186 The refractory period $\tau_\mathrm{ref}$ (ms) of the neuron directly 
    187 determines the largest possible firing rate of the neuron. This is 
     68The refractory period $\tau_\mathrm{ref}$ of the neuron directly 
     69determines the highest possible firing rate of the neuron. This is 
    18870shown in figure~\ref{fig:dcinput}. The spike rate will, for an 
    18971increasing amplitude of the current, eventually saturate at a rate of 
    190 1000ms/$\tau_\mathrm{ref}$ Hz.\\ 
    191 Please use the model to create a plot similar to figure ~\ref{fig:dcinput}. Use the ParameterRange to scan the necessary parameter space and SpikesList to estimate the mean firing rate. 
     721000/$\tau_\mathrm{ref}$ Hz (for $\tau_\mathrm{ref}$ in ms).\\ 
     73Please use the model to create an $f_I$ plot similar to figure ~\ref{fig:dcinput}. Use the \verb|ParameterRange| class to scan the necessary parameter space and the \verb|SpikeList| class to estimate the mean firing rate. 
    19274 
    19375 
     
    20082\end{figure} 
    20183 
    202 \paragraph*{Parameters for this Exercise} 
    203 \begin{description} 
    204 \item{tau\_refrac:} Change the refractory period of the neuron. Given in ms. 
    205 \item{i\_offset:} Change the amplitude of the offset current. Given in nA. 
    206 \end{description} 
    20784 
     85\subsection*{Exercise 3: noise sources} 
    20886 
    209 \subsection{Noise sources} 
    210 The are different kinds of noise sources available in pyNN. The SpikeSourcePoisson celltype emits spikes according to a Poisson process. Please create a neuron of type SpikeSourcePoisson, connect it to your IAF neuron and modulate its rate. You can add a spike source that delivers excitatory input and one that provides inhibitory input to control the mean membrane potential. Observe how the IF-curve changes its shape. 
    211 \paragraph{Parameters for this Exercise} 
    212 \begin{description} 
    213 \item{rate:} mean firing rate of the spike source (spikes/s) 
    214 \end{description} 
     87The are different kinds of noise sources available in PyNN. The \verb|SpikeSourcePoisson| cell type emits spikes according to a Poisson process. Please create a neuron of type \verb|SpikeSourcePoisson|, connect it to your IAF neuron and modulate its rate.  
    21588 
    216 \subsection{Temporal Summation in the IAF Neuron} 
     89\begin{itemize} 
     90\item Plot the output firing rate as a function of the input firing rate. 
     91\item Add both an excitatory and an inhibitory spike source. Balance the weights so that the cell is close to threshold but does not fire. Now plot the $f-I$ curve as in Exercise 2 and note how it changes shape in the presence of noise.  
     92\end{itemize} 
     93 
     94\subsection*{Exercise 4: temporal Summation in the IAF Neuron} 
     95 
    21796This exercise shows the effect of multiple spikes on the membrane 
    21897potential of the postsynaptic neuron. The setup is basically the same 
    219 as the previous one, with the difference that the SpikeSourcePoisson is replaced by a SpikeSourceArray. A SpikeSourceArray emits spikes at times specified in an array. To study the temporal summation properties of the neuron, these spike times will be drawn from a Gaussian distribution with a 
    220 standard deviation $\sigma$, creating a pulse packet with different width and size. When $\sigma$ is small the spikes created are delivered synchronously and when $\sigma$ is large asynchronously.\\ 
    221 Please create such a SpikeSourceArray and see the effect of the temporal summation. Please adjust the synaptic weight such that 100 synchronously arriving spikes elicit a spike in the post synaptic neuron. 
    222  
    223  
    224 \paragraph{PyNN functions for this exercise} 
    225 \begin{itemize} 
    226 \item SpikeSourceArray 
    227 \end{itemize} 
    228  
    229 %\texttt{show()} will plot the membrane 
    230 %potential trace of the neuron together with the spikes in the pulse 
    231 %packet against time. Two example plots for $n=10$ are shown in 
    232 %fig.~\ref{fig:temporal_summation}. 
     98as the previous one, with the difference that the SpikeSourcePoisson is replaced by a SpikeSourceArray. A SpikeSourceArray emits spikes at times specified in an array. To study the temporal summation properties of the neuron, these spike times will be drawn from a Gaussian distribution with a standard deviation $\sigma$, creating a pulse packet with different width and size. When $\sigma$ is small the spikes created are delivered synchronously and when $\sigma$ is large asynchronously.\\ 
     99Create such a SpikeSourceArray and examine the effect of the temporal summation. Adjust the synaptic weight such that 100 synchronously arriving spikes elicit a spike in the post synaptic neuron. 
    233100 
    234101\begin{figure}[!ht] 
     
    242109\end{figure} 
    243110 
    244 %To explore the effect of noise on the spiking probability, a random 
    245 %noise source can be introduced by usind a nonzero rate as already seen 
    246 %in exercise 1. This simulation contains inhibitory and excitatory 
    247 %connections to the postsynaptic neurons to allow the exploration of 
    248 %integration of both types of input. 
    249 
    250 %\subsubsection*{Parameters for this Exercise} 
    251 %\begin{description} 
    252 %\item{onset\_pulsepacket:} Set the onset of the pulse packet in ms. 
    253 %\item{sigma\_pulsepacket:} Change the standard deviation of the Gaussian. 
    254 %\item{n\_pulsepacketE:} The number of excitatory spikes in the pulse 
    255 %  packet. 
    256 %\item{n\_pulsepacketI:} The number of inhibitory spikes in the pulse 
    257 %  packet. 
    258 %\item{background\_rate:} Introduce a random noise source with a 
    259 %  specific rate, given in Hz. 
    260 %\end{description} 
     111\subsection*{Exercise 5: spike triggered averaging} 
     112Create a second neuron and use the neuron from previous exercises to provide synaptic input to it. Inject a current into the first neuron and adjust the amplitude such that you induce a moderate firing rate. Record the membrane potential of the second neuron and estimate the PSP amplitude by mean of reverse correlation (spike triggered averaging, STA). Use the spikes of the first neuron as triggers. Perform this STA in the presence and absence of noisy background input to neuron two. Can you use \verb|numpy.array|s to perform the STA? 
    261113 
    262 \subsection{Synapses between neurons, and spike triggered averaging} 
    263 Create a second neuron and use the neuron from previous exercises to provide synaptic input to it. Inject a current into the first neuron and adjust the amplitude such that you induce a moderate firing rate. Record the membrane potential of the second neuron and estimate the PSP amplitude by mean of reverse correlation (spike triggered averaging, STA). Use the spikes of the first neuron as triggers. Perform this STA in the presence and absence of noisy background input to neuron two. Can you use numpy.arrays to perform the STA? 
    264 An application of spike triggered averaging on the membrane potentials in vivo can be found here \cite{Matsumura:1996p731}. 
     114\section*{Networks} 
    265115 
    266 \section{Networks} 
    267  
    268 \subsection{Synfire chain} 
    269 The synfire hypothesis states that under appropriate conditions 
     116\subsection*{Exercise 6: Synfire chain} 
     117The Synfire hypothesis states that under appropriate conditions 
    270118volleys of synchronized spikes (\emph{pulse packets}, as seen in the 
    271119last section) can propagate through the cortical network by traveling 
     
    289137  \end{center} 
    290138\end{figure} 
    291 \begin{figure}[ht] 
    292   \begin{center} 
    293     \includegraphics[width=.9\linewidth]{synfirechain_activity} 
    294     \caption{Different regimes of synfire activity. Left panel: spike 
    295     activity of the neurons, right panel: distribution from which 
    296     spike times are drawn} 
    297     \label{fig:synfirechain_regimes} 
    298   \end{center} 
    299 \end{figure} 
     139 
    300140Basically, 4 regimes of synfire activity can be differentiated: 
    301141\begin{enumerate} 
     
    309149  ignition of the whole chain. 
    310150\end{enumerate} 
    311 A detailed analysis of the survival probability of signals in synfire 
    312 chains can be found in \cite{Gewaltig01}.\\ 
     151 
     152\begin{figure}[ht] 
     153  \begin{center} 
     154    \includegraphics[width=.9\linewidth]{synfirechain_activity} 
     155    \caption{Different regimes of synfire activity. Left panel: spike 
     156    activity of the neurons, right panel: distribution from which 
     157    spike times are drawn} 
     158    \label{fig:synfirechain_regimes} 
     159  \end{center} 
     160\end{figure} 
     161 
    313162Please construct a synfire chain and study the above described activity regimes. Use the ability to iterate over data structures to create and connect the neuron groups. 
    314163 
    315 \paragraph{Parameters for this Exercise} 
     164\paragraph{Parameters for this exercise} 
    316165\begin{description} 
    317166\item{number\_synfire\_groups:} The length of the synfire chain. 
     
    325174 
    326175 
    327 \subsection{Recurrent random networks} 
     176\subsection*{Exercise 7: Recurrent random networks} 
    328177The cortical network is not just a feed-forward structure. Each neuron provides inputs and receives inputs from many other neurons, creating a recurrent network. This recurrent network is often modeled by the random network, in which populations of neurons are randomly connected with each other. The connection probability is usually low, around 10 \%.\\ 
    329 Please construct a random network of 1000 excitatory/inhibitory neurons. The fraction of excitatory neurons should be around 80\% and the one of inhibitory 20\%. Connect all neurons with a connection probability of 10\% and use the Poisson generators to activate the network (see figure \ref{fig:randomnetwork} for a schematic diagram of the model).\\ Observe how the activity changes depending on the rate $\nu_{ext}$ of the Poisson generators. As a second parameter you may want to vary the strength of the inhibitory synapses $gi$ and create 2 dimensional colorplots, with $gi$ on the x-axis and $\nu_{ext}$ on the y-axis. Use the mean firing rate and other measures to describe the activity state. Details about the dynamics of conductance based random networks and how to measure and describe the activity can be found in \cite{Kumar:2008p1444,Kumar:2008p4530} 
     178Please construct a random network of 1000 excitatory/inhibitory neurons. The fraction of excitatory neurons should be around 80\% and the one of inhibitory 20\%. Connect all neurons with a connection probability of 10\% and use Poisson spike sources to activate the network (see figure \ref{fig:randomnetwork} for a schematic diagram of the model).\\ Observe how the activity changes depending on the rate $\nu_{ext}$ of the Poisson generators. As a second parameter you may want to vary the strength of the inhibitory synapses $gi$ and create 2-dimensional colorplots, with $gi$ on the x-axis and $\nu_{ext}$ on the y-axis. Use the mean firing rate and other measures to describe the activity state. %Details about the dynamics of conductance based random networks and how to measure and describe the activity can be found in \cite{Kumar:2008p1444,Kumar:2008p4530} 
    330179\begin{figure}[ht] 
    331180  \begin{center} 
  • doc/Freiburg2008/exercises/scripts/exercise1.py

    r353 r355  
    44""" 
    55 
    6 import pyNN.neuron as sim 
     6import pyNN.nest2 as sim 
    77 
    88dt = 0.1 
    99simtime = 100.0 
     10i_offset = 1.0 
    1011 
    1112filename = "exercise1.v" 
     
    2930t = pylab.arange(0, simtime+dt, dt) 
    3031 
    31 assert len(t) == len(vm), "%s != %s" % (len(t),len(vm)) 
     32assert 0 <= len(t) - len(vm) <= 2 
     33t = t[:len(vm)] 
    3234 
    3335pylab.plot(t, vm, 'b-') 
    3436pylab.xlabel('Time (ms)') 
    3537pylab.ylabel('Membrane potential (mV)') 
     38pylab.show() 
  • doc/Freiburg2008/exercises/scripts/exercise2.py

    r353 r355  
    33""" 
    44 
    5 import pyNN.neuron as sim 
     5import pyNN.nest2 as sim 
    66import pylab 
    77 
     
    1414sim.setup(timestep=dt, quit_on_end=False) 
    1515 
    16 p1 = sim.Population(1, sim.IF_cond_exp, {'tau_refrac':2.0}) 
     16#p1 = sim.Population(1, sim.IF_cond_exp, {'tau_refrac':2.0}) 
    1717 
    1818i_offset_arr = pylab.arange(0, 100.0, 1.0) 
     
    2222for i_offset in i_offset_arr: 
    2323    sim.setup() 
     24    p1 = sim.Population(1, sim.IF_cond_exp, {'tau_refrac':2.0}) 
    2425    p1[0].i_offset = i_offset 
    2526    p1.record() 
     
    3334pylab.xlabel('Current amplitude (nA)') 
    3435pylab.ylabel('Firing rate (spikes/s)') 
     36pylab.show() 
  • doc/Freiburg2008/exercises/scripts/exercise3.py

    r353 r355  
    33""" 
    44 
    5 import pyNN.neuron as sim 
     5import pyNN.nest2 as sim 
    66import pylab 
    77pylab.rcParams['interactive'] = True 
     
    4343pylab.xlabel('Input firing rate (spikes/s)') 
    4444pylab.ylabel('Output firing rate (spikes/s)') 
     45pylab.show() 
  • doc/Freiburg2008/freiburg_PyNN_lectures.tex

    r350 r355  
    6363{ 
    6464  \begin{frame}<beamer> 
     65    \small 
    6566    \frametitle{Outline} 
    66     \tableofcontents[currentsection,currentsubsection
     67    \tableofcontents[currentsection,hideallsubsections
    6768  \end{frame} 
    6869} 
     
    112113\input{standard_celltypes} 
    113114 
    114 \input{native_celltypes} 
     115%\input{native_celltypes} 
    115116 
    116117\input{larger_networks} 
     
    118119\input{plasticity} 
    119120 
    120 \input{porting} 
     121%\input{porting} 
    121122 
    122123\input{contributing} 
     
    124125% ==================================================================== 
    125126 
     127\setbeamertemplate{background} 
     128 {\includegraphics[width=\paperwidth,height=\paperheight]{figures/flickr_fortinbras_10182754_cfc533d350.jpg}} 
     129\begin{frame} 
     130   
     131  \begin{beamerboxesrounded}[width=9.0cm, shadow=True]{} 
     132  \Large 
     133  For more information: 
     134   
     135  \vspace{1ex} 
     136    \begin{center} 
     137    \LARGE 
     138        http://neuralensemble.org/PyNN 
     139        \end{center} 
     140   \vspace{1ex} 
     141         
     142  \end{beamerboxesrounded} 
     143   
     144\end{frame} 
     145 
     146 
    126147\end{document} 
    127148 
  • doc/Freiburg2008/installation.tex

    r321 r355  
    44\begin{frame} % -------------------------------------------------------------------- 
    55\frametitle{Installing PyNN} 
     6\framesubtitle{Download} 
    67 
     8\begin{block}{Latest stable version} 
     9\url{http://neuralensemble.org/PyNN/wiki/Download} 
     10\end{block} 
     11\begin{block}{Latest development version} 
     12\texttt{svn co https://neuralensemble.org/svn/PyNN/trunk pyNN} 
     13\end{block} 
     14\begin{block}{Full documentation} 
     15\url{http://neuralensemble.org/PyNN} 
     16\end{block} 
     17\end{frame} 
     18 
     19 
     20\begin{frame}[fragile] % -------------------------------------------------------------------- 
     21\frametitle{Installing PyNN} 
     22\framesubtitle{Installation} 
     23 
     24\begin{verbatim} 
     25$ tar xzf PyNN-0.4.1.tar.gz 
     26 
     27$ cd PyNN-0.4.1 
     28 
     29$ python setup.py install 
     30\end{verbatim} 
    731 
    832\end{frame} 
    933 
    10  
    11 \begin{frame} % -------------------------------------------------------------------- 
     34\begin{frame}[fragile] % -------------------------------------------------------------------- 
    1235\frametitle{Running a PyNN simulation} 
    1336 
    14 % mention the sys.argv trick 
     37\begin{block}{Pick a simulator, any simulator...} 
     38\begin{verbatim} 
     39  import pyNN.neuron as sim 
     40  import pyNN.nest1 as sim 
     41  import pyNN.nest2 as sim 
     42  import pyNN.pcsim as sim 
     43  import pyNN.brian as sim 
     44  import pyNN.facetshardware1 as sim 
     45\end{verbatim} 
     46\end{block} 
    1547 
    1648\end{frame} 
     49 
     50\begin{frame}[fragile] % -------------------------------------------------------------------- 
     51\frametitle{Running a PyNN simulation} 
     52 
     53\begin{block}{If you often switch simulators...} 
     54  \begin{verbatim} 
     55  simulator = sys.argv[-1] 
     56  exec("import pyNN.%s as sim" % simulator) 
     57  \end{verbatim} 
     58   
     59  \begin{verbatim} 
     60  $ python myscript.py nest2 
     61  $ python myscript.py neuron 
     62  \end{verbatim} 
     63   
     64\end{block} 
     65\end{frame} 
  • doc/Freiburg2008/intro.tex

    r320 r355  
    55  \frametitle{Simulator diversity} 
    66  \framesubtitle{Problem and opportunity} 
     7  \pause 
    78  \small 
    89  \textcolor{red!80!black}{\normalsize Cons} 
     
    1718    \end{itemize} 
    1819  \end{itemize} 
     20  
     21  \pause 
    1922  
    2023  \textcolor{blue!80!black}{\normalsize Pros} 
     
    8285\frametitle{Architecture} 
    8386\centering 
    84 \includegraphics[width=10.0cm]{figures/architecture_of_PyNN.pdf} 
     87\includegraphics[width=11.0cm]{figures/architecture_of_PyNN.pdf} 
    8588 
    8689\end{frame} 
    8790 
    88 \begin{frame} % ------------------------------------------------------ 
    89 \frametitle{How to get PyNN} 
    90  
    91 \begin{block}{Latest stable version} 
    92 \url{http://neuralensemble.org/PyNN/wiki/Download} 
    93 \end{block} 
    94 \begin{block}{Latest development version} 
    95 \texttt{svn co https://neuralensemble.org/svn/PyNN/trunk pyNN} 
    96 \end{block} 
    97 \begin{block}{Full documentation} 
    98 \url{http://neuralensemble.org/PyNN} 
    99 \end{block} 
    100 \end{frame} 
    101  
    102 \begin{frame} 
    103 \frametitle{How to participate in PyNN development} 
    104 \begin{center} 
    105 \includegraphics[height=7cm]{figures/pynn_website_screenshot2.png} 
    106  
    107 \Large{\url{http://neuralensemble.org/PyNN}} 
    108 \end{center} 
    109 \end{frame} 
  • doc/Freiburg2008/larger_networks.tex

    r353 r355  
    22\section{Larger networks} 
    33 
     4% .................................................................................. 
     5\subsection{Populations and Projections} 
     6 
    47\begin{frame}[fragile] % -------------------------------------------------------------------- 
    58\frametitle{Populations and Projections} 
     
    710\begin{block}{Problems with creating very large networks using \texttt{create()} and \texttt{connect()}} 
    811\begin{itemize} 
    9 \item involves writing a lot of repetitive code, which is the same or similar for every model: iterating over lists of cells and connections, creating common projection patterns, recording from all or a subset of neurons... 
    10 \item this sort of `book-keeping' code takes time to write, obscures the essential principles of the simulation script with details 
    11 \item and, of course, the more code that has to be written, the more bugs and errors will be introduced 
     12\item involves writing a lot of repetitive code, which is the same or similar for every model: iterating over lists of cells and connections, creating common projection patterns, recording from all or a subset of neurons...\pause 
     13\item this sort of `book-keeping' code takes time to write, obscures the essential principles of the simulation script with details\pause 
     14\item and, of course, the more code that has to be written, the more bugs and errors will be introduced\pause 
    1215\item and, if the code is only used for a single project, not all the bugs may be found. 
    1316\end{itemize} 
     
    2831All the book-keeping code is contained within the object classes, which also provide methods to perform commonly-used tasks, such as recording from a fixed number of cells within the population, chosen at random. 
    2932 
    30 [Give a side by side example of the latter?] 
    31  
    3233\end{frame} 
    3334 
     
    3738By using the \verb|Population| and \verb|Projection| classes: 
    3839\begin{itemize} 
    39 \item less code needs to be written to create a given simulation 
    40 \item which means fewer-bugs and easier-to-understand scripts 
    41 \item plus, because the code for the classes is used in many different projects, bugs will be found more reliably 
     40\item less code needs to be written to create a given simulation\pause 
     41\item which means fewer-bugs and easier-to-understand scripts\pause 
     42\item plus, because the code for the classes is used in many different projects, bugs will be found more reliably\pause 
    4243\item and the internal implementation of the classes optimized for performance, e.g. iterations over large numbers of cells or connections can be done in fast compiled code (within the simulator engines) rather than in comparatively slow Python code. 
    4344\end{itemize} 
    4445\end{frame} 
    4546 
     47% .................................................................................. 
     48\subsection{Creating Populations} 
    4649 
    4750\begin{frame}[fragile] % -------------------------------------------------------------------- 
     
    5053Create a 10 x 10 array of \verb|IF_curr_exp| neurons with default parameters: 
    5154    \begin{verbatim} 
    52  >>> p1 = Population((10,10), IF_curr_exp)\end{verbatim} 
     55 >>> p1 = Population((10,10), IF_curr_exp)\end{verbatim}\pause 
    5356Create a 1D array of 100 spike sources, and give it a label: 
    5457    \begin{verbatim} 
    5558 >>> p2 = Population(100, SpikeSourceArray,  
    56                      label="Input Population")\end{verbatim} 
     59                     label="Input Population")\end{verbatim}\pause 
    5760Create a 3D array of \verb|IF_cond_alpha| neurons, all with a spike threshold set to -55 mV and membrane time constant set to 10 ms: 
    5861\small 
     
    97100\end{frame} 
    98101 
     102% .................................................................................. 
     103\subsection{Addressing individual neurons} 
    99104 
    100105\begin{frame}[fragile] % -------------------------------------------------------------------- 
     
    126131    Traceback (most recent call last): 
    127132    . . . 
    128     IndexError: index (999) out of range (0<=index<=10) in dimension 0\end{verbatim} 
     133    IndexError: index (999) out of range (0<=index<=10) 
     134                in dimension 0\end{verbatim} 
    129135as will giving the wrong number of dimensions in the address. 
    130136 
     
    152158    >>> p3.locate(250) 
    153159    (2, 2, 0) 
    154     \end{verbatim} 
     160    \end{verbatim}\pause 
    155161To access the 'i'th neuron in a Population, use the \verb|index()| method, e.g.,: 
    156162    \begin{verbatim} 
     
    166172\end{frame} 
    167173 
     174% .................................................................................. 
     175\subsection{Setting parameter values} 
    168176 
    169177\begin{frame}[fragile] % -------------------------------------------------------------------- 
     
    189197\vspace{1ex} 
    190198 
    191 Sets the initial membrane potential of each neuron to a value drawn from a uniform distribution between -70 mV and -55 mV: 
     199Set the initial membrane potential of each neuron to a value drawn from a uniform distribution between -70 mV and -55 mV: 
    192200    \begin{verbatim} 
    193201 >>> from pyNN.random import RandomDistribution 
    194202 >>> distr = RandomDistribution('uniform', [-70,-55]) 
    195203 >>> p1.rset('v_init', distr) 
    196     \end{verbatim} 
     204    \end{verbatim}\pause 
    197205For the specific case of setting the initial membrane potential, there is a convenience method \verb|randomInit()|, e.g.: 
    198206    \begin{verbatim} 
     
    234242\end{frame} 
    235243 
     244\begin{frame}[fragile] % -------------------------------------------------------------------- 
     245\frametitle{Position in space} 
     246 
     247 
     248The positions of individual neurons in a population can be accessed using their \verb|position| attribute, e.g.: 
     249    \begin{verbatim} 
     250    >>> p1[1,0].position = (0.0, 0.1, 0.2) 
     251    >>> p1[1,0].position 
     252    array([ 0. ,  0.1,  0.2])\end{verbatim}    \pause 
     253To obtain the positions of all neurons at once (as a numpy array), use the \verb|positions| attribute of the \verb|Population| object, e.g.: 
     254    \begin{verbatim} 
     255    >>> p1.positions 
     256    array([[...]])\end{verbatim}      \pause    
     257To find the neuron that is closest to a particular point in space, use the \verb|nearest()| attribute: 
     258    \begin{verbatim} 
     259    >>> p1.nearest((4.5, 7.8, 3.3)) 
     260    48 
     261    >>> p1[p1.locate(48)].position 
     262    array([ 4.,  8.,  0.]) 
     263    \end{verbatim} 
     264\end{frame} 
     265 
     266% .................................................................................. 
     267\subsection{Iterating} 
    236268 
    237269\begin{frame}[fragile] % -------------------------------------------------------------------- 
     
    276308\end{frame} 
    277309 
     310% .................................................................................. 
     311\subsection{Recording} 
    278312 
    279313\begin{frame}[fragile] % -------------------------------------------------------------------- 
     
    284318 
    285319Recording membrane potential: \verb|record_v()| 
    286  
     320\pause 
    287321\vspace{1ex} 
    288322 
     
    313347To get output in the native format of the simulator, add \verb|compatible_output=False| to the argument list. 
    314348 
    315 getSpikes()? 
     349%getSpikes()? 
    316350 
    317351\end{frame} 
     
    323357 
    324358When running a distributed simulation, each node records only those neurons that it simulates. 
    325 By default, at the end of the simulation all nodes send their recorded data to the master node so that all values are written to a single output file. [Note that this does not work yet for nest2, not sure about pcsim]. 
    326 Again, there is a performance penalty for this, so if you wish each node to write its own file, add \verb|gather=False| to the argument list. 
    327  
    328 \end{frame} 
    329  
    330  
    331 \begin{frame}[fragile] % -------------------------------------------------------------------- 
    332 \frametitle{Position in space} 
    333  
    334  
    335 The positions of individual neurons in a population can be accessed using their \verb|position| attribute, e.g.: 
    336     \begin{verbatim} 
    337     >>> p1[1,0].position = (0.0, 0.1, 0.2) 
    338     >>> p1[1,0].position 
    339     array([ 0. ,  0.1,  0.2])\end{verbatim}     
    340 To obtain the positions of all neurons at once (as a numpy array), use the \verb|positions| attribute of the \verb|Population| object, e.g.: 
    341     \begin{verbatim} 
    342     >>> p1.positions 
    343     array([[...]])\end{verbatim}          
    344 To find the neuron that is closest to a particular point in space, use the \verb|nearest()| attribute: 
    345     \begin{verbatim} 
    346     >>> p1.nearest((4.5, 7.8, 3.3)) 
    347     48 
    348     >>> p1[p1.locate(48)].position 
    349     array([ 4.,  8.,  0.]) 
    350     \end{verbatim} 
    351 \end{frame} 
     359 
     360\vspace{2ex} 
     361 
     362\begin{verbatim} 
     363 >>> p1.printSpikes("spikefile.dat", gather=True)\end{verbatim} 
     364{\small All nodes send their recorded data to the master node so that all values are written to a single output file. [Currently only implemented for NEURON].} 
     365 
     366\vspace{2ex} 
     367 
     368\begin{verbatim} 
     369 >>> p1.printSpikes("spikefile.dat", gather=False)\end{verbatim} 
     370{\small Each node writes to its own file.} 
     371 
     372\end{frame} 
     373 
     374 
    352375 
    353376 
     
    367390\end{frame} 
    368391 
     392% .................................................................................. 
     393\subsection{Connecting Populations with Projections} 
    369394 
    370395\begin{frame}[fragile] % -------------------------------------------------------------------- 
     
    372397 
    373398 
    374 A \verb|Projection| object is a container for all the synaptic connections of a given type between neurons in two \verb|Population|s, together with methods for setting synaptic weights and delays. 
     399A \verb|Projection| object is a container for all the synaptic connections of a given type between neurons in two \verb|Population|s, together with methods for setting synaptic weights and delays.\pause 
     400 
     401\vspace{1ex} 
    375402 
    376403A \verb|Projection| is created by specifying 
     
    395422 
    396423By default it is \verb|True|, but if a neuron should not connect to itself, set it to \verb|False|, e.g.: 
     424\begin{footnotesize} 
    397425    \begin{verbatim} 
    398426 >>> prj = Projection(p1, p1,  
    399427                      AllToAllConnector(allow_self_connections=False)) 
    400428    \end{verbatim} 
     429\end{footnotesize} 
    401430\end{frame} 
    402431 
     
    408437Use of the \verb|OneToOneConnector| requires that the pre- and post-synaptic populations have the same dimensions, e.g.: 
    409438    \begin{verbatim} 
    410  >>> prj = Projection(p1, p1, OneToOneConnector()) 
    411     \end{verbatim}     
     439 >>> prj = Projection(p1, p1, OneToOneConnector())\end{verbatim}   \pause  
    412440Trying to connect two \verb|Population|s with different dimensions will raise an Exception, e.g.: 
    413441    \begin{verbatim} 
     
    415443 Traceback (most recent call last): 
    416444 . . .  
    417  Exception: OneToOneConnector does not support presynaptic and postsynaptic Populations of different sizes. 
    418     \end{verbatim}     
     445 Exception: OneToOneConnector does not support  
     446            presynaptic and postsynaptic Populations 
     447            of different sizes.\end{verbatim}  \pause    
    419448 
    420