bluecellulab 2.5.9__py3-none-any.whl → 2.5.10__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 bluecellulab might be problematic. Click here for more details.

bluecellulab/cell/core.py CHANGED
@@ -142,7 +142,8 @@ class Cell(InjectableMixin, PlottableMixin):
142
142
  dt=self.record_dt)
143
143
 
144
144
  self.delayed_weights = queue.PriorityQueue() # type: ignore
145
- self.psections, self.secname_to_psection = init_psections(public_hoc_cell(self.cell))
145
+ self.psections: dict[int, PSection] = {}
146
+ self.secname_to_psection: dict[str, PSection] = {}
146
147
 
147
148
  # Keep track of when a cell is made passive by make_passive()
148
149
  # Used to know when re_init_rng() can be executed
@@ -155,6 +156,11 @@ class Cell(InjectableMixin, PlottableMixin):
155
156
  # as the object exists
156
157
  self.persistent: list[HocObjectType] = []
157
158
 
159
+ def _init_psections(self) -> None:
160
+ """Initialize the psections of the cell."""
161
+ if not self.psections:
162
+ self.psections, self.secname_to_psection = init_psections(public_hoc_cell(self.cell))
163
+
158
164
  def _extract_sections(self, sections) -> SectionMapping:
159
165
  res: SectionMapping = {}
160
166
  for section in sections:
@@ -198,6 +204,7 @@ class Cell(InjectableMixin, PlottableMixin):
198
204
 
199
205
  def get_psection(self, section_id: int | str) -> PSection:
200
206
  """Return a python section with the specified section id."""
207
+ self._init_psections()
201
208
  if isinstance(section_id, int):
202
209
  return self.psections[section_id]
203
210
  elif isinstance(section_id, str):
@@ -60,6 +60,7 @@ class PlottableMixin:
60
60
  scale_bar_size=10.0,
61
61
  fig_title=None):
62
62
  """Show a dendrogram of the cell."""
63
+ self._init_psections()
63
64
  cell_dendrogram = bluecellulab.Dendrogram(
64
65
  self.psections,
65
66
  variable=variable,
bluecellulab/psection.py CHANGED
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
  """Represents a python version of NEURON Section (for drawing)."""
15
15
  from __future__ import annotations
16
+ import re
16
17
  import neuron
17
18
 
18
19
  import bluecellulab
@@ -75,21 +76,6 @@ class PSection:
75
76
  self.pchildren: list[PSection] = []
76
77
  self.isec = isec
77
78
 
78
- if 'apic' in self.name:
79
- self.section_type = 'apical'
80
- elif 'dend' in self.name:
81
- self.section_type = 'basal'
82
- elif 'soma' in self.name:
83
- self.section_type = 'somatic'
84
- elif 'axon' in self.name:
85
- self.section_type = 'axonal'
86
- elif 'myelin' in self.name:
87
- self.section_type = 'myelin'
88
- else:
89
- raise Exception(
90
- "PSection: Section of unknown type: %s" %
91
- self.name)
92
-
93
79
  self.psegments: list[PSegment] = []
94
80
  self.maxsegdiam = 0.0
95
81
  for hsegment in hsection:
@@ -101,6 +87,15 @@ class PSection:
101
87
  self.xSpacing = 1.0
102
88
  self.ySpacing = 5.0
103
89
 
90
+ @property
91
+ def section_type(self) -> str:
92
+ """Return the type of the section."""
93
+ # From Cell[0].soma[0] -> soma
94
+ matches = re.findall(r'\.([^.\[\]]+)\[', self.name)
95
+ if matches:
96
+ return matches[-1] # Return the last match
97
+ return 'unknown' # Return 'unknown' if no matches are found
98
+
104
99
  @property
105
100
  def is_leaf(self) -> bool:
106
101
  """Return true if section is a leaf in the morphological structure."""
bluecellulab/psegment.py CHANGED
@@ -17,7 +17,7 @@ import neuron
17
17
 
18
18
  from bluecellulab.neuron_interpreter import eval_neuron
19
19
 
20
- type_colormap = {'apical': 'm', 'basal': 'r', 'somatic': 'k', 'axonal': 'b', 'myelin': 'g'}
20
+ type_colormap = {'apic': 'm', 'dend': 'r', 'soma': 'k', 'axon': 'b', 'myelin': 'g', 'unknown': 'c'}
21
21
 
22
22
 
23
23
  class PSegment:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bluecellulab
3
- Version: 2.5.9
3
+ Version: 2.5.10
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -7,8 +7,8 @@ bluecellulab/graph.py,sha256=ODiQy4xjRVxtNITXeXpYnqHas0wR7gZ_aXuDAF7jMq4,3419
7
7
  bluecellulab/importer.py,sha256=zwVi1Nx2f8xzFfzxzYoXa7gfi7DQapqkRJII5sBbRyY,2900
8
8
  bluecellulab/neuron_interpreter.py,sha256=hXig_u3T6JmEHbkV8ZblEZtX0kY80ate4VpRtANNFrM,2185
9
9
  bluecellulab/plotwindow.py,sha256=UVHzml-BB83m5Qr-YGkjR9kB-vSW8mM0Owh2j95yIaU,2721
10
- bluecellulab/psection.py,sha256=EgAS8IS9DcYv2xOkNISgfg_CfRc0nDfRFjvgQhyi9eY,6328
11
- bluecellulab/psegment.py,sha256=rBryDYHC_uDK9itfXXrFZ0DL9F6WgRICL0j5EHN56QM,3125
10
+ bluecellulab/psection.py,sha256=SYI2mGUIp8UiuMkyp9ITChHVLbJ0fDsEmen1pAbgNJQ,6174
11
+ bluecellulab/psegment.py,sha256=02DkvazPGjnwjfjn1K8CZqdcVWnUhYpgrjqjoHNz6jM,3133
12
12
  bluecellulab/rngsettings.py,sha256=Dlt34dc4AoWyxCCzUK3Jlui90VCK20xHg6gD_OJzPIw,4237
13
13
  bluecellulab/tools.py,sha256=JrAfMVozfucwcyGklweMvEM7uGnTnWIDmk4eqI-43Es,11169
14
14
  bluecellulab/type_aliases.py,sha256=DvgjERv2Ztdw_sW63JrZTQGpJ0x5uMTFB5hcBHDb0WA,441
@@ -18,9 +18,9 @@ bluecellulab/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
18
18
  bluecellulab/analysis/inject_sequence.py,sha256=jfEESRAUKAWgjceNWfx3Rwe1gDNWhxwZL4PfnJZCzrg,4930
19
19
  bluecellulab/cell/__init__.py,sha256=Sbc0QOsJ8E7tSwf3q7fsXuE_SevBN6ZmoCVyyU5zfII,208
20
20
  bluecellulab/cell/cell_dict.py,sha256=PVmZsjhZ9jp3HC-8QmdFqp-crAcVMSVeLWujcOPLlpo,1346
21
- bluecellulab/cell/core.py,sha256=uxAWAZ6NpODJ3O77p0JWL6AVey3lOyetU3SVZxP4a9Q,31201
21
+ bluecellulab/cell/core.py,sha256=MtrVQAxT82dc9uQuWZyTQfc6Oczrnc_y_9hcyBqUT7w,31467
22
22
  bluecellulab/cell/injector.py,sha256=XC49VSHw78xCHzLJKO_-unnnVZAZXsYg5qbmZPx01AA,18091
23
- bluecellulab/cell/plotting.py,sha256=_hZs5oYG4vmJBVf05cJ2O_cVazi5Eap8OkL9BtIwjW8,4001
23
+ bluecellulab/cell/plotting.py,sha256=hW5KAmaSonJ1tgR6xRrnfVe33I5mBsBUrKJQwGvAbUc,4032
24
24
  bluecellulab/cell/random.py,sha256=FDby9BN4eJT27COwHP59bhDE2v-c6rdOKNFj3cYZTVY,1773
25
25
  bluecellulab/cell/recording.py,sha256=dekJspPb_5yrS6WR3aXtvZ6KWwMNbyhe5aIOVtNDHpY,342
26
26
  bluecellulab/cell/section_distance.py,sha256=J8-oqgCHzRaJkpfjPUR6NFtXDhwbrXad9nDaTCKNkTU,3908
@@ -61,9 +61,9 @@ bluecellulab/stimulus/factory.py,sha256=AOby3Sp2g8BJsRccz3afazfCyysyWIgLtcliWlye
61
61
  bluecellulab/synapse/__init__.py,sha256=RW8XoAMXOvK7OG1nHl_q8jSEKLj9ZN4oWf2nY9HAwuk,192
62
62
  bluecellulab/synapse/synapse_factory.py,sha256=YkvxbdGF-u-vxYdbRNTlX-9AtSC_3t_FQRFhybwzgrk,6805
63
63
  bluecellulab/synapse/synapse_types.py,sha256=4gne-hve2vq1Lau-LAVPsfLjffVYqAYBW3kCfC7_600,16871
64
- bluecellulab-2.5.9.dist-info/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
65
- bluecellulab-2.5.9.dist-info/LICENSE,sha256=xOouu1gC1GGklDxkITlaVl60I9Ab860O-nZsFbWydvU,11749
66
- bluecellulab-2.5.9.dist-info/METADATA,sha256=zDUbQYoAFBVjKO3yIkbYZvBC0sUA_8nO3TbECj-qFM4,7025
67
- bluecellulab-2.5.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
68
- bluecellulab-2.5.9.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
69
- bluecellulab-2.5.9.dist-info/RECORD,,
64
+ bluecellulab-2.5.10.dist-info/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
65
+ bluecellulab-2.5.10.dist-info/LICENSE,sha256=xOouu1gC1GGklDxkITlaVl60I9Ab860O-nZsFbWydvU,11749
66
+ bluecellulab-2.5.10.dist-info/METADATA,sha256=MEgGgaV3rXDUcTU5EntzGyw3GinZSWicJnC0cQuPrXo,7026
67
+ bluecellulab-2.5.10.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
68
+ bluecellulab-2.5.10.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
69
+ bluecellulab-2.5.10.dist-info/RECORD,,