bluecellulab 2.3.1__py3-none-any.whl → 2.3.2__py3-none-any.whl
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.
- bluecellulab/cell/core.py +1 -1
- bluecellulab/cell/injector.py +72 -55
- bluecellulab/circuit/config/bluepy_simulation_config.py +1 -1
- bluecellulab/circuit/config/definition.py +1 -1
- bluecellulab/circuit/config/sonata_simulation_config.py +1 -1
- bluecellulab/ssim.py +11 -11
- bluecellulab/stimulus/__init__.py +1 -0
- bluecellulab/{stimuli.py → stimulus/circuit_stimulus_definitions.py} +4 -0
- bluecellulab/stimulus/factory.py +254 -0
- {bluecellulab-2.3.1.dist-info → bluecellulab-2.3.2.dist-info}/METADATA +1 -1
- {bluecellulab-2.3.1.dist-info → bluecellulab-2.3.2.dist-info}/RECORD +15 -13
- {bluecellulab-2.3.1.dist-info → bluecellulab-2.3.2.dist-info}/AUTHORS.txt +0 -0
- {bluecellulab-2.3.1.dist-info → bluecellulab-2.3.2.dist-info}/LICENSE +0 -0
- {bluecellulab-2.3.1.dist-info → bluecellulab-2.3.2.dist-info}/WHEEL +0 -0
- {bluecellulab-2.3.1.dist-info → bluecellulab-2.3.2.dist-info}/top_level.txt +0 -0
bluecellulab/cell/core.py
CHANGED
|
@@ -41,7 +41,7 @@ from bluecellulab.exceptions import BluecellulabError
|
|
|
41
41
|
from bluecellulab.importer import load_hoc_and_mod_files
|
|
42
42
|
from bluecellulab.neuron_interpreter import eval_neuron
|
|
43
43
|
from bluecellulab.rngsettings import RNGSettings
|
|
44
|
-
from bluecellulab.
|
|
44
|
+
from bluecellulab.stimulus.circuit_stimulus_definitions import SynapseReplay
|
|
45
45
|
from bluecellulab.synapse import SynapseFactory, Synapse
|
|
46
46
|
from bluecellulab.synapse.synapse_types import SynapseID
|
|
47
47
|
from bluecellulab.type_aliases import HocObjectType, NeuronSection
|
bluecellulab/cell/injector.py
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
"""Contains injection functionality for the cell."""
|
|
15
|
-
|
|
15
|
+
from __future__ import annotations
|
|
16
16
|
import math
|
|
17
17
|
import warnings
|
|
18
18
|
import logging
|
|
@@ -27,7 +27,7 @@ from bluecellulab.cell.stimuli_generator import (
|
|
|
27
27
|
get_relative_shotnoise_params,
|
|
28
28
|
)
|
|
29
29
|
from bluecellulab.exceptions import BluecellulabError
|
|
30
|
-
from bluecellulab.
|
|
30
|
+
from bluecellulab.stimulus.circuit_stimulus_definitions import (
|
|
31
31
|
ClampMode,
|
|
32
32
|
Hyperpolarizing,
|
|
33
33
|
Noise,
|
|
@@ -36,7 +36,8 @@ from bluecellulab.stimuli import (
|
|
|
36
36
|
RelativeOrnsteinUhlenbeck,
|
|
37
37
|
RelativeShotNoise,
|
|
38
38
|
)
|
|
39
|
-
from bluecellulab.
|
|
39
|
+
from bluecellulab.stimulus.factory import StimulusFactory
|
|
40
|
+
from bluecellulab.type_aliases import NeuronSection
|
|
40
41
|
|
|
41
42
|
|
|
42
43
|
logger = logging.getLogger(__name__)
|
|
@@ -69,36 +70,62 @@ class InjectableMixin:
|
|
|
69
70
|
self.persistent.append(tstim)
|
|
70
71
|
return tstim
|
|
71
72
|
|
|
72
|
-
def add_step(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
def add_step(
|
|
74
|
+
self,
|
|
75
|
+
start_time: float,
|
|
76
|
+
stop_time: float,
|
|
77
|
+
level: float,
|
|
78
|
+
section: NeuronSection | None = None,
|
|
79
|
+
segx: float = 0.5,
|
|
80
|
+
dt: float = 0.025
|
|
81
|
+
) -> tuple[np.ndarray, np.ndarray]:
|
|
82
|
+
"""Add a step current injection.
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
section
|
|
84
|
+
Args:
|
|
85
|
+
start_time: Start time of the step injection in seconds.
|
|
86
|
+
stop_time: Stop time of the step injection in seconds.
|
|
87
|
+
level: Current level to inject in nanoamperes (nA).
|
|
88
|
+
section: The section to inject current into.
|
|
89
|
+
Defaults to the soma section.
|
|
90
|
+
segx: The fractional location within the section to inject.
|
|
91
|
+
Defaults to 0.5 (center of the section).
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
Tuple of time and current data.
|
|
95
|
+
"""
|
|
96
|
+
stim = StimulusFactory(dt=dt).step(start_time, stop_time, level)
|
|
97
|
+
t_content, i_content = stim.time, stim.current
|
|
98
|
+
self.inject_current_waveform(t_content, i_content, section, segx)
|
|
99
|
+
return (t_content, i_content)
|
|
88
100
|
|
|
89
|
-
|
|
101
|
+
def add_ramp(
|
|
102
|
+
self,
|
|
103
|
+
start_time: float,
|
|
104
|
+
stop_time: float,
|
|
105
|
+
start_level: float,
|
|
106
|
+
stop_level: float,
|
|
107
|
+
section: NeuronSection | None = None,
|
|
108
|
+
segx: float = 0.5,
|
|
109
|
+
dt: float = 0.025
|
|
110
|
+
) -> tuple[np.ndarray, np.ndarray]:
|
|
111
|
+
"""Add a ramp current injection.
|
|
90
112
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
start_level
|
|
95
|
-
stop_level
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
113
|
+
Args:
|
|
114
|
+
start_time: Start time of the ramp injection in seconds.
|
|
115
|
+
stop_time: Stop time of the ramp injection in seconds.
|
|
116
|
+
start_level: Current level at the start of the ramp in nanoamperes (nA).
|
|
117
|
+
stop_level: Current level at the end of the ramp in nanoamperes (nA).
|
|
118
|
+
section: The section to inject current into (optional). Defaults to soma.
|
|
119
|
+
segx: The fractional location within the section to inject (optional).
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
A tuple of numpy arrays containing time and current data.
|
|
123
|
+
"""
|
|
124
|
+
stim = StimulusFactory(dt=dt).ramp(start_time, stop_time, start_level, stop_level)
|
|
125
|
+
t_content, i_content = stim.time, stim.current
|
|
126
|
+
self.inject_current_waveform(t_content, i_content, section, segx)
|
|
99
127
|
|
|
100
|
-
|
|
101
|
-
return tstim
|
|
128
|
+
return t_content, i_content
|
|
102
129
|
|
|
103
130
|
def add_voltage_clamp(
|
|
104
131
|
self, stop_time, level, rs=None, section=None, segx=0.5,
|
|
@@ -395,32 +422,22 @@ class InjectableMixin:
|
|
|
395
422
|
else:
|
|
396
423
|
return self.inject_current_clamp_signal(section, segx, tvec, svec)
|
|
397
424
|
|
|
398
|
-
def inject_current_waveform(self, t_content, i_content, section=None,
|
|
399
|
-
|
|
400
|
-
"""Inject a custom current to the cell."""
|
|
401
|
-
start_time = t_content[0]
|
|
402
|
-
stop_time = t_content[-1]
|
|
403
|
-
time = neuron.h.Vector()
|
|
404
|
-
currents = neuron.h.Vector()
|
|
405
|
-
time = time.from_python(t_content)
|
|
406
|
-
currents = currents.from_python(i_content)
|
|
407
|
-
|
|
425
|
+
def inject_current_waveform(self, t_content, i_content, section=None, segx=0.5):
|
|
426
|
+
"""Inject a custom current waveform into the cell."""
|
|
408
427
|
if section is None:
|
|
409
428
|
section = self.soma
|
|
429
|
+
|
|
430
|
+
time_vector = neuron.h.Vector().from_python(t_content)
|
|
431
|
+
current_vector = neuron.h.Vector().from_python(i_content)
|
|
432
|
+
|
|
410
433
|
pulse = neuron.h.IClamp(segx, sec=section)
|
|
411
|
-
self.persistent.
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
pulse.
|
|
416
|
-
|
|
417
|
-
return
|
|
418
|
-
|
|
419
|
-
@deprecated("Use inject_current_waveform instead.")
|
|
420
|
-
def injectCurrentWaveform(self, t_content, i_content, section=None,
|
|
421
|
-
segx=0.5):
|
|
422
|
-
"""Inject a current in the cell."""
|
|
423
|
-
return self.inject_current_waveform(t_content, i_content, section, segx)
|
|
434
|
+
self.persistent.extend([pulse, time_vector, current_vector])
|
|
435
|
+
|
|
436
|
+
pulse.delay = t_content[0]
|
|
437
|
+
pulse.dur = t_content[-1] - t_content[0]
|
|
438
|
+
current_vector.play(pulse._ref_amp, time_vector)
|
|
439
|
+
|
|
440
|
+
return current_vector
|
|
424
441
|
|
|
425
442
|
@deprecated("Use add_sin_current instead.")
|
|
426
443
|
def addSineCurrentInject(self, start_time, stop_time, freq,
|
|
@@ -435,7 +452,7 @@ class InjectableMixin:
|
|
|
435
452
|
t_content = np.arange(start_time, stop_time, dt)
|
|
436
453
|
i_content = [amplitude * math.sin(freq * (x - start_time) * (
|
|
437
454
|
2 * math.pi)) + mid_level for x in t_content]
|
|
438
|
-
self.
|
|
455
|
+
self.inject_current_waveform(t_content, i_content)
|
|
439
456
|
return (t_content, i_content)
|
|
440
457
|
|
|
441
458
|
def add_sin_current(self, amp, start_time, duration, frequency,
|
|
@@ -454,9 +471,9 @@ class InjectableMixin:
|
|
|
454
471
|
tau: float,
|
|
455
472
|
gmax: float,
|
|
456
473
|
e: float,
|
|
457
|
-
section:
|
|
474
|
+
section: NeuronSection,
|
|
458
475
|
segx=0.5,
|
|
459
|
-
) ->
|
|
476
|
+
) -> NeuronSection:
|
|
460
477
|
"""Add an AlphaSynapse NEURON point process stimulus to the cell."""
|
|
461
478
|
syn = neuron.h.AlphaSynapse(segx, sec=section)
|
|
462
479
|
syn.onset = onset
|
|
@@ -25,7 +25,7 @@ if BLUEPY_AVAILABLE:
|
|
|
25
25
|
from bluepy.utils import open_utf8
|
|
26
26
|
|
|
27
27
|
from bluecellulab.circuit.config.sections import Conditions, ConnectionOverrides
|
|
28
|
-
from bluecellulab.
|
|
28
|
+
from bluecellulab.stimulus.circuit_stimulus_definitions import Stimulus
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class BluepySimulationConfig:
|
|
@@ -18,7 +18,7 @@ from typing import Optional, Protocol
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
from bluecellulab.circuit.config.sections import Conditions, ConnectionOverrides
|
|
21
|
-
from bluecellulab.
|
|
21
|
+
from bluecellulab.stimulus.circuit_stimulus_definitions import Stimulus
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class SimulationConfig(Protocol):
|
|
@@ -17,7 +17,7 @@ from pathlib import Path
|
|
|
17
17
|
from typing import Optional
|
|
18
18
|
|
|
19
19
|
from bluecellulab.circuit.config.sections import Conditions, ConnectionOverrides
|
|
20
|
-
from bluecellulab.
|
|
20
|
+
from bluecellulab.stimulus.circuit_stimulus_definitions import Stimulus
|
|
21
21
|
|
|
22
22
|
from bluepysnap import Simulation as SnapSimulation
|
|
23
23
|
|
bluecellulab/ssim.py
CHANGED
|
@@ -40,8 +40,8 @@ from bluecellulab.circuit.format import determine_circuit_format, CircuitFormat
|
|
|
40
40
|
from bluecellulab.circuit.node_id import create_cell_id, create_cell_ids
|
|
41
41
|
from bluecellulab.circuit.simulation_access import BluepySimulationAccess, SimulationAccess, SonataSimulationAccess, _sample_array
|
|
42
42
|
from bluecellulab.importer import load_hoc_and_mod_files
|
|
43
|
-
from bluecellulab.
|
|
44
|
-
import bluecellulab.
|
|
43
|
+
from bluecellulab.stimulus.circuit_stimulus_definitions import Noise, OrnsteinUhlenbeck, RelativeOrnsteinUhlenbeck, RelativeShotNoise, ShotNoise
|
|
44
|
+
import bluecellulab.stimulus.circuit_stimulus_definitions as circuit_stimulus_definitions
|
|
45
45
|
from bluecellulab.exceptions import BluecellulabError
|
|
46
46
|
from bluecellulab.simulation import (
|
|
47
47
|
set_global_condition_parameters,
|
|
@@ -298,40 +298,40 @@ class SSim:
|
|
|
298
298
|
for cell_id in self.cells:
|
|
299
299
|
if cell_id not in gids_of_target:
|
|
300
300
|
continue
|
|
301
|
-
if isinstance(stimulus,
|
|
301
|
+
if isinstance(stimulus, circuit_stimulus_definitions.Noise):
|
|
302
302
|
if add_noise_stimuli:
|
|
303
303
|
self.cells[cell_id].add_replay_noise(
|
|
304
304
|
stimulus, noisestim_count=noisestim_count)
|
|
305
|
-
elif isinstance(stimulus,
|
|
305
|
+
elif isinstance(stimulus, circuit_stimulus_definitions.Hyperpolarizing):
|
|
306
306
|
if add_hyperpolarizing_stimuli:
|
|
307
307
|
self.cells[cell_id].add_replay_hypamp(stimulus)
|
|
308
|
-
elif isinstance(stimulus,
|
|
308
|
+
elif isinstance(stimulus, circuit_stimulus_definitions.Pulse):
|
|
309
309
|
if add_pulse_stimuli:
|
|
310
310
|
self.cells[cell_id].add_pulse(stimulus)
|
|
311
|
-
elif isinstance(stimulus,
|
|
311
|
+
elif isinstance(stimulus, circuit_stimulus_definitions.RelativeLinear):
|
|
312
312
|
if add_relativelinear_stimuli:
|
|
313
313
|
self.cells[cell_id].add_replay_relativelinear(stimulus)
|
|
314
|
-
elif isinstance(stimulus,
|
|
314
|
+
elif isinstance(stimulus, circuit_stimulus_definitions.ShotNoise):
|
|
315
315
|
if add_shotnoise_stimuli:
|
|
316
316
|
self.cells[cell_id].add_replay_shotnoise(
|
|
317
317
|
self.cells[cell_id].soma, 0.5, stimulus,
|
|
318
318
|
shotnoise_stim_count=shotnoise_stim_count)
|
|
319
|
-
elif isinstance(stimulus,
|
|
319
|
+
elif isinstance(stimulus, circuit_stimulus_definitions.RelativeShotNoise):
|
|
320
320
|
if add_shotnoise_stimuli:
|
|
321
321
|
self.cells[cell_id].add_replay_relative_shotnoise(
|
|
322
322
|
self.cells[cell_id].soma, 0.5, stimulus,
|
|
323
323
|
shotnoise_stim_count=shotnoise_stim_count)
|
|
324
|
-
elif isinstance(stimulus,
|
|
324
|
+
elif isinstance(stimulus, circuit_stimulus_definitions.OrnsteinUhlenbeck):
|
|
325
325
|
if add_ornstein_uhlenbeck_stimuli:
|
|
326
326
|
self.cells[cell_id].add_ornstein_uhlenbeck(
|
|
327
327
|
self.cells[cell_id].soma, 0.5, stimulus,
|
|
328
328
|
stim_count=ornstein_uhlenbeck_stim_count)
|
|
329
|
-
elif isinstance(stimulus,
|
|
329
|
+
elif isinstance(stimulus, circuit_stimulus_definitions.RelativeOrnsteinUhlenbeck):
|
|
330
330
|
if add_ornstein_uhlenbeck_stimuli:
|
|
331
331
|
self.cells[cell_id].add_relative_ornstein_uhlenbeck(
|
|
332
332
|
self.cells[cell_id].soma, 0.5, stimulus,
|
|
333
333
|
stim_count=ornstein_uhlenbeck_stim_count)
|
|
334
|
-
elif isinstance(stimulus,
|
|
334
|
+
elif isinstance(stimulus, circuit_stimulus_definitions.SynapseReplay): # sonata only
|
|
335
335
|
if self.circuit_access.target_contains_cell(
|
|
336
336
|
stimulus.target, cell_id
|
|
337
337
|
):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .factory import StimulusFactory
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
"""Defines the expected data structures associated with the stimulus defined in
|
|
15
|
+
simulation configs.
|
|
14
16
|
|
|
17
|
+
Run-time validates the data via Pydantic.
|
|
18
|
+
"""
|
|
15
19
|
from __future__ import annotations
|
|
16
20
|
|
|
17
21
|
from enum import Enum
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
import matplotlib.pyplot as plt
|
|
4
|
+
import numpy as np
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Stimulus(ABC):
|
|
8
|
+
def __init__(self, dt: float) -> None:
|
|
9
|
+
self.dt = dt
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def time(self) -> np.ndarray:
|
|
14
|
+
"""Time values of the stimulus."""
|
|
15
|
+
...
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
@abstractmethod
|
|
19
|
+
def current(self) -> np.ndarray:
|
|
20
|
+
"""Current values of the stimulus."""
|
|
21
|
+
...
|
|
22
|
+
|
|
23
|
+
def __len__(self) -> int:
|
|
24
|
+
return len(self.time)
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def stimulus_time(self) -> float:
|
|
28
|
+
return len(self) * self.dt
|
|
29
|
+
|
|
30
|
+
def __repr__(self) -> str:
|
|
31
|
+
return f"{self.__class__.__name__}(dt={self.dt})"
|
|
32
|
+
|
|
33
|
+
def plot(self, ax=None, **kwargs):
|
|
34
|
+
if ax is None:
|
|
35
|
+
ax = plt.gca()
|
|
36
|
+
ax.plot(self.time, self.current, **kwargs)
|
|
37
|
+
ax.set_xlabel("Time (ms)")
|
|
38
|
+
ax.set_ylabel("Current (nA)")
|
|
39
|
+
ax.set_title(self.__class__.__name__)
|
|
40
|
+
return ax
|
|
41
|
+
|
|
42
|
+
def plot_during_simulation(self, duration: float, ax=None, **kwargs):
|
|
43
|
+
if ax is None:
|
|
44
|
+
ax = plt.gca()
|
|
45
|
+
# Create an array for the entire duration
|
|
46
|
+
full_time = np.arange(0, duration, self.dt)
|
|
47
|
+
full_current = np.zeros_like(full_time)
|
|
48
|
+
|
|
49
|
+
# Replace the corresponding values with self.time and self.current
|
|
50
|
+
indices = (self.time / self.dt).astype(int)
|
|
51
|
+
full_current[indices] = self.current
|
|
52
|
+
|
|
53
|
+
ax.plot(full_time, full_current, **kwargs)
|
|
54
|
+
ax.set_xlabel("Time (ms)")
|
|
55
|
+
ax.set_ylabel("Current (nA)")
|
|
56
|
+
ax.set_title(self.__class__.__name__)
|
|
57
|
+
ax.set_xlim(0, duration)
|
|
58
|
+
return ax
|
|
59
|
+
|
|
60
|
+
def __add__(self, other: Stimulus) -> CombinedStimulus:
|
|
61
|
+
"""Override + operator to concatenate Stimulus objects."""
|
|
62
|
+
if self.dt != other.dt:
|
|
63
|
+
raise ValueError("Stimulus objects must have the same dt to be concatenated")
|
|
64
|
+
# shift other time
|
|
65
|
+
other_time = other.time + self.time[-1] + self.dt
|
|
66
|
+
combined_time = np.concatenate([self.time, other_time])
|
|
67
|
+
# Concatenate the current arrays
|
|
68
|
+
combined_current = np.concatenate([self.current, other.current])
|
|
69
|
+
return CombinedStimulus(self.dt, combined_time, combined_current)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class CombinedStimulus(Stimulus):
|
|
73
|
+
"""Represents the Stimulus created by combining multiple stimuli."""
|
|
74
|
+
def __init__(self, dt: float, time: np.ndarray, current: np.ndarray) -> None:
|
|
75
|
+
super().__init__(dt)
|
|
76
|
+
self._time = time
|
|
77
|
+
self._current = current
|
|
78
|
+
|
|
79
|
+
@property
|
|
80
|
+
def time(self) -> np.ndarray:
|
|
81
|
+
return self._time
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def current(self) -> np.ndarray:
|
|
85
|
+
return self._current
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class EmptyStimulus(Stimulus):
|
|
89
|
+
"""Represents empty stimulus (all zeros) that has no impact on the cell.
|
|
90
|
+
|
|
91
|
+
This is required by some Stimuli that expect the cell to rest.
|
|
92
|
+
"""
|
|
93
|
+
def __init__(self, dt: float, duration: float) -> None:
|
|
94
|
+
super().__init__(dt)
|
|
95
|
+
self.duration = duration
|
|
96
|
+
|
|
97
|
+
@property
|
|
98
|
+
def time(self) -> np.ndarray:
|
|
99
|
+
return np.arange(0.0, self.duration, self.dt)
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def current(self) -> np.ndarray:
|
|
103
|
+
return np.zeros_like(self.time)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class Step(Stimulus):
|
|
107
|
+
def __init__(self, dt: float, start: float, end: float, amplitude: float) -> None:
|
|
108
|
+
super().__init__(dt)
|
|
109
|
+
self.start = start
|
|
110
|
+
self.end = end
|
|
111
|
+
self.amplitude = amplitude
|
|
112
|
+
|
|
113
|
+
@classmethod
|
|
114
|
+
def threshold_based(
|
|
115
|
+
cls,
|
|
116
|
+
dt: float,
|
|
117
|
+
threshold_current: float,
|
|
118
|
+
threshold_percentage: float,
|
|
119
|
+
start: float,
|
|
120
|
+
end: float,
|
|
121
|
+
post_wait: float,
|
|
122
|
+
) -> CombinedStimulus:
|
|
123
|
+
amplitude = threshold_current * threshold_percentage / 100
|
|
124
|
+
res = cls(dt, start, end, amplitude) + EmptyStimulus(dt, duration=post_wait)
|
|
125
|
+
return res
|
|
126
|
+
|
|
127
|
+
@property
|
|
128
|
+
def time(self) -> np.ndarray:
|
|
129
|
+
return np.arange(self.start, self.end, self.dt)
|
|
130
|
+
|
|
131
|
+
@property
|
|
132
|
+
def current(self) -> np.ndarray:
|
|
133
|
+
return np.full_like(self.time, self.amplitude)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class Ramp(Stimulus):
|
|
137
|
+
def __init__(
|
|
138
|
+
self,
|
|
139
|
+
dt: float,
|
|
140
|
+
start: float,
|
|
141
|
+
end: float,
|
|
142
|
+
amplitude_start: float,
|
|
143
|
+
amplitude_end: float,
|
|
144
|
+
) -> None:
|
|
145
|
+
super().__init__(dt)
|
|
146
|
+
self.start = start
|
|
147
|
+
self.end = end
|
|
148
|
+
self.amplitude_start = amplitude_start
|
|
149
|
+
self.amplitude_end = amplitude_end
|
|
150
|
+
|
|
151
|
+
@property
|
|
152
|
+
def time(self) -> np.ndarray:
|
|
153
|
+
return np.arange(self.start, self.end, self.dt)
|
|
154
|
+
|
|
155
|
+
@property
|
|
156
|
+
def current(self) -> np.ndarray:
|
|
157
|
+
return np.linspace(self.amplitude_start, self.amplitude_end, len(self.time))
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class StimulusFactory:
|
|
161
|
+
def __init__(self, dt: float):
|
|
162
|
+
self.dt = dt
|
|
163
|
+
|
|
164
|
+
def step(self, start: float, end: float, amplitude: float) -> Stimulus:
|
|
165
|
+
return Step(self.dt, start, end, amplitude)
|
|
166
|
+
|
|
167
|
+
def ramp(
|
|
168
|
+
self, start: float, end: float, amplitude_start: float, amplitude_end: float
|
|
169
|
+
) -> Stimulus:
|
|
170
|
+
return Ramp(self.dt, start, end, amplitude_start, amplitude_end)
|
|
171
|
+
|
|
172
|
+
def ap_waveform(
|
|
173
|
+
self,
|
|
174
|
+
threshold_current: float,
|
|
175
|
+
threshold_percentage: float = 220.0,
|
|
176
|
+
start: float = 250.0,
|
|
177
|
+
end: float = 300.0,
|
|
178
|
+
post_wait: float = 250.0,
|
|
179
|
+
) -> Stimulus:
|
|
180
|
+
"""Returns the APWaveform Stimulus object, a type of Step stimulus.
|
|
181
|
+
|
|
182
|
+
Args:
|
|
183
|
+
threshold_current: The threshold current of the Cell.
|
|
184
|
+
threshold_percentage: Percentage of desired threshold_current amplification.
|
|
185
|
+
start: The start time of the step.
|
|
186
|
+
end: The end time of the step.
|
|
187
|
+
post_wait: The time to wait after the end of the step.
|
|
188
|
+
"""
|
|
189
|
+
return Step.threshold_based(
|
|
190
|
+
self.dt, threshold_current, threshold_percentage, start, end, post_wait
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
def idrest(
|
|
194
|
+
self,
|
|
195
|
+
threshold_current: float,
|
|
196
|
+
threshold_percentage: float = 200.0,
|
|
197
|
+
start: float = 250.0,
|
|
198
|
+
end: float = 1600.0,
|
|
199
|
+
post_wait: float = 250.0,
|
|
200
|
+
) -> Stimulus:
|
|
201
|
+
"""Returns the IDRest Stimulus object, a type of Step stimulus.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
threshold_current: The threshold current of the Cell.
|
|
205
|
+
threshold_percentage: Percentage of desired threshold_current amplification.
|
|
206
|
+
start: The start time of the step.
|
|
207
|
+
end: The end time of the step.
|
|
208
|
+
post_wait: The time to wait after the end of the step.
|
|
209
|
+
"""
|
|
210
|
+
return Step.threshold_based(
|
|
211
|
+
self.dt, threshold_current, threshold_percentage, start, end, post_wait
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
def iv(
|
|
215
|
+
self,
|
|
216
|
+
threshold_current: float,
|
|
217
|
+
threshold_percentage: float = -40.0,
|
|
218
|
+
start: float = 250.0,
|
|
219
|
+
end: float = 3250.0,
|
|
220
|
+
post_wait: float = 250.0,
|
|
221
|
+
) -> Stimulus:
|
|
222
|
+
"""Returns the IV Stimulus object, a type of Step stimulus.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
threshold_current: The threshold current of the Cell.
|
|
226
|
+
threshold_percentage: Percentage of desired threshold_current amplification.
|
|
227
|
+
start: The start time of the step.
|
|
228
|
+
end: The end time of the step.
|
|
229
|
+
post_wait: The time to wait after the end of the step.
|
|
230
|
+
"""
|
|
231
|
+
return Step.threshold_based(
|
|
232
|
+
self.dt, threshold_current, threshold_percentage, start, end, post_wait
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
def fire_pattern(
|
|
236
|
+
self,
|
|
237
|
+
threshold_current: float,
|
|
238
|
+
threshold_percentage: float = 200.0,
|
|
239
|
+
start: float = 250.0,
|
|
240
|
+
end: float = 3850.0,
|
|
241
|
+
post_wait: float = 250.0,
|
|
242
|
+
) -> Stimulus:
|
|
243
|
+
"""Returns the FirePattern Stimulus object, a type of Step stimulus.
|
|
244
|
+
|
|
245
|
+
Args:
|
|
246
|
+
threshold_current: The threshold current of the Cell.
|
|
247
|
+
threshold_percentage: Percentage of desired threshold_current amplification.
|
|
248
|
+
start: The start time of the step.
|
|
249
|
+
end: The end time of the step.
|
|
250
|
+
post_wait: The time to wait after the end of the step.
|
|
251
|
+
"""
|
|
252
|
+
return Step.threshold_based(
|
|
253
|
+
self.dt, threshold_current, threshold_percentage, start, end, post_wait
|
|
254
|
+
)
|
|
@@ -9,15 +9,14 @@ bluecellulab/plotwindow.py,sha256=UVHzml-BB83m5Qr-YGkjR9kB-vSW8mM0Owh2j95yIaU,27
|
|
|
9
9
|
bluecellulab/psection.py,sha256=EgAS8IS9DcYv2xOkNISgfg_CfRc0nDfRFjvgQhyi9eY,6328
|
|
10
10
|
bluecellulab/psegment.py,sha256=rBryDYHC_uDK9itfXXrFZ0DL9F6WgRICL0j5EHN56QM,3125
|
|
11
11
|
bluecellulab/rngsettings.py,sha256=SLvkgM8K26Z-zTTN__CnFl_KjIJNuF4n_jzviyei5P4,3986
|
|
12
|
-
bluecellulab/ssim.py,sha256=
|
|
13
|
-
bluecellulab/stimuli.py,sha256=u3AG3u0yYIvZzvFAwl1-8UPvEbq50mERVLVajX8JXdo,15540
|
|
12
|
+
bluecellulab/ssim.py,sha256=_MyUObeKIHhuT4cbB1uSD7izpZZHNRACiPlO9R1TNa8,33552
|
|
14
13
|
bluecellulab/tools.py,sha256=s4NTE0DzK8z8oAy1BF1C2f19nBx-qBPuArz7e7hUTnw,24231
|
|
15
14
|
bluecellulab/type_aliases.py,sha256=EMrunY-pIgZrsmetpAM8lA7tr0TFEzFoU5SX9sBuiOk,312
|
|
16
15
|
bluecellulab/utils.py,sha256=GKZkRYI2LY08tsIkG95MGn7EfmV4pBrIAqfRQCW14fs,300
|
|
17
16
|
bluecellulab/cell/__init__.py,sha256=Sbc0QOsJ8E7tSwf3q7fsXuE_SevBN6ZmoCVyyU5zfII,208
|
|
18
17
|
bluecellulab/cell/cell_dict.py,sha256=PVmZsjhZ9jp3HC-8QmdFqp-crAcVMSVeLWujcOPLlpo,1346
|
|
19
|
-
bluecellulab/cell/core.py,sha256=
|
|
20
|
-
bluecellulab/cell/injector.py,sha256=
|
|
18
|
+
bluecellulab/cell/core.py,sha256=UtPjq_SYX8wOehQe7GqkbPxDWG1vIIJQ5-e3T_g29YU,31480
|
|
19
|
+
bluecellulab/cell/injector.py,sha256=4h11fObfbKhuvexE_AawCWiAalZIUjDsbVjqOeJ34Tw,17842
|
|
21
20
|
bluecellulab/cell/plotting.py,sha256=_hZs5oYG4vmJBVf05cJ2O_cVazi5Eap8OkL9BtIwjW8,4001
|
|
22
21
|
bluecellulab/cell/random.py,sha256=FDby9BN4eJT27COwHP59bhDE2v-c6rdOKNFj3cYZTVY,1773
|
|
23
22
|
bluecellulab/cell/section_distance.py,sha256=J8-oqgCHzRaJkpfjPUR6NFtXDhwbrXad9nDaTCKNkTU,3908
|
|
@@ -40,10 +39,10 @@ bluecellulab/circuit/circuit_access/bluepy_circuit_access.py,sha256=j-DYHMBTbq1T
|
|
|
40
39
|
bluecellulab/circuit/circuit_access/definition.py,sha256=SnKBFEgdXFG-QexYRrGSzVAd7bSj7NwN0IuTsjDOrDY,4435
|
|
41
40
|
bluecellulab/circuit/circuit_access/sonata_circuit_access.py,sha256=P1ElK_VA10_JyyKbAnqzuAlduEYE2c_NSec2TZuix1U,10345
|
|
42
41
|
bluecellulab/circuit/config/__init__.py,sha256=aaoJXRKBJzpxxREo9NxKc-_CCPmVeuR1mcViRXcLrC4,215
|
|
43
|
-
bluecellulab/circuit/config/bluepy_simulation_config.py,sha256=
|
|
44
|
-
bluecellulab/circuit/config/definition.py,sha256=
|
|
42
|
+
bluecellulab/circuit/config/bluepy_simulation_config.py,sha256=tUyHvzlxFWRxh8rBNvU0FdUqGqJR2G8OXifATQ9W7yw,6974
|
|
43
|
+
bluecellulab/circuit/config/definition.py,sha256=o0751Dd83f8TWGw95EAQ8coJrYGasdshrIrXViF5lzg,2774
|
|
45
44
|
bluecellulab/circuit/config/sections.py,sha256=O1198JvusdOQBWgUeOZ5OhOupbHvvt3NtP9JfBWNbn0,7151
|
|
46
|
-
bluecellulab/circuit/config/sonata_simulation_config.py,sha256=
|
|
45
|
+
bluecellulab/circuit/config/sonata_simulation_config.py,sha256=P0IKazCuNAG97xq2xLwHLbmr_lrNAqPsa6rXi-uDqb0,4829
|
|
47
46
|
bluecellulab/hoc/Cell.hoc,sha256=z77qRQG_-afj-RLX0xN6V-K6Duq3bR7vmlDrGWPdh4E,16435
|
|
48
47
|
bluecellulab/hoc/RNGSettings.hoc,sha256=wOtPxVMkCBTHsFLs5jPMKyverm1llXqaX8VKsAX43r8,1413
|
|
49
48
|
bluecellulab/hoc/TDistFunc.hoc,sha256=WKX-anvL83xGuGPH9g1oIORB17UM4Pi3-iIXzKO-pUQ,2663
|
|
@@ -52,12 +51,15 @@ bluecellulab/hoc/fileUtils.hoc,sha256=LSM7BgyjYVqo2DGSOKvg4W8IIusbsL45JVYK0vgwit
|
|
|
52
51
|
bluecellulab/simulation/__init__.py,sha256=G1md-6mqaYQkfZT8pmzqRi3WW1fMQCgkeaela2kX3OM,258
|
|
53
52
|
bluecellulab/simulation/neuron_globals.py,sha256=PuAxrXbr734RP-5q6YkHpnOgzTVyo_8SYZux9HABlaI,3348
|
|
54
53
|
bluecellulab/simulation/simulation.py,sha256=tM5Psl-w25CHA4hp2fqs3GcZ2HSjIbu_6iyOcs-1jd8,6439
|
|
54
|
+
bluecellulab/stimulus/__init__.py,sha256=DgIgVaSyR-URf3JZzvO6j-tjCerzvktuK-ep8pjMRPQ,37
|
|
55
|
+
bluecellulab/stimulus/circuit_stimulus_definitions.py,sha256=uij_s44uNdmMwMLGmTHSRgmp9K9B_vvHHshX6YPJNJU,15686
|
|
56
|
+
bluecellulab/stimulus/factory.py,sha256=AOby3Sp2g8BJsRccz3afazfCyysyWIgLtcliWlyeiu0,8097
|
|
55
57
|
bluecellulab/synapse/__init__.py,sha256=RW8XoAMXOvK7OG1nHl_q8jSEKLj9ZN4oWf2nY9HAwuk,192
|
|
56
58
|
bluecellulab/synapse/synapse_factory.py,sha256=ZBRpjvIRyHc4hBfBvtLukLf7E2PjHhzwqGt9O4MBOTk,6862
|
|
57
59
|
bluecellulab/synapse/synapse_types.py,sha256=wWVBfvPYF6g3dSoaXsjJ6QI929yWYrTh_OmauS5Y-Uk,17027
|
|
58
|
-
bluecellulab-2.3.
|
|
59
|
-
bluecellulab-2.3.
|
|
60
|
-
bluecellulab-2.3.
|
|
61
|
-
bluecellulab-2.3.
|
|
62
|
-
bluecellulab-2.3.
|
|
63
|
-
bluecellulab-2.3.
|
|
60
|
+
bluecellulab-2.3.2.dist-info/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
|
|
61
|
+
bluecellulab-2.3.2.dist-info/LICENSE,sha256=xOouu1gC1GGklDxkITlaVl60I9Ab860O-nZsFbWydvU,11749
|
|
62
|
+
bluecellulab-2.3.2.dist-info/METADATA,sha256=1uZpRUUBcPBBCbAiudS3Qg3anmrygJBuNtQ_kTEC6O8,6907
|
|
63
|
+
bluecellulab-2.3.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
64
|
+
bluecellulab-2.3.2.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
|
|
65
|
+
bluecellulab-2.3.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|