bluecellulab 2.4.0__py3-none-any.whl → 2.4.1__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/analysis/__init__.py +0 -0
- bluecellulab/analysis/inject_sequence.py +130 -0
- bluecellulab/cell/core.py +57 -23
- bluecellulab/cell/injector.py +6 -6
- bluecellulab/cell/recording.py +8 -0
- bluecellulab/cell/template.py +8 -1
- bluecellulab/type_aliases.py +4 -1
- bluecellulab/utils.py +8 -2
- {bluecellulab-2.4.0.dist-info → bluecellulab-2.4.1.dist-info}/METADATA +1 -1
- {bluecellulab-2.4.0.dist-info → bluecellulab-2.4.1.dist-info}/RECORD +14 -11
- {bluecellulab-2.4.0.dist-info → bluecellulab-2.4.1.dist-info}/AUTHORS.txt +0 -0
- {bluecellulab-2.4.0.dist-info → bluecellulab-2.4.1.dist-info}/LICENSE +0 -0
- {bluecellulab-2.4.0.dist-info → bluecellulab-2.4.1.dist-info}/WHEEL +0 -0
- {bluecellulab-2.4.0.dist-info → bluecellulab-2.4.1.dist-info}/top_level.txt +0 -0
|
File without changes
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""Module for injecting a sequence of protocols to the cell."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
from enum import Enum, auto
|
|
4
|
+
from typing import NamedTuple, Sequence, Dict
|
|
5
|
+
|
|
6
|
+
import neuron
|
|
7
|
+
import numpy as np
|
|
8
|
+
from bluecellulab.cell.core import Cell
|
|
9
|
+
from bluecellulab.cell.template import TemplateParams
|
|
10
|
+
from bluecellulab.simulation.simulation import Simulation
|
|
11
|
+
from bluecellulab.stimulus.factory import Stimulus, StimulusFactory
|
|
12
|
+
from bluecellulab.utils import IsolatedProcess
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class StimulusName(Enum):
|
|
16
|
+
"""Allowed values for the StimulusName."""
|
|
17
|
+
AP_WAVEFORM = auto()
|
|
18
|
+
IDREST = auto()
|
|
19
|
+
IV = auto()
|
|
20
|
+
FIRE_PATTERN = auto()
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Recording(NamedTuple):
|
|
24
|
+
"""A tuple of the current, voltage and time recordings."""
|
|
25
|
+
current: np.ndarray
|
|
26
|
+
voltage: np.ndarray
|
|
27
|
+
time: np.ndarray
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
StimulusRecordings = Dict[str, Recording]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def run_stimulus(
|
|
34
|
+
template_params: TemplateParams,
|
|
35
|
+
stimulus: Stimulus,
|
|
36
|
+
section: str,
|
|
37
|
+
segment: float,
|
|
38
|
+
duration: float,
|
|
39
|
+
) -> Recording:
|
|
40
|
+
"""Creates a cell and stimulates it with a given stimulus.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
template_params: The parameters to create the cell from a template.
|
|
44
|
+
stimulus: The input stimulus to inject into the cell.
|
|
45
|
+
section: Name of the section of cell where the stimulus is to be injected.
|
|
46
|
+
segment: The segment of the section where the stimulus is to be injected.
|
|
47
|
+
duration: The duration for which the simulation is to be run.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
The voltage-time recording at the specified location.
|
|
51
|
+
|
|
52
|
+
Raises:
|
|
53
|
+
ValueError: If the time and voltage arrays are not the same length.
|
|
54
|
+
"""
|
|
55
|
+
cell = Cell.from_template_parameters(template_params)
|
|
56
|
+
neuron_section = cell.sections[section]
|
|
57
|
+
cell.add_voltage_recording(neuron_section, segment)
|
|
58
|
+
iclamp, _ = cell.inject_current_waveform(
|
|
59
|
+
stimulus.time, stimulus.current, section=neuron_section, segx=segment
|
|
60
|
+
)
|
|
61
|
+
current_vector = neuron.h.Vector()
|
|
62
|
+
current_vector.record(iclamp._ref_i)
|
|
63
|
+
simulation = Simulation(cell)
|
|
64
|
+
simulation.run(duration)
|
|
65
|
+
current = np.array(current_vector.to_python())
|
|
66
|
+
voltage = cell.get_voltage_recording(neuron_section, segment)
|
|
67
|
+
time = cell.get_time()
|
|
68
|
+
if len(time) != len(voltage) or len(time) != len(current):
|
|
69
|
+
raise ValueError("Time, current and voltage arrays are not the same length")
|
|
70
|
+
return Recording(current, voltage, time)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def apply_multiple_step_stimuli(
|
|
74
|
+
cell: Cell,
|
|
75
|
+
stimulus_name: StimulusName,
|
|
76
|
+
amplitudes: Sequence[float],
|
|
77
|
+
duration: float,
|
|
78
|
+
section_name: str | None = None,
|
|
79
|
+
segment: float = 0.5,
|
|
80
|
+
n_processes: int | None = None,
|
|
81
|
+
) -> StimulusRecordings:
|
|
82
|
+
"""Apply multiple stimuli to the cell on isolated processes.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
cell: The cell to which the stimuli are applied.
|
|
86
|
+
stimulus_name: The name of the stimulus to apply.
|
|
87
|
+
amplitudes: The amplitudes of the stimuli to apply.
|
|
88
|
+
duration: The duration for which each stimulus is applied.
|
|
89
|
+
section_name: Section name of the cell where the stimuli are applied.
|
|
90
|
+
If None, the stimuli are applied at the soma[0] of the cell.
|
|
91
|
+
segment: The segment of the section where the stimuli are applied.
|
|
92
|
+
n_processes: The number of processes to use for running the stimuli.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
A dictionary where the keys are the names of the stimuli and the values
|
|
96
|
+
are the recordings of the cell's response to each stimulus.
|
|
97
|
+
|
|
98
|
+
Raises:
|
|
99
|
+
ValueError: If the stimulus name is not recognized.
|
|
100
|
+
"""
|
|
101
|
+
res: StimulusRecordings = {}
|
|
102
|
+
stim_factory = StimulusFactory(dt=1.0)
|
|
103
|
+
task_args = []
|
|
104
|
+
section_name = section_name if section_name is not None else "soma[0]"
|
|
105
|
+
|
|
106
|
+
# Prepare arguments for each stimulus
|
|
107
|
+
for amplitude in amplitudes:
|
|
108
|
+
if stimulus_name == StimulusName.AP_WAVEFORM:
|
|
109
|
+
stimulus = stim_factory.ap_waveform(threshold_current=cell.threshold, threshold_percentage=amplitude)
|
|
110
|
+
elif stimulus_name == StimulusName.IDREST:
|
|
111
|
+
stimulus = stim_factory.idrest(threshold_current=cell.threshold, threshold_percentage=amplitude)
|
|
112
|
+
elif stimulus_name == StimulusName.IV:
|
|
113
|
+
stimulus = stim_factory.iv(threshold_current=cell.threshold, threshold_percentage=amplitude)
|
|
114
|
+
elif stimulus_name == StimulusName.FIRE_PATTERN:
|
|
115
|
+
stimulus = stim_factory.fire_pattern(threshold_current=cell.threshold, threshold_percentage=amplitude)
|
|
116
|
+
else:
|
|
117
|
+
raise ValueError("Unknown stimulus name.")
|
|
118
|
+
|
|
119
|
+
task_args.append((cell.template_params, stimulus, section_name, segment, duration))
|
|
120
|
+
|
|
121
|
+
with IsolatedProcess(processes=n_processes) as pool:
|
|
122
|
+
# Map expects a function and a list of argument tuples
|
|
123
|
+
results = pool.starmap(run_stimulus, task_args)
|
|
124
|
+
|
|
125
|
+
# Associate each result with a key
|
|
126
|
+
for amplitude, result in zip(amplitudes, results):
|
|
127
|
+
key = f"{stimulus_name}_{amplitude}"
|
|
128
|
+
res[key] = result
|
|
129
|
+
|
|
130
|
+
return res
|
bluecellulab/cell/core.py
CHANGED
|
@@ -27,12 +27,13 @@ import numpy as np
|
|
|
27
27
|
import pandas as pd
|
|
28
28
|
|
|
29
29
|
import bluecellulab
|
|
30
|
+
from bluecellulab.cell.recording import section_to_voltage_recording_str
|
|
30
31
|
from bluecellulab.psection import PSection, init_psections
|
|
31
32
|
from bluecellulab.cell.injector import InjectableMixin
|
|
32
33
|
from bluecellulab.cell.plotting import PlottableMixin
|
|
33
34
|
from bluecellulab.cell.section_distance import EuclideanSectionDistance
|
|
34
35
|
from bluecellulab.cell.sonata_proxy import SonataProxy
|
|
35
|
-
from bluecellulab.cell.template import NeuronTemplate, public_hoc_cell
|
|
36
|
+
from bluecellulab.cell.template import NeuronTemplate, TemplateParams, public_hoc_cell
|
|
36
37
|
from bluecellulab.circuit.config.sections import Conditions
|
|
37
38
|
from bluecellulab.circuit import EmodelProperties, SynapseProperty
|
|
38
39
|
from bluecellulab.circuit.node_id import CellId
|
|
@@ -44,7 +45,7 @@ from bluecellulab.rngsettings import RNGSettings
|
|
|
44
45
|
from bluecellulab.stimulus.circuit_stimulus_definitions import SynapseReplay
|
|
45
46
|
from bluecellulab.synapse import SynapseFactory, Synapse
|
|
46
47
|
from bluecellulab.synapse.synapse_types import SynapseID
|
|
47
|
-
from bluecellulab.type_aliases import HocObjectType, NeuronSection
|
|
48
|
+
from bluecellulab.type_aliases import HocObjectType, NeuronSection, SectionMapping
|
|
48
49
|
|
|
49
50
|
logger = logging.getLogger(__name__)
|
|
50
51
|
|
|
@@ -54,6 +55,24 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
54
55
|
|
|
55
56
|
last_id = 0
|
|
56
57
|
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_template_parameters(
|
|
60
|
+
cls, template_params: TemplateParams, cell_id: Optional[CellId] = None,
|
|
61
|
+
record_dt: Optional[float] = None
|
|
62
|
+
) -> Cell:
|
|
63
|
+
"""Create a cell from a TemplateParams object.
|
|
64
|
+
|
|
65
|
+
Useful in isolating runs.
|
|
66
|
+
"""
|
|
67
|
+
return cls(
|
|
68
|
+
template_path=template_params.template_filepath,
|
|
69
|
+
morphology_path=template_params.morph_filepath,
|
|
70
|
+
cell_id=cell_id,
|
|
71
|
+
record_dt=record_dt,
|
|
72
|
+
template_format=template_params.template_format,
|
|
73
|
+
emodel_properties=template_params.emodel_properties,
|
|
74
|
+
)
|
|
75
|
+
|
|
57
76
|
@load_hoc_and_mod_files
|
|
58
77
|
def __init__(self,
|
|
59
78
|
template_path: str | Path,
|
|
@@ -73,6 +92,12 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
73
92
|
emodel_properties: Template specific emodel properties.
|
|
74
93
|
"""
|
|
75
94
|
super().__init__()
|
|
95
|
+
self.template_params = TemplateParams(
|
|
96
|
+
template_filepath=template_path,
|
|
97
|
+
morph_filepath=morphology_path,
|
|
98
|
+
template_format=template_format,
|
|
99
|
+
emodel_properties=emodel_properties,
|
|
100
|
+
)
|
|
76
101
|
if cell_id is None:
|
|
77
102
|
cell_id = CellId("", Cell.last_id)
|
|
78
103
|
Cell.last_id += 1
|
|
@@ -86,17 +111,16 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
86
111
|
if emodel_properties is None:
|
|
87
112
|
raise BluecellulabError('EmodelProperties must be provided for v6 template')
|
|
88
113
|
self.hypamp: float | None = emodel_properties.holding_current
|
|
89
|
-
self.threshold: float
|
|
114
|
+
self.threshold: float = emodel_properties.threshold_current
|
|
90
115
|
else:
|
|
91
116
|
try:
|
|
92
117
|
self.hypamp = self.cell.getHypAmp()
|
|
93
118
|
except AttributeError:
|
|
94
119
|
self.hypamp = None
|
|
95
|
-
|
|
96
120
|
try:
|
|
97
121
|
self.threshold = self.cell.getThreshold()
|
|
98
122
|
except AttributeError:
|
|
99
|
-
self.threshold =
|
|
123
|
+
self.threshold = 0.0
|
|
100
124
|
self.soma = public_hoc_cell(self.cell).soma[0]
|
|
101
125
|
# WARNING: this finitialize 'must' be here, otherwhise the
|
|
102
126
|
# diameters of the loaded morph are wrong
|
|
@@ -131,6 +155,13 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
131
155
|
# as the object exists
|
|
132
156
|
self.persistent: list[HocObjectType] = []
|
|
133
157
|
|
|
158
|
+
def _extract_sections(self, sections) -> SectionMapping:
|
|
159
|
+
res: SectionMapping = {}
|
|
160
|
+
for section in sections:
|
|
161
|
+
key_name = str(section).split(".")[-1]
|
|
162
|
+
res[key_name] = section
|
|
163
|
+
return res
|
|
164
|
+
|
|
134
165
|
@property
|
|
135
166
|
def somatic(self) -> list[NeuronSection]:
|
|
136
167
|
return list(public_hoc_cell(self.cell).somatic)
|
|
@@ -148,8 +179,8 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
148
179
|
return list(public_hoc_cell(self.cell).axonal)
|
|
149
180
|
|
|
150
181
|
@property
|
|
151
|
-
def
|
|
152
|
-
return
|
|
182
|
+
def sections(self) -> SectionMapping:
|
|
183
|
+
return self._extract_sections(public_hoc_cell(self.cell).all)
|
|
153
184
|
|
|
154
185
|
def __repr__(self) -> str:
|
|
155
186
|
base_info = f"Cell Object: {super().__repr__()}"
|
|
@@ -197,7 +228,7 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
197
228
|
|
|
198
229
|
def make_passive(self) -> None:
|
|
199
230
|
"""Make the cell passive by deactivating all the active channels."""
|
|
200
|
-
for section in self.
|
|
231
|
+
for section in self.sections.values():
|
|
201
232
|
mech_names = set()
|
|
202
233
|
for seg in section:
|
|
203
234
|
for mech in seg:
|
|
@@ -232,14 +263,14 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
232
263
|
|
|
233
264
|
def _default_enable_ttx(self) -> None:
|
|
234
265
|
"""Default enable_ttx implementation."""
|
|
235
|
-
for section in self.
|
|
266
|
+
for section in self.sections.values():
|
|
236
267
|
if not neuron.h.ismembrane("TTXDynamicsSwitch"):
|
|
237
268
|
section.insert('TTXDynamicsSwitch')
|
|
238
269
|
section.ttxo_level_TTXDynamicsSwitch = 1.0
|
|
239
270
|
|
|
240
271
|
def _default_disable_ttx(self) -> None:
|
|
241
272
|
"""Default disable_ttx implementation."""
|
|
242
|
-
for section in self.
|
|
273
|
+
for section in self.sections.values():
|
|
243
274
|
if not neuron.h.ismembrane("TTXDynamicsSwitch"):
|
|
244
275
|
section.insert('TTXDynamicsSwitch')
|
|
245
276
|
section.ttxo_level_TTXDynamicsSwitch = 1e-14
|
|
@@ -247,7 +278,7 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
247
278
|
def area(self) -> float:
|
|
248
279
|
"""The total surface area of the cell."""
|
|
249
280
|
area = 0.0
|
|
250
|
-
for section in self.
|
|
281
|
+
for section in self.sections.values():
|
|
251
282
|
x_s = np.arange(1.0 / (2 * section.nseg), 1.0,
|
|
252
283
|
1.0 / (section.nseg))
|
|
253
284
|
for x in x_s:
|
|
@@ -297,7 +328,7 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
297
328
|
self.add_recording("self.axonal[1](0.5)._ref_v", dt=dt)
|
|
298
329
|
|
|
299
330
|
def add_voltage_recording(
|
|
300
|
-
self, section:
|
|
331
|
+
self, section: Optional[NeuronSection] = None, segx: float = 0.5, dt: Optional[float] = None
|
|
301
332
|
) -> None:
|
|
302
333
|
"""Add a voltage recording to a certain section at a given segment
|
|
303
334
|
(segx).
|
|
@@ -309,11 +340,13 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
309
340
|
dt: Recording time step. If not provided, the recording step will
|
|
310
341
|
default to the simulator's time step.
|
|
311
342
|
"""
|
|
312
|
-
|
|
343
|
+
if section is None:
|
|
344
|
+
section = self.soma
|
|
345
|
+
var_name = section_to_voltage_recording_str(section, segx)
|
|
313
346
|
self.add_recording(var_name, dt)
|
|
314
347
|
|
|
315
348
|
def get_voltage_recording(
|
|
316
|
-
self, section:
|
|
349
|
+
self, section: Optional[NeuronSection] = None, segx: float = 0.5
|
|
317
350
|
) -> np.ndarray:
|
|
318
351
|
"""Get a voltage recording for a certain section at a given segment
|
|
319
352
|
(segx).
|
|
@@ -329,7 +362,9 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
329
362
|
Raises:
|
|
330
363
|
BluecellulabError: If voltage recording was not added previously using add_voltage_recording.
|
|
331
364
|
"""
|
|
332
|
-
|
|
365
|
+
if section is None:
|
|
366
|
+
section = self.soma
|
|
367
|
+
recording_name = section_to_voltage_recording_str(section, segx)
|
|
333
368
|
if recording_name in self.recordings:
|
|
334
369
|
return self.get_recording(recording_name)
|
|
335
370
|
else:
|
|
@@ -340,15 +375,13 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
340
375
|
|
|
341
376
|
def add_allsections_voltagerecordings(self):
|
|
342
377
|
"""Add a voltage recording to every section of the cell."""
|
|
343
|
-
|
|
344
|
-
for section in all_sections:
|
|
378
|
+
for section in self.sections.values():
|
|
345
379
|
self.add_voltage_recording(section, dt=self.record_dt)
|
|
346
380
|
|
|
347
381
|
def get_allsections_voltagerecordings(self) -> dict[str, np.ndarray]:
|
|
348
382
|
"""Get all the voltage recordings from all the sections."""
|
|
349
383
|
all_section_voltages = {}
|
|
350
|
-
|
|
351
|
-
for section in all_sections:
|
|
384
|
+
for section in self.sections.values():
|
|
352
385
|
recording = self.get_voltage_recording(section)
|
|
353
386
|
all_section_voltages[section.name()] = recording
|
|
354
387
|
return all_section_voltages
|
|
@@ -426,10 +459,10 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
426
459
|
"""
|
|
427
460
|
if location == "soma":
|
|
428
461
|
sec = public_hoc_cell(self.cell).soma[0]
|
|
429
|
-
source =
|
|
462
|
+
source = sec(1)._ref_v
|
|
430
463
|
elif location == "AIS":
|
|
431
464
|
sec = public_hoc_cell(self.cell).axon[1]
|
|
432
|
-
source =
|
|
465
|
+
source = sec(0.5)._ref_v
|
|
433
466
|
else:
|
|
434
467
|
raise ValueError("Spike detection location must be soma or AIS")
|
|
435
468
|
netcon = neuron.h.NetCon(source, target, sec=sec)
|
|
@@ -682,9 +715,10 @@ class Cell(InjectableMixin, PlottableMixin):
|
|
|
682
715
|
"""Get a vector of AIS voltage."""
|
|
683
716
|
return self.get_recording('self.axonal[1](0.5)._ref_v')
|
|
684
717
|
|
|
685
|
-
|
|
718
|
+
@property
|
|
719
|
+
def n_segments(self) -> int:
|
|
686
720
|
"""Get the number of segments in the cell."""
|
|
687
|
-
return sum(section.nseg for section in self.
|
|
721
|
+
return sum(section.nseg for section in self.sections.values())
|
|
688
722
|
|
|
689
723
|
def add_synapse_replay(
|
|
690
724
|
self, stimulus: SynapseReplay, spike_threshold: float, spike_location: str
|
bluecellulab/cell/injector.py
CHANGED
|
@@ -443,14 +443,14 @@ class InjectableMixin:
|
|
|
443
443
|
time_vector = neuron.h.Vector().from_python(t_content)
|
|
444
444
|
current_vector = neuron.h.Vector().from_python(i_content)
|
|
445
445
|
|
|
446
|
-
|
|
447
|
-
self.persistent.extend([
|
|
446
|
+
iclamp = neuron.h.IClamp(segx, sec=section)
|
|
447
|
+
self.persistent.extend([iclamp, time_vector, current_vector])
|
|
448
448
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
current_vector.play(
|
|
449
|
+
iclamp.delay = t_content[0]
|
|
450
|
+
iclamp.dur = t_content[-1] - t_content[0]
|
|
451
|
+
current_vector.play(iclamp._ref_amp, time_vector)
|
|
452
452
|
|
|
453
|
-
return current_vector
|
|
453
|
+
return iclamp, current_vector
|
|
454
454
|
|
|
455
455
|
@deprecated("Use add_sin_current instead.")
|
|
456
456
|
def addSineCurrentInject(self, start_time, stop_time, freq,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Neuron recordings related functions."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
from bluecellulab.type_aliases import NeuronSection
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def section_to_voltage_recording_str(section: NeuronSection, segment=0.5) -> str:
|
|
7
|
+
"""Converts a section and segment to voltage recording string."""
|
|
8
|
+
return f"neuron.h.{section.name()}({segment})._ref_v"
|
bluecellulab/cell/template.py
CHANGED
|
@@ -20,7 +20,7 @@ import os
|
|
|
20
20
|
from pathlib import Path
|
|
21
21
|
import re
|
|
22
22
|
import string
|
|
23
|
-
from typing import Optional
|
|
23
|
+
from typing import NamedTuple, Optional
|
|
24
24
|
|
|
25
25
|
import neuron
|
|
26
26
|
|
|
@@ -44,6 +44,13 @@ def public_hoc_cell(cell: HocObjectType) -> HocObjectType:
|
|
|
44
44
|
from the hoc model. Either getCell() or CellRef needs to be provided""")
|
|
45
45
|
|
|
46
46
|
|
|
47
|
+
class TemplateParams(NamedTuple):
|
|
48
|
+
template_filepath: str | Path
|
|
49
|
+
morph_filepath: str | Path
|
|
50
|
+
template_format: str
|
|
51
|
+
emodel_properties: Optional[EmodelProperties]
|
|
52
|
+
|
|
53
|
+
|
|
47
54
|
class NeuronTemplate:
|
|
48
55
|
"""NeuronTemplate representation."""
|
|
49
56
|
|
bluecellulab/type_aliases.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Type aliases used within the package."""
|
|
2
|
-
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
from typing import Dict
|
|
3
4
|
from typing_extensions import TypeAlias
|
|
4
5
|
from neuron import h as hoc_type
|
|
5
6
|
|
|
@@ -8,3 +9,5 @@ NeuronRNG: TypeAlias = hoc_type
|
|
|
8
9
|
NeuronVector: TypeAlias = hoc_type
|
|
9
10
|
NeuronSection: TypeAlias = hoc_type
|
|
10
11
|
TStim: TypeAlias = hoc_type
|
|
12
|
+
|
|
13
|
+
SectionMapping = Dict[str, NeuronSection]
|
bluecellulab/utils.py
CHANGED
|
@@ -50,5 +50,11 @@ class IsolatedProcess(Pool):
|
|
|
50
50
|
Use this when running isolated NEURON simulations. Running 2 NEURON
|
|
51
51
|
simulations on a single process is to be avoided.
|
|
52
52
|
"""
|
|
53
|
-
def __init__(self):
|
|
54
|
-
|
|
53
|
+
def __init__(self, processes: int | None = 1):
|
|
54
|
+
"""Initialize the IsolatedProcess pool.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
processes: The number of processes to use for running the stimuli.
|
|
58
|
+
If set to None, then the number returned by os.cpu_count() is used.
|
|
59
|
+
"""
|
|
60
|
+
super().__init__(processes=processes, maxtasksperchild=1)
|
|
@@ -11,20 +11,23 @@ bluecellulab/psegment.py,sha256=rBryDYHC_uDK9itfXXrFZ0DL9F6WgRICL0j5EHN56QM,3125
|
|
|
11
11
|
bluecellulab/rngsettings.py,sha256=qjwnzAEdbRt66DKd_NTD2OZnlu4hDH7UUOXxd0G9c_Q,4244
|
|
12
12
|
bluecellulab/ssim.py,sha256=U8HFKso4lQkKowts_x2DQfG3ihR56KcN0ITeTlGu3hI,33533
|
|
13
13
|
bluecellulab/tools.py,sha256=tS9a9VDMQOVw6zIllT3FxPIzQk4xheNlGf8lpIg01FY,10931
|
|
14
|
-
bluecellulab/type_aliases.py,sha256=
|
|
15
|
-
bluecellulab/utils.py,sha256=
|
|
14
|
+
bluecellulab/type_aliases.py,sha256=DvgjERv2Ztdw_sW63JrZTQGpJ0x5uMTFB5hcBHDb0WA,441
|
|
15
|
+
bluecellulab/utils.py,sha256=fgqjgy3xzyL0zu-qjCPJdHp6PEAHADCzlr2FqyBmzHI,2012
|
|
16
16
|
bluecellulab/verbosity.py,sha256=T0IgX7DrRo19faxrT4Xzb27gqxzoILQ8FzYKxvUeaPM,1342
|
|
17
|
+
bluecellulab/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
+
bluecellulab/analysis/inject_sequence.py,sha256=jfEESRAUKAWgjceNWfx3Rwe1gDNWhxwZL4PfnJZCzrg,4930
|
|
17
19
|
bluecellulab/cell/__init__.py,sha256=Sbc0QOsJ8E7tSwf3q7fsXuE_SevBN6ZmoCVyyU5zfII,208
|
|
18
20
|
bluecellulab/cell/cell_dict.py,sha256=PVmZsjhZ9jp3HC-8QmdFqp-crAcVMSVeLWujcOPLlpo,1346
|
|
19
|
-
bluecellulab/cell/core.py,sha256=
|
|
20
|
-
bluecellulab/cell/injector.py,sha256=
|
|
21
|
+
bluecellulab/cell/core.py,sha256=r_9nq9MBm-VM-oZQc2KN3a4GxFRYgWy9AF-XpjMIDAE,32156
|
|
22
|
+
bluecellulab/cell/injector.py,sha256=XC49VSHw78xCHzLJKO_-unnnVZAZXsYg5qbmZPx01AA,18091
|
|
21
23
|
bluecellulab/cell/plotting.py,sha256=_hZs5oYG4vmJBVf05cJ2O_cVazi5Eap8OkL9BtIwjW8,4001
|
|
22
24
|
bluecellulab/cell/random.py,sha256=FDby9BN4eJT27COwHP59bhDE2v-c6rdOKNFj3cYZTVY,1773
|
|
25
|
+
bluecellulab/cell/recording.py,sha256=dekJspPb_5yrS6WR3aXtvZ6KWwMNbyhe5aIOVtNDHpY,342
|
|
23
26
|
bluecellulab/cell/section_distance.py,sha256=J8-oqgCHzRaJkpfjPUR6NFtXDhwbrXad9nDaTCKNkTU,3908
|
|
24
27
|
bluecellulab/cell/serialized_sections.py,sha256=UQUecO07ChRZ7xHuDp-QAQRUpUiIwROzHxjZliP9gfQ,1614
|
|
25
28
|
bluecellulab/cell/sonata_proxy.py,sha256=dLT9mLlGVpXxj2O2lXN0g7Sq4BwroPLVdPikR2yNMv4,1529
|
|
26
29
|
bluecellulab/cell/stimuli_generator.py,sha256=cJwjNwsQeEBHLjuJIFv6VBSqd9IpmbR7CuSMyotCiWc,6320
|
|
27
|
-
bluecellulab/cell/template.py,sha256=
|
|
30
|
+
bluecellulab/cell/template.py,sha256=K8Vp1-yE6-9wxjmhkLBhnjBhgciUixoMk8LU-GioTgM,7562
|
|
28
31
|
bluecellulab/cell/ballstick/__init__.py,sha256=v1Z8tHFfbpWShxOBdShCUaE0utoz-7rZumuNBQtNOFI,439
|
|
29
32
|
bluecellulab/cell/ballstick/emodel.hoc,sha256=7WcuepK-wB9bASRvNdCwO9Woc9-SpBCFqBqCXKgjsV8,1517
|
|
30
33
|
bluecellulab/cell/ballstick/morphology.asc,sha256=EO0VIRilJAwpiDP2hIevwusfvYptNYhvsu1f5GgbSQo,190
|
|
@@ -58,9 +61,9 @@ bluecellulab/stimulus/factory.py,sha256=AOby3Sp2g8BJsRccz3afazfCyysyWIgLtcliWlye
|
|
|
58
61
|
bluecellulab/synapse/__init__.py,sha256=RW8XoAMXOvK7OG1nHl_q8jSEKLj9ZN4oWf2nY9HAwuk,192
|
|
59
62
|
bluecellulab/synapse/synapse_factory.py,sha256=YkvxbdGF-u-vxYdbRNTlX-9AtSC_3t_FQRFhybwzgrk,6805
|
|
60
63
|
bluecellulab/synapse/synapse_types.py,sha256=4gne-hve2vq1Lau-LAVPsfLjffVYqAYBW3kCfC7_600,16871
|
|
61
|
-
bluecellulab-2.4.
|
|
62
|
-
bluecellulab-2.4.
|
|
63
|
-
bluecellulab-2.4.
|
|
64
|
-
bluecellulab-2.4.
|
|
65
|
-
bluecellulab-2.4.
|
|
66
|
-
bluecellulab-2.4.
|
|
64
|
+
bluecellulab-2.4.1.dist-info/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
|
|
65
|
+
bluecellulab-2.4.1.dist-info/LICENSE,sha256=xOouu1gC1GGklDxkITlaVl60I9Ab860O-nZsFbWydvU,11749
|
|
66
|
+
bluecellulab-2.4.1.dist-info/METADATA,sha256=7Ug3ADUg1_1XIbqRyQ07KaSb512jch3wiaxRKsxkXPY,6907
|
|
67
|
+
bluecellulab-2.4.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
68
|
+
bluecellulab-2.4.1.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
|
|
69
|
+
bluecellulab-2.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|