bsb-arbor 6.0.1__tar.gz → 7.0.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_arbor-6.0.1 → bsb_arbor-7.0.2}/PKG-INFO +3 -3
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/bsb_arbor/adapter.py +16 -10
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/bsb_arbor/cell.py +5 -5
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/bsb_arbor/connection.py +4 -2
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/bsb_arbor/device.py +3 -3
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/bsb_arbor/devices/probe.py +3 -8
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/bsb_arbor/devices/spike_recorder.py +3 -3
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/pyproject.toml +4 -4
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/LICENSE +0 -0
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/README.md +0 -0
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/bsb_arbor/__init__.py +0 -0
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/bsb_arbor/devices/__init__.py +0 -0
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/bsb_arbor/devices/poisson_generator.py +0 -0
- {bsb_arbor-6.0.1 → bsb_arbor-7.0.2}/bsb_arbor/simulation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bsb-arbor
|
|
3
|
-
Version:
|
|
3
|
+
Version: 7.0.2
|
|
4
4
|
Summary: Arbor simulation adapter for the BSB framework.
|
|
5
5
|
Author-email: Robin De Schepper <robin@alexandria.sc>, Dimitri Rodarie <dimitri.rodarie@unipv.it>
|
|
6
6
|
Requires-Python: >=3.10,<4
|
|
@@ -8,8 +8,8 @@ Description-Content-Type: text/markdown
|
|
|
8
8
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
9
9
|
License-File: LICENSE
|
|
10
10
|
Requires-Dist: numpy~=1.21
|
|
11
|
-
Requires-Dist: bsb-core~=
|
|
12
|
-
Requires-Dist: arborize~=
|
|
11
|
+
Requires-Dist: bsb-core~=7.0
|
|
12
|
+
Requires-Dist: arborize~=7.0
|
|
13
13
|
Requires-Dist: arbor~=0.10; sys_platform != 'win32'
|
|
14
14
|
|
|
15
15
|
[](https://github.com/dbbs-lab/bsb/actions/workflows/main.yml)
|
|
@@ -16,7 +16,7 @@ from bsb import (
|
|
|
16
16
|
warn,
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
-
if typing.TYPE_CHECKING:
|
|
19
|
+
if typing.TYPE_CHECKING: # pragma: nocover
|
|
20
20
|
from .simulation import ArborSimulation
|
|
21
21
|
|
|
22
22
|
|
|
@@ -69,6 +69,7 @@ class Population:
|
|
|
69
69
|
This class manages a collection of cells from a specific cell model, handling their
|
|
70
70
|
GID ranges and providing methods to access and manipulate subsets of the population.
|
|
71
71
|
"""
|
|
72
|
+
|
|
72
73
|
def __init__(self, simdata, cell_model, offset):
|
|
73
74
|
"""
|
|
74
75
|
Initialize a population of cells.
|
|
@@ -203,7 +204,9 @@ class Population:
|
|
|
203
204
|
start = i
|
|
204
205
|
stop = i + 1
|
|
205
206
|
prev = i
|
|
207
|
+
ranges.append((start, stop))
|
|
206
208
|
pop._ranges = ranges
|
|
209
|
+
|
|
207
210
|
return pop
|
|
208
211
|
|
|
209
212
|
def _subpop_one(self, item):
|
|
@@ -405,11 +408,13 @@ class ArborAdapter(SimulatorAdapter):
|
|
|
405
408
|
report("MPI processes:", context.ranks, level=2)
|
|
406
409
|
report("Threads per process:", context.threads, level=2)
|
|
407
410
|
recipe = self.get_recipe(simulation, simdata)
|
|
411
|
+
self._duration = simulation.duration
|
|
408
412
|
# Gap junctions are required for domain decomposition
|
|
409
413
|
self.domain = arbor.partition_load_balance(recipe, context)
|
|
410
414
|
self.gids = set(it.chain.from_iterable(g.gids for g in self.domain.groups))
|
|
411
415
|
simdata.arbor_sim = arbor.simulation(recipe, context, self.domain)
|
|
412
|
-
self.
|
|
416
|
+
self.implement_components(simulation)
|
|
417
|
+
self.load_controllers(simulation)
|
|
413
418
|
report("prepared simulation", level=1)
|
|
414
419
|
return simdata
|
|
415
420
|
except Exception:
|
|
@@ -419,10 +424,6 @@ class ArborAdapter(SimulatorAdapter):
|
|
|
419
424
|
def get_gid_manager(self, simulation, simdata):
|
|
420
425
|
return GIDManager(simulation, simdata)
|
|
421
426
|
|
|
422
|
-
def prepare_samples(self, simulation, simdata):
|
|
423
|
-
for device in simulation.devices.values():
|
|
424
|
-
device.prepare_samples(simdata, comm=self.comm)
|
|
425
|
-
|
|
426
427
|
def run(self, *simulations):
|
|
427
428
|
if len(simulations) != 1:
|
|
428
429
|
raise RuntimeError(
|
|
@@ -443,14 +444,19 @@ class ArborAdapter(SimulatorAdapter):
|
|
|
443
444
|
|
|
444
445
|
start = time.time()
|
|
445
446
|
report("running simulation", level=1)
|
|
446
|
-
|
|
447
|
-
|
|
447
|
+
|
|
448
|
+
for t, checkpoint_controllers in self.get_next_checkpoint():
|
|
449
|
+
arbor_sim.run(t * U.ms, dt=simulation.resolution * U.ms)
|
|
450
|
+
self.execute_checkpoints(checkpoint_controllers)
|
|
451
|
+
report(f"Completed simulation. {time.time() - start:.2f}s", level=1)
|
|
448
452
|
if simulation.profiling and arbor.config()["profiling"]:
|
|
449
453
|
report("printing profiler summary", level=2)
|
|
450
454
|
report(arbor.profiler_summary(), level=1)
|
|
451
455
|
return [simdata.result]
|
|
452
456
|
finally:
|
|
457
|
+
results = [self.simdata[sim].result for sim in simulations]
|
|
453
458
|
del self.simdata[simulation]
|
|
459
|
+
return results
|
|
454
460
|
|
|
455
461
|
def get_recipe(self, simulation, simdata=None):
|
|
456
462
|
if simdata is None:
|
|
@@ -523,7 +529,7 @@ class ArborAdapter(SimulatorAdapter):
|
|
|
523
529
|
|
|
524
530
|
def _all_bools(arr):
|
|
525
531
|
try:
|
|
526
|
-
return all(
|
|
532
|
+
return all(np.issubdtype(type(b), np.bool_) for b in arr)
|
|
527
533
|
except TypeError:
|
|
528
534
|
# Not iterable
|
|
529
535
|
return False
|
|
@@ -531,7 +537,7 @@ def _all_bools(arr):
|
|
|
531
537
|
|
|
532
538
|
def _all_ints(arr):
|
|
533
539
|
try:
|
|
534
|
-
return all(
|
|
540
|
+
return all(np.issubdtype(type(b), np.integer) for b in arr)
|
|
535
541
|
except TypeError:
|
|
536
542
|
# Not iterable
|
|
537
543
|
return False
|
|
@@ -24,23 +24,23 @@ class ArborCell(CellModel):
|
|
|
24
24
|
"""Importable reference to the arborize model describing the cell type."""
|
|
25
25
|
|
|
26
26
|
@abc.abstractmethod
|
|
27
|
-
def cache_population_data(self, simdata, ps: PlacementSet):
|
|
27
|
+
def cache_population_data(self, simdata, ps: PlacementSet): # pragma: nocover
|
|
28
28
|
pass
|
|
29
29
|
|
|
30
30
|
@abc.abstractmethod
|
|
31
|
-
def discard_population_data(self):
|
|
31
|
+
def discard_population_data(self): # pragma: nocover
|
|
32
32
|
pass
|
|
33
33
|
|
|
34
34
|
@abc.abstractmethod
|
|
35
|
-
def get_prefixed_catalogue(self):
|
|
35
|
+
def get_prefixed_catalogue(self): # pragma: nocover
|
|
36
36
|
pass
|
|
37
37
|
|
|
38
38
|
@abc.abstractmethod
|
|
39
|
-
def get_cell_kind(self, gid):
|
|
39
|
+
def get_cell_kind(self, gid): # pragma: nocover
|
|
40
40
|
pass
|
|
41
41
|
|
|
42
42
|
@abc.abstractmethod
|
|
43
|
-
def make_receiver_collection(self):
|
|
43
|
+
def make_receiver_collection(self): # pragma: nocover
|
|
44
44
|
pass
|
|
45
45
|
|
|
46
46
|
def get_description(self, gid):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import arbor
|
|
2
2
|
import tqdm
|
|
3
|
-
from bsb import ConnectionModel, config
|
|
3
|
+
from bsb import ConnectionModel, config, options
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class Receiver:
|
|
@@ -53,7 +53,9 @@ class ArborConnection(ConnectionModel):
|
|
|
53
53
|
gj_on_gid.setdefault(conn.from_id, []).append(conn)
|
|
54
54
|
|
|
55
55
|
def create_connections_on(self, conns_on_gid, conns, pop_pre, pop_post):
|
|
56
|
-
for pre_loc, post_loc in tqdm.tqdm(
|
|
56
|
+
for pre_loc, post_loc in tqdm.tqdm(
|
|
57
|
+
conns, total=len(conns), desc=self.name, disable=options.verbosity < 2
|
|
58
|
+
):
|
|
57
59
|
conns_on_gid[post_loc[0] + pop_post.offset].append(
|
|
58
60
|
Receiver(self, pre_loc[0] + pop_pre.offset, pre_loc[1:], post_loc[1:])
|
|
59
61
|
)
|
|
@@ -24,7 +24,7 @@ class ArborDevice(DeviceModel):
|
|
|
24
24
|
def register_probe_id(self, gid, tag):
|
|
25
25
|
self._probe_ids.append((gid, tag))
|
|
26
26
|
|
|
27
|
-
def
|
|
27
|
+
def implement(self, adapter, simulation, simdata):
|
|
28
28
|
self._handles = [
|
|
29
29
|
self.sample(simdata.arbor_sim, probe_id) for probe_id in self._probe_ids
|
|
30
30
|
]
|
|
@@ -42,9 +42,9 @@ class ArborDevice(DeviceModel):
|
|
|
42
42
|
return dict(zip(attrs, (getattr(self, attr) for attr in attrs), strict=False))
|
|
43
43
|
|
|
44
44
|
@abc.abstractmethod
|
|
45
|
-
def implement_probes(self, simdata, target):
|
|
45
|
+
def implement_probes(self, simdata, target): # pragma: nocover
|
|
46
46
|
pass
|
|
47
47
|
|
|
48
48
|
@abc.abstractmethod
|
|
49
|
-
def implement_generators(self, simdata, target):
|
|
49
|
+
def implement_generators(self, simdata, target): # pragma: nocover
|
|
50
50
|
pass
|
|
@@ -16,15 +16,10 @@ class Probe(ArborDevice):
|
|
|
16
16
|
f"`{self.probe_type}` is not a valid probe type for `{self.name}`"
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
-
def implement(self,
|
|
20
|
-
|
|
21
|
-
kwargs = dict((k, getattr(self, k)) for k in probe_args if hasattr(self, k))
|
|
22
|
-
return [getattr(arbor, self.get_probe_name())(**kwargs)]
|
|
23
|
-
|
|
24
|
-
def prepare_samples(self, sim, comm):
|
|
25
|
-
super().prepare_samples(sim, comm)
|
|
19
|
+
def implement(self, adapter, simulation, simdata):
|
|
20
|
+
super().implement(adapter, simulation, simdata)
|
|
26
21
|
for probe_id, handle in zip(self._probe_ids, self._handles, strict=False):
|
|
27
|
-
self.adapter.result.add(ProbeRecorder(self,
|
|
22
|
+
self.adapter.result.add(ProbeRecorder(self, simdata, probe_id, handle))
|
|
28
23
|
|
|
29
24
|
|
|
30
25
|
class ProbeRecorder:
|
|
@@ -9,9 +9,9 @@ class SpikeRecorder(ArborDevice, classmap_entry="spike_recorder"):
|
|
|
9
9
|
def boot(self):
|
|
10
10
|
self._gids = set()
|
|
11
11
|
|
|
12
|
-
def
|
|
13
|
-
super().
|
|
14
|
-
if not comm.get_rank():
|
|
12
|
+
def implement(self, adapter, simulation, simdata):
|
|
13
|
+
super().implement(adapter, simulation, simdata)
|
|
14
|
+
if not adapter.comm.get_rank():
|
|
15
15
|
|
|
16
16
|
def record_device_spikes(segment):
|
|
17
17
|
spiketrain = list()
|
|
@@ -6,7 +6,7 @@ build-backend = "flit_core.buildapi"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "bsb-arbor"
|
|
9
|
-
version = "
|
|
9
|
+
version = "7.0.2"
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.10,<4"
|
|
12
12
|
dynamic = [ "description" ]
|
|
@@ -15,8 +15,8 @@ classifiers = [
|
|
|
15
15
|
]
|
|
16
16
|
dependencies = [
|
|
17
17
|
"numpy~=1.21",
|
|
18
|
-
"bsb-core~=
|
|
19
|
-
"arborize~=
|
|
18
|
+
"bsb-core~=7.0",
|
|
19
|
+
"arborize~=7.0",
|
|
20
20
|
"arbor~=0.10; sys_platform != 'win32'"
|
|
21
21
|
]
|
|
22
22
|
|
|
@@ -46,7 +46,7 @@ branch = true
|
|
|
46
46
|
source = [ "bsb_arbor" ]
|
|
47
47
|
|
|
48
48
|
[tool.coverage.report]
|
|
49
|
-
exclude_lines = [ "if TYPE_CHECKING:" ]
|
|
49
|
+
exclude_lines = [ "if typing.TYPE_CHECKING:", "pragma: nocover" ]
|
|
50
50
|
show_missing = true
|
|
51
51
|
|
|
52
52
|
[tool.ruff]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|