bsb-arbor 6.0.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bsb-arbor
3
- Version: 6.0.5
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~=6.0
12
- Requires-Dist: arborize~=6.0
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
  [![Build Status](https://github.com/dbbs-lab/bsb/actions/workflows/main.yml/badge.svg)](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
 
@@ -408,11 +408,13 @@ class ArborAdapter(SimulatorAdapter):
408
408
  report("MPI processes:", context.ranks, level=2)
409
409
  report("Threads per process:", context.threads, level=2)
410
410
  recipe = self.get_recipe(simulation, simdata)
411
+ self._duration = simulation.duration
411
412
  # Gap junctions are required for domain decomposition
412
413
  self.domain = arbor.partition_load_balance(recipe, context)
413
414
  self.gids = set(it.chain.from_iterable(g.gids for g in self.domain.groups))
414
415
  simdata.arbor_sim = arbor.simulation(recipe, context, self.domain)
415
- self.prepare_samples(simulation, simdata)
416
+ self.implement_components(simulation)
417
+ self.load_controllers(simulation)
416
418
  report("prepared simulation", level=1)
417
419
  return simdata
418
420
  except Exception:
@@ -422,10 +424,6 @@ class ArborAdapter(SimulatorAdapter):
422
424
  def get_gid_manager(self, simulation, simdata):
423
425
  return GIDManager(simulation, simdata)
424
426
 
425
- def prepare_samples(self, simulation, simdata):
426
- for device in simulation.devices.values():
427
- device.prepare_samples(simdata, comm=self.comm)
428
-
429
427
  def run(self, *simulations):
430
428
  if len(simulations) != 1:
431
429
  raise RuntimeError(
@@ -446,14 +444,19 @@ class ArborAdapter(SimulatorAdapter):
446
444
 
447
445
  start = time.time()
448
446
  report("running simulation", level=1)
449
- arbor_sim.run(simulation.duration * U.ms, dt=simulation.resolution * U.ms)
450
- report(f"completed simulation. {time.time() - start:.2f}s", level=1)
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)
451
452
  if simulation.profiling and arbor.config()["profiling"]:
452
453
  report("printing profiler summary", level=2)
453
454
  report(arbor.profiler_summary(), level=1)
454
455
  return [simdata.result]
455
456
  finally:
457
+ results = [self.simdata[sim].result for sim in simulations]
456
458
  del self.simdata[simulation]
459
+ return results
457
460
 
458
461
  def get_recipe(self, simulation, simdata=None):
459
462
  if simdata is None:
@@ -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(conns, total=len(conns), desc=self.name):
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 prepare_samples(self, simdata, comm):
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, target):
20
- probe_args = ("where", "mechanism", "ion", "state")
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, sim, probe_id, handle))
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 prepare_samples(self, simdata, comm):
13
- super().prepare_samples(simdata, comm)
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 = "6.0.5"
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~=6.0",
19
- "arborize~=6.0",
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