`scale_down_to` is the down-scaling factor which defines the the ratio of the full scale multi-area model being down-scaled to a model with fewer neurons and indegrees so as to be simulated on machines with lower computational ability and the simulation results can be obtained within relative shorter period of time. <br> Its deafualt value if `1.` meaning full scale simulation. <br> In the pre-set downscale version, it's set as `0.005`, where the numer of neurons and indegrees are both scaled down to 0.5% of its full scale amount, where the model can usually be simulated on a local machine. <br>**Warning**: This will not yield reasonable dynamical results from the network and is only meant to demonstrate the simulation workflow <br>
`scale_down_to` is the down-scaling factor which defines the the ratio of the full scale multi-area model being down-scaled to a model with fewer neurons and indegrees so as to be simulated on machines with lower computational ability and the simulation results can be obtained within relative shorter period of time. <br> Its deafualt value if `1.` meaning full scale simulation. <br> In the pre-set downscale version, it's set as `0.005`, where the numer of neurons and indegrees are both scaled down to 0.5% of its full scale amount, where the model can usually be simulated on a 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`<br>
2.`cc_weights_factor`<br>
This scaling factor 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>
This scaling factor 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`<br>
3.`areas_simulated`<br>
This parameter specifies the cortical areas included in the simulation process. Its default value is `complete_area_list` meaning all the areas in the complete_area_list will be actually simulated. <br>
This parameter specifies the cortical areas included in the simulation process. Its default value is `complete_area_list` meaning all the areas in the complete_area_list will be actually simulated. <br>
The value assigned to simulation_areas can be any sublist of the compete_area_list specifying areas a user want to include in his/her simulation. <br>
The value assigned to simulation_areas can be any sublist of the compete_area_list specifying areas a user want to include in his/her simulation. <br>
4.`replace_non_simulated_areas`<br>
4.`replace_non_simulated_areas`<br>
The paramter `replace_non_simulated_areas` defines how non-simulated areas will be replaced. <br> It's set as `None` by default when the parameter areas_simulated is set as full_area_list where all areas will be simulated so that no areas need to be replaced. <br> Other options are: `'hom_poisson_stat'`, `'het_poisson_stat'`, and `'het_current_nonstat'`. `'hom_poisson_stat'` is a manually set parameter which can be tuned. When it's set as 'het_poisson_stat' or 'het_current_nonstat', the data to replace the cortico-cortical input is loaded from 'replace_cc_input_source' which is the firing rates of our full scale simulation results. The differenc between 'het_poisson_stat' and 'het_current_nonstat' is that 'het_poisson_stat' is the mean of the time-series firing rate so that it's static, yet 'het_current_nonstat' is time-varying specific current, which is varying by time.
The paramter `replace_non_simulated_areas` defines how non-simulated areas will be replaced. <br> It's set as `None` by default when the parameter areas_simulated is set as full_area_list where all areas will be simulated so that no areas need to be replaced. <br> Other options are: `'hom_poisson_stat'`, `'het_poisson_stat'`, and `'het_current_nonstat'`. `'hom_poisson_stat'` is a manually set parameter which can be tuned. When it's set as 'het_poisson_stat' or 'het_current_nonstat', the data to replace the cortico-cortical input is loaded from 'replace_cc_input_source' which is the firing rates of our full scale simulation results. The differenc between 'het_poisson_stat' and 'het_current_nonstat' is that 'het_poisson_stat' is the mean of the time-series firing rate so that it's static, yet 'het_current_nonstat' is time-varying specific current, which is varying by time.
%% Cell type:code id:60265d52 tags:
%% Cell type:code id:60265d52 tags:
``` python
``` python
# Downscaling factor
# Downscaling factor
scale_down_to=0.005# Change it to 1. for running the fullscale network
scale_down_to=0.005# Change it to 1. for running the fullscale network
# Scaling factor for cortico-cortical connections (chi)
# Scaling factor for cortico-cortical connections (chi)
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.
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.
%% Cell type:code id:6e4bed8d tags:
%% Cell type:code id:6e4bed8d tags:
``` python
``` python
# Connection parameters
# Connection parameters
conn_params={
conn_params={
'replace_non_simulated_areas':'het_poisson_stat',# Whether to replace non-simulated areas by Poisson sources with the same global rate, by default: None
'replace_non_simulated_areas':'het_poisson_stat',# 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.
'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
'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_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_5E':1.125,# Increase the external Poisson indegree onto 5E
'fac_nu_ext_6E':1.41666667,# Increase the external Poisson indegree onto 6E
'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
}
}
# Input parameters
# Input parameters
input_params={
input_params={
'rate_ext':10.# Rate of the Poissonian spike generator (in spikes/s)
'rate_ext':10.# Rate of the Poissonian spike generator (in spikes/s)
}
}
# Neuron parameters
# Neuron parameters
neuron_params={
neuron_params={
'V0_mean':-150.,# Mean for the distribution of initial membrane potentials, by default: -100.
'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.
'V0_sd':50.}# Standard deviation for the distribution of initial membrane potentials, by default: 50.
# Network parameters
# Network parameters
network_params={
network_params={
'N_scaling':scale_down_to,# Scaling of population sizes, by default: 1.
'N_scaling':scale_down_to,# Scaling of population sizes, by default: 1.
'K_scaling':scale_down_to,# Scaling of indegrees, 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
'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>
## S2. Multi-area model instantiation and simulation <a class="anchor" id="section_2"></a>
%% Cell type:markdown id:1fd58841 tags:
%% Cell type:markdown id:1fd58841 tags:
### 2.1. Insantiate a multi-area model <a class="anchor" id="section_2_1"></a>
### 2.1. Insantiate a multi-area model <a class="anchor" id="section_2_1"></a>
%% Cell type:code id:ab25f9f8 tags:
%% Cell type:code id:ab25f9f8 tags:
``` python
``` python
M=MultiAreaModel(network_params,
M=MultiAreaModel(network_params,
simulation=True,
simulation=True,
sim_spec=sim_params,
sim_spec=sim_params,
theory=True,
theory=True,
theory_spec=theory_params)
theory_spec=theory_params)
```
```
%% Output
%% Output
Initializing network from dictionary.
Initializing network from dictionary.
RAND_DATA_LABEL 588
RAND_DATA_LABEL 588
/srv/main-spack-instance-2302/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0/py-numpy-1.21.6-6fewtq7oarp3vtwlxrrcofz5sxwt55s7/lib/python3.8/site-packages/numpy/core/fromnumeric.py:3440: RuntimeWarning:Mean of empty slice.
/srv/main-spack-instance-2302/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0/py-numpy-1.21.6-6fewtq7oarp3vtwlxrrcofz5sxwt55s7/lib/python3.8/site-packages/numpy/core/fromnumeric.py:3440: RuntimeWarning:Mean of empty slice.
/srv/main-spack-instance-2302/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0/py-numpy-1.21.6-6fewtq7oarp3vtwlxrrcofz5sxwt55s7/lib/python3.8/site-packages/numpy/core/_methods.py:189: RuntimeWarning:invalid value encountered in double_scalars
/srv/main-spack-instance-2302/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0/py-numpy-1.21.6-6fewtq7oarp3vtwlxrrcofz5sxwt55s7/lib/python3.8/site-packages/numpy/core/_methods.py:189: RuntimeWarning:invalid value encountered in double_scalars
Error in library("aod") : there is no package called ‘aod’
Error in library("aod") : there is no package called ‘aod’
Execution halted
Execution halted
No R installation or IndexError, taking hard-coded SLN fit parameters.
No R installation or IndexError, taking hard-coded SLN fit parameters.
/srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/dicthash/dicthash.py:47: UserWarning:Float too small for safe conversion tointeger. Rounding down to zero.
/srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/dicthash/dicthash.py:47: UserWarning:Float too small for safe conversion tointeger. Rounding down to zero.
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>
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>
# syn = M.synapses[target_area.name][target_pop][source_area.name][source_pop]
# syn = M.synapses[target_area.name][target_pop][source_area.name][source_pop]
# assert(len(created_syn) == int(syn))
# assert(len(created_syn) == int(syn))
```
```
%% Cell type:markdown id:57401110 tags:
%% Cell type:markdown id:57401110 tags:
### 3.2 Extract connections information
### 3.2 Extract connections information
**Warning**: Memory explosion <br>
**Warning**: Memory explosion <br>
To obtain the connections information, you can extract the lists of connected sources and targets. Moreover, you can access additional synaptic details, such as synaptic weights and delays.
To obtain the connections information, you can extract the lists of connected sources and targets. Moreover, you can access additional synaptic details, such as synaptic weights and delays.
You can determine the area and subpopulation to which the neuron ID ranges belong by referring to the file `network_gids.txt`, which is automatically generated during network creation.
You can determine the area and subpopulation to which the neuron ID ranges belong by referring to the file `network_gids.txt`, which is automatically generated during network creation.
%% Cell type:code id:902f2800 tags:
%% Cell type:code id:902f2800 tags:
``` python
``` python
# # Open the file using a with statement
# # Open the file using a with statement
# with open(os.path.join(M.simulation.data_dir,"recordings/network_gids.txt"), "r") as file:
# with open(os.path.join(M.simulation.data_dir,"recordings/network_gids.txt"), "r") as file:
CalledProcessError: Command '['latex', '-interaction=nonstopmode', '--halt-on-error', '../540885da22f8d5147f0088a11e43701a.tex']' returned non-zero exit status 1.
CalledProcessError: Command '['latex', '-interaction=nonstopmode', '--halt-on-error', '../540885da22f8d5147f0088a11e43701a.tex']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
RuntimeError Traceback (most recent call last)
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/IPython/core/formatters.py:339, in BaseFormatter.__call__(self, obj)
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/IPython/core/formatters.py:339, in BaseFormatter.__call__(self, obj)
---> 73 result = draw(artist, renderer, *args, **kwargs)
---> 73 result = draw(artist, renderer, *args, **kwargs)
74 if renderer._rasterizing:
74 if renderer._rasterizing:
75 renderer.stop_rasterizing()
75 renderer.stop_rasterizing()
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/artist.py:50, in allow_rasterization.<locals>.draw_wrapper(artist, renderer)
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/artist.py:50, in allow_rasterization.<locals>.draw_wrapper(artist, renderer)
47 if artist.get_agg_filter() is not None:
47 if artist.get_agg_filter() is not None:
48 renderer.start_filter()
48 renderer.start_filter()
---> 50 return draw(artist, renderer)
---> 50 return draw(artist, renderer)
51 finally:
51 finally:
52 if artist.get_agg_filter() is not None:
52 if artist.get_agg_filter() is not None:
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/figure.py:2837, in Figure.draw(self, renderer)
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/figure.py:2837, in Figure.draw(self, renderer)
2834 # ValueError can occur when resizing a window.
2834 # ValueError can occur when resizing a window.
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/image.py:132, in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/image.py:132, in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
130 if not_composite or not has_images:
130 if not_composite or not has_images:
131 for a in artists:
131 for a in artists:
--> 132 a.draw(renderer)
--> 132 a.draw(renderer)
133 else:
133 else:
134 # Composite any adjacent images together
134 # Composite any adjacent images together
135 image_group = []
135 image_group = []
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/artist.py:50, in allow_rasterization.<locals>.draw_wrapper(artist, renderer)
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/artist.py:50, in allow_rasterization.<locals>.draw_wrapper(artist, renderer)
47 if artist.get_agg_filter() is not None:
47 if artist.get_agg_filter() is not None:
48 renderer.start_filter()
48 renderer.start_filter()
---> 50 return draw(artist, renderer)
---> 50 return draw(artist, renderer)
51 finally:
51 finally:
52 if artist.get_agg_filter() is not None:
52 if artist.get_agg_filter() is not None:
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/axes/_base.py:3055, in _AxesBase.draw(self, renderer)
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/axes/_base.py:3055, in _AxesBase.draw(self, renderer)
3052 for spine in self.spines.values():
3052 for spine in self.spines.values():
3053 artists.remove(spine)
3053 artists.remove(spine)
-> 3055 self._update_title_position(renderer)
-> 3055 self._update_title_position(renderer)
3057 if not self.axison:
3057 if not self.axison:
3058 for _axis in self._get_axis_list():
3058 for _axis in self._get_axis_list():
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/axes/_base.py:3005, in _AxesBase._update_title_position(self, renderer)
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/axes/_base.py:3005, in _AxesBase._update_title_position(self, renderer)
3003 _log.debug('top of Axes not in the figure, so title not moved')
3003 _log.debug('top of Axes not in the figure, so title not moved')
3004 return
3004 return
-> 3005 if title.get_window_extent(renderer).ymin < top:
-> 3005 if title.get_window_extent(renderer).ymin < top:
3006 _, y = self.transAxes.inverted().transform((0, top))
3006 _, y = self.transAxes.inverted().transform((0, top))
3007 title.set_position((x, y))
3007 title.set_position((x, y))
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/text.py:910, in Text.get_window_extent(self, renderer, dpi)
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/text.py:910, in Text.get_window_extent(self, renderer, dpi)
907 raise RuntimeError('Cannot get window extent w/o renderer')
907 raise RuntimeError('Cannot get window extent w/o renderer')
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/text.py:309, in Text._get_layout(self, renderer)
File /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/matplotlib/text.py:309, in Text._get_layout(self, renderer)
306 ys = []
306 ys = []
308 # Full vertical extent of font, including ascenders and descenders:
308 # Full vertical extent of font, including ascenders and descenders:
### 5.2 Resting state plots <a class="anchor" id="section_5_2"></a>
### 5.2 Resting state plots <a class="anchor" id="section_5_2"></a>
%% Cell type:markdown id:aeae56a4 tags:
%% Cell type:markdown id:aeae56a4 tags:
**Fig 5. Resting state of the model with χ =1.9.** (A-C) Raster plot of spiking activity of 3% of the neurons in area V1 (A), V2 (B), and FEF (C). Blue: excitatory neurons, red: inhibitory neurons. (D-F) Spiking statistics across all 32 areas for the respective populations shown as area-averaged box plots. Crosses: medians, boxes: interquartile range (IQR), whiskers extend to the most extremeobservat ions within 1.5×IQR beyond the IQR. (D) Population-averaged firing rates. (E) Average pairwise correlation coefficients of spiking activity. (F) Irregularity measured by revised local variation LvR averaged across neurons. (G) Area-averaged firing rates, shown as raw binned spike histograms with 1ms bin width (gray) and convolved histograms, with aGaussian kernel (black) of optimal width.
**Fig 5. Resting state of the model with χ =1.9.** (A-C) Raster plot of spiking activity of 3% of the neurons in area V1 (A), V2 (B), and FEF (C). Blue: excitatory neurons, red: inhibitory neurons. (D-F) Spiking statistics across all 32 areas for the respective populations shown as area-averaged box plots. Crosses: medians, boxes: interquartile range (IQR), whiskers extend to the most extremeobservat ions within 1.5×IQR beyond the IQR. (D) Population-averaged firing rates. (E) Average pairwise correlation coefficients of spiking activity. (F) Irregularity measured by revised local variation LvR averaged across neurons. (G) Area-averaged firing rates, shown as raw binned spike histograms with 1ms bin width (gray) and convolved histograms, with aGaussian kernel (black) of optimal width.
TypeError: plot_resting_state() takes 0 positional arguments but 1 was given
%% Cell type:markdown id:3ef52a7c tags:
%% Cell type:markdown id:3ef52a7c tags:
### 5.2 Raster plot of spiking activity for single area <a class="anchor" id="section_5_2"></a>
### 5.2 Raster plot of spiking activity for single area <a class="anchor" id="section_5_2"></a>
Fig. 3 (A-C) Raster plot of spiking activity of 3% of the neurons in area V1 (A), V2 (B), and FEF (C). Blue: excitatory neurons, red: inhibitory neurons. (D-F) Spiking statistics across all 32 areas for the respective populations shown as area-averaged box plots. Crosses: medians, boxes: interquartile range (IQR), whiskers extend to the most extremeobservat ions within 1.5×IQR beyond the IQR.
Fig. 3 (A-C) Raster plot of spiking activity of 3% of the neurons in area V1 (A), V2 (B), and FEF (C). Blue: excitatory neurons, red: inhibitory neurons. (D-F) Spiking statistics across all 32 areas for the respective populations shown as area-averaged box plots. Crosses: medians, boxes: interquartile range (IQR), whiskers extend to the most extremeobservat ions within 1.5×IQR beyond the IQR.
### 5.7 Time series of area-averaged firing rates <a class="anchor" id="section_5_7"></a>
### 5.7 Time series of area-averaged firing rates <a class="anchor" id="section_5_7"></a>
Area-averaged firing rates, shown as raw binned spike histograms with 1ms bin width (gray) and convolved histograms, with a Gaussian kernel (black) of optimal width.
Area-averaged firing rates, shown as raw binned spike histograms with 1ms bin width (gray) and convolved histograms, with a Gaussian kernel (black) of optimal width.