bluecellulab 2.6.62__tar.gz → 2.6.64__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 (116) hide show
  1. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/PKG-INFO +1 -1
  2. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/analysis/analysis.py +67 -39
  3. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/validation/validation.py +65 -30
  4. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab.egg-info/PKG-INFO +1 -1
  5. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/.compile_mod.sh +0 -0
  6. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/.gitattributes +0 -0
  7. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/.github/dependabot.yml +0 -0
  8. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/.github/workflows/release.yml +0 -0
  9. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/.github/workflows/test.yml +0 -0
  10. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/.gitignore +0 -0
  11. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/.gitlab-ci.yml +0 -0
  12. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/.readthedocs.yml +0 -0
  13. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/.zenodo.json +0 -0
  14. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/AUTHORS.txt +0 -0
  15. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/CHANGELOG.rst +0 -0
  16. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/CITATION.cff +0 -0
  17. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/CONTRIBUTING.rst +0 -0
  18. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/LICENSE +0 -0
  19. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/MANIFEST.in +0 -0
  20. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/Makefile +0 -0
  21. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/README.rst +0 -0
  22. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/__init__.py +0 -0
  23. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/analysis/__init__.py +0 -0
  24. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/analysis/inject_sequence.py +0 -0
  25. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/analysis/plotting.py +0 -0
  26. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/analysis/utils.py +0 -0
  27. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/__init__.py +0 -0
  28. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/ballstick/__init__.py +0 -0
  29. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/ballstick/emodel.hoc +0 -0
  30. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/ballstick/morphology.asc +0 -0
  31. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/cell_dict.py +0 -0
  32. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/core.py +0 -0
  33. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/injector.py +0 -0
  34. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/plotting.py +0 -0
  35. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/random.py +0 -0
  36. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/recording.py +0 -0
  37. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/section_distance.py +0 -0
  38. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/serialized_sections.py +0 -0
  39. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/sonata_proxy.py +0 -0
  40. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/stimuli_generator.py +0 -0
  41. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/cell/template.py +0 -0
  42. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/__init__.py +0 -0
  43. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/circuit_access/__init__.py +0 -0
  44. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/circuit_access/bluepy_circuit_access.py +0 -0
  45. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/circuit_access/definition.py +0 -0
  46. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/circuit_access/sonata_circuit_access.py +0 -0
  47. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/config/__init__.py +0 -0
  48. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/config/bluepy_simulation_config.py +0 -0
  49. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/config/definition.py +0 -0
  50. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/config/sections.py +0 -0
  51. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/config/sonata_simulation_config.py +0 -0
  52. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/format.py +0 -0
  53. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/iotools.py +0 -0
  54. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/node_id.py +0 -0
  55. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/simulation_access.py +0 -0
  56. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/synapse_properties.py +0 -0
  57. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit/validate.py +0 -0
  58. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/circuit_simulation.py +0 -0
  59. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/connection.py +0 -0
  60. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/dendrogram.py +0 -0
  61. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/exceptions.py +0 -0
  62. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/graph.py +0 -0
  63. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/hoc/Cell.hoc +0 -0
  64. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/hoc/RNGSettings.hoc +0 -0
  65. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/hoc/TDistFunc.hoc +0 -0
  66. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/hoc/TStim.hoc +0 -0
  67. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/hoc/fileUtils.hoc +0 -0
  68. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/importer.py +0 -0
  69. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/neuron_interpreter.py +0 -0
  70. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/plotwindow.py +0 -0
  71. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/psection.py +0 -0
  72. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/psegment.py +0 -0
  73. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/reports/__init__.py +0 -0
  74. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/reports/manager.py +0 -0
  75. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/reports/utils.py +0 -0
  76. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/reports/writers/__init__.py +0 -0
  77. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/reports/writers/base_writer.py +0 -0
  78. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/reports/writers/compartment.py +0 -0
  79. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/reports/writers/spikes.py +0 -0
  80. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/rngsettings.py +0 -0
  81. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/simulation/__init__.py +0 -0
  82. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/simulation/neuron_globals.py +0 -0
  83. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/simulation/parallel.py +0 -0
  84. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/simulation/report.py +0 -0
  85. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/simulation/simulation.py +0 -0
  86. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/stimulus/__init__.py +0 -0
  87. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/stimulus/circuit_stimulus_definitions.py +0 -0
  88. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/stimulus/factory.py +0 -0
  89. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/stimulus/stimulus.py +0 -0
  90. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/synapse/__init__.py +0 -0
  91. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/synapse/synapse_factory.py +0 -0
  92. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/synapse/synapse_types.py +0 -0
  93. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/tools.py +0 -0
  94. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/type_aliases.py +0 -0
  95. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/utils.py +0 -0
  96. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab/verbosity.py +0 -0
  97. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab.egg-info/SOURCES.txt +0 -0
  98. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab.egg-info/dependency_links.txt +0 -0
  99. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab.egg-info/requires.txt +0 -0
  100. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/bluecellulab.egg-info/top_level.txt +0 -0
  101. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/Makefile +0 -0
  102. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/images/voltage-readme.png +0 -0
  103. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/make.bat +0 -0
  104. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/requirements_docs.txt +0 -0
  105. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/source/_static/.gitkeep +0 -0
  106. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/source/api.rst +0 -0
  107. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/source/changelog.rst +0 -0
  108. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/source/compiling-mechanisms.rst +0 -0
  109. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/source/conf.py +0 -0
  110. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/source/contributing.rst +0 -0
  111. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/source/index.rst +0 -0
  112. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/source/list_of_stim.rst +0 -0
  113. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/docs/source/logo/BlueCelluLabBanner.jpg +0 -0
  114. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/pyproject.toml +0 -0
  115. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/setup.cfg +0 -0
  116. {bluecellulab-2.6.62 → bluecellulab-2.6.64}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bluecellulab
3
- Version: 2.6.62
3
+ Version: 2.6.64
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -4,9 +4,11 @@ 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
@@ -40,7 +42,8 @@ def compute_plot_iv_curve(cell,
40
42
  show_figure=True,
41
43
  save_figure=False,
42
44
  output_dir="./",
43
- output_fname="iv_curve.pdf"):
45
+ output_fname="iv_curve.pdf",
46
+ n_processes=None):
44
47
  """Compute and plot the Current-Voltage (I-V) curve for a given cell by
45
48
  injecting a range of currents.
46
49
 
@@ -72,6 +75,9 @@ def compute_plot_iv_curve(cell,
72
75
  save_figure (bool): Whether to save the figure. Default is False.
73
76
  output_dir (str): The directory to save the figure if save_figure is True. Default is "./".
74
77
  output_fname (str): The filename to save the figure as if save_figure is True. Default is "iv_curve.png".
78
+ n_processes (int, optional): The number of processes to use for parallel execution.
79
+ If None or if it is higher than the number of steps,
80
+ it will use the number of steps as the number of processes.
75
81
 
76
82
  Returns:
77
83
  tuple: A tuple containing:
@@ -95,15 +101,22 @@ def compute_plot_iv_curve(cell,
95
101
  for amp in list_amp
96
102
  ]
97
103
 
98
- recordings = []
99
- for step in steps:
100
- recording = run_stimulus(cell.template_params,
101
- step,
102
- section=injecting_section,
103
- segment=injecting_segment,
104
- recording_section=recording_section,
105
- recording_segment=recording_segment)
106
- recordings.append(recording)
104
+ if n_processes is None or n_processes > len(steps):
105
+ n_processes = len(steps)
106
+ with Pool(n_processes) as p:
107
+ recordings = p.starmap(
108
+ run_stimulus,
109
+ zip(
110
+ repeat(cell.template_params),
111
+ steps,
112
+ repeat(injecting_section),
113
+ repeat(injecting_segment),
114
+ repeat(True), # cvode
115
+ repeat(True), # add_hypamp
116
+ repeat(recording_section),
117
+ repeat(recording_segment),
118
+ )
119
+ )
107
120
 
108
121
  steady_states = []
109
122
  # compute steady state response
@@ -148,7 +161,8 @@ def compute_plot_fi_curve(cell,
148
161
  show_figure=True,
149
162
  save_figure=False,
150
163
  output_dir="./",
151
- output_fname="fi_curve.pdf"):
164
+ output_fname="fi_curve.pdf",
165
+ n_processes=None):
152
166
  """Compute and plot the Frequency-Current (F-I) curve for a given cell by
153
167
  injecting a range of currents.
154
168
 
@@ -182,6 +196,9 @@ def compute_plot_fi_curve(cell,
182
196
  save_figure (bool): Whether to save the figure. Default is False.
183
197
  output_dir (str): The directory to save the figure if save_figure is True. Default is "./".
184
198
  output_fname (str): The filename to save the figure as if save_figure is True. Default is "iv_curve.png".
199
+ n_processes (int, optional): The number of processes to use for parallel execution.
200
+ If None or if it is higher than the number of steps,
201
+ it will use the number of steps as the number of processes.
185
202
 
186
203
  Returns:
187
204
  tuple: A tuple containing:
@@ -201,19 +218,26 @@ def compute_plot_fi_curve(cell,
201
218
  for amp in list_amp
202
219
  ]
203
220
 
204
- spikes = []
205
- for step in steps:
206
- recording = run_stimulus(cell.template_params,
207
- step,
208
- section=injecting_section,
209
- segment=injecting_segment,
210
- recording_section=recording_section,
211
- recording_segment=recording_segment,
212
- enable_spike_detection=True,
213
- threshold_spike_detection=threshold_voltage)
214
- spikes.append(recording.spike)
221
+ if n_processes is None or n_processes > len(steps):
222
+ n_processes = len(steps)
223
+ with Pool(n_processes) as p:
224
+ recordings = p.starmap(
225
+ run_stimulus,
226
+ zip(
227
+ repeat(cell.template_params),
228
+ steps,
229
+ repeat(injecting_section),
230
+ repeat(injecting_segment),
231
+ repeat(True), # cvode
232
+ repeat(True), # add_hypamp
233
+ repeat(recording_section),
234
+ repeat(recording_segment),
235
+ repeat(True), # enable_spike_detection
236
+ repeat(threshold_voltage), # threshold_spike_detection
237
+ )
238
+ )
215
239
 
216
- spike_count = [len(spike) for spike in spikes]
240
+ spike_count = [len(recording.spike) for recording in recordings]
217
241
 
218
242
  plot_fi_curve(list_amp,
219
243
  spike_count,
@@ -327,29 +351,32 @@ class BPAP:
327
351
  return soma_amp, dend_amps, dend_dist, apic_amps, apic_dist
328
352
 
329
353
  @staticmethod
330
- def fit(soma_amp, dend_amps, dend_dist, apic_amps, apic_dist):
354
+ def fit(soma_amp, branch_amps, branch_dist):
331
355
  """Fit the amplitudes vs distances to an exponential decay function."""
332
356
  from scipy.optimize import curve_fit
333
357
 
334
- popt_dend = None
335
- if dend_amps and dend_dist:
336
- dist = [0] + dend_dist # add soma distance
337
- amps = soma_amp + dend_amps # add soma amplitude
338
- popt_dend, _ = curve_fit(exp_decay, dist, amps)
339
-
340
- popt_apic = None
341
- if apic_amps and apic_dist:
342
- dist = [0] + apic_dist # add soma distance
343
- amps = soma_amp + apic_amps # add soma amplitude
344
- popt_apic, _ = curve_fit(exp_decay, dist, amps)
345
-
346
- return popt_dend, popt_apic
358
+ if not branch_amps or not branch_dist or len(branch_amps) != len(branch_dist):
359
+ return None, False
360
+ try:
361
+ dist = [0] + branch_dist
362
+ amps = soma_amp + branch_amps
363
+ popt, _ = curve_fit(exp_decay, dist, amps)
364
+ return popt, False
365
+ except RuntimeError:
366
+ return None, True
347
367
 
348
368
  def validate(self, soma_amp, dend_amps, dend_dist, apic_amps, apic_dist):
349
369
  """Check that the exponential fit is decaying."""
350
370
  validated = True
351
371
  notes = ""
352
- popt_dend, popt_apic = self.fit(soma_amp, dend_amps, dend_dist, apic_amps, apic_dist)
372
+ popt_dend, dend_fit_error = self.fit(soma_amp, dend_amps, dend_dist)
373
+ popt_apic, apic_fit_error = self.fit(soma_amp, apic_amps, apic_dist)
374
+ if dend_fit_error or apic_fit_error:
375
+ logger.debug("Fitting error occurred.")
376
+ validated = False
377
+ notes += "Validation failed: Fitting error occurred.\n"
378
+ return validated, notes
379
+
353
380
  if dend_amps is not None:
354
381
  plt.cla()
355
382
  plt.plot([0], soma_amp, '.')
@@ -391,7 +418,8 @@ class BPAP:
391
418
  output_fname="bpap.pdf",
392
419
  ):
393
420
  """Plot the results of the BPAP analysis."""
394
- popt_dend, popt_apic = self.fit(soma_amp, dend_amps, dend_dist, apic_amps, apic_dist)
421
+ popt_dend, _ = self.fit(soma_amp, dend_amps, dend_dist)
422
+ popt_apic, _ = self.fit(soma_amp, apic_amps, apic_dist)
395
423
 
396
424
  outpath = pathlib.Path(output_dir) / output_fname
397
425
  fig, ax1 = plt.subplots(figsize=(10, 6))
@@ -337,7 +337,7 @@ def rin_test(rin):
337
337
  }
338
338
 
339
339
 
340
- def iv_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30.):
340
+ def iv_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30., n_processes=None):
341
341
  """IV curve should have a positive slope."""
342
342
  name = "Simulatable Neuron IV Curve Validation"
343
343
  amps, steady_states = compute_plot_iv_curve(
@@ -348,7 +348,9 @@ def iv_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30.):
348
348
  show_figure=False,
349
349
  save_figure=True,
350
350
  output_dir=out_dir,
351
- output_fname="iv_curve.pdf")
351
+ output_fname="iv_curve.pdf",
352
+ n_processes=n_processes,
353
+ )
352
354
 
353
355
  outpath = pathlib.Path(out_dir) / "iv_curve.pdf"
354
356
 
@@ -375,7 +377,7 @@ def iv_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30.):
375
377
  }
376
378
 
377
379
 
378
- def fi_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30.):
380
+ def fi_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30., n_processes=None):
379
381
  """FI curve should have a positive slope."""
380
382
  name = "Simulatable Neuron FI Curve Validation"
381
383
  amps, spike_counts = compute_plot_fi_curve(
@@ -386,7 +388,9 @@ def fi_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30.):
386
388
  show_figure=False,
387
389
  save_figure=True,
388
390
  output_dir=out_dir,
389
- output_fname="fi_curve.pdf")
391
+ output_fname="fi_curve.pdf",
392
+ n_processes=n_processes,
393
+ )
390
394
 
391
395
  outpath = pathlib.Path(out_dir) / "fi_curve.pdf"
392
396
 
@@ -448,7 +452,8 @@ def run_validations(
448
452
  spike_threshold_voltage=-30,
449
453
  v_init=-80.0,
450
454
  celsius=34.0,
451
- output_dir="./memodel_validation_figures"
455
+ output_dir="./memodel_validation_figures",
456
+ n_processes=None,
452
457
  ):
453
458
  """Run all the validations on the cell.
454
459
 
@@ -459,6 +464,9 @@ def run_validations(
459
464
  v_init: Initial membrane potential. Default is -80.0 mV.
460
465
  celsius: Temperature in Celsius. Default is 34.0.
461
466
  output_dir (str): The directory to save the validation figures.
467
+ n_processes (int, optional): The number of processes to use for parallel execution
468
+ in IV and FI curves computation. If None or higher than the number of steps,
469
+ then it will use the number of steps as the number of processes instead.
462
470
  """
463
471
  out_dir = pathlib.Path(output_dir) / cell_name
464
472
  out_dir.mkdir(parents=True, exist_ok=True)
@@ -484,41 +492,68 @@ def run_validations(
484
492
  )
485
493
 
486
494
  logger.debug("Running validations...")
487
- # Validation 1: Spiking Test
488
- spiking_test_result = spiking_test(
489
- cell.template_params, rheobase, out_dir, spike_threshold_voltage
490
- )
495
+ from bluecellulab.utils import NestedPool
496
+ val_n_processes = n_processes if n_processes is not None else 7
497
+ with NestedPool(processes=val_n_processes) as pool:
498
+ # Validation 1: Spiking Test
499
+ spiking_test_result_future = pool.apply_async(
500
+ spiking_test,
501
+ (cell.template_params, rheobase, out_dir, spike_threshold_voltage)
502
+ )
491
503
 
492
- # Validation 2: Depolarization Block Test
493
- depolarization_block_result = depolarization_block_test(
494
- cell.template_params, rheobase, out_dir
495
- )
504
+ # Validation 2: Depolarization Block Test
505
+ depolarization_block_result_future = pool.apply_async(
506
+ depolarization_block_test,
507
+ (cell.template_params, rheobase, out_dir)
508
+ )
496
509
 
497
- # Validation 3: Backpropagating AP Test
498
- bpap_result = bpap_test(cell.template_params, rheobase, out_dir)
510
+ # Validation 3: Backpropagating AP Test
511
+ bpap_result_future = pool.apply_async(
512
+ bpap_test,
513
+ (cell.template_params, rheobase, out_dir)
514
+ )
499
515
 
500
- # Validation 4: Postsynaptic Potential Test
501
- # We have to wait for ProbAMPANMDA_EMS to be present in entitycore to implement this test
516
+ # Validation 4: Postsynaptic Potential Test
517
+ # We have to wait for ProbAMPANMDA_EMS to be present in entitycore to implement this test
502
518
 
503
- # Validation 5: AIS Spiking Test
504
- ais_spiking_test_result = ais_spiking_test(
505
- cell.template_params, rheobase, out_dir, spike_threshold_voltage
506
- )
519
+ # Validation 5: AIS Spiking Test
520
+ ais_spiking_test_result_future = pool.apply_async(
521
+ ais_spiking_test,
522
+ (cell.template_params, rheobase, out_dir, spike_threshold_voltage)
523
+ )
507
524
 
508
- # Validation 6: Hyperpolarization Test
509
- hyperpolarization_result = hyperpolarization_test(cell.template_params, rheobase, out_dir)
525
+ # Validation 6: Hyperpolarization Test
526
+ hyperpolarization_result_future = pool.apply_async(
527
+ hyperpolarization_test,
528
+ (cell.template_params, rheobase, out_dir)
529
+ )
510
530
 
511
- # Validation 7: Rin Test
512
- rin_result = rin_test(rin)
531
+ # Validation 7: Rin Test
532
+ rin_result_future = pool.apply_async(
533
+ rin_test,
534
+ (rin,)
535
+ )
513
536
 
537
+ # Validation 10: Thumbnail Test
538
+ thumbnail_result_future = pool.apply_async(
539
+ thumbnail_test,
540
+ (cell.template_params, rheobase, out_dir)
541
+ )
542
+
543
+ spiking_test_result = spiking_test_result_future.get()
544
+ depolarization_block_result = depolarization_block_result_future.get()
545
+ bpap_result = bpap_result_future.get()
546
+ ais_spiking_test_result = ais_spiking_test_result_future.get()
547
+ hyperpolarization_result = hyperpolarization_result_future.get()
548
+ rin_result = rin_result_future.get()
549
+ thumbnail_result = thumbnail_result_future.get()
550
+
551
+ # IV and FI tests are outside of nestedpool, because they use multiprocessing internaly
514
552
  # Validation 8: IV Test
515
- iv_test_result = iv_test(cell.template_params, rheobase, out_dir, spike_threshold_voltage)
553
+ iv_test_result = iv_test(cell.template_params, rheobase, out_dir, spike_threshold_voltage, n_processes)
516
554
 
517
555
  # Validation 9: FI Test
518
- fi_test_result = fi_test(cell.template_params, rheobase, out_dir, spike_threshold_voltage)
519
-
520
- # Validation 10: Thumbnail Test
521
- thumbnail_result = thumbnail_test(cell.template_params, rheobase, out_dir)
556
+ fi_test_result = fi_test(cell.template_params, rheobase, out_dir, spike_threshold_voltage, n_processes)
522
557
 
523
558
  return {
524
559
  "memodel_properties": {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bluecellulab
3
- Version: 2.6.62
3
+ Version: 2.6.64
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