bluecellulab 2.6.50__tar.gz → 2.6.51__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 (108) hide show
  1. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/PKG-INFO +1 -1
  2. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/analysis/analysis.py +48 -34
  3. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/utils.py +26 -0
  4. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/validation/validation.py +72 -44
  5. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab.egg-info/PKG-INFO +1 -1
  6. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/.compile_mod.sh +0 -0
  7. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/.gitattributes +0 -0
  8. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/.github/dependabot.yml +0 -0
  9. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/.github/workflows/release.yml +0 -0
  10. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/.github/workflows/test.yml +0 -0
  11. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/.gitignore +0 -0
  12. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/.gitlab-ci.yml +0 -0
  13. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/.readthedocs.yml +0 -0
  14. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/.zenodo.json +0 -0
  15. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/AUTHORS.txt +0 -0
  16. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/CHANGELOG.rst +0 -0
  17. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/CITATION.cff +0 -0
  18. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/CONTRIBUTING.rst +0 -0
  19. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/LICENSE +0 -0
  20. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/MANIFEST.in +0 -0
  21. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/Makefile +0 -0
  22. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/README.rst +0 -0
  23. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/__init__.py +0 -0
  24. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/analysis/__init__.py +0 -0
  25. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/analysis/inject_sequence.py +0 -0
  26. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/analysis/plotting.py +0 -0
  27. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/analysis/utils.py +0 -0
  28. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/__init__.py +0 -0
  29. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/ballstick/__init__.py +0 -0
  30. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/ballstick/emodel.hoc +0 -0
  31. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/ballstick/morphology.asc +0 -0
  32. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/cell_dict.py +0 -0
  33. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/core.py +0 -0
  34. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/injector.py +0 -0
  35. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/plotting.py +0 -0
  36. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/random.py +0 -0
  37. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/recording.py +0 -0
  38. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/section_distance.py +0 -0
  39. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/serialized_sections.py +0 -0
  40. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/sonata_proxy.py +0 -0
  41. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/stimuli_generator.py +0 -0
  42. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/cell/template.py +0 -0
  43. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/__init__.py +0 -0
  44. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/circuit_access/__init__.py +0 -0
  45. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/circuit_access/bluepy_circuit_access.py +0 -0
  46. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/circuit_access/definition.py +0 -0
  47. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/circuit_access/sonata_circuit_access.py +0 -0
  48. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/config/__init__.py +0 -0
  49. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/config/bluepy_simulation_config.py +0 -0
  50. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/config/definition.py +0 -0
  51. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/config/sections.py +0 -0
  52. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/config/sonata_simulation_config.py +0 -0
  53. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/format.py +0 -0
  54. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/iotools.py +0 -0
  55. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/node_id.py +0 -0
  56. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/simulation_access.py +0 -0
  57. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/synapse_properties.py +0 -0
  58. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit/validate.py +0 -0
  59. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/circuit_simulation.py +0 -0
  60. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/connection.py +0 -0
  61. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/dendrogram.py +0 -0
  62. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/exceptions.py +0 -0
  63. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/graph.py +0 -0
  64. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/hoc/Cell.hoc +0 -0
  65. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/hoc/RNGSettings.hoc +0 -0
  66. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/hoc/TDistFunc.hoc +0 -0
  67. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/hoc/TStim.hoc +0 -0
  68. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/hoc/fileUtils.hoc +0 -0
  69. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/importer.py +0 -0
  70. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/neuron_interpreter.py +0 -0
  71. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/plotwindow.py +0 -0
  72. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/psection.py +0 -0
  73. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/psegment.py +0 -0
  74. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/rngsettings.py +0 -0
  75. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/simulation/__init__.py +0 -0
  76. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/simulation/neuron_globals.py +0 -0
  77. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/simulation/parallel.py +0 -0
  78. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/simulation/simulation.py +0 -0
  79. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/stimulus/__init__.py +0 -0
  80. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/stimulus/circuit_stimulus_definitions.py +0 -0
  81. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/stimulus/factory.py +0 -0
  82. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/stimulus/stimulus.py +0 -0
  83. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/synapse/__init__.py +0 -0
  84. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/synapse/synapse_factory.py +0 -0
  85. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/synapse/synapse_types.py +0 -0
  86. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/tools.py +0 -0
  87. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/type_aliases.py +0 -0
  88. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab/verbosity.py +0 -0
  89. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab.egg-info/SOURCES.txt +0 -0
  90. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab.egg-info/dependency_links.txt +0 -0
  91. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab.egg-info/requires.txt +0 -0
  92. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/bluecellulab.egg-info/top_level.txt +0 -0
  93. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/Makefile +0 -0
  94. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/images/voltage-readme.png +0 -0
  95. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/make.bat +0 -0
  96. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/requirements_docs.txt +0 -0
  97. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/source/_static/.gitkeep +0 -0
  98. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/source/api.rst +0 -0
  99. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/source/changelog.rst +0 -0
  100. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/source/compiling-mechanisms.rst +0 -0
  101. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/source/conf.py +0 -0
  102. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/source/contributing.rst +0 -0
  103. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/source/index.rst +0 -0
  104. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/source/list_of_stim.rst +0 -0
  105. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/docs/source/logo/BlueCelluLabBanner.jpg +0 -0
  106. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/pyproject.toml +0 -0
  107. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/setup.cfg +0 -0
  108. {bluecellulab-2.6.50 → bluecellulab-2.6.51}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bluecellulab
3
- Version: 2.6.50
3
+ Version: 2.6.51
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -4,14 +4,17 @@ try:
4
4
  except ImportError:
5
5
  efel = None
6
6
  from itertools import islice
7
+ from itertools import repeat
7
8
  import logging
8
9
  from matplotlib.collections import LineCollection
9
10
  import matplotlib.pyplot as plt
11
+ from multiprocessing import Pool
10
12
  import neuron
11
13
  import numpy as np
12
14
  import pathlib
13
15
  import seaborn as sns
14
16
 
17
+
15
18
  from bluecellulab import Cell
16
19
  from bluecellulab.analysis.inject_sequence import run_stimulus
17
20
  from bluecellulab.analysis.plotting import plot_iv_curve, plot_fi_curve
@@ -87,30 +90,35 @@ def compute_plot_iv_curve(cell,
87
90
 
88
91
  list_amp = np.linspace(rheobase - 2, rheobase - 0.1, nb_bins) # [nA]
89
92
 
90
- steps = []
91
- times = []
92
- voltages = []
93
93
  # inject step current and record voltage response
94
94
  stim_factory = StimulusFactory(dt=0.1)
95
- for amp in list_amp:
96
- step_stimulus = stim_factory.step(pre_delay=stim_start, duration=duration, post_delay=post_delay, amplitude=amp)
97
- recording = run_stimulus(cell.template_params,
98
- step_stimulus,
99
- section=injecting_section,
100
- segment=injecting_segment,
101
- recording_section=recording_section,
102
- recording_segment=recording_segment)
103
- steps.append(step_stimulus)
104
- times.append(recording.time)
105
- voltages.append(recording.voltage)
95
+ steps = [
96
+ stim_factory.step(pre_delay=stim_start, duration=duration, post_delay=post_delay, amplitude=amp)
97
+ for amp in list_amp
98
+ ]
99
+
100
+ with Pool(len(steps)) as p:
101
+ recordings = p.starmap(
102
+ run_stimulus,
103
+ zip(
104
+ repeat(cell.template_params),
105
+ steps,
106
+ repeat(injecting_section),
107
+ repeat(injecting_segment),
108
+ repeat(True), # cvode
109
+ repeat(True), # add_hypamp
110
+ repeat(recording_section),
111
+ repeat(recording_segment),
112
+ )
113
+ )
106
114
 
107
115
  steady_states = []
108
116
  # compute steady state response
109
117
  efel.set_setting('Threshold', threshold_voltage)
110
- for voltage, t in zip(voltages, times):
118
+ for recording in recordings:
111
119
  trace = {
112
- 'T': t,
113
- 'V': voltage,
120
+ 'T': recording.time,
121
+ 'V': recording.voltage,
114
122
  'stim_start': [stim_start],
115
123
  'stim_end': [stim_start + duration]
116
124
  }
@@ -194,24 +202,30 @@ def compute_plot_fi_curve(cell,
194
202
  rheobase = calculate_rheobase(cell=cell, section=injecting_section, segx=injecting_segment)
195
203
 
196
204
  list_amp = np.linspace(rheobase, max_current, nb_bins) # [nA]
197
- steps = []
198
- spikes = []
199
- # inject step current and record spike response
200
205
  stim_factory = StimulusFactory(dt=0.1)
201
- for amp in list_amp:
202
- step_stimulus = stim_factory.step(pre_delay=stim_start, duration=duration, post_delay=post_delay, amplitude=amp)
203
- recording = run_stimulus(cell.template_params,
204
- step_stimulus,
205
- section=injecting_section,
206
- segment=injecting_segment,
207
- recording_section=recording_section,
208
- recording_segment=recording_segment,
209
- enable_spike_detection=True,
210
- threshold_spike_detection=threshold_voltage)
211
- steps.append(step_stimulus)
212
- spikes.append(recording.spike)
213
-
214
- spike_count = [len(spike) for spike in spikes]
206
+ steps = [
207
+ stim_factory.step(pre_delay=stim_start, duration=duration, post_delay=post_delay, amplitude=amp)
208
+ for amp in list_amp
209
+ ]
210
+
211
+ with Pool(len(steps)) as p:
212
+ recordings = p.starmap(
213
+ run_stimulus,
214
+ zip(
215
+ repeat(cell.template_params),
216
+ steps,
217
+ repeat(injecting_section),
218
+ repeat(injecting_segment),
219
+ repeat(True), # cvode
220
+ repeat(True), # add_hypamp
221
+ repeat(recording_section),
222
+ repeat(recording_segment),
223
+ repeat(True), # enable_spike_detection
224
+ repeat(threshold_voltage), # threshold_spike_detection
225
+ )
226
+ )
227
+
228
+ spike_count = [len(recording.spike) for recording in recordings]
215
229
 
216
230
  plot_fi_curve(list_amp,
217
231
  spike_count,
@@ -4,6 +4,8 @@ from __future__ import annotations
4
4
  import contextlib
5
5
  import io
6
6
  import json
7
+ import multiprocessing
8
+ from multiprocessing import pool
7
9
 
8
10
  import numpy as np
9
11
 
@@ -56,3 +58,27 @@ class NumpyEncoder(json.JSONEncoder):
56
58
  elif isinstance(obj, np.ndarray):
57
59
  return obj.tolist()
58
60
  return json.JSONEncoder.default(self, obj)
61
+
62
+
63
+ class NoDaemonProcess(multiprocessing.Process):
64
+ """Class that represents a non-daemon process."""
65
+
66
+ # pylint: disable=dangerous-default-value
67
+
68
+ def __init__(self, group=None, target=None, name=None, args=(), kwargs={}):
69
+ """Ensures group=None, for macosx."""
70
+ super().__init__(group=None, target=target, name=name, args=args, kwargs=kwargs)
71
+
72
+ @property
73
+ def daemon(self):
74
+ return False
75
+
76
+ @daemon.setter
77
+ def daemon(self, val):
78
+ pass
79
+
80
+
81
+ class NestedPool(pool.Pool): # pylint: disable=abstract-method
82
+ """Class that represents a MultiProcessing nested pool."""
83
+
84
+ Process = NoDaemonProcess
@@ -24,6 +24,7 @@ from bluecellulab.analysis.analysis import compute_plot_fi_curve
24
24
  from bluecellulab.analysis.analysis import compute_plot_iv_curve
25
25
  from bluecellulab.analysis.inject_sequence import run_multirecordings_stimulus
26
26
  from bluecellulab.analysis.inject_sequence import run_stimulus
27
+ from bluecellulab.cell.core import Cell
27
28
  from bluecellulab.stimulus.factory import IDRestTimings
28
29
  from bluecellulab.stimulus.factory import StimulusFactory
29
30
  from bluecellulab.tools import calculate_input_resistance
@@ -79,12 +80,12 @@ def plot_traces(recordings, out_dir, fname, title, labels=None, xlim=None):
79
80
  return outpath
80
81
 
81
82
 
82
- def spiking_test(cell, rheobase, out_dir, spike_threshold_voltage=-30.):
83
+ def spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30.):
83
84
  """Spiking test: cell should spike."""
84
85
  stim_factory = StimulusFactory(dt=1.0)
85
86
  step_stimulus = stim_factory.idrest(threshold_current=rheobase, threshold_percentage=200)
86
87
  recording = run_stimulus(
87
- cell.template_params,
88
+ template_params,
88
89
  step_stimulus,
89
90
  "soma[0]",
90
91
  0.5,
@@ -111,13 +112,13 @@ def spiking_test(cell, rheobase, out_dir, spike_threshold_voltage=-30.):
111
112
  }
112
113
 
113
114
 
114
- def depolarization_block_test(cell, rheobase, out_dir):
115
+ def depolarization_block_test(template_params, rheobase, out_dir):
115
116
  """Depolarization block test: no depolarization block should be detected."""
116
117
  # Run the stimulus
117
118
  stim_factory = StimulusFactory(dt=1.0)
118
119
  step_stimulus = stim_factory.idrest(threshold_current=rheobase, threshold_percentage=200)
119
120
  recording = run_stimulus(
120
- cell.template_params,
121
+ template_params,
121
122
  step_stimulus,
122
123
  "soma[0]",
123
124
  0.5,
@@ -151,16 +152,16 @@ def depolarization_block_test(cell, rheobase, out_dir):
151
152
  }
152
153
 
153
154
 
154
- def bpap_test(cell, rheobase, out_dir="./"):
155
+ def bpap_test(template_params, rheobase, out_dir="./"):
155
156
  """Back-propagating action potential test: exponential fit should decay.
156
157
 
157
158
  Args:
158
- cell (Cell): The cell to test.
159
+ template_params (dict): The template parameters for creating the cell.
159
160
  rheobase (float): The rheobase current to use for the test.
160
161
  out_dir (str): Directory to save the figure.
161
162
  """
162
163
  amplitude = 10. * rheobase # Use 1000% of the rheobase current
163
- bpap = BPAP(cell)
164
+ bpap = BPAP(Cell.from_template_parameters(template_params))
164
165
  bpap.run(duration=1500, amplitude=amplitude)
165
166
  soma_amp, dend_amps, dend_dist, apic_amps, apic_dist = bpap.get_amplitudes_and_distances()
166
167
  validated, notes = bpap.validate(soma_amp, dend_amps, dend_dist, apic_amps, apic_dist)
@@ -190,11 +191,11 @@ def bpap_test(cell, rheobase, out_dir="./"):
190
191
  }
191
192
 
192
193
 
193
- def ais_spiking_test(cell, rheobase, out_dir, spike_threshold_voltage=-30.):
194
+ def ais_spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30.):
194
195
  """AIS spiking test: axon should spike before soma."""
195
196
  name = "Simulatable Neuron AIS Spiking Validation"
196
197
  # Check that the cell has an axon
197
- if len(cell.axonal) == 0:
198
+ if len(Cell.from_template_parameters(template_params).axonal) == 0:
198
199
  return {
199
200
  "name": name,
200
201
  "passed": True,
@@ -206,7 +207,7 @@ def ais_spiking_test(cell, rheobase, out_dir, spike_threshold_voltage=-30.):
206
207
  stim_factory = StimulusFactory(dt=1.0)
207
208
  step_stimulus = stim_factory.idrest(threshold_current=rheobase, threshold_percentage=200)
208
209
  recordings = run_multirecordings_stimulus(
209
- cell.template_params,
210
+ template_params,
210
211
  step_stimulus,
211
212
  "soma[0]",
212
213
  0.5,
@@ -259,14 +260,14 @@ def ais_spiking_test(cell, rheobase, out_dir, spike_threshold_voltage=-30.):
259
260
  }
260
261
 
261
262
 
262
- def hyperpolarization_test(cell, rheobase, out_dir):
263
+ def hyperpolarization_test(template_params, rheobase, out_dir):
263
264
  """Hyperpolarization test: hyperpolarized voltage should be lower than RMP."""
264
265
  name = "Simulatable Neuron Hyperpolarization Validation"
265
266
  # Run the stimulus
266
267
  stim_factory = StimulusFactory(dt=1.0)
267
268
  step_stimulus = stim_factory.iv(threshold_current=rheobase, threshold_percentage=-40)
268
269
  recording = run_stimulus(
269
- cell.template_params,
270
+ template_params,
270
271
  step_stimulus,
271
272
  "soma[0]",
272
273
  0.5,
@@ -331,11 +332,11 @@ def rin_test(rin):
331
332
  }
332
333
 
333
334
 
334
- def iv_test(cell, rheobase, out_dir, spike_threshold_voltage=-30.):
335
+ def iv_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30.):
335
336
  """IV curve should have a positive slope."""
336
337
  name = "Simulatable Neuron IV Curve Validation"
337
338
  amps, steady_states = compute_plot_iv_curve(
338
- cell,
339
+ Cell.from_template_parameters(template_params),
339
340
  rheobase=rheobase,
340
341
  threshold_voltage=spike_threshold_voltage,
341
342
  nb_bins=5,
@@ -369,11 +370,11 @@ def iv_test(cell, rheobase, out_dir, spike_threshold_voltage=-30.):
369
370
  }
370
371
 
371
372
 
372
- def fi_test(cell, rheobase, out_dir, spike_threshold_voltage=-30.):
373
+ def fi_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30.):
373
374
  """FI curve should have a positive slope."""
374
375
  name = "Simulatable Neuron FI Curve Validation"
375
376
  amps, spike_counts = compute_plot_fi_curve(
376
- cell,
377
+ Cell.from_template_parameters(template_params),
377
378
  rheobase=rheobase,
378
379
  threshold_voltage=spike_threshold_voltage,
379
380
  nb_bins=5,
@@ -421,7 +422,6 @@ def run_validations(
421
422
  out_dir = pathlib.Path(output_dir) / cell_name
422
423
  out_dir.mkdir(parents=True, exist_ok=True)
423
424
 
424
- # cell = Cell.from_template_parameters(template_params)
425
425
  # get me-model properties
426
426
  holding_current = cell.hypamp if cell.hypamp else 0.0
427
427
  if cell.threshold:
@@ -437,41 +437,69 @@ def run_validations(
437
437
  emodel_properties=cell.template_params.emodel_properties,
438
438
  )
439
439
 
440
- # Validation 1: Spiking Test
441
- logger.debug("Running spiking test")
442
- spiking_test_result = spiking_test(cell, rheobase, out_dir, spike_threshold_voltage)
440
+ logger.debug("Running validations...")
441
+ from bluecellulab.utils import NestedPool
442
+ with NestedPool(processes=8) as pool:
443
+ # Validation 1: Spiking Test
444
+ spiking_test_result_future = pool.apply_async(
445
+ spiking_test,
446
+ (cell.template_params, rheobase, out_dir, spike_threshold_voltage)
447
+ )
443
448
 
444
- # Validation 2: Depolarization Block Test
445
- logger.debug("Running depolarization block test")
446
- depolarization_block_result = depolarization_block_test(cell, rheobase, out_dir)
449
+ # Validation 2: Depolarization Block Test
450
+ depolarization_block_result_future = pool.apply_async(
451
+ depolarization_block_test,
452
+ (cell.template_params, rheobase, out_dir)
453
+ )
447
454
 
448
- # Validation 3: Backpropagating AP Test
449
- logger.debug("Running backpropagating AP test")
450
- bpap_result = bpap_test(cell, rheobase, out_dir)
455
+ # Validation 3: Backpropagating AP Test
456
+ bpap_result_future = pool.apply_async(
457
+ bpap_test,
458
+ (cell.template_params, rheobase, out_dir)
459
+ )
451
460
 
452
- # Validation 4: Postsynaptic Potential Test
453
- # logger.debug("Running postsynaptic potential test")
454
- # We have to wait for ProbAMPANMDA_EMS to be present in entitycore to implement this test
461
+ # Validation 4: Postsynaptic Potential Test
462
+ # We have to wait for ProbAMPANMDA_EMS to be present in entitycore to implement this test
455
463
 
456
- # Validation 5: AIS Spiking Test
457
- logger.debug("Running AIS spiking test")
458
- ais_spiking_test_result = ais_spiking_test(cell, rheobase, out_dir, spike_threshold_voltage)
464
+ # Validation 5: AIS Spiking Test
465
+ ais_spiking_test_result_future = pool.apply_async(
466
+ ais_spiking_test,
467
+ (cell.template_params, rheobase, out_dir, spike_threshold_voltage)
468
+ )
459
469
 
460
- # Validation 6: Hyperpolarization Test
461
- logger.debug("Running hyperpolarization test")
462
- hyperpolarization_result = hyperpolarization_test(cell, rheobase, out_dir)
470
+ # Validation 6: Hyperpolarization Test
471
+ hyperpolarization_result_future = pool.apply_async(
472
+ hyperpolarization_test,
473
+ (cell.template_params, rheobase, out_dir)
474
+ )
463
475
 
464
- # Validation 7: Rin Test
465
- logger.debug("Running Rin test")
466
- rin_result = rin_test(rin)
476
+ # Validation 7: Rin Test
477
+ rin_result_future = pool.apply_async(
478
+ rin_test,
479
+ (rin,)
480
+ )
481
+
482
+ # # Validation 8: IV Test
483
+ iv_test_result_future = pool.apply_async(
484
+ iv_test,
485
+ (cell.template_params, rheobase, out_dir, spike_threshold_voltage)
486
+ )
467
487
 
468
- # # Validation 8: IV Test
469
- logger.debug("Running IV test")
470
- iv_test_result = iv_test(cell, rheobase, out_dir, spike_threshold_voltage)
488
+ # # Validation 9: FI Test
489
+ fi_test_result_future = pool.apply_async(
490
+ fi_test,
491
+ (cell.template_params, rheobase, out_dir, spike_threshold_voltage)
492
+ )
471
493
 
472
- # # Validation 9: FI Test
473
- logger.debug("Running FI test")
474
- fi_test_result = fi_test(cell, rheobase, out_dir, spike_threshold_voltage)
494
+ # Wait for all validations to complete
495
+ spiking_test_result = spiking_test_result_future.get()
496
+ depolarization_block_result = depolarization_block_result_future.get()
497
+ bpap_result = bpap_result_future.get()
498
+ ais_spiking_test_result = ais_spiking_test_result_future.get()
499
+ hyperpolarization_result = hyperpolarization_result_future.get()
500
+ rin_result = rin_result_future.get()
501
+ iv_test_result = iv_test_result_future.get()
502
+ fi_test_result = fi_test_result_future.get()
475
503
 
476
504
  return {
477
505
  "memodel_properties": {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bluecellulab
3
- Version: 2.6.50
3
+ Version: 2.6.51
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes