"Cell \u001b[0;32mIn [13], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# %%capture captured\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;66;03m# run the simulation, depending on the model parameter and downscale ratio, the running time varies largely.\u001b[39;00m\n\u001b[0;32m----> 3\u001b[0m M\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39msimulate()\n",
"File \u001b[0;32m~/MAM2EBRAINS/multiarea_model/simulation.py:300\u001b[0m, in \u001b[0;36mSimulation.simulate\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 296\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtime_network_local \u001b[38;5;241m=\u001b[39m t2 \u001b[38;5;241m-\u001b[39m t1\n\u001b[1;32m 297\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCreated areas and internal connections in \u001b[39m\u001b[38;5;132;01m{0:.2f}\u001b[39;00m\u001b[38;5;124m seconds.\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mformat(\n\u001b[1;32m 298\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtime_network_local))\n\u001b[0;32m--> 300\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcortico_cortical_input\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 301\u001b[0m t3 \u001b[38;5;241m=\u001b[39m time\u001b[38;5;241m.\u001b[39mtime()\n\u001b[1;32m 302\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnetwork_memory \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmemory()\n",
The code in this notebook implements the down-scaled version of spiking network model of macaque visual cortex developed at the Institute of Neuroscience and Medicine (INM-6), Research Center Jülich. The full-scale model has been documented in the following publications:
1. Schmidt M, Bakker R, Hilgetag CC, Diesmann M & van Albada SJ
Multi-scale account of the network structure of macaque visual cortex
Brain Structure and Function (2018), 223: 1409 [https://doi.org/10.1007/s00429-017-1554-4](https://doi.org/10.1007/s00429-017-1554-4)
2. Schuecker J, Schmidt M, van Albada SJ, Diesmann M & Helias M (2017)
Fundamental Activity Constraints Lead to Specific Interpretations of the Connectome.
1.`scale_down_to` is the down-scaling factor that defines the ratio by which the full-scale multi-area model is reduced to a model with fewer neurons and indegrees. This reduction is essential to enable simulation on machines with limited computational power, ensuring that simulation results can be obtained in a relatively shorter timeframe. <br> If the value is `scale_down_to = 1.`, the full-scale network will be simulated. <br> In the pre-set downscale version, it is set to `scale_down_to = 0.005`, This setting reduces both the number of neurons and indegrees to 0.5 % of their full-scale counterparts, facilitating simulation on a typical local machine. <br>**Warning**: This will not yield reasonable dynamical results from the network and is only meant to demonstrate the simulation workflow <br>
2.`cc_weights_factor` is the scaling factor that controls the cortico-cortical synaptic strength. <br> By default it's set as `1.0`, where the inter-area synaptic strength is the same as the intra-areal. <br>**Important**: This factor changes the network activity from ground state to metastable state. <br>
3.`areas_simulated` specifies the cortical areas to be included in the simulation process. Its default value is `complete_area_list` meaning all the areas in the complete_area_list will be simulated. The value assigned to `areas_simulated` can be any sublist of the list below:
4.`replace_non_simulated_areas` defines how non-simulated areas will be replaced. <br> When all areas are included, it is set as `None` by default. <br> Other options are: `'hom_poisson_stat'`, `'het_poisson_stat'`, and `'het_current_nonstat'`.<br>`'hom_poisson_stat'` replaces the non-simulated areas by Poisson sources with the same global rate `rate_ext`. The `'het_poisson_stat'` and `'het_current_nonstat'` options use the loaded specific rates from `'replace_cc_input_source'`, which contains the area-specific firing rates of our full scale simulation results. The difference between them is that `'het_poisson_stat'` replaces the non-simulated areas by Poisson spike trains and `'het_current_nonstat'` replaces it by a time-varying current input.
%% Cell type:code id:60265d52 tags:
``` python
# Downscaling factor
# Value range/options: (0, 1.]
# Value assigned: 0.005
scale_down_to=0.005# Change it to 1. for running the fullscale network
# Scaling factor for cortico-cortical connections (chi)
# Value range/options: [1., 2.5]
# Value assigned: 1.0
cc_weights_factor=1.0
# Cortical areas included in the simulation
# Value range/options: any sublist of complete_area_list
We try our best not to confuse users with too many parameters. However, if you want to change more parameters and explore the model, you can do so by passing a dictionary to the `default_params` argument of the `MultiAreaModel` class. (*NOTE: it should may be moved to the default parameters file in the future.*)
'replace_non_simulated_areas':replace_non_simulated_areas,# Whether to replace non-simulated areas by Poisson sources with the same global rate, by default: None
'g':-11.,# It sets the relative inhibitory synaptic strength, by default: -16.
'K_stable':'K_stable.npy',# Whether to apply the stabilization method of Schuecker, Schmidt et al. (2017), by default: None
'fac_nu_ext_TH':1.2,# Increase the external input to 2/3E and 5E in area TH
'fac_nu_ext_5E':1.125,# Increase the external Poisson indegree onto 5E
'fac_nu_ext_6E':1.41666667,# Increase the external Poisson indegree onto 6E
'av_indegree_V1':3950.# Adjust the average indegree in V1 based on monkey data
'av_indegree_V1':3950.,# Adjust the average indegree in V1 based on monkey data
'replace_cc_input_source':replace_cc_input_source
}
# Input parameters
input_params={
'rate_ext':10.# Rate of the Poissonian spike generator (in spikes/s)
}
# Neuron parameters
neuron_params={
'V0_mean':-150.,# Mean for the distribution of initial membrane potentials, by default: -100.
'V0_sd':50.# Standard deviation for the distribution of initial membrane potentials, by default: 50.
}
# Network parameters
network_params={
'N_scaling':scale_down_to,# Scaling of population sizes, by default: 1.
'K_scaling':scale_down_to,# Scaling of indegrees, by default: 1.
'fullscale_rates':'tests/fullscale_rates.json',# Absolute path to the file holding full-scale rates for scaling synaptic weights, by default: None
## S2. Multi-Area Model Instantiation and Simulation <a class="anchor" id="section_2"></a>
%% Cell type:markdown id:1fd58841 tags:
### 2.1. Instantiate a multi-area model <a class="anchor" id="section_2_1"></a>
%% Cell type:code id:ab25f9f8 tags:
``` python
%%capturecaptured
M=MultiAreaModel(network_params,
simulation=True,
sim_spec=sim_params,
theory=True,
theory_spec=theory_params)
```
%% Output
Error in library("aod") : there is no package called ‘aod’
Execution halted
%% Cell type:markdown id:91649c30 tags:
### 2.2. Predict firing rates from theory <a class="anchor" id="section_2_2"></a>
%% Cell type:code id:6a7ddf0e tags:
``` python
p,r=M.theory.integrate_siegert()
print("Mean-field theory predicts an average "
"firing rate of {0:.3f} spikes/s across all populations.".format(np.mean(r[:,-1])))
```
%% Output
Iteration: 0
Mean-field theory predicts an average firing rate of 29.588 spikes/s across all populations.
%% Cell type:markdown id:2062ddf3 tags:
### 2.3. Extract and visualize interareal connectivity <a class="anchor" id="section_2_3"></a>
%% Cell type:markdown id:8a7c09e0 tags:
The connectivity and neuron numbers are stored in the attributes of the model class. Neuron numbers are stored in `M.N` as a dictionary (and in `M.N_vec` as an array), indegrees in `M.K` as a dictionary (and in `M.K_matrix` as an array). Number of synapses can also be access via `M.synapses` (and in `M.syn_matrix` as an array). <br>
"Cell \u001b[0;32mIn [13], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# %%capture captured\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;66;03m# run the simulation, depending on the model parameter and downscale ratio, the running time varies largely.\u001b[39;00m\n\u001b[0;32m----> 3\u001b[0m M\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39msimulate()\n",
"File \u001b[0;32m~/MAM2EBRAINS/multiarea_model/simulation.py:300\u001b[0m, in \u001b[0;36mSimulation.simulate\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 296\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtime_network_local \u001b[38;5;241m=\u001b[39m t2 \u001b[38;5;241m-\u001b[39m t1\n\u001b[1;32m 297\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCreated areas and internal connections in \u001b[39m\u001b[38;5;132;01m{0:.2f}\u001b[39;00m\u001b[38;5;124m seconds.\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mformat(\n\u001b[1;32m 298\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtime_network_local))\n\u001b[0;32m--> 300\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcortico_cortical_input\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 301\u001b[0m t3 \u001b[38;5;241m=\u001b[39m time\u001b[38;5;241m.\u001b[39mtime()\n\u001b[1;32m 302\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnetwork_memory \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmemory()\n",
The code in this notebook implements the down-scaled version of spiking network model of macaque visual cortex developed at the Institute of Neuroscience and Medicine (INM-6), Research Center Jülich. The full-scale model has been documented in the following publications:
1. Schmidt M, Bakker R, Hilgetag CC, Diesmann M & van Albada SJ
Multi-scale account of the network structure of macaque visual cortex
Brain Structure and Function (2018), 223: 1409 [https://doi.org/10.1007/s00429-017-1554-4](https://doi.org/10.1007/s00429-017-1554-4)
2. Schuecker J, Schmidt M, van Albada SJ, Diesmann M & Helias M (2017)
Fundamental Activity Constraints Lead to Specific Interpretations of the Connectome.
1.`scale_down_to` is the down-scaling factor that defines the ratio by which the full-scale multi-area model is reduced to a model with fewer neurons and indegrees. This reduction is essential to enable simulation on machines with limited computational power, ensuring that simulation results can be obtained in a relatively shorter timeframe. <br> If the value is `scale_down_to = 1.`, the full-scale network will be simulated. <br> In the pre-set downscale version, it is set to `scale_down_to = 0.005`, This setting reduces both the number of neurons and indegrees to 0.5 % of their full-scale counterparts, facilitating simulation on a typical local machine. <br>**Warning**: This will not yield reasonable dynamical results from the network and is only meant to demonstrate the simulation workflow <br>
2.`cc_weights_factor` is the scaling factor that controls the cortico-cortical synaptic strength. <br> By default it's set as `1.0`, where the inter-area synaptic strength is the same as the intra-areal. <br>**Important**: This factor changes the network activity from ground state to metastable state. <br>
3.`areas_simulated` specifies the cortical areas to be included in the simulation process. Its default value is `complete_area_list` meaning all the areas in the complete_area_list will be simulated. The value assigned to `areas_simulated` can be any sublist of the list below:
4.`replace_non_simulated_areas` defines how non-simulated areas will be replaced. <br> When all areas are included, it is set as `None` by default. <br> Other options are: `'hom_poisson_stat'`, `'het_poisson_stat'`, and `'het_current_nonstat'`.<br>`'hom_poisson_stat'` replaces the non-simulated areas by Poisson sources with the same global rate `rate_ext`. The `'het_poisson_stat'` and `'het_current_nonstat'` options use the loaded specific rates from `'replace_cc_input_source'`, which contains the area-specific firing rates of our full scale simulation results. The difference between them is that `'het_poisson_stat'` replaces the non-simulated areas by Poisson spike trains and `'het_current_nonstat'` replaces it by a time-varying current input.
%% Cell type:code id:60265d52 tags:
``` python
# Downscaling factor
# Value range/options: (0, 1.]
# Value assigned: 0.005
scale_down_to=0.005# Change it to 1. for running the fullscale network
# Scaling factor for cortico-cortical connections (chi)
# Value range/options: [1., 2.5]
# Value assigned: 1.0
cc_weights_factor=1.0
# Cortical areas included in the simulation
# Value range/options: any sublist of complete_area_list
We try our best not to confuse users with too many parameters. However, if you want to change more parameters and explore the model, you can do so by passing a dictionary to the `default_params` argument of the `MultiAreaModel` class. (*NOTE: it should may be moved to the default parameters file in the future.*)
'replace_non_simulated_areas':replace_non_simulated_areas,# Whether to replace non-simulated areas by Poisson sources with the same global rate, by default: None
'g':-11.,# It sets the relative inhibitory synaptic strength, by default: -16.
'K_stable':'K_stable.npy',# Whether to apply the stabilization method of Schuecker, Schmidt et al. (2017), by default: None
'fac_nu_ext_TH':1.2,# Increase the external input to 2/3E and 5E in area TH
'fac_nu_ext_5E':1.125,# Increase the external Poisson indegree onto 5E
'fac_nu_ext_6E':1.41666667,# Increase the external Poisson indegree onto 6E
'av_indegree_V1':3950.# Adjust the average indegree in V1 based on monkey data
'av_indegree_V1':3950.,# Adjust the average indegree in V1 based on monkey data
'replace_cc_input_source':replace_cc_input_source
}
# Input parameters
input_params={
'rate_ext':10.# Rate of the Poissonian spike generator (in spikes/s)
}
# Neuron parameters
neuron_params={
'V0_mean':-150.,# Mean for the distribution of initial membrane potentials, by default: -100.
'V0_sd':50.# Standard deviation for the distribution of initial membrane potentials, by default: 50.
}
# Network parameters
network_params={
'N_scaling':scale_down_to,# Scaling of population sizes, by default: 1.
'K_scaling':scale_down_to,# Scaling of indegrees, by default: 1.
'fullscale_rates':'tests/fullscale_rates.json',# Absolute path to the file holding full-scale rates for scaling synaptic weights, by default: None
## S2. Multi-Area Model Instantiation and Simulation <a class="anchor" id="section_2"></a>
%% Cell type:markdown id:1fd58841 tags:
### 2.1. Instantiate a multi-area model <a class="anchor" id="section_2_1"></a>
%% Cell type:code id:ab25f9f8 tags:
``` python
%%capturecaptured
M=MultiAreaModel(network_params,
simulation=True,
sim_spec=sim_params,
theory=True,
theory_spec=theory_params)
```
%% Output
Error in library("aod") : there is no package called ‘aod’
Execution halted
%% Cell type:markdown id:91649c30 tags:
### 2.2. Predict firing rates from theory <a class="anchor" id="section_2_2"></a>
%% Cell type:code id:6a7ddf0e tags:
``` python
p,r=M.theory.integrate_siegert()
print("Mean-field theory predicts an average "
"firing rate of {0:.3f} spikes/s across all populations.".format(np.mean(r[:,-1])))
```
%% Output
Iteration: 0
Mean-field theory predicts an average firing rate of 29.588 spikes/s across all populations.
%% Cell type:markdown id:2062ddf3 tags:
### 2.3. Extract and visualize interareal connectivity <a class="anchor" id="section_2_3"></a>
%% Cell type:markdown id:8a7c09e0 tags:
The connectivity and neuron numbers are stored in the attributes of the model class. Neuron numbers are stored in `M.N` as a dictionary (and in `M.N_vec` as an array), indegrees in `M.K` as a dictionary (and in `M.K_matrix` as an array). Number of synapses can also be access via `M.synapses` (and in `M.syn_matrix` as an array). <br>