bluecellulab 2.6.38__tar.gz → 2.6.39__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 (105) hide show
  1. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/.gitignore +2 -0
  2. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/PKG-INFO +1 -1
  3. bluecellulab-2.6.39/bluecellulab/analysis/analysis.py +63 -0
  4. bluecellulab-2.6.39/bluecellulab/analysis/plotting.py +25 -0
  5. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/tools.py +74 -0
  6. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab.egg-info/PKG-INFO +1 -1
  7. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab.egg-info/SOURCES.txt +2 -0
  8. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/.compile_mod.sh +0 -0
  9. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/.gitattributes +0 -0
  10. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/.github/dependabot.yml +0 -0
  11. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/.github/workflows/release.yml +0 -0
  12. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/.github/workflows/test.yml +0 -0
  13. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/.gitlab-ci.yml +0 -0
  14. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/.readthedocs.yml +0 -0
  15. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/.zenodo.json +0 -0
  16. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/AUTHORS.txt +0 -0
  17. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/CHANGELOG.rst +0 -0
  18. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/CITATION.cff +0 -0
  19. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/CONTRIBUTING.rst +0 -0
  20. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/LICENSE +0 -0
  21. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/MANIFEST.in +0 -0
  22. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/Makefile +0 -0
  23. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/README.rst +0 -0
  24. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/__init__.py +0 -0
  25. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/analysis/__init__.py +0 -0
  26. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/analysis/inject_sequence.py +0 -0
  27. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/__init__.py +0 -0
  28. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/ballstick/__init__.py +0 -0
  29. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/ballstick/emodel.hoc +0 -0
  30. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/ballstick/morphology.asc +0 -0
  31. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/cell_dict.py +0 -0
  32. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/core.py +0 -0
  33. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/injector.py +0 -0
  34. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/plotting.py +0 -0
  35. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/random.py +0 -0
  36. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/recording.py +0 -0
  37. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/section_distance.py +0 -0
  38. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/serialized_sections.py +0 -0
  39. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/sonata_proxy.py +0 -0
  40. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/stimuli_generator.py +0 -0
  41. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/cell/template.py +0 -0
  42. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/__init__.py +0 -0
  43. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/circuit_access/__init__.py +0 -0
  44. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/circuit_access/bluepy_circuit_access.py +0 -0
  45. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/circuit_access/definition.py +0 -0
  46. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/circuit_access/sonata_circuit_access.py +0 -0
  47. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/config/__init__.py +0 -0
  48. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/config/bluepy_simulation_config.py +0 -0
  49. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/config/definition.py +0 -0
  50. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/config/sections.py +0 -0
  51. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/config/sonata_simulation_config.py +0 -0
  52. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/format.py +0 -0
  53. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/iotools.py +0 -0
  54. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/node_id.py +0 -0
  55. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/simulation_access.py +0 -0
  56. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/synapse_properties.py +0 -0
  57. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit/validate.py +0 -0
  58. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/circuit_simulation.py +0 -0
  59. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/connection.py +0 -0
  60. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/dendrogram.py +0 -0
  61. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/exceptions.py +0 -0
  62. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/graph.py +0 -0
  63. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/hoc/Cell.hoc +0 -0
  64. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/hoc/RNGSettings.hoc +0 -0
  65. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/hoc/TDistFunc.hoc +0 -0
  66. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/hoc/TStim.hoc +0 -0
  67. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/hoc/fileUtils.hoc +0 -0
  68. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/importer.py +0 -0
  69. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/neuron_interpreter.py +0 -0
  70. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/plotwindow.py +0 -0
  71. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/psection.py +0 -0
  72. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/psegment.py +0 -0
  73. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/rngsettings.py +0 -0
  74. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/simulation/__init__.py +0 -0
  75. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/simulation/neuron_globals.py +0 -0
  76. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/simulation/parallel.py +0 -0
  77. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/simulation/simulation.py +0 -0
  78. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/stimulus/__init__.py +0 -0
  79. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/stimulus/circuit_stimulus_definitions.py +0 -0
  80. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/stimulus/factory.py +0 -0
  81. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/synapse/__init__.py +0 -0
  82. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/synapse/synapse_factory.py +0 -0
  83. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/synapse/synapse_types.py +0 -0
  84. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/type_aliases.py +0 -0
  85. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/utils.py +0 -0
  86. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab/verbosity.py +0 -0
  87. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab.egg-info/dependency_links.txt +0 -0
  88. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab.egg-info/requires.txt +0 -0
  89. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/bluecellulab.egg-info/top_level.txt +0 -0
  90. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/Makefile +0 -0
  91. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/images/voltage-readme.png +0 -0
  92. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/make.bat +0 -0
  93. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/requirements_docs.txt +0 -0
  94. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/source/_static/.gitkeep +0 -0
  95. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/source/api.rst +0 -0
  96. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/source/changelog.rst +0 -0
  97. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/source/compiling-mechanisms.rst +0 -0
  98. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/source/conf.py +0 -0
  99. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/source/contributing.rst +0 -0
  100. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/source/index.rst +0 -0
  101. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/source/list_of_stim.rst +0 -0
  102. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/docs/source/logo/BlueCelluLabBanner.jpg +0 -0
  103. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/pyproject.toml +0 -0
  104. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/setup.cfg +0 -0
  105. {bluecellulab-2.6.38 → bluecellulab-2.6.39}/tox.ini +0 -0
@@ -1,5 +1,6 @@
1
1
  /modlib
2
2
  **/x86_64
3
+ **/arm64
3
4
  /.tox
4
5
  *.pyc
5
6
  *.egg-info
@@ -26,3 +27,4 @@ nrnivmodl.log
26
27
  *.btr
27
28
  *.whl
28
29
  .ipynb_checkpoints
30
+ cADpyr_L2TPC_dendrogram.png
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: bluecellulab
3
- Version: 2.6.38
3
+ Version: 2.6.39
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -0,0 +1,63 @@
1
+ """Module for analyzing cell simulation results."""
2
+ try:
3
+ import efel
4
+ except ImportError:
5
+ efel = None
6
+ import numpy as np
7
+
8
+ from bluecellulab.stimulus import StimulusFactory
9
+ from bluecellulab.tools import calculate_rheobase
10
+ from bluecellulab.analysis.inject_sequence import run_stimulus
11
+ from bluecellulab.analysis.plotting import plot_iv_curve
12
+
13
+
14
+ def compute_plot_iv_curve(cell, stim_start=100.0, duration=500.0, post_delay=100.0, threshold_voltage=-30, nb_bins=11):
15
+ """Compute and plot the IV curve from a given cell by injecting a
16
+ predefined range of currents.
17
+
18
+ Args:
19
+ cell (bluecellulab.cell.Cell): The initialized cell model.
20
+ stim_start (float): Start time for current injection (in ms). Default is 100.0 ms.
21
+ duration (float): Duration of current injection (in ms). Default is 500.0 ms.
22
+ post_delay (float): Delay after the stimulation ends (in ms). Default is 100.0 ms.
23
+ nb_bins (int): Number of current injection levels. Default is 11.
24
+
25
+ Returns:
26
+ tuple: A tuple containing:
27
+ - list_amp (np.ndarray): The predefined injected step current levels (nA).
28
+ - steady_states (np.ndarray): The corresponding steady-state voltages (mV).
29
+ """
30
+ rheobase = calculate_rheobase(cell)
31
+
32
+ list_amp = np.linspace(rheobase - 2, rheobase - 0.1, nb_bins) # [nA]
33
+
34
+ steps = []
35
+ times = []
36
+ voltages = []
37
+ # inject step current and record voltage response
38
+ for amp in list_amp:
39
+ stim_factory = StimulusFactory(dt=0.1)
40
+ step_stimulus = stim_factory.step(pre_delay=stim_start, duration=duration, post_delay=post_delay, amplitude=amp)
41
+ recording = run_stimulus(cell.template_params, step_stimulus, section="soma[0]", segment=0.5)
42
+ steps.append(step_stimulus)
43
+ times.append(recording.time)
44
+ voltages.append(recording.voltage)
45
+
46
+ steady_states = []
47
+ # compute steady state response
48
+ efel.set_setting('Threshold', threshold_voltage)
49
+ for voltage, t in zip(voltages, times):
50
+ trace = {
51
+ 'T': t,
52
+ 'V': voltage,
53
+ 'stim_start': [stim_start],
54
+ 'stim_end': [stim_start + duration]
55
+ }
56
+ features_results = efel.get_feature_values([trace], ['steady_state_voltage_stimend'])
57
+ steady_state = features_results[0]['steady_state_voltage_stimend']
58
+ steady_states.append(steady_state)
59
+
60
+ # plot I-V curve
61
+ plot_iv_curve(list_amp, steady_states)
62
+
63
+ return np.array(list_amp), np.array(steady_states)
@@ -0,0 +1,25 @@
1
+ """Module for plotting analysis results of cell simulations."""
2
+
3
+ import matplotlib.pyplot as plt
4
+
5
+
6
+ def plot_iv_curve(currents, voltages):
7
+ """Plots the IV curve.
8
+
9
+ Args:
10
+ currents (iterable): The injected current levels (nA).
11
+ voltages (iterable): The corresponding steady-state voltages (mV).
12
+ Raises:
13
+ ValueError: If the lengths of currents and voltages do not match.
14
+ """
15
+ if len(currents) != len(voltages):
16
+ raise ValueError("currents and voltages must have the same length")
17
+
18
+ # Plotting
19
+ plt.figure(figsize=(10, 6))
20
+ plt.plot(voltages, currents, marker='o', linestyle='-', color='b')
21
+ plt.title("I-V Curve")
22
+ plt.ylabel("Injected current [nA]")
23
+ plt.xlabel("Steady state voltage [mV]")
24
+ plt.tight_layout()
25
+ plt.show()
@@ -23,6 +23,7 @@ import neuron
23
23
  import numpy as np
24
24
 
25
25
  import bluecellulab
26
+ from bluecellulab.cell import Cell
26
27
  from bluecellulab.circuit.circuit_access import EmodelProperties
27
28
  from bluecellulab.exceptions import UnsteadyCellError
28
29
  from bluecellulab.simulation.parallel import IsolatedProcess
@@ -351,3 +352,76 @@ def check_empty_topology() -> bool:
351
352
  neuron.h.topology()
352
353
 
353
354
  return stdout == ['', '']
355
+
356
+
357
+ def calculate_max_thresh_current(cell: Cell, threshold_voltage: float = -30.0) -> float:
358
+ """Calculate the upper bound threshold current.
359
+
360
+ Args:
361
+ cell (bluecellulab.cell.Cell): The initialized cell model.
362
+ threshold_voltage (float, optional): Voltage threshold for spike detection. Default is -30.0 mV.
363
+
364
+ Returns:
365
+ float: The upper bound threshold current.
366
+ """
367
+ # Calculate resting membrane potential (rmp)
368
+ rmp = calculate_SS_voltage(
369
+ template_path=cell.template_params.template_filepath,
370
+ morphology_path=cell.template_params.morph_filepath,
371
+ template_format=cell.template_params.template_format,
372
+ emodel_properties=cell.template_params.emodel_properties,
373
+ step_level=0.0,
374
+ )
375
+
376
+ # Calculate input resistance (rin)
377
+ rin = calculate_input_resistance(
378
+ template_path=cell.template_params.template_filepath,
379
+ morphology_path=cell.template_params.morph_filepath,
380
+ template_format=cell.template_params.template_format,
381
+ emodel_properties=cell.template_params.emodel_properties,
382
+ )
383
+
384
+ # Calculate upperbound threshold current
385
+ upperbound_threshold_current = (threshold_voltage - rmp) / rin
386
+ upperbound_threshold_current = np.min([upperbound_threshold_current, 2.0])
387
+
388
+ return upperbound_threshold_current
389
+
390
+
391
+ def calculate_rheobase(cell: Cell,
392
+ threshold_voltage: float = -30.0,
393
+ threshold_search_stim_start: float = 300.0,
394
+ threshold_search_stim_stop: float = 1000.0) -> float:
395
+ """Calculate the rheobase by first computing the upper bound threshold
396
+ current.
397
+
398
+ Args:
399
+ cell (bluecellulab.cell.Cell): The initialized cell model.
400
+ threshold_voltage (float, optional): Voltage threshold for spike detection. Default is -30.0 mV.
401
+ threshold_search_stim_start (float, optional): Start time for threshold search stimulation (in ms). Default is 300.0 ms.
402
+ threshold_search_stim_stop (float, optional): Stop time for threshold search stimulation (in ms). Default is 1000.0 ms.
403
+
404
+ Returns:
405
+ float: The rheobase current.
406
+ """
407
+ if cell.template_params.emodel_properties is None:
408
+ raise ValueError("emodel_properties cannot be None")
409
+
410
+ # Calculate upper bound threshold current
411
+ upperbound_threshold_current = calculate_max_thresh_current(cell, threshold_voltage)
412
+
413
+ # Compute rheobase
414
+ rheobase = search_threshold_current(
415
+ template_name=cell.template_params.template_filepath,
416
+ morphology_path=cell.template_params.morph_filepath,
417
+ template_format=cell.template_params.template_format,
418
+ emodel_properties=cell.template_params.emodel_properties,
419
+ hyp_level=cell.template_params.emodel_properties.holding_current,
420
+ inj_start=threshold_search_stim_start,
421
+ inj_stop=threshold_search_stim_stop,
422
+ min_current=cell.template_params.emodel_properties.holding_current,
423
+ max_current=upperbound_threshold_current,
424
+ current_precision=0.005,
425
+ )
426
+
427
+ return rheobase
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: bluecellulab
3
- Version: 2.6.38
3
+ Version: 2.6.39
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -39,7 +39,9 @@ bluecellulab.egg-info/dependency_links.txt
39
39
  bluecellulab.egg-info/requires.txt
40
40
  bluecellulab.egg-info/top_level.txt
41
41
  bluecellulab/analysis/__init__.py
42
+ bluecellulab/analysis/analysis.py
42
43
  bluecellulab/analysis/inject_sequence.py
44
+ bluecellulab/analysis/plotting.py
43
45
  bluecellulab/cell/__init__.py
44
46
  bluecellulab/cell/cell_dict.py
45
47
  bluecellulab/cell/core.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes