Changeset 355
- Timestamp:
- 06/12/08 11:21:16 (5 months ago)
- Files:
-
- doc/Freiburg2008/backends.tex (modified) (7 diffs)
- doc/Freiburg2008/contributing.tex (modified) (3 diffs)
- doc/Freiburg2008/exercises/pyNN_exercises.tex (modified) (9 diffs)
- doc/Freiburg2008/exercises/scripts/exercise1.py (modified) (2 diffs)
- doc/Freiburg2008/exercises/scripts/exercise2.py (modified) (4 diffs)
- doc/Freiburg2008/exercises/scripts/exercise3.py (modified) (2 diffs)
- doc/Freiburg2008/exercises/scripts/exercise4.py (added)
- doc/Freiburg2008/freiburg_PyNN_lectures.tex (modified) (4 diffs)
- doc/Freiburg2008/installation.tex (modified) (1 diff)
- doc/Freiburg2008/intro.tex (modified) (3 diffs)
- doc/Freiburg2008/larger_networks.tex (modified) (28 diffs)
- doc/Freiburg2008/plasticity.tex (modified) (1 diff)
- doc/Freiburg2008/small_networks.tex (modified) (10 diffs)
- doc/Freiburg2008/standard_celltypes.tex (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doc/Freiburg2008/backends.tex
r348 r355 41 41 \begin{block}{NEST 1.0} 42 42 \small 43 (deprecated) 44 43 45 \url{http://www.nest-initiative.org/index.php/Software:Download} 44 46 … … 48 50 \begin{block}{NEST 2.0} 49 51 \small 50 available on request from Marc-Oliver Gewaltig (marc-oliver.gewaltig@honda-ri.de) 51 52 available on request from Marc-Oliver Gewaltig (marc-oliver.gewaltig@honda-ri.de)\\ 53 or Jochen Eppler.\\ 52 54 (PyNEST included). 53 55 \end{block} … … 63 65 64 66 \begin{verbatim} 65 ./configure -- enable-pynest --with-mpi67 ./configure --with-mpi 66 68 make 67 69 make install … … 97 99 \framesubtitle{Example} 98 100 99 \begin{ verbatim}100 import nest 101 102 neuron = nest.Create("iaf_neuron") 101 \begin{semiverbatim} 102 import nest\pause 103 104 neuron = nest.Create("iaf_neuron")\pause 103 105 104 106 input = nest.Create("dc_generator") 105 nest.SetStatus(input, {"amplitude": 550.0}) 106 107 vm = nest.Create("voltmeter") 107 nest.SetStatus(input, {"amplitude": 550.0})\pause 108 109 vm = nest.Create("voltmeter")\pause 108 110 109 111 nest.Connect(input, neuron) 110 nest.Connect(vm, neuron) 112 nest.Connect(vm, neuron)\pause 111 113 112 114 nest.Simulate(100.0) 113 \end{ verbatim}115 \end{semiverbatim} 114 116 115 117 \end{frame} … … 195 197 \framesubtitle{Example} 196 198 197 \begin{ verbatim}198 import neuron, nrn 199 \begin{semiverbatim} 200 import neuron, nrn\pause 199 201 200 202 soma = nrn.Section() 201 soma.insert("hh") 202 203 input = neuron.IClamp(soma, 0.5) 204 input.dur = 100 205 input.amp = 0.1 203 soma.insert("hh")\pause 204 205 input = neuron.IClamp(soma, dur=100, amp=0.1)\pause 206 207 vm = neuron.Vector() 208 vm.record(soma, "v")\pause 206 209 207 210 neuron.init() 208 211 neuron.run(100.0) 209 \end{ verbatim}212 \end{semiverbatim} 210 213 \end{frame} 211 214 … … 284 287 \framesubtitle{Example} 285 288 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} 290 import pypcsim\pause 291 292 net = pypcsim.SingleThreadNetwork()\pause 293 294 neuron = net.create(pypcsim.LifNeuron(Iinject=1e-8))\pause 295 296 vm = net.record(neuron, "Vm", pypcsim.AnalogRecorder())\pause 294 297 295 298 net.simulate(0.1) 296 \end{ verbatim}299 \end{semiverbatim} 297 300 298 301 \end{frame} … … 365 368 \end{frame} 366 369 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 5 5 \frametitle{Reporting a bug} 6 6 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} 9 11 \end{frame} 10 12 … … 12 14 \frametitle{Reporting a bug} 13 15 14 screenshot of New Ticket page 16 \begin{center} 17 \includegraphics[height=0.8\textheight]{figures/pynn_website_screenshot_newticket2} 18 \end{center} 15 19 16 20 \end{frame} … … 19 23 \frametitle{Asking a question} 20 24 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} 22 29 23 30 \end{frame} 24 31 25 \begin{frame} % --------------------------------------------------------------------26 \frametitle{ svn commit}32 \begin{frame}[fragile] % -------------------------------------------------------------------- 33 \frametitle{Contributing code} 27 34 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} 34 54 35 55 \end{frame} doc/Freiburg2008/exercises/pyNN_exercises.tex
r353 r355 2 2 3 3 \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} 5 5 \usepackage{graphicx} 6 6 \usepackage{natbib} … … 13 13 %\author{Jochen Martin Eppler, eppler@biologie.uni-freiburg.de\\ 14 14 %Jens Kremkow, kremkow@incm.cnrs-mrs.fr} 15 %\date{}15 \date{FACETS/BCCN Python Workshop, 9th-13th June 2008} 16 16 \maketitle 17 17 18 \section{Objectives} 19 This exercises make you familiar with the basic commands of PyNN. 18 \section*{Single neurons} 20 19 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} 27 21 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 to34 %utilize the computing power of modern multicore computers and clusters35 %of such machines. NEST is written as C++ library that is interfaced by36 %a simulation language interpreter (SLI) for the setup and control of37 %the simulations. For more information, see the homepage of the NEST38 %Initiative at \url{http://www.nest-initiative.org}. You will also find39 %the source code there.40 41 %PyNEST is an extension to NEST that provides Python bindings for the42 %simulation kernel. These bindings can be used to set up simulations43 %instead of the built in language interpreter. Because PyNEST is used44 %from within Python, it is possible to directly plot the data from the45 %networks simulated within NEST.46 47 %PyNN is a Python package for simulator-independent specification of48 %neuronal network models. In other words, you can write the code for a49 %model once, using the PyNN API, and then run it without modification50 %on any simulator that PyNN supports (currently NEURON, NEST and51 %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 are58 %explained in the following list. For a detailed user manual, see the59 %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 the63 % population, a node type and a parameter dictionary. It creates the64 % elements and returns a handle to the population.65 %\item{\texttt{Projection()}:} Takes two populations and a connection66 % method (pattern). Possible values for the method are, among others,67 % \emph{allToAll} or \emph{oneToOne}. The function connects the68 % populations with the given pattern. A handle to the projections is69 % returned.70 %\item{\texttt{Population.record()}:} Activate spike recording for the71 % 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 and74 % 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 enhanced79 %interpreter for Python. This allows to easily change parameters and80 %explore the effects in a convenient and interactive way. All81 %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 a85 % dictionary with the standard parameters for all experiments. During86 % the exercises, this dictionary can be modified to explore the effect87 % of the parameters of the simulation.88 %\item{\texttt{get\_experiment\_dict(params)\footnote{Contained in the89 % tools.py module}}:} This function returns a dictionary of90 % dictionaries that contains all possible combinations of the given91 % parameters. Each entry is an experiment that can be passed to92 % \texttt{sim()}.93 %\item{\texttt{sim(experiment)}:} This function runs the simulation for94 % one specific set of parameters. The results from the simulation are95 % stored in the \texttt{results/} directory.96 %\item{\texttt{show(experiments)}:} This function produces nice plots97 % from the data from the simulation runs. Figures are stored in98 % \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 a104 single point, which is why they are also called point neurons. Thus105 the membrane potential $V$ is only a function of time and not of106 space. The most frequently used model of this kind is the "leaky107 integrate-and-fire" model, which was already described 1907 by108 Lapicque. It acts as a low-pass-filter below threshold and will evoke109 a spike when the threshold ($V_{Th}$) is crossed. In110 principle it is possible to include active mechanisms that give rise111 to i.e. realistic spikes, adaptive firing, afterhyperpolarization112 etc., for details refer to \cite{Gerstner02}. The spike is imitated by113 a reset of the membrane potential followed by a clamping to the114 resting value for the length of the refractory period115 $\tau_\mathrm{ref}$. After the refractory period, the integration116 process continues. The subthreshold dynamics is described by117 \[118 \tau_m \frac{dV}{dt} = E_L-V-r_m\overline{g_s}P_s(V-E_s)+R_m I_e119 \]120 $\tau_m$ is the membrane time constant, $E_L$ the reversal potential121 of the leak, $V$ the membrane potential, $r_m$ the specific membrane122 resistance ($1/\overline{g_L}$), $P_s$ the alpha function of the123 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}128 22 The setup for the first exercise is very simple 129 23 (figure~\ref{fig:ex1_setup}): A current is injected into a single 130 24 integrate-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} 25 and the parameters of the neuron, the firing rate of the neuron can be 26 modulated. 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). 145 27 146 \begin{figure}[h t]28 \begin{figure}[hbt] 147 29 \begin{center} 148 30 \includegraphics[width=.65\linewidth]{ex1_setup} … … 154 36 \end{figure} 155 37 156 \subsection{Membrane Potential and Spikes}157 38 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()|. 163 47 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] 165 57 \begin{center} 166 58 \includegraphics[width=\linewidth]{dc_input_membrane_traces} … … 171 63 \end{figure} 172 64 173 The traces of $V$ are shown in fig.~\ref{fig:dc_mempot} for different174 amplitudes of the DC. In the absence of noise, the neuron will fire175 regularly like a clock.176 65 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} 182 67 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 68 The refractory period $\tau_\mathrm{ref}$ of the neuron directly 69 determines the highest possible firing rate of the neuron. This is 188 70 shown in figure~\ref{fig:dcinput}. The spike rate will, for an 189 71 increasing amplitude of the current, eventually saturate at a rate of 190 1000 ms/$\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 SpikesListto estimate the mean firing rate.72 1000/$\tau_\mathrm{ref}$ Hz (for $\tau_\mathrm{ref}$ in ms).\\ 73 Please 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. 192 74 193 75 … … 200 82 \end{figure} 201 83 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}207 84 85 \subsection*{Exercise 3: noise sources} 208 86 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} 87 The 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. 215 88 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 217 96 This exercise shows the effect of multiple spikes on the membrane 218 97 potential 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}. 98 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 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.\\ 99 Create 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. 233 100 234 101 \begin{figure}[!ht] … … 242 109 \end{figure} 243 110 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} 112 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 \verb|numpy.array|s to perform the STA? 261 113 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} 265 115 266 \section{Networks} 267 268 \subsection{Synfire chain} 269 The synfire hypothesis states that under appropriate conditions 116 \subsection*{Exercise 6: Synfire chain} 117 The Synfire hypothesis states that under appropriate conditions 270 118 volleys of synchronized spikes (\emph{pulse packets}, as seen in the 271 119 last section) can propagate through the cortical network by traveling … … 289 137 \end{center} 290 138 \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 300 140 Basically, 4 regimes of synfire activity can be differentiated: 301 141 \begin{enumerate} … … 309 149 ignition of the whole chain. 310 150 \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 313 162 Please 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. 314 163 315 \paragraph{Parameters for this Exercise}164 \paragraph{Parameters for this exercise} 316 165 \begin{description} 317 166 \item{number\_synfire\_groups:} The length of the synfire chain. … … 325 174 326 175 327 \subsection {Recurrent random networks}176 \subsection*{Exercise 7: Recurrent random networks} 328 177 The 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}178 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 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} 330 179 \begin{figure}[ht] 331 180 \begin{center} doc/Freiburg2008/exercises/scripts/exercise1.py
r353 r355 4 4 """ 5 5 6 import pyNN.ne uronas sim6 import pyNN.nest2 as sim 7 7 8 8 dt = 0.1 9 9 simtime = 100.0 10 i_offset = 1.0 10 11 11 12 filename = "exercise1.v" … … 29 30 t = pylab.arange(0, simtime+dt, dt) 30 31 31 assert len(t) == len(vm), "%s != %s" % (len(t),len(vm)) 32 assert 0 <= len(t) - len(vm) <= 2 33 t = t[:len(vm)] 32 34 33 35 pylab.plot(t, vm, 'b-') 34 36 pylab.xlabel('Time (ms)') 35 37 pylab.ylabel('Membrane potential (mV)') 38 pylab.show() doc/Freiburg2008/exercises/scripts/exercise2.py
r353 r355 3 3 """ 4 4 5 import pyNN.ne uronas sim5 import pyNN.nest2 as sim 6 6 import pylab 7 7 … … 14 14 sim.setup(timestep=dt, quit_on_end=False) 15 15 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}) 17 17 18 18 i_offset_arr = pylab.arange(0, 100.0, 1.0) … … 22 22 for i_offset in i_offset_arr: 23 23 sim.setup() 24 p1 = sim.Population(1, sim.IF_cond_exp, {'tau_refrac':2.0}) 24 25 p1[0].i_offset = i_offset 25 26 p1.record() … … 33 34 pylab.xlabel('Current amplitude (nA)') 34 35 pylab.ylabel('Firing rate (spikes/s)') 36 pylab.show() doc/Freiburg2008/exercises/scripts/exercise3.py
r353 r355 3 3 """ 4 4 5 import pyNN.ne uronas sim5 import pyNN.nest2 as sim 6 6 import pylab 7 7 pylab.rcParams['interactive'] = True … … 43 43 pylab.xlabel('Input firing rate (spikes/s)') 44 44 pylab.ylabel('Output firing rate (spikes/s)') 45 pylab.show() doc/Freiburg2008/freiburg_PyNN_lectures.tex
r350 r355 63 63 { 64 64 \begin{frame}<beamer> 65 \small 65 66 \frametitle{Outline} 66 \tableofcontents[currentsection, currentsubsection]67 \tableofcontents[currentsection,hideallsubsections] 67 68 \end{frame} 68 69 } … … 112 113 \input{standard_celltypes} 113 114 114 \input{native_celltypes}115 %\input{native_celltypes} 115 116 116 117 \input{larger_networks} … … 118 119 \input{plasticity} 119 120 120 \input{porting}121 %\input{porting} 121 122 122 123 \input{contributing} … … 124 125 % ==================================================================== 125 126 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 126 147 \end{document} 127 148 doc/Freiburg2008/installation.tex
r321 r355 4 4 \begin{frame} % -------------------------------------------------------------------- 5 5 \frametitle{Installing PyNN} 6 \framesubtitle{Download} 6 7 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} 7 31 8 32 \end{frame} 9 33 10 11 \begin{frame} % -------------------------------------------------------------------- 34 \begin{frame}[fragile] % -------------------------------------------------------------------- 12 35 \frametitle{Running a PyNN simulation} 13 36 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} 15 47 16 48 \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 5 5 \frametitle{Simulator diversity} 6 6 \framesubtitle{Problem and opportunity} 7 \pause 7 8 \small 8 9 \textcolor{red!80!black}{\normalsize Cons} … … 17 18 \end{itemize} 18 19 \end{itemize} 20 21 \pause 19 22 20 23 \textcolor{blue!80!black}{\normalsize Pros} … … 82 85 \frametitle{Architecture} 83 86 \centering 84 \includegraphics[width=1 0.0cm]{figures/architecture_of_PyNN.pdf}87 \includegraphics[width=11.0cm]{figures/architecture_of_PyNN.pdf} 85 88 86 89 \end{frame} 87 90 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 2 2 \section{Larger networks} 3 3 4 % .................................................................................. 5 \subsection{Populations and Projections} 6 4 7 \begin{frame}[fragile] % -------------------------------------------------------------------- 5 8 \frametitle{Populations and Projections} … … 7 10 \begin{block}{Problems with creating very large networks using \texttt{create()} and \texttt{connect()}} 8 11 \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 12 15 \item and, if the code is only used for a single project, not all the bugs may be found. 13 16 \end{itemize} … … 28 31 All 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. 29 32 30 [Give a side by side example of the latter?]31 32 33 \end{frame} 33 34 … … 37 38 By using the \verb|Population| and \verb|Projection| classes: 38 39 \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 42 43 \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. 43 44 \end{itemize} 44 45 \end{frame} 45 46 47 % .................................................................................. 48 \subsection{Creating Populations} 46 49 47 50 \begin{frame}[fragile] % -------------------------------------------------------------------- … … 50 53 Create a 10 x 10 array of \verb|IF_curr_exp| neurons with default parameters: 51 54 \begin{verbatim} 52 >>> p1 = Population((10,10), IF_curr_exp)\end{verbatim} 55 >>> p1 = Population((10,10), IF_curr_exp)\end{verbatim}\pause 53 56 Create a 1D array of 100 spike sources, and give it a label: 54 57 \begin{verbatim} 55 58 >>> p2 = Population(100, SpikeSourceArray, 56 label="Input Population")\end{verbatim} 59 label="Input Population")\end{verbatim}\pause 57 60 Create 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: 58 61 \small … … 97 100 \end{frame} 98 101 102 % .................................................................................. 103 \subsection{Addressing individual neurons} 99 104 100 105 \begin{frame}[fragile] % -------------------------------------------------------------------- … … 126 131 Traceback (most recent call last): 127 132 . . . 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} 129 135 as will giving the wrong number of dimensions in the address. 130 136 … … 152 158 >>> p3.locate(250) 153 159 (2, 2, 0) 154 \end{verbatim} 160 \end{verbatim}\pause 155 161 To access the 'i'th neuron in a Population, use the \verb|index()| method, e.g.,: 156 162 \begin{verbatim} … … 166 172 \end{frame} 167 173 174 % .................................................................................. 175 \subsection{Setting parameter values} 168 176 169 177 \begin{frame}[fragile] % -------------------------------------------------------------------- … … 189 197 \vspace{1ex} 190 198 191 Set sthe initial membrane potential of each neuron to a value drawn from a uniform distribution between -70 mV and -55 mV:199 Set the initial membrane potential of each neuron to a value drawn from a uniform distribution between -70 mV and -55 mV: 192 200 \begin{verbatim} 193 201 >>> from pyNN.random import RandomDistribution 194 202 >>> distr = RandomDistribution('uniform', [-70,-55]) 195 203 >>> p1.rset('v_init', distr) 196 \end{verbatim} 204 \end{verbatim}\pause 197 205 For the specific case of setting the initial membrane potential, there is a convenience method \verb|randomInit()|, e.g.: 198 206 \begin{verbatim} … … 234 242 \end{frame} 235 243 244 \begin{frame}[fragile] % -------------------------------------------------------------------- 245 \frametitle{Position in space} 246 247 248 The 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 253 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.: 254 \begin{verbatim} 255 >>> p1.positions 256 array([[...]])\end{verbatim} \pause 257 To 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} 236 268 237 269 \begin{frame}[fragile] % -------------------------------------------------------------------- … … 276 308 \end{frame} 277 309 310 % .................................................................................. 311 \subsection{Recording} 278 312 279 313 \begin{frame}[fragile] % -------------------------------------------------------------------- … … 284 318 285 319 Recording membrane potential: \verb|record_v()| 286 320 \pause 287 321 \vspace{1ex} 288 322 … … 313 347 To get output in the native format of the simulator, add \verb|compatible_output=False| to the argument list. 314 348 315 getSpikes()?349 %getSpikes()? 316 350 317 351 \end{frame} … … 323 357 324 358 When 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 352 375 353 376 … … 367 390 \end{frame} 368 391 392 % .................................................................................. 393 \subsection{Connecting Populations with Projections} 369 394 370 395 \begin{frame}[fragile] % -------------------------------------------------------------------- … … 372 397 373 398 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. 399 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.\pause 400 401 \vspace{1ex} 375 402 376 403 A \verb|Projection| is created by specifying … … 395 422 396 423 By default it is \verb|True|, but if a neuron should not connect to itself, set it to \verb|False|, e.g.: 424 \begin{footnotesize} 397 425 \begin{verbatim} 398 426 >>> prj = Projection(p1, p1, 399 427 AllToAllConnector(allow_self_connections=False)) 400 428 \end{verbatim} 429 \end{footnotesize} 401 430 \end{frame} 402 431 … … 408 437 Use of the \verb|OneToOneConnector| requires that the pre- and post-synaptic populations have the same dimensions, e.g.: 409 438 \begin{verbatim} 410 >>> prj = Projection(p1, p1, OneToOneConnector()) 411 \end{verbatim} 439 >>> prj = Projection(p1, p1, OneToOneConnector())\end{verbatim} \pause 412 440 Trying to connect two \verb|Population|s with different dimensions will raise an Exception, e.g.: 413 441 \begin{verbatim} … … 415 443 Traceback (most recent call last): 416 444 . . . 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 419 448 420
