bsb-arbor 6.0.0a15__py3-none-any.whl → 6.0.1__py3-none-any.whl

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.

bsb_arbor/adapter.py CHANGED
@@ -63,7 +63,20 @@ class SingleReceiverCollection(list):
63
63
 
64
64
 
65
65
  class Population:
66
+ """
67
+ Represents a population of cells for the Arbor simulator.
68
+
69
+ This class manages a collection of cells from a specific cell model, handling their
70
+ GID ranges and providing methods to access and manipulate subsets of the population.
71
+ """
66
72
  def __init__(self, simdata, cell_model, offset):
73
+ """
74
+ Initialize a population of cells.
75
+
76
+ :param simdata: The simulation data container
77
+ :param cell_model: The cell model for this population
78
+ :param offset: The GID offset for this population
79
+ """
67
80
  self._model = cell_model
68
81
  self._simdata = simdata
69
82
  ps = cell_model.get_placement_set(simdata.chunks)
@@ -72,22 +85,61 @@ class Population:
72
85
 
73
86
  @property
74
87
  def model(self):
88
+ """
89
+ Get the cell model associated with this population.
90
+
91
+ :return: The cell model object
92
+ """
75
93
  return self._model
76
94
 
77
95
  @property
78
96
  def offset(self):
97
+ """
98
+ Get the GID offset for this population.
99
+
100
+ :return: The GID offset value
101
+ """
79
102
  return self._offset
80
103
 
81
104
  def __len__(self):
105
+ """
106
+ Get the total number of cells in this population.
107
+
108
+ :return: The number of cells
109
+ """
82
110
  return sum(stop - start for start, stop in self._ranges)
83
111
 
84
112
  def __contains__(self, i):
113
+ """
114
+ Check if a GID is part of this population.
115
+
116
+ :param i: The GID to check
117
+ :return: True if the GID is in this population, False otherwise
118
+ """
85
119
  return any(start <= i < stop for start, stop in self._ranges)
86
120
 
87
121
  def copy(self):
122
+ """
123
+ Create a copy of this population.
124
+
125
+ :return: A new Population instance with the same properties
126
+ """
88
127
  return Population(self._simdata, self._model, self._offset)
89
128
 
90
129
  def __getitem__(self, item):
130
+ """
131
+ Get a subset of the population based on the provided index or mask.
132
+
133
+ Supports various indexing methods:
134
+ - Boolean masking: Select cells based on a boolean mask
135
+ - Integer indexing: Select specific cells by their indices
136
+ - Slicing: Select a range of cells
137
+
138
+ :param item: The index, slice, or mask to use for selection
139
+ :return: A new Population instance containing the selected cells
140
+ :raises ValueError: If the dimensions of the mask don't match the population
141
+ :raises IndexError: If an index is out of bounds
142
+ """
91
143
  # Boolean masking, kind of
92
144
  if getattr(item, "dtype", None) == bool or _all_bools(item): # noqa: E721
93
145
  if len(item) != len(self):
@@ -106,6 +158,14 @@ class Population:
106
158
  return self._subpop_one(item)
107
159
 
108
160
  def _get_ranges(self, chunks, ps, offset):
161
+ """
162
+ Calculate the GID ranges for this population based on chunk statistics.
163
+
164
+ :param chunks: The simulation chunks to include
165
+ :param ps: The placement set for the cell model
166
+ :param offset: The starting GID offset
167
+ :return: A list of (start, stop) tuples representing GID ranges
168
+ """
109
169
  stats = ps.get_chunk_stats()
110
170
  ranges = []
111
171
  for chunk, len_ in sorted(
@@ -117,6 +177,15 @@ class Population:
117
177
  return ranges
118
178
 
119
179
  def _subpop_np(self, arr):
180
+ """
181
+ Create a subpopulation from a numpy array of indices.
182
+
183
+ This method handles array-based indexing, including boolean masks,
184
+ integer arrays, and slices.
185
+
186
+ :param arr: A numpy array of indices to include in the subpopulation
187
+ :return: A new Population instance containing only the selected cells
188
+ """
120
189
  pop = self.copy()
121
190
  if not len(pop):
122
191
  return pop
@@ -138,6 +207,13 @@ class Population:
138
207
  return pop
139
208
 
140
209
  def _subpop_one(self, item):
210
+ """
211
+ Create a subpopulation containing a single cell.
212
+
213
+ :param item: The index of the cell to include
214
+ :return: A new Population instance containing only the selected cell
215
+ :raises IndexError: If the index is out of bounds
216
+ """
141
217
  if item >= len(self):
142
218
  raise IndexError(f"Index {item} out of bounds for size {len(self)}")
143
219
  pop = self.copy()
@@ -150,6 +226,11 @@ class Population:
150
226
  ptr += stop - start
151
227
 
152
228
  def __iter__(self):
229
+ """
230
+ Iterate over all GIDs in this population.
231
+
232
+ :yield: Each GID in the population's ranges
233
+ """
153
234
  yield from itertools.chain.from_iterable(range(r[0], r[1]) for r in self._ranges)
154
235
 
155
236
 
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.4
2
+ Name: bsb-arbor
3
+ Version: 6.0.1
4
+ Summary: Arbor simulation adapter for the BSB framework.
5
+ Author-email: Robin De Schepper <robin@alexandria.sc>, Dimitri Rodarie <dimitri.rodarie@unipv.it>
6
+ Requires-Python: >=3.10,<4
7
+ Description-Content-Type: text/markdown
8
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
9
+ License-File: LICENSE
10
+ Requires-Dist: numpy~=1.21
11
+ Requires-Dist: bsb-core~=6.0
12
+ Requires-Dist: arborize~=6.0
13
+ Requires-Dist: arbor~=0.10; sys_platform != 'win32'
14
+
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
+ [![Documentation](https://readthedocs.org/projects/bsb-arbor/badge/?version=latest)](https://bsb-arbor.readthedocs.io/en/latest/?badge=latest)
17
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
18
+
19
+ # bsb-arbor
20
+
21
+ bsb-arbor is a plugin of the [BSB](https://github.com/dbbs-lab/bsb)
22
+ It contains the interfaces and tools to simulate BSB circuits with the
23
+ [Arbor simulator](https://arbor-sim.org/).
24
+
25
+ Comprehensive documentation is available at:
26
+
27
+ * [BSB Documentation](https://bsb.readthedocs.io/en/latest)
28
+ * [bsb-arbor Documentation](https://bsb-arbor.readthedocs.io/en/latest)
29
+
@@ -1,5 +1,5 @@
1
1
  bsb_arbor/__init__.py,sha256=1kJSMSgt1vnjllcKXRUfomu0XTczbqYkkRf-TjSQbP8,437
2
- bsb_arbor/adapter.py,sha256=2aeDo_znf7_przJMDe7AqfVse9GlRA0WA8qDDJcfEqs,16136
2
+ bsb_arbor/adapter.py,sha256=OJdbfNVQ_74KtFlgQit1MCi4zuoNzf2WOzs-wIzDv00,18996
3
3
  bsb_arbor/cell.py,sha256=V4JxsdwS_FNfQ_wRjnJH-kFVLMwipzLSHcYbf-VgP_c,2476
4
4
  bsb_arbor/connection.py,sha256=1u3yLA7R0G3Rxxf0Zvw3AcBa242n8XeSVej_r8iXjXY,2446
5
5
  bsb_arbor/device.py,sha256=5PD6nujSlTu74BonS5Ojp7LhopusQ4cDVEEAYg1aAMA,1752
@@ -8,8 +8,8 @@ bsb_arbor/devices/__init__.py,sha256=8PgEH4gktvNW7KywuFXIzZXsPuWayWt0BPuKz6sJyPA
8
8
  bsb_arbor/devices/poisson_generator.py,sha256=PGcx1YQn6WoZ3yZGXbW0nF1gtDo1fC7KGnmFYaklR3s,1045
9
9
  bsb_arbor/devices/probe.py,sha256=Dv0GiWxNUuiKRYg8wCik2xlQLvh5dJBE4e-v3-W2eLg,1732
10
10
  bsb_arbor/devices/spike_recorder.py,sha256=xJ720Tg9EO71RIc54ZEN04UqUDNyyI5TliC1ZD5UHWc,1339
11
- bsb_arbor-6.0.0a15.dist-info/entry_points.txt,sha256=8z5oyflKGOBD2smUKyrUit-_2JqBs85g8rm5YOM8SYg,43
12
- bsb_arbor-6.0.0a15.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
13
- bsb_arbor-6.0.0a15.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
14
- bsb_arbor-6.0.0a15.dist-info/METADATA,sha256=Lu2mGvQBc8furvuB3gjEn40uR7dby3SxuCfAdFokQNg,1602
15
- bsb_arbor-6.0.0a15.dist-info/RECORD,,
11
+ bsb_arbor-6.0.1.dist-info/entry_points.txt,sha256=8z5oyflKGOBD2smUKyrUit-_2JqBs85g8rm5YOM8SYg,43
12
+ bsb_arbor-6.0.1.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
13
+ bsb_arbor-6.0.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
14
+ bsb_arbor-6.0.1.dist-info/METADATA,sha256=tINOGljnDSXkfeQBOfjZIdlEDRCeAVBB2GrsdS7YDd4,1347
15
+ bsb_arbor-6.0.1.dist-info/RECORD,,
@@ -1,36 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: bsb-arbor
3
- Version: 6.0.0a15
4
- Summary: Arbor simulation adapter for the BSB framework.
5
- Author-email: Robin De Schepper <robin@alexandria.sc>, Dimitri Rodarie <dimitri.rodarie@unipv.it>
6
- Requires-Python: >=3.10,<4
7
- Description-Content-Type: text/markdown
8
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
9
- License-File: LICENSE
10
- Requires-Dist: numpy~=1.21
11
- Requires-Dist: bsb-core~=6.0
12
- Requires-Dist: arborize~=6.0
13
- Requires-Dist: arbor~=0.10; sys_platform != 'win32'
14
- Requires-Dist: bsb-arbor[test, docs] ; extra == "dev"
15
- Requires-Dist: pre-commit~=3.5 ; extra == "dev"
16
- Requires-Dist: ruff>=0.8.2 ; extra == "dev"
17
- Requires-Dist: snakeviz~=2.1 ; extra == "dev"
18
- Requires-Dist: furo~=2024.0 ; extra == "docs"
19
- Requires-Dist: sphinxext-bsb~=6.0 ; extra == "docs"
20
- Requires-Dist: bsb-core[parallel] ; extra == "test"
21
- Requires-Dist: bsb-hdf5~=6.0 ; extra == "test"
22
- Requires-Dist: bsb-test~=6.0 ; extra == "test"
23
- Requires-Dist: coverage>=7.3 ; extra == "test"
24
- Provides-Extra: dev
25
- Provides-Extra: docs
26
- Provides-Extra: test
27
-
28
- [![Build Status](https://github.com/dbbs-lab/bsb-arbor/actions/workflows/main.yml/badge.svg)](https://github.com/dbbs-lab/bsb-arbor/actions/workflows/main.yml)
29
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
30
-
31
- # bsb-arbor
32
-
33
- bsb-arbor is a plugin of the [BSB](https://github.com/dbbs-lab/bsb) (see also
34
- [bsb-core](https://github.com/dbbs-lab/bsb-core)).
35
- It contains the interfaces and tools to simulate BSB circuit with the
36
- [Arbor simulator](https://arbor-sim.org/).