bsb-nest 4.3.0__tar.gz → 4.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/PKG-INFO +5 -5
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/README.md +1 -1
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/__init__.py +1 -1
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/device.py +53 -10
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/devices/multimeter.py +18 -10
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/devices/poisson_generator.py +1 -0
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/devices/sinusoidal_poisson_generator.py +2 -1
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/pyproject.toml +3 -3
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/LICENSE +0 -0
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/adapter.py +0 -0
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/cell.py +0 -0
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/connection.py +0 -0
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/devices/__init__.py +0 -0
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/devices/dc_generator.py +0 -0
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/devices/spike_recorder.py +0 -0
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/distributions.py +0 -0
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/exceptions.py +0 -0
- {bsb_nest-4.3.0 → bsb_nest-4.3.2}/bsb_nest/simulation.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: bsb-nest
|
|
3
|
-
Version: 4.3.
|
|
3
|
+
Version: 4.3.2
|
|
4
4
|
Summary: NEST simulation adapter for the BSB framework.
|
|
5
5
|
Author-email: Robin De Schepper <robingilbert.deschepper@unipv.it>
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
8
|
-
Requires-Dist: bsb-core~=
|
|
8
|
+
Requires-Dist: bsb-core~=5.0
|
|
9
9
|
Requires-Dist: bsb-nest[test] ; extra == "dev"
|
|
10
10
|
Requires-Dist: build~=1.0 ; extra == "dev"
|
|
11
11
|
Requires-Dist: twine~=4.0 ; extra == "dev"
|
|
@@ -17,7 +17,7 @@ Requires-Dist: bump-my-version~=0.24 ; extra == "dev"
|
|
|
17
17
|
Requires-Dist: bsb-core[parallel] ; extra == "parallel"
|
|
18
18
|
Requires-Dist: bsb-core[parallel] ; extra == "test"
|
|
19
19
|
Requires-Dist: bsb-test~=4.0 ; extra == "test"
|
|
20
|
-
Requires-Dist: bsb-hdf5~=
|
|
20
|
+
Requires-Dist: bsb-hdf5~=5.0 ; extra == "test"
|
|
21
21
|
Requires-Dist: bsb-arbor~=4.0 ; extra == "test"
|
|
22
22
|
Requires-Dist: coverage~=7.0 ; extra == "test"
|
|
23
23
|
Provides-Extra: dev
|
|
@@ -29,7 +29,7 @@ Provides-Extra: test
|
|
|
29
29
|
|
|
30
30
|
# bsb-nest
|
|
31
31
|
|
|
32
|
-
bsb-nest is a
|
|
32
|
+
bsb-nest is a plugin of the [BSB](https://github.com/dbbs-lab/bsb) (see also
|
|
33
33
|
[bsb-core](https://github.com/dbbs-lab/bsb-core)).
|
|
34
34
|
It contains the interfaces and tools to simulate BSB circuit with the
|
|
35
35
|
[NEST simulator](https://www.nest-simulator.org/).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# bsb-nest
|
|
5
5
|
|
|
6
|
-
bsb-nest is a
|
|
6
|
+
bsb-nest is a plugin of the [BSB](https://github.com/dbbs-lab/bsb) (see also
|
|
7
7
|
[bsb-core](https://github.com/dbbs-lab/bsb-core)).
|
|
8
8
|
It contains the interfaces and tools to simulate BSB circuit with the
|
|
9
9
|
[NEST simulator](https://www.nest-simulator.org/).
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import typing
|
|
1
2
|
import warnings
|
|
2
3
|
|
|
3
4
|
import nest
|
|
4
|
-
from bsb import DeviceModel, Targetting, config, refs, types
|
|
5
|
+
from bsb import DeviceModel, SimulationData, Targetting, config, refs, types
|
|
6
|
+
|
|
7
|
+
if typing.TYPE_CHECKING:
|
|
8
|
+
from .adapter import NestAdapter
|
|
9
|
+
from .simulation import NestSimulation
|
|
5
10
|
|
|
6
11
|
|
|
7
12
|
@config.node
|
|
@@ -24,18 +29,56 @@ class NestDevice(DeviceModel):
|
|
|
24
29
|
receptor_type = config.attr(type=int, required=False, default=0)
|
|
25
30
|
"""Integer ID of the postsynaptic target receptor"""
|
|
26
31
|
|
|
27
|
-
def
|
|
32
|
+
def get_dict_targets(
|
|
33
|
+
self,
|
|
34
|
+
adapter: "NestAdapter",
|
|
35
|
+
simulation: "NestSimulation",
|
|
36
|
+
simdata: "SimulationData",
|
|
37
|
+
) -> dict:
|
|
38
|
+
"""
|
|
39
|
+
Get a dictionary from a target group to its NEST Collection
|
|
40
|
+
for each target group of the device.
|
|
41
|
+
|
|
42
|
+
:param bsb_nest.NestAdapter adapter:
|
|
43
|
+
:param bsb_nest.NestSimulation simulation: Nest simulation instance
|
|
44
|
+
:param bsb.SimulationData simdata: Simulation data instance
|
|
45
|
+
:return: dictionary of device target group to NEST Collection
|
|
46
|
+
:rtype: dict
|
|
47
|
+
"""
|
|
28
48
|
if isinstance(self.targetting, Targetting):
|
|
29
|
-
node_collector = self.targetting.get_targets(
|
|
30
|
-
adapter, simulation, simdata
|
|
31
|
-
).values()
|
|
49
|
+
node_collector = self.targetting.get_targets(adapter, simulation, simdata)
|
|
32
50
|
else:
|
|
33
|
-
node_collector =
|
|
34
|
-
simdata.populations[model][targets]
|
|
51
|
+
node_collector = {
|
|
52
|
+
model: simdata.populations[model][targets]
|
|
35
53
|
for model, targets in simdata.populations.items()
|
|
36
54
|
if not self.targetting.cell_models or model in self.targetting.cell_models
|
|
37
|
-
|
|
38
|
-
return
|
|
55
|
+
}
|
|
56
|
+
return node_collector
|
|
57
|
+
|
|
58
|
+
@staticmethod
|
|
59
|
+
def _flatten_nodes_ids(dict_targets):
|
|
60
|
+
return sum(dict_targets.values(), start=nest.NodeCollection())
|
|
61
|
+
|
|
62
|
+
@staticmethod
|
|
63
|
+
def _invert_targets_dict(dict_targets):
|
|
64
|
+
return {elem: k.name for k, v in dict_targets.items() for elem in v.tolist()}
|
|
65
|
+
|
|
66
|
+
def get_target_nodes(
|
|
67
|
+
self,
|
|
68
|
+
adapter: "NestAdapter",
|
|
69
|
+
simulation: "NestSimulation",
|
|
70
|
+
simdata: "SimulationData",
|
|
71
|
+
):
|
|
72
|
+
"""
|
|
73
|
+
Get the NEST Collection of the targets of the device.
|
|
74
|
+
|
|
75
|
+
:param bsb_nest.NestAdapter adapter:
|
|
76
|
+
:param bsb_nest.NestSimulation simulation: Nest simulation instance
|
|
77
|
+
:param bsb.SimulationData simdata: Simulation data instance
|
|
78
|
+
:return: Flattened NEST collection with all the targets of the device
|
|
79
|
+
"""
|
|
80
|
+
targets_dict = self.get_dict_targets(adapter, simulation, simdata)
|
|
81
|
+
return self._flatten_nodes_ids(targets_dict)
|
|
39
82
|
|
|
40
83
|
def connect_to_nodes(self, device, nodes):
|
|
41
84
|
if len(nodes) == 0:
|
|
@@ -75,5 +118,5 @@ class ExtNestDevice(NestDevice, classmap_entry="external"):
|
|
|
75
118
|
simdata.devices[self] = device = nest.Create(
|
|
76
119
|
self.nest_model, params=self.constants
|
|
77
120
|
)
|
|
78
|
-
nodes = self.get_target_nodes(adapter, simdata)
|
|
121
|
+
nodes = self.get_target_nodes(adapter, simulation, simdata)
|
|
79
122
|
self.connect_to_nodes(device, nodes)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import nest
|
|
2
|
+
import numpy as np
|
|
2
3
|
import quantities as pq
|
|
3
4
|
from bsb import ConfigurationError, _util, config, types
|
|
4
5
|
from neo import AnalogSignal
|
|
@@ -24,7 +25,9 @@ class Multimeter(NestDevice, classmap_entry="multimeter"):
|
|
|
24
25
|
|
|
25
26
|
def implement(self, adapter, simulation, simdata):
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
targets_dict = self.get_dict_targets(adapter, simulation, simdata)
|
|
29
|
+
nodes = self._flatten_nodes_ids(targets_dict)
|
|
30
|
+
inv_targets = self._invert_targets_dict(targets_dict)
|
|
28
31
|
device = self.register_device(
|
|
29
32
|
simdata,
|
|
30
33
|
nest.Create(
|
|
@@ -38,15 +41,20 @@ class Multimeter(NestDevice, classmap_entry="multimeter"):
|
|
|
38
41
|
self.connect_to_nodes(device, nodes)
|
|
39
42
|
|
|
40
43
|
def recorder(segment):
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
senders = device.events["senders"]
|
|
45
|
+
for sender in np.unique(senders):
|
|
46
|
+
sender_filter = senders == sender
|
|
47
|
+
for prop, unit in zip(self.properties, self.units):
|
|
48
|
+
segment.analogsignals.append(
|
|
49
|
+
AnalogSignal(
|
|
50
|
+
device.events[prop][sender_filter],
|
|
51
|
+
units=pq.units.__dict__[unit],
|
|
52
|
+
sampling_period=self.simulation.resolution * pq.ms,
|
|
53
|
+
name=self.name,
|
|
54
|
+
cell_type=inv_targets[sender],
|
|
55
|
+
cell_id=sender,
|
|
56
|
+
prop_recorded=prop,
|
|
57
|
+
)
|
|
49
58
|
)
|
|
50
|
-
)
|
|
51
59
|
|
|
52
60
|
simdata.result.create_recorder(recorder)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import nest
|
|
2
|
-
from bsb import config
|
|
2
|
+
from bsb import ConfigurationError, config
|
|
3
3
|
from neo import SpikeTrain
|
|
4
4
|
|
|
5
5
|
from ..device import NestDevice
|
|
@@ -56,6 +56,7 @@ class SinusoidalPoissonGenerator(
|
|
|
56
56
|
senders=sr.events["senders"],
|
|
57
57
|
t_stop=simulation.duration,
|
|
58
58
|
device=self.name,
|
|
59
|
+
pop_size=len(nodes),
|
|
59
60
|
)
|
|
60
61
|
)
|
|
61
62
|
|
|
@@ -9,7 +9,7 @@ readme = "README.md"
|
|
|
9
9
|
license = {file = "LICENSE"}
|
|
10
10
|
classifiers = ["License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)"]
|
|
11
11
|
dynamic = ["version", "description"]
|
|
12
|
-
dependencies = ["bsb-core~=
|
|
12
|
+
dependencies = ["bsb-core~=5.0"]
|
|
13
13
|
|
|
14
14
|
[tool.flit.module]
|
|
15
15
|
name = "bsb_nest"
|
|
@@ -22,7 +22,7 @@ parallel = ["bsb-core[parallel]"]
|
|
|
22
22
|
test = [
|
|
23
23
|
"bsb-core[parallel]",
|
|
24
24
|
"bsb-test~=4.0",
|
|
25
|
-
"bsb-hdf5~=
|
|
25
|
+
"bsb-hdf5~=5.0",
|
|
26
26
|
# Required to load the Brunel config file
|
|
27
27
|
"bsb-arbor~=4.0",
|
|
28
28
|
"coverage~=7.0"
|
|
@@ -46,7 +46,7 @@ profile = "black"
|
|
|
46
46
|
known_third_party = ["nest"]
|
|
47
47
|
|
|
48
48
|
[tool.bumpversion]
|
|
49
|
-
current_version = "4.3.
|
|
49
|
+
current_version = "4.3.2"
|
|
50
50
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
|
51
51
|
serialize = ["{major}.{minor}.{patch}"]
|
|
52
52
|
search = "{current_version}"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|