Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multi-area-model
Manage
Activity
Members
Labels
Plan
Issues
7
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IAS-6
multi-area-model
Commits
fbae2073
Unverified
Commit
fbae2073
authored
3 years ago
by
Jari Pronold
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request
#4
from jasperalbers/review-nest_2_and_3
Review NEST 3 adaptations
parents
eeae09f1
3635bac5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!19
Enable use of NEST 3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-2
2 additions, 2 deletions
README.md
multiarea_model/default_params.py
+1
-1
1 addition, 1 deletion
multiarea_model/default_params.py
multiarea_model/simulation.py
+79
-38
79 additions, 38 deletions
multiarea_model/simulation.py
with
82 additions
and
41 deletions
README.md
+
2
−
2
View file @
fbae2073
...
...
@@ -69,7 +69,7 @@ technical parameters such as the number of parallel MPI processes and
threads. The simulation uses the network simulator NEST
(https://www.nest-simulator.org). For the simulations in [2, 3], we
used NEST version 2.8.0. The code in this repository runs with a
later release of NEST, version 2.14.0.
later release of NEST, version 2.14.0
, as well as NEST 3.0
.
`Theory`
...
...
@@ -203,7 +203,7 @@ conveniently run by executing `pytest` in the `tests/` folder:
## Requirements
Python 3, python
\_
dicthash (
[
https://github.com/INM-6/python-dicthash
](
https://github.com/INM-6/python-dicthash
)
),
correlation
\_
toolbox (
[
https://github.com/INM-6/correlation-toolbox
](
https://github.com/INM-6/correlation-toolbox
)
),
pandas, numpy, nested_dict, matplotlib (2.1.2), scipy, pytest, NEST 2.14.0
pandas, numpy, nested_dict, matplotlib (2.1.2), scipy, pytest, NEST 2.14.0
or NEST 3.0
Optional: seaborn, Sumatra
...
...
This diff is collapsed.
Click to expand it.
multiarea_model/default_params.py
+
1
−
1
View file @
fbae2073
...
...
@@ -38,7 +38,7 @@ Simulation parameters
"""
sim_params
=
{
# master seed for random number generators
'
master
_seed
'
:
0
,
'
rng
_seed
'
:
1
,
# simulation step (in ms)
'
dt
'
:
0.1
,
# simulated time (in ms)
...
...
This diff is collapsed.
Click to expand it.
multiarea_model/simulation.py
+
79
−
38
View file @
fbae2073
...
...
@@ -145,7 +145,7 @@ class Simulation:
Prepare NEST Kernel.
"""
nest
.
ResetKernel
()
master
_seed
=
self
.
params
[
'
master
_seed
'
]
rng
_seed
=
self
.
params
[
'
rng
_seed
'
]
num_processes
=
self
.
params
[
'
num_processes
'
]
local_num_threads
=
self
.
params
[
'
local_num_threads
'
]
vp
=
num_processes
*
local_num_threads
...
...
@@ -153,15 +153,18 @@ class Simulation:
'
total_num_virtual_procs
'
:
vp
,
'
overwrite_files
'
:
True
,
'
data_path
'
:
os
.
path
.
join
(
self
.
data_dir
,
'
recordings
'
),
'
print_time
'
:
False
,
'
grng_seed
'
:
master_seed
,
'
rng_seeds
'
:
list
(
range
(
master_seed
+
1
,
master_seed
+
vp
+
1
))})
'
print_time
'
:
False
})
if
self
.
network
.
params
[
'
USING_NEST_3
'
]:
nest
.
SetKernelStatus
({
'
rng_seed
'
:
rng_seed
})
else
:
nest
.
SetKernelStatus
({
'
grng_seed
'
:
rng_seed
,
'
rng_seeds
'
:
list
(
range
(
rng_seed
+
1
,
rng_seed
+
vp
+
1
))})
self
.
pyrngs
=
[
np
.
random
.
RandomState
(
s
)
for
s
in
list
(
range
(
rng_seed
+
vp
+
1
,
rng_seed
+
2
*
(
vp
+
1
)))]
nest
.
SetDefaults
(
self
.
network
.
params
[
'
neuron_params
'
][
'
neuron_model
'
],
self
.
network
.
params
[
'
neuron_params
'
][
'
single_neuron_dict
'
])
self
.
pyrngs
=
[
np
.
random
.
RandomState
(
s
)
for
s
in
list
(
range
(
master_seed
+
vp
+
1
,
master_seed
+
2
*
(
vp
+
1
)))]
def
create_recording_devices
(
self
):
"""
...
...
@@ -619,6 +622,7 @@ def connect(simulation,
source_area : Area instance
Source area of the projection
"""
network
=
simulation
.
network
synapses
=
extract_area_dict
(
network
.
synapses
,
network
.
structure
,
...
...
@@ -632,40 +636,77 @@ def connect(simulation,
network
.
structure
,
target_area
.
name
,
source_area
.
name
)
for
target
in
target_area
.
populations
:
for
source
in
source_area
.
populations
:
conn_spec
=
{
'
rule
'
:
'
fixed_total_number
'
,
'
N
'
:
int
(
synapses
[
target
][
source
])}
syn_weight
=
{
'
distribution
'
:
'
normal_clipped
'
,
'
mu
'
:
W
[
target
][
source
],
'
sigma
'
:
W_sd
[
target
][
source
]}
if
target_area
==
source_area
:
if
'
E
'
in
source
:
syn_weight
.
update
({
'
low
'
:
0.
})
mean_delay
=
network
.
params
[
'
delay_params
'
][
'
delay_e
'
]
elif
'
I
'
in
source
:
syn_weight
.
update
({
'
high
'
:
0.
})
mean_delay
=
network
.
params
[
'
delay_params
'
][
'
delay_i
'
]
else
:
v
=
network
.
params
[
'
delay_params
'
][
'
interarea_speed
'
]
s
=
network
.
distances
[
target_area
.
name
][
source_area
.
name
]
mean_delay
=
s
/
v
syn_delay
=
{
'
distribution
'
:
'
normal_clipped
'
,
'
low
'
:
simulation
.
params
[
'
dt
'
],
'
mu
'
:
mean_delay
,
'
sigma
'
:
mean_delay
*
network
.
params
[
'
delay_params
'
][
'
delay_rel
'
]}
syn_spec
=
{
'
weight
'
:
syn_weight
,
'
delay
'
:
syn_delay
,
'
model
'
:
'
static_synapse
'
}
if
network
.
params
[
'
USING_NEST_3
'
]:
if
network
.
params
[
'
USING_NEST_3
'
]:
for
target
in
target_area
.
populations
:
for
source
in
source_area
.
populations
:
conn_spec
=
{
'
rule
'
:
'
fixed_total_number
'
,
'
N
'
:
int
(
synapses
[
target
][
source
])}
if
target_area
==
source_area
:
if
'
E
'
in
source
:
w_min
=
0.
w_max
=
np
.
Inf
mean_delay
=
network
.
params
[
'
delay_params
'
][
'
delay_e
'
]
elif
'
I
'
in
source
:
w_min
=
np
.
NINF
w_max
=
0.
mean_delay
=
network
.
params
[
'
delay_params
'
][
'
delay_i
'
]
else
:
w_min
=
0.
w_max
=
np
.
Inf
v
=
network
.
params
[
'
delay_params
'
][
'
interarea_speed
'
]
s
=
network
.
distances
[
target_area
.
name
][
source_area
.
name
]
mean_delay
=
s
/
v
syn_spec
=
{
'
synapse_model
'
:
'
static_synapse
'
,
'
weight
'
:
nest
.
math
.
redraw
(
nest
.
random
.
normal
(
mean
=
W
[
target
][
source
],
std
=
W_sd
[
target
][
source
]),
min
=
w_min
,
max
=
w_max
),
'
delay
'
:
nest
.
math
.
redraw
(
nest
.
random
.
normal
(
mean
=
mean_delay
,
std
=
(
mean_delay
*
network
.
params
[
'
delay_params
'
][
'
delay_rel
'
])),
min
=
simulation
.
params
[
'
dt
'
],
max
=
np
.
Inf
)
}
nest
.
Connect
(
source_area
.
gids
[
source
],
target_area
.
gids
[
target
],
conn_spec
,
syn_spec
)
else
:
else
:
for
target
in
target_area
.
populations
:
for
source
in
source_area
.
populations
:
conn_spec
=
{
'
rule
'
:
'
fixed_total_number
'
,
'
N
'
:
int
(
synapses
[
target
][
source
])}
syn_weight
=
{
'
distribution
'
:
'
normal_clipped
'
,
'
mu
'
:
W
[
target
][
source
],
'
sigma
'
:
W_sd
[
target
][
source
]}
if
target_area
==
source_area
:
if
'
E
'
in
source
:
syn_weight
.
update
({
'
low
'
:
0.
})
mean_delay
=
network
.
params
[
'
delay_params
'
][
'
delay_e
'
]
elif
'
I
'
in
source
:
syn_weight
.
update
({
'
high
'
:
0.
})
mean_delay
=
network
.
params
[
'
delay_params
'
][
'
delay_i
'
]
else
:
v
=
network
.
params
[
'
delay_params
'
][
'
interarea_speed
'
]
s
=
network
.
distances
[
target_area
.
name
][
source_area
.
name
]
mean_delay
=
s
/
v
syn_delay
=
{
'
distribution
'
:
'
normal_clipped
'
,
'
low
'
:
simulation
.
params
[
'
dt
'
],
'
mu
'
:
mean_delay
,
'
sigma
'
:
mean_delay
*
network
.
params
[
'
delay_params
'
][
'
delay_rel
'
]}
syn_spec
=
{
'
weight
'
:
syn_weight
,
'
delay
'
:
syn_delay
,
'
model
'
:
'
static_synapse
'
}
nest
.
Connect
(
tuple
(
range
(
source_area
.
gids
[
source
][
0
],
source_area
.
gids
[
source
][
1
]
+
1
)),
tuple
(
range
(
target_area
.
gids
[
target
][
0
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment