bsb-arbor 0.0.0b0__tar.gz → 0.0.0b1__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.

Potentially problematic release.


This version of bsb-arbor might be problematic. Click here for more details.

File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bsb-arbor
3
- Version: 0.0.0b0
3
+ Version: 0.0.0b1
4
4
  Summary: Arbor simulation adapter for the BSB framework
5
5
  Author-email: Robin De Schepper <robingilbert.deschepper@unipv.it>
6
6
  Description-Content-Type: text/markdown
@@ -8,7 +8,9 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (G
8
8
  Requires-Dist: bsb-core>=4.0.0b0,<=4.0.0b9999
9
9
  Requires-Dist: arbor~=0.9
10
10
  Requires-Dist: arborize[arbor]>=4.0.0b1
11
+ Requires-Dist: bsb-core[parallel] ; extra == "test"
11
12
  Requires-Dist: bsb-test>=0.0.0b0 ; extra == "test"
13
+ Requires-Dist: coverage~=7.0 ; extra == "test"
12
14
  Provides-Extra: test
13
15
 
14
16
  # bsb-arbor
File without changes
@@ -3,9 +3,10 @@ Arbor simulation adapter for the BSB framework
3
3
  """
4
4
 
5
5
  from bsb.simulation import SimulationBackendPlugin
6
- from .simulation import ArborSimulation
7
- from .adapter import ArborAdapter
6
+
8
7
  from . import devices
8
+ from .adapter import ArborAdapter
9
+ from .simulation import ArborSimulation
9
10
 
10
- __version__ = "0.0.0b0"
11
+ __version__ = "0.0.0b1"
11
12
  __plugin__ = SimulationBackendPlugin(Simulation=ArborSimulation, Adapter=ArborAdapter)
@@ -1,14 +1,13 @@
1
1
  import itertools
2
+ import itertools as it
3
+ import time
2
4
  import typing
3
5
 
4
- from bsb.reporting import report, warn
6
+ import arbor
5
7
  from bsb.exceptions import AdapterError, UnknownGIDError
8
+ from bsb.reporting import report, warn
6
9
  from bsb.services import MPI
7
10
  from bsb.simulation.adapter import SimulationData, SimulatorAdapter
8
- import itertools as it
9
- import time
10
- import arbor
11
-
12
11
  from bsb.storage import Chunk
13
12
 
14
13
  if typing.TYPE_CHECKING:
@@ -79,7 +78,9 @@ class Population:
79
78
  return ranges
80
79
 
81
80
  def __iter__(self):
82
- yield from itertools.chain.from_iterable(range(r[0], r[1]) for r in self._ranges)
81
+ yield from itertools.chain.from_iterable(
82
+ range(r[0], r[1]) for r in self._ranges
83
+ )
83
84
 
84
85
 
85
86
  class GIDManager:
@@ -266,7 +267,12 @@ class ArborAdapter(SimulatorAdapter):
266
267
  for device in simulation.devices.values():
267
268
  device.prepare_samples(simdata)
268
269
 
269
- def run(self, simulation):
270
+ def run(self, *simulations):
271
+ if len(simulations) != 1:
272
+ raise RuntimeError(
273
+ "Can not run multiple simultaneous simulations. Composition not implemented."
274
+ )
275
+ simulation = simulations[0]
270
276
  try:
271
277
  simdata = self.simdata[simulation]
272
278
  arbor_sim = simdata.arbor_sim
@@ -285,7 +291,7 @@ class ArborAdapter(SimulatorAdapter):
285
291
  if simulation.profiling and arbor.config()["profiling"]:
286
292
  report("printing profiler summary", level=2)
287
293
  report(arbor.profiler_summary(), level=1)
288
- return simdata.result
294
+ return [simdata.result]
289
295
  finally:
290
296
  del self.simdata[simulation]
291
297
 
@@ -1,11 +1,11 @@
1
1
  import abc
2
2
  import typing
3
3
 
4
+ import arbor
4
5
  from bsb import config
5
6
  from bsb.config import types
6
7
  from bsb.exceptions import ConfigurationError
7
8
  from bsb.simulation.cell import CellModel
8
- import arbor
9
9
 
10
10
  from .adapter import SingleReceiverCollection
11
11
 
@@ -1,8 +1,7 @@
1
+ import arbor
1
2
  import tqdm
2
-
3
3
  from bsb import config
4
4
  from bsb.simulation.connection import ConnectionModel
5
- import arbor
6
5
 
7
6
 
8
7
  class Receiver:
@@ -63,5 +62,7 @@ class ArborConnection(ConnectionModel):
63
62
 
64
63
  def gap_junction(self, conn):
65
64
  l = arbor.cell_local_label(f"gap_{conn.to_compartment.id}")
66
- g = arbor.cell_global_label(int(conn.from_id), f"gap_{conn.from_compartment.id}")
65
+ g = arbor.cell_global_label(
66
+ int(conn.from_id), f"gap_{conn.from_compartment.id}"
67
+ )
67
68
  return arbor.gap_junction_connection(g, l, self.weight)
@@ -1,12 +1,11 @@
1
1
  import abc
2
2
 
3
+ import arbor
3
4
  from bsb import config
4
5
  from bsb.config import types
5
6
  from bsb.simulation.device import DeviceModel
6
7
  from bsb.simulation.targetting import Targetting
7
8
 
8
- import arbor
9
-
10
9
 
11
10
  @config.dynamic(attr_name="device", auto_classmap=True, classmap_entry=None)
12
11
  class ArborDevice(DeviceModel):
@@ -1,3 +1,3 @@
1
1
  from .poisson_generator import PoissonGenerator
2
- from .spike_recorder import SpikeRecorder
3
2
  from .probe import Probe
3
+ from .spike_recorder import SpikeRecorder
@@ -1,7 +1,8 @@
1
+ import arbor
1
2
  from bsb import config
3
+
2
4
  from ..connection import Receiver
3
5
  from ..device import ArborDevice
4
- import arbor
5
6
 
6
7
 
7
8
  @config.node
@@ -1,6 +1,7 @@
1
- from ..device import ArborDevice
2
- from bsb.exceptions import ConfigurationError
3
1
  import arbor
2
+ from bsb.exceptions import ConfigurationError
3
+
4
+ from ..device import ArborDevice
4
5
 
5
6
 
6
7
  class Probe(ArborDevice):
@@ -1,7 +1,7 @@
1
1
  import neo
2
-
3
2
  from bsb import config
4
3
  from bsb.services import MPI
4
+
5
5
  from ..device import ArborDevice
6
6
 
7
7
 
@@ -2,6 +2,7 @@ import psutil
2
2
  from bsb import config
3
3
  from bsb.config import types
4
4
  from bsb.simulation.simulation import Simulation
5
+
5
6
  from .cell import ArborCell
6
7
  from .connection import ArborConnection
7
8
  from .device import ArborDevice
@@ -22,4 +22,4 @@ arbor = "bsb_arbor"
22
22
  name = "bsb_arbor"
23
23
 
24
24
  [project.optional-dependencies]
25
- test = ["bsb-test>=0.0.0b0"]
25
+ test = ["bsb-core[parallel]", "bsb-test>=0.0.0b0", "coverage~=7.0"]
@@ -1,40 +0,0 @@
1
- name: Test BSB Arbor adapter
2
-
3
- on: [ push, pull_request ]
4
-
5
- jobs:
6
- build:
7
- if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
8
- runs-on: ubuntu-latest
9
- strategy:
10
- matrix:
11
- python-version: [ "3.9", "3.10", "3.11" ]
12
- steps:
13
- - uses: actions/checkout@v3
14
- - name: Set up Python ${{ matrix.python-version }}
15
- uses: actions/setup-python@v3
16
- with:
17
- python-version: ${{ matrix.python-version }}
18
- - name: Install apt dependencies
19
- run: |
20
- sudo apt-get update
21
- sudo apt-get install openmpi-bin libopenmpi-dev
22
- - name: Cache pip
23
- uses: actions/cache@v3
24
- with:
25
- path: ~/.cache/pip
26
- key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
27
- restore-keys: |
28
- ${{ runner.os }}-pip-
29
- ${{ runner.os }}-
30
- - name: Install dependencies & self
31
- run: |
32
- python -m pip install --upgrade pip
33
- pip install -e . --no-deps
34
- pip install -r requirements.txt --prefer-binary
35
- pip install -e .
36
- - name: Run tests & coverage
37
- run: |
38
- coverage run -p -m unittest
39
- mpiexec -n 2 coverage run -p -m unittest
40
- bash <(curl -s https://codecov.io/bash)
@@ -1,126 +0,0 @@
1
- # Byte-compiled / optimized / DLL files
2
- __pycache__/
3
- *.py[cod]
4
- *$py.class
5
-
6
- # C extensions
7
- *.so
8
-
9
- # Distribution / packaging
10
- .Python
11
- build/
12
- develop-eggs/
13
- dist/
14
- downloads/
15
- eggs/
16
- .eggs/
17
- lib/
18
- lib64/
19
- parts/
20
- sdist/
21
- var/
22
- wheels/
23
- pip-wheel-metadata/
24
- share/python-wheels/
25
- *.egg-info/
26
- .installed.cfg
27
- *.egg
28
- MANIFEST
29
-
30
- # PyInstaller
31
- # Usually these files are written by a python script from a template
32
- # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
- *.manifest
34
- *.spec
35
-
36
- # Installer logs
37
- pip-log.txt
38
- pip-delete-this-directory.txt
39
-
40
- # Unit test / coverage reports
41
- htmlcov/
42
- .tox/
43
- .nox/
44
- .coverage
45
- .coverage.*
46
- .cache
47
- nosetests.xml
48
- coverage.xml
49
- *.cover
50
- .hypothesis/
51
- .pytest_cache/
52
-
53
- # Translations
54
- *.mo
55
- *.pot
56
-
57
- # Django stuff:
58
- *.log
59
- local_settings.py
60
- db.sqlite3
61
- db.sqlite3-journal
62
-
63
- # Flask stuff:
64
- instance/
65
- .webassets-cache
66
-
67
- # Scrapy stuff:
68
- .scrapy
69
-
70
- # Sphinx documentation
71
- docs/_build/
72
-
73
- # PyBuilder
74
- target/
75
-
76
- # Jupyter Notebook
77
- .ipynb_checkpoints
78
-
79
- # IPython
80
- profile_default/
81
- ipython_config.py
82
-
83
- # pyenv
84
- .python-version
85
-
86
- # pipenv
87
- # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
88
- # However, in case of collaboration, if having platform-specific dependencies or dependencies
89
- # having no cross-platform support, pipenv may install dependencies that don't work, or not
90
- # install all needed dependencies.
91
- #Pipfile.lock
92
-
93
- # celery beat schedule file
94
- celerybeat-schedule
95
-
96
- # SageMath parsed files
97
- *.sage.py
98
-
99
- # Environments
100
- .env
101
- .venv
102
- env/
103
- venv/
104
- ENV/
105
- env.bak/
106
- venv.bak/
107
-
108
- # Spyder project settings
109
- .spyderproject
110
- .spyproject
111
-
112
- # Rope project settings
113
- .ropeproject
114
-
115
- # mkdocs documentation
116
- /site
117
-
118
- # mypy
119
- .mypy_cache/
120
- .dmypy.json
121
- dmypy.json
122
-
123
- # Pyre type checker
124
- .pyre/
125
-
126
- .idea/
@@ -1,5 +0,0 @@
1
- arbor==0.9
2
- mpi4py==3.1.5
3
- bsb-core>=4.0.0b0
4
- bsb-test==0.0.0b2
5
- coverage==7.3.3
@@ -1,34 +0,0 @@
1
- from bsb.config import from_file
2
- from bsb.core import Scaffold
3
- from bsb.services import MPI
4
- from bsb_test import RandomStorageFixture, get_config_path
5
- import unittest
6
-
7
-
8
- @unittest.skipIf(MPI.get_size() > 1, "Skipped during parallel testing.")
9
- class TestArbor(RandomStorageFixture, unittest.TestCase, engine_name="hdf5"):
10
- def test_brunel(self):
11
- cfg = from_file(get_config_path("test_brunel_wbsb.json"))
12
- simcfg = cfg.simulations.test_arbor
13
-
14
- network = Scaffold(cfg, self.storage)
15
- network.compile()
16
- result = network.run_simulation("test_arbor")
17
-
18
- spiketrains = result.block.segments[0].spiketrains
19
- sr_exc, sr_inh = None, None
20
- for st in spiketrains:
21
- if st.annotations["device"] == "sr_exc":
22
- sr_exc = st
23
- elif st.annotations["device"] == "sr_inh":
24
- sr_inh = st
25
-
26
- self.assertIsNotNone(sr_exc)
27
- self.assertIsNotNone(sr_inh)
28
-
29
- rate_ex = len(sr_exc) / simcfg.duration * 1000.0 / sr_exc.annotations["pop_size"]
30
- rate_in = len(sr_inh) / simcfg.duration * 1000.0 / sr_inh.annotations["pop_size"]
31
-
32
- # These are temporary circular values, taken from the output. May be incorrect.
33
- self.assertAlmostEqual(rate_in, 34.2, delta=1)
34
- self.assertAlmostEqual(rate_ex, 34.2, delta=1)