Edit History

Wiki » History » Version 13

Ramon Martinez, 22 Aug 2014 08:23

1 2 Ramon Martinez
##  Network models of V1
2 1 Padraig Gleeson
3 1 Padraig Gleeson
This project will be used to test implementations in PyNN (and eventually NeuroML) of published models of primary visual cortex (V1) based on spiking point neurons.
4 1 Padraig Gleeson
5 1 Padraig Gleeson
An initial focus will be on pubmed:14614078, but other models investigated will include pubmed:19477158 and pubmed:22681694.
6 1 Padraig Gleeson
7 9 Andrew Davison
This project is part of the [INCF participation in the Google Summer of Code 2014](http://incf.org/gsoc/2014).
8 2 Ramon Martinez
9 2 Ramon Martinez
10 2 Ramon Martinez
### Troyer Model
11 10 Andrew Davison
Here I will describe briefly the implementation of pubmed:9671678. 
12 2 Ramon Martinez
13 2 Ramon Martinez
In order to run this model is necessary to first install [git](http://git-scm.com/) and [PyNN](http://neuralensemble.org/PyNN/) and the appropriate simulator.
14 2 Ramon Martinez
15 3 Ramon Martinez
After that you can clone directly from git using:
16 3 Ramon Martinez
17 3 Ramon Martinez
~~~
18 3 Ramon Martinez
git clone https://github.com/OpenSourceBrain/V1NetworkModels.git
19 3 Ramon Martinez
~~~
20 3 Ramon Martinez
21 1 Padraig Gleeson
22 13 Ramon Martinez
##### Overview of the model 
23 13 Ramon Martinez
As the project stands at this moment the workflow can be briefly described in two steps:  first there are two scripts that implement the spatio-temporal filter in the retina and produce the spike-trains for each cell in the Lateral Geniculate Nucelus (LGN) and stores them for further use.  Second, there is a file that loads those spike-trains and runs the simulation of the cortical networks in PyNN using them. The first task is executed by two scripts `produce_lgn_spikes_on_cells.py` and ` produce_lgn_spikes_off_cells.py ` which generates pickled files in the folder './data' with the spike trains and positions for a given contrast that is selected in the parameters of the script. After we have run the file to produce the spikes with a given contrast (which can be adjusted in the scripts mentioned above) we can run the main script `full_model.py` with the same contrast in order to run the complete model. 
24 13 Ramon Martinez
25 13 Ramon Martinez
In order to describe the model in more detail we will start by describing `full_model.py`. That is, we will assume that we already have the spikes' data from the LGN that is going to be feed into the other layers. So we will start by describing the general structure of the model which is shown in the following diagram. 
26 13 Ramon Martinez
27 13 Ramon Martinez
![Scheme](http://www.opensourcebrain.org/attachments/download/213/print_model.png)
28 13 Ramon Martinez
29 13 Ramon Martinez
The model consists in three qualitatvely different types of layers. The LGN with center-surround receptive fields and  the inhibitory and excitatory layers which are connected with a Gabor filter profile to the LGN and a correlation based connectivity between them.  At the beginning of the `full_model.py` script we have the following parameters that control the general structure of the model and the connections between the layers. First we have the parameters that control the number of cells in each layer which were set accordingly to the values given in the troyer paper. Furthermore we have included a factor constant to decrease the overall size of the model and we also give the user the ability to chose how many LGN population layers he wants to include in the simulation:
30 13 Ramon Martinez
31 11 Ramon Martinez
~~~
32 11 Ramon Martinez
factor = 1.0  # Reduction factor
33 11 Ramon Martinez
Nside_exc = int(factor * Nside_exc)
34 11 Ramon Martinez
Nside_inh = int(factor * Nside_inh)
35 1 Padraig Gleeson
36 11 Ramon Martinez
Ncell_lgn = Nside_lgn * Nside_lgn
37 11 Ramon Martinez
Ncell_exc = Nside_exc ** 2
38 11 Ramon Martinez
Ncell_inh = Nside_inh ** 2
39 11 Ramon Martinez
40 1 Padraig Gleeson
N_lgn_layers = 1
41 13 Ramon Martinez
~~~
42 1 Padraig Gleeson
43 13 Ramon Martinez
After we also include a series of bolean parameters that give the user the ability to show whether he wants to include certain connections and layers in the simulation. This is very useful to test the effect of a particular connection or layer in the overall behavior of the model.
44 13 Ramon Martinez
45 13 Ramon Martinez
~~~
46 11 Ramon Martinez
## Main connections
47 11 Ramon Martinez
thalamo_cortical_connections = True # If True create connections from the thalamus to the cortex
48 11 Ramon Martinez
feed_forward_inhibition = True # If True add feed-forward inhibition ( i -> e )
49 11 Ramon Martinez
cortical_excitatory_feedback = True # If True add cortical excitatory feedback (e -> e) and ( e -> i )
50 11 Ramon Martinez
background_noise = True  # If True add cortical noise
51 1 Padraig Gleeson
correlated_noise = False  # Makes the noise coorelated
52 13 Ramon Martinez
~~~
53 11 Ramon Martinez
54 11 Ramon Martinez
55 11 Ramon Martinez
56 11 Ramon Martinez
The factor parameter allows us to reduce the overall size of the cortical network by a given percentage (the square of it). We can also choose to use between one and four layers of the LGN in case we want with the parameter N_lgn_layers. Finally we can remove the connections and noise between the different networks with the bolean parameters bellow. We also have the settings here to plot relevant analysis of the data and save the data produced by the simulation here.
57 11 Ramon Martinez
58 11 Ramon Martinez
After we have run the model with a couple of contrasts and save them in the 'output_data' we can run the script `compare_contrasts.py` in order to see if contrast invariant orientation tuning holds for our data.  
59 11 Ramon Martinez
60 11 Ramon Martinez
As the model stands, spike-trains and orientation curves are already given for four contrasts and the model can be tested right away.
61 12 Ramon Martinez
62 12 Ramon Martinez
Furthermore we have added scripts that allow the user to reproduce easy and promptly the figures from the Troyer paper. This way the differences between the current and the original implementation can be illustrated and tuned to the user needs:
63 12 Ramon Martinez
64 12 Ramon Martinez
1. First we have the LGN reponse. In order to obtain the results in figure 1a we have to run the file 'troyer_plot_1a.py'. We obtain something like the following.
65 12 Ramon Martinez
![Toyer1a](http://www.opensourcebrain.org/attachments/download/207/troyer_plot1a.png)
66 12 Ramon Martinez
67 11 Ramon Martinez
 
68 11 Ramon Martinez
Here bellow I describe in more detail all of the parts of the model
69 4 Ramon Martinez
#### LGN - spikes
70 4 Ramon Martinez
71 4 Ramon Martinez
In brief, the Retina and the Thalamus part of the model can be represented by a spatio-temporal filter that, when convolved with the stimuli, will produce the firing rate of a given LGN cell. After that, we can use a non-homogeneous Poisson process to produce the corresponding spikes for each cell. We describe this in detail bellow.
72 4 Ramon Martinez
73 5 Ramon Martinez
###### Spatio-Temporal Receptive Field (STRF)
74 4 Ramon Martinez
75 5 Ramon Martinez
The file `kernel_functions.py` contains the code for creating the  STRF.  The spatial part of the kernel possess a **center-surround** architecture which is model as a different of Gaussians. The temporal part of the receptive field has a **biphasic** structure, we use the implementation describe in Cai et al (1998). The details of the implementation are described in detail in the companion blog of this project  [(link)](http://neuralensemble.blogspot.fr/2014/06/gsoc-open-source-brain-retinal-filter-i.html). Down here we present a kernel produce with this classes. The time here runs from left to right and from up to down as usual text, so we can see how the spatial components of the filter change in time with this series of two dimensional maps.
76 1 Padraig Gleeson
77 5 Ramon Martinez
![STRF](http://www.opensourcebrain.org/attachments/download/205/kernel.png)
78 1 Padraig Gleeson
79 5 Ramon Martinez
We also include a small script `center_surround_plot.py` that can be used to visualize the spatial component of the STRF and received immediate feedback on how the overall pattern changes when the parameters and resolutions are changed. 
80 5 Ramon Martinez
81 5 Ramon Martinez
###### Stimuli 
82 5 Ramon Martinez
The file `stimuli_functions.py` contains the code for creating the stimuli. In particular we used the implementation of a **full field sinusoidal grating** with the parameters described in the paper. Down here we show an example of the stimuli at a particular point in time for illustration purposes:
83 5 Ramon Martinez
84 5 Ramon Martinez
![stimuli](http://www.opensourcebrain.org/attachments/download/206/sinus_grating.png)
85 5 Ramon Martinez
86 5 Ramon Martinez
Here we also included a small script `sine_grating_plot.py` to visualize the sine grating at a particular point in time.
87 5 Ramon Martinez
88 5 Ramon Martinez
###### Convolution 
89 5 Ramon Martinez
90 6 Ramon Martinez
After we have the stimuli and the STRF we can use the **convolution** function defined in the file `analysis_functions.py` to calculate the response of LGN' neurons. The details of how the the convolution is implemented is described in the detail in the following entry of the blog [(link)](http://neuralensemble.blogspot.fr/2014/06/gsoc-open-source-brain-retinal-filter-ii.html). With this in our hand and using the parameters described in the paper we can already reproduce the first plot in Troyer's paper.  The file `lgn_firing_rate_troyer_plot1.py` in the repository does this automatically for us and give us the next plot:
91 1 Padraig Gleeson
92 6 Ramon Martinez
![troyer_plot](http://www.opensourcebrain.org/attachments/download/207/troyer_plot1a.png)
93 1 Padraig Gleeson
94 6 Ramon Martinez
Here we can see the firing rate for an on and for an off cell subjected to the same stimuli. Note that they are off-phase and also the contrast dependent response. The responses are rectified after back ground noise was added. 
95 6 Ramon Martinez
96 6 Ramon Martinez
###### Producing Spikes
97 6 Ramon Martinez
98 6 Ramon Martinez
After we have the firing rate of a neuron we can use the produce_spikes functions in the file `analysis_functions.py`. This functions takes the firing rate and using non-homogeneous Poisson process outputs an array with the spikes times.  We provide one file `produce_lgn_spikes_one.py` for testing variations of parameters and as an example showcase.
99 6 Ramon Martinez
100 6 Ramon Martinez
![example](http://www.opensourcebrain.org/attachments/download/208/spikes_example.png)
101 6 Ramon Martinez
102 6 Ramon Martinez
103 6 Ramon Martinez
###### Storing Spikes
104 7 Ramon Martinez
Now we have the complete mechanism of spike creation. In the file `produce_lgn_spikes.py`. This file creates a grid of positions (This should correspond to the grid of LGN cells that we are going to use in PyNN) and produces the list of spikes associated with them as well as the positions. The particular stoage format that we are using is `cPickled`. 
105 6 Ramon Martinez
106 6 Ramon Martinez
#### LGN - Network