bluecellulab 2.6.66__tar.gz → 2.6.68__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 bluecellulab might be problematic. Click here for more details.

Files changed (117) hide show
  1. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/PKG-INFO +3 -1
  2. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/core.py +104 -9
  3. bluecellulab-2.6.68/bluecellulab/cell/section_tools.py +96 -0
  4. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab.egg-info/PKG-INFO +3 -1
  5. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab.egg-info/SOURCES.txt +1 -0
  6. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab.egg-info/requires.txt +3 -0
  7. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/pyproject.toml +5 -0
  8. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/tox.ini +1 -0
  9. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/.compile_mod.sh +0 -0
  10. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/.gitattributes +0 -0
  11. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/.github/dependabot.yml +0 -0
  12. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/.github/workflows/release.yml +0 -0
  13. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/.github/workflows/test.yml +0 -0
  14. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/.gitignore +0 -0
  15. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/.gitlab-ci.yml +0 -0
  16. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/.readthedocs.yml +0 -0
  17. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/.zenodo.json +0 -0
  18. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/AUTHORS.txt +0 -0
  19. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/CHANGELOG.rst +0 -0
  20. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/CITATION.cff +0 -0
  21. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/CONTRIBUTING.rst +0 -0
  22. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/LICENSE +0 -0
  23. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/MANIFEST.in +0 -0
  24. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/Makefile +0 -0
  25. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/README.rst +0 -0
  26. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/__init__.py +0 -0
  27. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/analysis/__init__.py +0 -0
  28. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/analysis/analysis.py +0 -0
  29. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/analysis/inject_sequence.py +0 -0
  30. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/analysis/plotting.py +0 -0
  31. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/analysis/utils.py +0 -0
  32. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/__init__.py +0 -0
  33. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/ballstick/__init__.py +0 -0
  34. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/ballstick/emodel.hoc +0 -0
  35. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/ballstick/morphology.asc +0 -0
  36. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/cell_dict.py +0 -0
  37. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/injector.py +0 -0
  38. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/plotting.py +0 -0
  39. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/random.py +0 -0
  40. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/recording.py +0 -0
  41. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/section_distance.py +0 -0
  42. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/serialized_sections.py +0 -0
  43. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/sonata_proxy.py +0 -0
  44. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/stimuli_generator.py +0 -0
  45. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/cell/template.py +0 -0
  46. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/__init__.py +0 -0
  47. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/circuit_access/__init__.py +0 -0
  48. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/circuit_access/bluepy_circuit_access.py +0 -0
  49. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/circuit_access/definition.py +0 -0
  50. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/circuit_access/sonata_circuit_access.py +0 -0
  51. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/config/__init__.py +0 -0
  52. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/config/bluepy_simulation_config.py +0 -0
  53. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/config/definition.py +0 -0
  54. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/config/sections.py +0 -0
  55. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/config/sonata_simulation_config.py +0 -0
  56. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/format.py +0 -0
  57. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/iotools.py +0 -0
  58. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/node_id.py +0 -0
  59. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/simulation_access.py +0 -0
  60. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/synapse_properties.py +0 -0
  61. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit/validate.py +0 -0
  62. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/circuit_simulation.py +0 -0
  63. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/connection.py +0 -0
  64. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/dendrogram.py +0 -0
  65. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/exceptions.py +0 -0
  66. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/graph.py +0 -0
  67. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/hoc/Cell.hoc +0 -0
  68. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/hoc/RNGSettings.hoc +0 -0
  69. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/hoc/TDistFunc.hoc +0 -0
  70. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/hoc/TStim.hoc +0 -0
  71. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/hoc/fileUtils.hoc +0 -0
  72. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/importer.py +0 -0
  73. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/neuron_interpreter.py +0 -0
  74. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/plotwindow.py +0 -0
  75. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/psection.py +0 -0
  76. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/psegment.py +0 -0
  77. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/reports/__init__.py +0 -0
  78. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/reports/manager.py +0 -0
  79. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/reports/utils.py +0 -0
  80. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/reports/writers/__init__.py +0 -0
  81. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/reports/writers/base_writer.py +0 -0
  82. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/reports/writers/compartment.py +0 -0
  83. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/reports/writers/spikes.py +0 -0
  84. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/rngsettings.py +0 -0
  85. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/simulation/__init__.py +0 -0
  86. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/simulation/neuron_globals.py +0 -0
  87. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/simulation/parallel.py +0 -0
  88. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/simulation/report.py +0 -0
  89. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/simulation/simulation.py +0 -0
  90. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/stimulus/__init__.py +0 -0
  91. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/stimulus/circuit_stimulus_definitions.py +0 -0
  92. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/stimulus/factory.py +0 -0
  93. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/stimulus/stimulus.py +0 -0
  94. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/synapse/__init__.py +0 -0
  95. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/synapse/synapse_factory.py +0 -0
  96. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/synapse/synapse_types.py +0 -0
  97. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/tools.py +0 -0
  98. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/type_aliases.py +0 -0
  99. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/utils.py +0 -0
  100. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/validation/validation.py +0 -0
  101. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab/verbosity.py +0 -0
  102. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab.egg-info/dependency_links.txt +0 -0
  103. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/bluecellulab.egg-info/top_level.txt +0 -0
  104. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/Makefile +0 -0
  105. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/images/voltage-readme.png +0 -0
  106. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/make.bat +0 -0
  107. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/requirements_docs.txt +0 -0
  108. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/source/_static/.gitkeep +0 -0
  109. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/source/api.rst +0 -0
  110. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/source/changelog.rst +0 -0
  111. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/source/compiling-mechanisms.rst +0 -0
  112. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/source/conf.py +0 -0
  113. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/source/contributing.rst +0 -0
  114. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/source/index.rst +0 -0
  115. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/source/list_of_stim.rst +0 -0
  116. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/docs/source/logo/BlueCelluLabBanner.jpg +0 -0
  117. {bluecellulab-2.6.66 → bluecellulab-2.6.68}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bluecellulab
3
- Version: 2.6.66
3
+ Version: 2.6.68
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -28,6 +28,8 @@ Requires-Dist: typing-extensions>=4.8.0
28
28
  Requires-Dist: networkx>=3.1
29
29
  Requires-Dist: h5py>=3.8.0
30
30
  Requires-Dist: seaborn
31
+ Provides-Extra: examples
32
+ Requires-Dist: ipywidgets; extra == "examples"
31
33
  Dynamic: license-file
32
34
 
33
35
  |banner|
@@ -47,6 +47,7 @@ from bluecellulab.stimulus.circuit_stimulus_definitions import SynapseReplay
47
47
  from bluecellulab.synapse import SynapseFactory, Synapse
48
48
  from bluecellulab.synapse.synapse_types import SynapseID
49
49
  from bluecellulab.type_aliases import HocObjectType, NeuronSection, SectionMapping
50
+ from bluecellulab.cell.section_tools import currents_vars, section_to_variable_recording_str
50
51
 
51
52
  logger = logging.getLogger(__name__)
52
53
 
@@ -250,6 +251,10 @@ class Cell(InjectableMixin, PlottableMixin):
250
251
  else:
251
252
  self._default_disable_ttx()
252
253
 
254
+ @property
255
+ def ttx_enabled(self):
256
+ return getattr(self, "_ttx_enabled", False)
257
+
253
258
  def _default_enable_ttx(self) -> None:
254
259
  """Default enable_ttx implementation."""
255
260
  for section in self.sections.values():
@@ -316,6 +321,7 @@ class Cell(InjectableMixin, PlottableMixin):
316
321
  """Adds recording to AIS."""
317
322
  self.add_recording("self.axonal[1](0.5)._ref_v", dt=dt)
318
323
 
324
+ @deprecated("Use add_variable_recording('v', ...) instead.")
319
325
  def add_voltage_recording(
320
326
  self, section: Optional[NeuronSection] = None, segx: float = 0.5, dt: Optional[float] = None
321
327
  ) -> None:
@@ -334,6 +340,7 @@ class Cell(InjectableMixin, PlottableMixin):
334
340
  var_name = section_to_voltage_recording_str(section, segx)
335
341
  self.add_recording(var_name, dt)
336
342
 
343
+ @deprecated("Use get_variable_recording('v', ...) instead.")
337
344
  def get_voltage_recording(
338
345
  self, section: Optional[NeuronSection] = None, segx: float = 0.5
339
346
  ) -> np.ndarray:
@@ -760,17 +767,66 @@ class Cell(InjectableMixin, PlottableMixin):
760
767
  """Get a vector of AIS voltage."""
761
768
  return self.get_recording('self.axonal[1](0.5)._ref_v')
762
769
 
763
- def add_variable_recording(self, variable: str, section, segx):
764
- if variable == "v":
765
- self.add_voltage_recording(section, segx)
766
- else:
767
- raise ValueError(f"Unsupported variable for recording: {variable}")
770
+ def add_variable_recording(
771
+ self,
772
+ variable: str,
773
+ section: Optional[NeuronSection] = None,
774
+ segx: float = 0.5,
775
+ dt: Optional[float] = None
776
+ ) -> None:
777
+ """Add a recording of any NEURON RANGE variable (e.g., gna, gk, ina)
778
+ from a given section and segment.
779
+
780
+ Args:
781
+ variable: The NEURON variable name to record (e.g., "gna").
782
+ section: The section to record from (defaults to soma).
783
+ segx: Segment position between 0 and 1.
784
+ dt: Optional recording time step.
785
+ """
768
786
 
769
- def get_variable_recording(self, variable: str, section, segx) -> np.ndarray:
770
- if variable == "v":
771
- return self.get_voltage_recording(section=section, segx=segx)
787
+ if section is None:
788
+ section = self.soma
789
+
790
+ # validate before constructing the string
791
+ seg = section(segx)
792
+ if "." in variable:
793
+ mech, var = variable.split(".", 1)
794
+ mobj = getattr(seg, mech, None)
795
+ if mobj is None or not hasattr(mobj, f"_ref_{var}"):
796
+ raise ValueError(
797
+ f"'{variable}' not recordable at {section.name()}({segx}). "
798
+ f"Mechanisms here: {list(section.psection()['density_mechs'].keys())}"
799
+ )
772
800
  else:
773
- raise ValueError(f"Unsupported variable '{variable}'")
801
+ if not hasattr(seg, f"_ref_{variable}"):
802
+ raise ValueError(
803
+ f"'{variable}' not recordable at {section.name()}({segx}). "
804
+ f"(Top-level vars are typically v/ina/ik/ica)"
805
+ )
806
+
807
+ var_name = section_to_variable_recording_str(section, segx, variable)
808
+ self.add_recording(var_name, dt)
809
+
810
+ def get_variable_recording(
811
+ self, variable: str, section: Optional[NeuronSection], segx: float
812
+ ) -> np.ndarray:
813
+ """Get a recording of any variable recorded from a section and segment.
814
+
815
+ Args:
816
+ variable: The name of the recorded variable (e.g., 'v', 'gna').
817
+ section: The NEURON section object.
818
+ segx: Segment location from 0 to 1.
819
+
820
+ Returns:
821
+ NumPy array of recorded values.
822
+
823
+ Raises:
824
+ ValueError: If the recording is not found.
825
+ """
826
+ if section is None:
827
+ section = self.soma
828
+ recording_name = section_to_variable_recording_str(section, segx, variable)
829
+ return self.get_recording(recording_name)
774
830
 
775
831
  @property
776
832
  def n_segments(self) -> int:
@@ -843,3 +899,42 @@ class Cell(InjectableMixin, PlottableMixin):
843
899
 
844
900
  def __del__(self):
845
901
  self.delete()
902
+
903
+ def add_currents_recordings(
904
+ self,
905
+ section,
906
+ segx: float = 0.5,
907
+ *,
908
+ include_nonspecific: bool = True,
909
+ include_point_processes: bool = False,
910
+ dt: float | None = None,
911
+ ) -> list[str]:
912
+ """Record all available currents (ionic + optionally nonspecific) at
913
+ (section, segx)."""
914
+
915
+ # discover what’s available at this site
916
+ available = currents_vars(section)
917
+ chosen: list[str] = []
918
+
919
+ for name, meta in available.items():
920
+ kind = meta.get("kind")
921
+
922
+ if kind == "ionic_current":
923
+ self.add_variable_recording(name, section=section, segx=segx, dt=dt)
924
+ chosen.append(name)
925
+
926
+ elif kind == "nonspecific_current":
927
+ if not include_nonspecific:
928
+ continue
929
+ # density-mech nonspecific currents
930
+ self.add_variable_recording(name, section=section, segx=segx, dt=dt)
931
+ chosen.append(name)
932
+
933
+ elif kind == "point_process_current":
934
+ if not include_point_processes:
935
+ continue
936
+ # point process nonspecific currents
937
+ self.add_variable_recording(name, section=section, segx=segx, dt=dt)
938
+ chosen.append(name)
939
+
940
+ return chosen
@@ -0,0 +1,96 @@
1
+ # Copyright 2025 Open Brain Institute
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """NEURON section helpers for BlueCelluLab."""
15
+
16
+
17
+ def currents_vars(section) -> dict:
18
+ """Return recordable currents (with units) at a given section.
19
+
20
+ - Ionic currents from the ions block (e.g. ``ina``, ``ik``, ``ica``), in mA/cm².
21
+ - Mechanism currents for variables ``i`` or ``ihcn``, reported as ``<var>_<mech>``
22
+ (e.g. ``i_pas``, ``ihcn_Ih``), in mA/cm².
23
+
24
+ Args:
25
+ section: NEURON Section object.
26
+
27
+ Returns:
28
+ dict mapping variable names to {"units": str, "kind": str}.
29
+ """
30
+ psec = section.psection()
31
+ out = {}
32
+
33
+ ions = psec.get("ions", {}) or {}
34
+ for ion, vars_dict in ions.items():
35
+ if ion == "ttx":
36
+ continue
37
+ name = f"i{ion}"
38
+ if name in vars_dict:
39
+ out[name] = {"units": "mA/cm²", "kind": "ionic_current"}
40
+
41
+ special_currents = {
42
+ ("pas", "i"): "i_pas",
43
+ ("Ih", "ihcn"): "ihcn_Ih",
44
+ ("hd", "i"): "i_hd",
45
+ }
46
+
47
+ for (mech, var), out_name in special_currents.items():
48
+ if var in (psec.get("density_mechs") or {}).get(mech, {}):
49
+ out[out_name] = {"units": "mA/cm²", "kind": "nonspecific_current"}
50
+
51
+ return dict(sorted(out.items()))
52
+
53
+
54
+ def mechs_vars(section, include_point_mechs: bool = False) -> dict:
55
+ """Return mechanism-scoped variables at a given section.
56
+
57
+ Args:
58
+ section: NEURON Section object.
59
+ include_point_mechs: Whether to include point processes.
60
+ """
61
+ psec = section.psection()
62
+ dens = psec.get("density_mechs", {}) or {}
63
+ points = psec.get("point_mechs", {}) or {}
64
+ mech_map = {
65
+ mech: sorted(vars_dict.keys())
66
+ for mech, vars_dict in dens.items() if vars_dict
67
+ }
68
+ entry = {"mech": mech_map}
69
+ if include_point_mechs:
70
+ point_map = {
71
+ pp: sorted(vars_dict.keys())
72
+ for pp, vars_dict in points.items() if vars_dict
73
+ }
74
+ entry["point"] = point_map
75
+ return entry
76
+
77
+
78
+ def section_to_variable_recording_str(section, segx: float, variable: str) -> str:
79
+ """Build an evaluable NEURON pointer string for `add_recording`.
80
+
81
+ Accepts:
82
+ - top-level vars: "v", "ina", "ik", ...
83
+ - mechanism-scoped vars: "kca.gkca", "na3.m", "na3.h", ...
84
+
85
+ Returns examples:
86
+ neuron.h.soma[0](0.5)._ref_v
87
+ neuron.h.soma[0](0.5)._ref_ina
88
+ neuron.h.soma[0](0.5).kca._ref_gkca
89
+ neuron.h.dend[3](0.7).na3._ref_m
90
+ """
91
+ sec_name = section.name()
92
+ if "." in variable:
93
+ mech, var = variable.split(".", 1)
94
+ return f"neuron.h.{sec_name}({segx}).{mech}._ref_{var}"
95
+ else:
96
+ return f"neuron.h.{sec_name}({segx})._ref_{variable}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bluecellulab
3
- Version: 2.6.66
3
+ Version: 2.6.68
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -28,6 +28,8 @@ Requires-Dist: typing-extensions>=4.8.0
28
28
  Requires-Dist: networkx>=3.1
29
29
  Requires-Dist: h5py>=3.8.0
30
30
  Requires-Dist: seaborn
31
+ Provides-Extra: examples
32
+ Requires-Dist: ipywidgets; extra == "examples"
31
33
  Dynamic: license-file
32
34
 
33
35
  |banner|
@@ -51,6 +51,7 @@ bluecellulab/cell/plotting.py
51
51
  bluecellulab/cell/random.py
52
52
  bluecellulab/cell/recording.py
53
53
  bluecellulab/cell/section_distance.py
54
+ bluecellulab/cell/section_tools.py
54
55
  bluecellulab/cell/serialized_sections.py
55
56
  bluecellulab/cell/sonata_proxy.py
56
57
  bluecellulab/cell/stimuli_generator.py
@@ -8,3 +8,6 @@ typing-extensions>=4.8.0
8
8
  networkx>=3.1
9
9
  h5py>=3.8.0
10
10
  seaborn
11
+
12
+ [examples]
13
+ ipywidgets
@@ -41,6 +41,11 @@ dependencies = [
41
41
  ]
42
42
  requires-python = ">=3.9"
43
43
 
44
+ [project.optional-dependencies]
45
+ examples = [
46
+ "ipywidgets",
47
+ ]
48
+
44
49
  [project.urls]
45
50
  Homepage = "https://github.com/openbraininstitute/BlueCelluLab"
46
51
  Documentation = "https://bluecellulab.readthedocs.io/"
@@ -50,6 +50,7 @@ commands =
50
50
 
51
51
  [testenv:examples]
52
52
  envdir={toxworkdir}/{envname}
53
+ extras = examples
53
54
  deps =
54
55
  pytest>=7.3.1,<9.0.0
55
56
  pytest-xdist>=3.3.1 # multiprocessing
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes