bluecellulab 2.6.13__tar.gz → 2.6.15__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 (100) hide show
  1. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/PKG-INFO +1 -1
  2. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/analysis/inject_sequence.py +28 -6
  3. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/psegment.py +2 -2
  4. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/stimulus/factory.py +151 -45
  5. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/synapse/synapse_factory.py +4 -0
  6. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab.egg-info/PKG-INFO +1 -1
  7. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/.compile_mod.sh +0 -0
  8. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/.gitattributes +0 -0
  9. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/.github/dependabot.yml +0 -0
  10. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/.github/workflows/release.yml +0 -0
  11. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/.github/workflows/test.yml +0 -0
  12. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/.gitignore +0 -0
  13. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/.gitlab-ci.yml +0 -0
  14. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/.readthedocs.yml +0 -0
  15. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/.zenodo.json +0 -0
  16. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/AUTHORS.txt +0 -0
  17. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/CHANGELOG.rst +0 -0
  18. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/LICENSE +0 -0
  19. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/MANIFEST.in +0 -0
  20. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/Makefile +0 -0
  21. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/README.rst +0 -0
  22. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/__init__.py +0 -0
  23. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/analysis/__init__.py +0 -0
  24. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/__init__.py +0 -0
  25. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/ballstick/__init__.py +0 -0
  26. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/ballstick/emodel.hoc +0 -0
  27. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/ballstick/morphology.asc +0 -0
  28. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/cell_dict.py +0 -0
  29. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/core.py +0 -0
  30. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/injector.py +0 -0
  31. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/plotting.py +0 -0
  32. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/random.py +0 -0
  33. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/recording.py +0 -0
  34. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/section_distance.py +0 -0
  35. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/serialized_sections.py +0 -0
  36. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/sonata_proxy.py +0 -0
  37. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/stimuli_generator.py +0 -0
  38. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/cell/template.py +0 -0
  39. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/__init__.py +0 -0
  40. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/circuit_access/__init__.py +0 -0
  41. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/circuit_access/bluepy_circuit_access.py +0 -0
  42. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/circuit_access/definition.py +0 -0
  43. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/circuit_access/sonata_circuit_access.py +0 -0
  44. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/config/__init__.py +0 -0
  45. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/config/bluepy_simulation_config.py +0 -0
  46. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/config/definition.py +0 -0
  47. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/config/sections.py +0 -0
  48. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/config/sonata_simulation_config.py +0 -0
  49. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/format.py +0 -0
  50. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/iotools.py +0 -0
  51. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/node_id.py +0 -0
  52. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/simulation_access.py +0 -0
  53. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/synapse_properties.py +0 -0
  54. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit/validate.py +0 -0
  55. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/circuit_simulation.py +0 -0
  56. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/connection.py +0 -0
  57. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/dendrogram.py +0 -0
  58. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/exceptions.py +0 -0
  59. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/graph.py +0 -0
  60. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/hoc/Cell.hoc +0 -0
  61. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/hoc/RNGSettings.hoc +0 -0
  62. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/hoc/TDistFunc.hoc +0 -0
  63. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/hoc/TStim.hoc +0 -0
  64. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/hoc/fileUtils.hoc +0 -0
  65. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/importer.py +0 -0
  66. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/neuron_interpreter.py +0 -0
  67. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/plotwindow.py +0 -0
  68. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/psection.py +0 -0
  69. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/rngsettings.py +0 -0
  70. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/simulation/__init__.py +0 -0
  71. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/simulation/neuron_globals.py +0 -0
  72. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/simulation/parallel.py +0 -0
  73. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/simulation/simulation.py +0 -0
  74. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/stimulus/__init__.py +0 -0
  75. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/stimulus/circuit_stimulus_definitions.py +0 -0
  76. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/synapse/__init__.py +0 -0
  77. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/synapse/synapse_types.py +0 -0
  78. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/tools.py +0 -0
  79. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/type_aliases.py +0 -0
  80. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/utils.py +0 -0
  81. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab/verbosity.py +0 -0
  82. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab.egg-info/SOURCES.txt +0 -0
  83. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab.egg-info/dependency_links.txt +0 -0
  84. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab.egg-info/requires.txt +0 -0
  85. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/bluecellulab.egg-info/top_level.txt +0 -0
  86. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/Makefile +0 -0
  87. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/images/voltage-readme.png +0 -0
  88. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/make.bat +0 -0
  89. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/requirements_docs.txt +0 -0
  90. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/source/_static/.gitkeep +0 -0
  91. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/source/api.rst +0 -0
  92. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/source/changelog.rst +0 -0
  93. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/source/compiling-mechanisms.rst +0 -0
  94. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/source/conf.py +0 -0
  95. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/source/index.rst +0 -0
  96. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/source/list_of_stim.rst +0 -0
  97. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/docs/source/logo/BlueCelluLabBanner.jpg +0 -0
  98. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/pyproject.toml +0 -0
  99. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/setup.cfg +0 -0
  100. {bluecellulab-2.6.13 → bluecellulab-2.6.15}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bluecellulab
3
- Version: 2.6.13
3
+ Version: 2.6.15
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -74,6 +74,7 @@ def apply_multiple_stimuli(
74
74
  cell: Cell,
75
75
  stimulus_name: StimulusName,
76
76
  amplitudes: Sequence[float],
77
+ threshold_based: bool = True,
77
78
  section_name: str | None = None,
78
79
  segment: float = 0.5,
79
80
  n_processes: int | None = None,
@@ -84,6 +85,8 @@ def apply_multiple_stimuli(
84
85
  cell: The cell to which the stimuli are applied.
85
86
  stimulus_name: The name of the stimulus to apply.
86
87
  amplitudes: The amplitudes of the stimuli to apply.
88
+ threshold_based: Whether to consider amplitudes to be
89
+ threshold percentages or to be raw amplitudes.
87
90
  section_name: Section name of the cell where the stimuli are applied.
88
91
  If None, the stimuli are applied at the soma[0] of the cell.
89
92
  segment: The segment of the section where the stimuli are applied.
@@ -103,18 +106,37 @@ def apply_multiple_stimuli(
103
106
 
104
107
  # Prepare arguments for each stimulus
105
108
  for amplitude in amplitudes:
109
+ if threshold_based:
110
+ thres_perc = amplitude
111
+ amp = None
112
+ else:
113
+ thres_perc = None
114
+ amp = amplitude
115
+
106
116
  if stimulus_name == StimulusName.AP_WAVEFORM:
107
- stimulus = stim_factory.ap_waveform(threshold_current=cell.threshold, threshold_percentage=amplitude)
117
+ stimulus = stim_factory.ap_waveform(
118
+ threshold_current=cell.threshold, threshold_percentage=thres_perc, amplitude=amp
119
+ )
108
120
  elif stimulus_name == StimulusName.IDREST:
109
- stimulus = stim_factory.idrest(threshold_current=cell.threshold, threshold_percentage=amplitude)
121
+ stimulus = stim_factory.idrest(
122
+ threshold_current=cell.threshold, threshold_percentage=thres_perc, amplitude=amp
123
+ )
110
124
  elif stimulus_name == StimulusName.IV:
111
- stimulus = stim_factory.iv(threshold_current=cell.threshold, threshold_percentage=amplitude)
125
+ stimulus = stim_factory.iv(
126
+ threshold_current=cell.threshold, threshold_percentage=thres_perc, amplitude=amp
127
+ )
112
128
  elif stimulus_name == StimulusName.FIRE_PATTERN:
113
- stimulus = stim_factory.fire_pattern(threshold_current=cell.threshold, threshold_percentage=amplitude)
129
+ stimulus = stim_factory.fire_pattern(
130
+ threshold_current=cell.threshold, threshold_percentage=thres_perc, amplitude=amp
131
+ )
114
132
  elif stimulus_name == StimulusName.POS_CHEOPS:
115
- stimulus = stim_factory.pos_cheops(threshold_current=cell.threshold, threshold_percentage=amplitude)
133
+ stimulus = stim_factory.pos_cheops(
134
+ threshold_current=cell.threshold, threshold_percentage=thres_perc, amplitude=amp
135
+ )
116
136
  elif stimulus_name == StimulusName.NEG_CHEOPS:
117
- stimulus = stim_factory.neg_cheops(threshold_current=cell.threshold, threshold_percentage=amplitude)
137
+ stimulus = stim_factory.neg_cheops(
138
+ threshold_current=cell.threshold, threshold_percentage=thres_perc, amplitude=amp
139
+ )
118
140
  else:
119
141
  raise ValueError("Unknown stimulus name.")
120
142
 
@@ -25,7 +25,7 @@ class PSegment:
25
25
 
26
26
  def __init__(self, hsegment, parentsection):
27
27
  # import matplotlib as plt
28
- from matplotlib import cm
28
+ from matplotlib import colormaps
29
29
 
30
30
  self.hsegment = hsegment
31
31
  self.parentsection = parentsection
@@ -35,7 +35,7 @@ class PSegment:
35
35
  self.figure = None
36
36
  self.figX = None
37
37
  self.figY = None
38
- self.color_map = cm.get_cmap("hot")
38
+ self.color_map = colormaps["hot"]
39
39
  self.ax = None
40
40
  self.patch = None
41
41
  self.plotvariable = None
@@ -1,8 +1,12 @@
1
1
  from __future__ import annotations
2
2
  from abc import ABC, abstractmethod
3
+ from typing import Optional
4
+ import logging
3
5
  import matplotlib.pyplot as plt
4
6
  import numpy as np
5
7
 
8
+ logger = logging.getLogger(__name__)
9
+
6
10
 
7
11
  class Stimulus(ABC):
8
12
  def __init__(self, dt: float) -> None:
@@ -299,99 +303,182 @@ class StimulusFactory:
299
303
  )
300
304
 
301
305
  def ap_waveform(
302
- self, threshold_current: float, threshold_percentage: float = 220.0
306
+ self,
307
+ threshold_current: Optional[float] = None,
308
+ threshold_percentage: Optional[float] = 220.0,
309
+ amplitude: Optional[float] = None,
303
310
  ) -> Stimulus:
304
311
  """Returns the APWaveform Stimulus object, a type of Step stimulus.
305
312
 
306
313
  Args:
307
314
  threshold_current: The threshold current of the Cell.
308
315
  threshold_percentage: Percentage of desired threshold_current amplification.
316
+ amplitude: Raw amplitude of input current.
309
317
  """
310
318
  pre_delay = 250.0
311
319
  duration = 50.0
312
320
  post_delay = 250.0
313
- return Step.threshold_based(
314
- self.dt,
315
- pre_delay=pre_delay,
316
- duration=duration,
317
- post_delay=post_delay,
318
- threshold_current=threshold_current,
319
- threshold_percentage=threshold_percentage,
320
- )
321
+
322
+ if amplitude is not None:
323
+ if threshold_current is not None and threshold_current != 0 and threshold_percentage is not None:
324
+ logger.info(
325
+ "amplitude, threshold_current and threshold_percentage are all set in ap_waveform."
326
+ " Will only keep amplitude value."
327
+ )
328
+ return Step.amplitude_based(
329
+ self.dt,
330
+ pre_delay=pre_delay,
331
+ duration=duration,
332
+ post_delay=post_delay,
333
+ amplitude=amplitude,
334
+ )
335
+
336
+ if threshold_current is not None and threshold_current != 0 and threshold_percentage is not None:
337
+ return Step.threshold_based(
338
+ self.dt,
339
+ pre_delay=pre_delay,
340
+ duration=duration,
341
+ post_delay=post_delay,
342
+ threshold_current=threshold_current,
343
+ threshold_percentage=threshold_percentage,
344
+ )
345
+
346
+ raise TypeError("You have to give either threshold_current or amplitude")
321
347
 
322
348
  def idrest(
323
349
  self,
324
- threshold_current: float,
325
- threshold_percentage: float = 200.0,
350
+ threshold_current: Optional[float] = None,
351
+ threshold_percentage: Optional[float] = 200.0,
352
+ amplitude: Optional[float] = None,
326
353
  ) -> Stimulus:
327
354
  """Returns the IDRest Stimulus object, a type of Step stimulus.
328
355
 
329
356
  Args:
330
357
  threshold_current: The threshold current of the Cell.
331
358
  threshold_percentage: Percentage of desired threshold_current amplification.
359
+ amplitude: Raw amplitude of input current.
332
360
  """
333
361
  pre_delay = 250.0
334
362
  duration = 1350.0
335
363
  post_delay = 250.0
336
- return Step.threshold_based(
337
- self.dt,
338
- pre_delay=pre_delay,
339
- duration=duration,
340
- post_delay=post_delay,
341
- threshold_current=threshold_current,
342
- threshold_percentage=threshold_percentage,
343
- )
364
+
365
+ if amplitude is not None:
366
+ if threshold_current is not None and threshold_current != 0 and threshold_percentage is not None:
367
+ logger.info(
368
+ "amplitude, threshold_current and threshold_percentage are all set in idrest."
369
+ " Will only keep amplitude value."
370
+ )
371
+ return Step.amplitude_based(
372
+ self.dt,
373
+ pre_delay=pre_delay,
374
+ duration=duration,
375
+ post_delay=post_delay,
376
+ amplitude=amplitude,
377
+ )
378
+
379
+ if threshold_current is not None and threshold_current != 0 and threshold_percentage is not None:
380
+ return Step.threshold_based(
381
+ self.dt,
382
+ pre_delay=pre_delay,
383
+ duration=duration,
384
+ post_delay=post_delay,
385
+ threshold_current=threshold_current,
386
+ threshold_percentage=threshold_percentage,
387
+ )
388
+
389
+ raise TypeError("You have to give either threshold_current or amplitude")
344
390
 
345
391
  def iv(
346
392
  self,
347
- threshold_current: float,
348
- threshold_percentage: float = -40.0,
393
+ threshold_current: Optional[float] = None,
394
+ threshold_percentage: Optional[float] = -40.0,
395
+ amplitude: Optional[float] = None,
349
396
  ) -> Stimulus:
350
397
  """Returns the IV Stimulus object, a type of Step stimulus.
351
398
 
352
399
  Args:
353
400
  threshold_current: The threshold current of the Cell.
354
401
  threshold_percentage: Percentage of desired threshold_current amplification.
402
+ amplitude: Raw amplitude of input current.
355
403
  """
356
404
  pre_delay = 250.0
357
405
  duration = 3000.0
358
406
  post_delay = 250.0
359
- return Step.threshold_based(
360
- self.dt,
361
- pre_delay=pre_delay,
362
- duration=duration,
363
- post_delay=post_delay,
364
- threshold_current=threshold_current,
365
- threshold_percentage=threshold_percentage,
366
- )
407
+
408
+ if amplitude is not None:
409
+ if threshold_current is not None and threshold_current != 0 and threshold_percentage is not None:
410
+ logger.info(
411
+ "amplitude, threshold_current and threshold_percentage are all set in iv."
412
+ " Will only keep amplitude value."
413
+ )
414
+ return Step.amplitude_based(
415
+ self.dt,
416
+ pre_delay=pre_delay,
417
+ duration=duration,
418
+ post_delay=post_delay,
419
+ amplitude=amplitude,
420
+ )
421
+
422
+ if threshold_current is not None and threshold_current != 0 and threshold_percentage is not None:
423
+ return Step.threshold_based(
424
+ self.dt,
425
+ pre_delay=pre_delay,
426
+ duration=duration,
427
+ post_delay=post_delay,
428
+ threshold_current=threshold_current,
429
+ threshold_percentage=threshold_percentage,
430
+ )
431
+
432
+ raise TypeError("You have to give either threshold_current or amplitude")
367
433
 
368
434
  def fire_pattern(
369
435
  self,
370
- threshold_current: float,
371
- threshold_percentage: float = 200.0,
436
+ threshold_current: Optional[float] = None,
437
+ threshold_percentage: Optional[float] = 200.0,
438
+ amplitude: Optional[float] = None,
372
439
  ) -> Stimulus:
373
440
  """Returns the FirePattern Stimulus object, a type of Step stimulus.
374
441
 
375
442
  Args:
376
443
  threshold_current: The threshold current of the Cell.
377
444
  threshold_percentage: Percentage of desired threshold_current amplification.
445
+ amplitude: Raw amplitude of input current.
378
446
  """
379
447
  pre_delay = 250.0
380
448
  duration = 3600.0
381
449
  post_delay = 250.0
382
- return Step.threshold_based(
383
- self.dt,
384
- pre_delay=pre_delay,
385
- duration=duration,
386
- post_delay=post_delay,
387
- threshold_current=threshold_current,
388
- threshold_percentage=threshold_percentage,
389
- )
450
+
451
+ if amplitude is not None:
452
+ if threshold_current is not None and threshold_current != 0 and threshold_percentage is not None:
453
+ logger.info(
454
+ "amplitude, threshold_current and threshold_percentage are all set in fire_pattern."
455
+ " Will only keep amplitude value."
456
+ )
457
+ return Step.amplitude_based(
458
+ self.dt,
459
+ pre_delay=pre_delay,
460
+ duration=duration,
461
+ post_delay=post_delay,
462
+ amplitude=amplitude,
463
+ )
464
+
465
+ if threshold_current is not None and threshold_current != 0 and threshold_percentage is not None:
466
+ return Step.threshold_based(
467
+ self.dt,
468
+ pre_delay=pre_delay,
469
+ duration=duration,
470
+ post_delay=post_delay,
471
+ threshold_current=threshold_current,
472
+ threshold_percentage=threshold_percentage,
473
+ )
474
+
475
+ raise TypeError("You have to give either threshold_current or amplitude")
390
476
 
391
477
  def pos_cheops(
392
478
  self,
393
- threshold_current: float,
394
- threshold_percentage: float = 300.0,
479
+ threshold_current: Optional[float] = None,
480
+ threshold_percentage: Optional[float] = 300.0,
481
+ amplitude: Optional[float] = None,
395
482
  ) -> Stimulus:
396
483
  """A combination of pyramid shaped Ramp stimuli with a positive
397
484
  amplitude.
@@ -399,6 +486,7 @@ class StimulusFactory:
399
486
  Args:
400
487
  threshold_current: The threshold current of the Cell.
401
488
  threshold_percentage: Percentage of desired threshold_current amplification.
489
+ amplitude: Raw amplitude of input current.
402
490
  """
403
491
  delay = 250.0
404
492
  ramp1_duration = 4000.0
@@ -407,7 +495,15 @@ class StimulusFactory:
407
495
  inter_delay = 2000.0
408
496
  post_delay = 250.0
409
497
 
410
- amplitude = threshold_current * threshold_percentage / 100
498
+ if amplitude is None:
499
+ if threshold_current is None or threshold_current == 0 or threshold_percentage is None:
500
+ raise TypeError("You have to give either threshold_current or amplitude")
501
+ amplitude = threshold_current * threshold_percentage / 100
502
+ elif threshold_current is not None and threshold_current != 0 and threshold_percentage is not None:
503
+ logger.info(
504
+ "amplitude, threshold_current and threshold_percentage are all set in pos_cheops."
505
+ " Will only keep amplitude value."
506
+ )
411
507
  result = (
412
508
  Empty(self.dt, duration=delay)
413
509
  + Slope(self.dt, duration=ramp1_duration, amplitude_start=0.0, amplitude_end=amplitude)
@@ -424,8 +520,9 @@ class StimulusFactory:
424
520
 
425
521
  def neg_cheops(
426
522
  self,
427
- threshold_current: float,
428
- threshold_percentage: float = 300.0,
523
+ threshold_current: Optional[float] = None,
524
+ threshold_percentage: Optional[float] = 300.0,
525
+ amplitude: Optional[float] = None,
429
526
  ) -> Stimulus:
430
527
  """A combination of pyramid shaped Ramp stimuli with a negative
431
528
  amplitude.
@@ -433,6 +530,7 @@ class StimulusFactory:
433
530
  Args:
434
531
  threshold_current: The threshold current of the Cell.
435
532
  threshold_percentage: Percentage of desired threshold_current amplification.
533
+ amplitude: Raw amplitude of input current.
436
534
  """
437
535
  delay = 1750.0
438
536
  ramp1_duration = 3333.0
@@ -441,7 +539,15 @@ class StimulusFactory:
441
539
  inter_delay = 2000.0
442
540
  post_delay = 250.0
443
541
 
444
- amplitude = - threshold_current * threshold_percentage / 100
542
+ if amplitude is None:
543
+ if threshold_current is None or threshold_current == 0 or threshold_percentage is None:
544
+ raise TypeError("You have to give either threshold_current or amplitude")
545
+ amplitude = - threshold_current * threshold_percentage / 100
546
+ elif threshold_current is not None and threshold_current != 0 and threshold_percentage is not None:
547
+ logger.info(
548
+ "amplitude, threshold_current and threshold_percentage are all set in neg_cheops."
549
+ " Will only keep amplitude value."
550
+ )
445
551
  result = (
446
552
  Empty(self.dt, duration=delay)
447
553
  + Slope(self.dt, duration=ramp1_duration, amplitude_start=0.0, amplitude_end=amplitude)
@@ -118,6 +118,10 @@ class SynapseFactory:
118
118
  not np.isnan(syn_description[SynapseProperty.AFFERENT_SECTION_POS])):
119
119
  # position is pre computed in SONATA
120
120
  location = syn_description[SynapseProperty.AFFERENT_SECTION_POS]
121
+ if location == 0.0:
122
+ location = 0.0000001
123
+ elif location >= 1.0:
124
+ location = 0.9999999
121
125
  else:
122
126
  ipt = syn_description[SynapseProperty.POST_SEGMENT_ID]
123
127
  syn_offset = syn_description[SynapseProperty.POST_SEGMENT_OFFSET]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bluecellulab
3
- Version: 2.6.13
3
+ Version: 2.6.15
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