bsb-core 7.2.2__tar.gz → 7.3.0__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_core-7.2.2 → bsb_core-7.3.0}/PKG-INFO +1 -1
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/__init__.py +1 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/_encoding.py +38 -2
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/config/_attrs.py +1 -1
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/exceptions.py +2 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/storage/interfaces.py +51 -5
- {bsb_core-7.2.2 → bsb_core-7.3.0}/pyproject.toml +1 -1
- {bsb_core-7.2.2 → bsb_core-7.3.0}/LICENSE +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/README.md +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/__main__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/_contexts.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/_options.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/_package_spec.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/_util.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/cell_types.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/cli/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/cli/commands/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/cli/commands/_commands.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/cli/commands/_projects.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/config/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/config/_compile.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/config/_config.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/config/_distributions.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/config/_hooks.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/config/_make.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/config/_parse_types.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/config/parsers.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/config/refs.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/config/types.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/detailed/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/detailed/shared.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/detailed/voxel_intersection.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/general.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/geometric/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/geometric/geometric_shapes.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/geometric/morphology_shape_intersection.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/geometric/shape_morphology_intersection.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/geometric/shape_shape_intersection.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/import_.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/strategy.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/core.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/mixins.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/morphologies/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/morphologies/parsers/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/morphologies/parsers/parser.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/morphologies/selector.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/option.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/options.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/placement/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/placement/arrays.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/placement/distributor.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/placement/import_.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/placement/indicator.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/placement/random.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/placement/strategy.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/plugins.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/postprocessing.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/profiling.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/reporting.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/services/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/services/_pool_listeners.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/services/_util.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/services/mpi.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/services/mpilock.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/services/pool.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/simulation/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/simulation/_backends.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/simulation/adapter.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/simulation/cell.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/simulation/component.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/simulation/connection.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/simulation/device.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/simulation/parameter.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/simulation/results.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/simulation/simulation.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/simulation/targetting.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/storage/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/storage/_chunks.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/storage/_files.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/storage/_util.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/storage/decorators.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/storage/fs/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/storage/fs/file_store.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/topology/__init__.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/topology/_layout.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/topology/partition.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/topology/region.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/trees.py +0 -0
- {bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/voxels.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bsb-core
|
|
3
|
-
Version: 7.
|
|
3
|
+
Version: 7.3.0
|
|
4
4
|
Summary: `bsb-core` is the backbone package contain the essential code of the BSB: A component
|
|
5
5
|
Author-email: Robin De Schepper <robin@alexandria.sc>, Dimitri Rodarie <dimitri.rodarie@unipv.it>
|
|
6
6
|
Requires-Python: >=3.10,<4
|
|
@@ -257,6 +257,7 @@ JobPoolContextError: type["bsb.exceptions.JobPoolContextError"]
|
|
|
257
257
|
JobPoolError: type["bsb.exceptions.JobPoolError"]
|
|
258
258
|
JobSchedulingError: type["bsb.exceptions.JobSchedulingError"]
|
|
259
259
|
LabelTargetting: type["bsb.simulation.targetting.LabelTargetting"]
|
|
260
|
+
LabellingError: type["bsb.exceptions.LabellingError"]
|
|
260
261
|
Layer: type["bsb.topology.partition.Layer"]
|
|
261
262
|
LayoutError: type["bsb.exceptions.LayoutError"]
|
|
262
263
|
LocationTargetting: type["bsb.simulation.targetting.LocationTargetting"]
|
|
@@ -58,8 +58,42 @@ class EncodedLabels(np.ndarray):
|
|
|
58
58
|
cp.labels = {k: v.copy() for k, v in cp.labels.items()}
|
|
59
59
|
return cp
|
|
60
60
|
|
|
61
|
+
def remove_labels(self, labels, points):
|
|
62
|
+
# points can be either a boolean mask or a list of indices
|
|
63
|
+
if (
|
|
64
|
+
np.asarray(points).dtype != bool
|
|
65
|
+
and not len(points)
|
|
66
|
+
or np.asarray(points).dtype == bool
|
|
67
|
+
and not np.any(points)
|
|
68
|
+
):
|
|
69
|
+
return
|
|
70
|
+
|
|
71
|
+
# A counter that skips existing values.
|
|
72
|
+
counter = (c for c in itertools.count() if c not in self.labels)
|
|
73
|
+
|
|
74
|
+
for i in points:
|
|
75
|
+
point = self[i]
|
|
76
|
+
point_labels = self.labels[point].copy()
|
|
77
|
+
is_in = np.isin(labels, list(point_labels))
|
|
78
|
+
if np.any(is_in):
|
|
79
|
+
point_labels -= set(np.array(labels)[is_in])
|
|
80
|
+
for k, v in self.labels.items():
|
|
81
|
+
if point_labels == v:
|
|
82
|
+
new_id = k
|
|
83
|
+
break
|
|
84
|
+
else:
|
|
85
|
+
new_id = next(counter)
|
|
86
|
+
self.labels[new_id] = point_labels
|
|
87
|
+
self[i] = new_id
|
|
88
|
+
|
|
61
89
|
def label(self, labels, points):
|
|
62
|
-
|
|
90
|
+
# points can be either a boolean mask or a list of indices
|
|
91
|
+
if (
|
|
92
|
+
np.asarray(points).dtype != bool
|
|
93
|
+
and not len(points)
|
|
94
|
+
or np.asarray(points).dtype == bool
|
|
95
|
+
and not np.any(points)
|
|
96
|
+
):
|
|
63
97
|
return
|
|
64
98
|
_transitions = {}
|
|
65
99
|
# A counter that skips existing values.
|
|
@@ -110,7 +144,9 @@ class EncodedLabels(np.ndarray):
|
|
|
110
144
|
:param list[str] labels: List of labels
|
|
111
145
|
:rtype: numpy.ndarray[int]
|
|
112
146
|
"""
|
|
113
|
-
|
|
147
|
+
if labels is None:
|
|
148
|
+
return np.full(self.size, True, dtype=bool)
|
|
149
|
+
labels = set(labels)
|
|
114
150
|
has_any = [
|
|
115
151
|
k
|
|
116
152
|
for k, v in self.labels.items()
|
|
@@ -399,7 +399,7 @@ def _getref(remote, key):
|
|
|
399
399
|
|
|
400
400
|
|
|
401
401
|
def _getrefname(remote):
|
|
402
|
-
"""Canonical way to retrieve
|
|
402
|
+
"""Canonical way to retrieve the name of a remote node."""
|
|
403
403
|
try:
|
|
404
404
|
return remote.get_node_name()
|
|
405
405
|
except TypeError:
|
|
@@ -65,6 +65,7 @@ _t(
|
|
|
65
65
|
),
|
|
66
66
|
UnknownGIDError=_e(),
|
|
67
67
|
),
|
|
68
|
+
LabellingError=_e(),
|
|
68
69
|
MorphologyError=_e(
|
|
69
70
|
MorphologyRepositoryError=_e(),
|
|
70
71
|
MissingMorphologyError=_e(),
|
|
@@ -200,6 +201,7 @@ __all__ = [
|
|
|
200
201
|
"JobPoolContextError",
|
|
201
202
|
"JobPoolError",
|
|
202
203
|
"JobSchedulingError",
|
|
204
|
+
"LabellingError",
|
|
203
205
|
"LayoutError",
|
|
204
206
|
"MissingActiveConfigError",
|
|
205
207
|
"MissingMorphologyError",
|
|
@@ -386,6 +386,7 @@ class PlacementSet(Interface):
|
|
|
386
386
|
self._type = cell_type
|
|
387
387
|
self._tag = cell_type.name
|
|
388
388
|
self._morphology_labels = None
|
|
389
|
+
self._labels = None
|
|
389
390
|
|
|
390
391
|
@abc.abstractmethod
|
|
391
392
|
def __len__(self): # pragma: nocover
|
|
@@ -605,7 +606,6 @@ class PlacementSet(Interface):
|
|
|
605
606
|
"""
|
|
606
607
|
pass
|
|
607
608
|
|
|
608
|
-
@abc.abstractmethod
|
|
609
609
|
def set_label_filter(self, labels): # pragma: nocover
|
|
610
610
|
"""
|
|
611
611
|
Should limit the scope of the placement set to the given labels.
|
|
@@ -613,7 +613,16 @@ class PlacementSet(Interface):
|
|
|
613
613
|
:param labels: List of labels
|
|
614
614
|
:type labels: list[str]
|
|
615
615
|
"""
|
|
616
|
-
|
|
616
|
+
self._labels = labels
|
|
617
|
+
|
|
618
|
+
def get_label_filter(self): # pragma: nocover
|
|
619
|
+
"""
|
|
620
|
+
Get the labels used to limit the scope of the placement set.
|
|
621
|
+
|
|
622
|
+
:param labels: List of labels
|
|
623
|
+
:type labels: list[str]
|
|
624
|
+
"""
|
|
625
|
+
return self._labels
|
|
617
626
|
|
|
618
627
|
@abc.abstractmethod
|
|
619
628
|
def set_morphology_label_filter(self, morphology_labels): # pragma: nocover
|
|
@@ -629,6 +638,17 @@ class PlacementSet(Interface):
|
|
|
629
638
|
"""
|
|
630
639
|
pass
|
|
631
640
|
|
|
641
|
+
@abc.abstractmethod
|
|
642
|
+
def label_by_mask(self, labels, mask): # pragma: nocover
|
|
643
|
+
"""
|
|
644
|
+
Should label the masked with the given labels.
|
|
645
|
+
|
|
646
|
+
:param list[str] labels: List of labels
|
|
647
|
+
:param list[bool] mask: Array of boolean for each cell to label
|
|
648
|
+
:raises: LabellingError if the array provided has invalid shape.
|
|
649
|
+
"""
|
|
650
|
+
pass
|
|
651
|
+
|
|
632
652
|
@abc.abstractmethod
|
|
633
653
|
def label(self, labels, cells): # pragma: nocover
|
|
634
654
|
"""
|
|
@@ -638,6 +658,31 @@ class PlacementSet(Interface):
|
|
|
638
658
|
:type labels: list[str]
|
|
639
659
|
:param cells: Array of cells in this set to label.
|
|
640
660
|
:type cells: list[int]
|
|
661
|
+
:raises: LabellingError if the ids provided are invalid.
|
|
662
|
+
"""
|
|
663
|
+
pass
|
|
664
|
+
|
|
665
|
+
@abc.abstractmethod
|
|
666
|
+
def remove_labels_by_mask(self, labels, mask): # pragma: nocover
|
|
667
|
+
"""
|
|
668
|
+
Should remove the provided labels assigned to the masked cells.
|
|
669
|
+
|
|
670
|
+
:param list[str] labels: List of labels
|
|
671
|
+
:param list[bool] mask: Array of boolean for each cell to label
|
|
672
|
+
:raises: LabellingError if the array provided has invalid shape.
|
|
673
|
+
"""
|
|
674
|
+
pass
|
|
675
|
+
|
|
676
|
+
@abc.abstractmethod
|
|
677
|
+
def remove_labels(self, labels, cells):
|
|
678
|
+
"""
|
|
679
|
+
Should remove the provided labels assigned to the cells.
|
|
680
|
+
|
|
681
|
+
:param labels: List of labels
|
|
682
|
+
:type labels: list[str]
|
|
683
|
+
:param cells: Array of cells in this set to remove labels.
|
|
684
|
+
:type cells: list[int]
|
|
685
|
+
:raises: LabellingError if the ids provided are invalid.
|
|
641
686
|
"""
|
|
642
687
|
pass
|
|
643
688
|
|
|
@@ -654,8 +699,8 @@ class PlacementSet(Interface):
|
|
|
654
699
|
@abc.abstractmethod
|
|
655
700
|
def get_labelled(self, labels=None): # pragma: nocover
|
|
656
701
|
"""
|
|
657
|
-
Should return the ids of the cells labelled with given labels.
|
|
658
|
-
|
|
702
|
+
Should return the ids of the cells labelled with given labels.
|
|
703
|
+
To filter non labelled cells, set labels to empty list.
|
|
659
704
|
|
|
660
705
|
:param labels: List of labels
|
|
661
706
|
:type labels: list[str]
|
|
@@ -667,10 +712,11 @@ class PlacementSet(Interface):
|
|
|
667
712
|
def get_label_mask(self, labels=None): # pragma: nocover
|
|
668
713
|
"""
|
|
669
714
|
Should return a mask that fits the placement set for the cells with given labels.
|
|
670
|
-
|
|
715
|
+
To filter non labelled cells, set labels to empty list.
|
|
671
716
|
|
|
672
717
|
:param labels: List of labels
|
|
673
718
|
:type labels: list[str]
|
|
719
|
+
:rtype: numpy.ndarray[bool]
|
|
674
720
|
"""
|
|
675
721
|
pass
|
|
676
722
|
|
|
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
|
|
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
|
|
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
|
{bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/geometric/morphology_shape_intersection.py
RENAMED
|
File without changes
|
{bsb_core-7.2.2 → bsb_core-7.3.0}/bsb/connectivity/geometric/shape_morphology_intersection.py
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|